# CVE-2025-25199: BCryptGenerateSymmetricKey memory leak

> A memory leak in the go-crypto-winnative library allows attackers to exhaust system memory via repeated TLS1PRF calls, potentially causing denial of service.

- **Severity:** High 7.5 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 12 Feb 2025
- **Updated:** 12 Feb 2025
- **Also known as:** AZL-79122, AZL-98937, GHSA-29c6-3hcj-89cf, GO-2025-3461

## What is CVE-2025-25199?

CVE-2025-25199 is a high-severity denial of service vulnerability in microsoft go-crypto-winnative, published on 12 Feb 2025. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

go-crypto-winnative Go crypto backend for Windows using Cryptography API: Next Generation (CNG). Prior to commit f49c8e1379ea4b147d5bff1b3be5b0ff45792e41, calls to `cng.TLS1PRF` don't release the key handle, producing a small memory leak every time. Commit f49c8e1379ea4b147d5bff1b3be5b0ff45792e41 contains a fix for the issue. The fix is included in versions 1.23.6-2 and 1.22.12-2 of the Microsoft build of go, as well as in the pseudoversion 0.0.0-20250211154640-f49c8e1379ea of the `github.com/microsoft/go-crypto-winnative` Go package.

Weakness: CWE-401 (Missing Release of Memory after Effective Lifetime)

## Which versions are affected by CVE-2025-25199?

3 open source packages ship an affected version, including github.com/microsoft/go-crypto-winnative.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `github.com/microsoft/go-crypto-winnative` | Go | All versions | 0.0.0-20250211154640-f49c8e1379ea |
| `github.com/microsoft/go-crypto-winnative` | Go | All versions | 0.0.0-20250211154640-f49c8e1379ea |
| `github.com/microsoft/go-crypto-winnative` | Go | All versions | 0.0.0-20250211154640-f49c8e1379ea |

## How do I fix CVE-2025-25199?

Upgrade github.com/microsoft/go-crypto-winnative to 0.0.0-20250211154640-f49c8e1379ea or later.

## Is CVE-2025-25199 being exploited?

There is no known exploitation of CVE-2025-25199 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2025-25199 and fix it if it is affected.

What it is: CVE-2025-25199 is a high-severity denial of service vulnerability in microsoft go-crypto-winnative, published on 12 Feb 2025. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2025-25199 in the wild and no public exploit code.

Affected packages and fixed versions:
- github.com/microsoft/go-crypto-winnative (Go): affected all versions; fixed in 0.0.0-20250211154640-f49c8e1379ea
- github.com/microsoft/go-crypto-winnative (Go): affected all versions; fixed in 0.0.0-20250211154640-f49c8e1379ea
- github.com/microsoft/go-crypto-winnative (Go): affected all versions; fixed in 0.0.0-20250211154640-f49c8e1379ea

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2025-25199/ (Markdown: https://insights.sbomify.com/CVE-2025-25199/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2025-25199
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2025-25199
- OSV: https://osv.dev/vulnerability/CVE-2025-25199

---
From sbomify Insights: https://insights.sbomify.com/CVE-2025-25199/
Summaries are generated and may contain mistakes; the official description above is the record.
