# CVE-2024-6197: freeing stack buffer in utf8asn1str

> An attacker can trigger a stack buffer free error in libcurl's ASN1 parser, causing crashes or potential code execution via memory corruption.

- **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:** 24 Jul 2024
- **Updated:** 13 Feb 2025
- **Also known as:** ALPINE-CVE-2024-6197, AZL-47023, AZL-47028, AZL-47049, BELL-CVE-2024-6197, CLEANSTART-2026-TJ58314, CURL-CVE-2024-6197, DEBIAN-CVE-2024-6197, ECHO-afee-d753-9067, GHSA-x3h8-3mf2-v794, JLSEC-2025-36

## What is CVE-2024-6197?

CVE-2024-6197 is a high-severity memory corruption vulnerability in Haxx Libcurl, published on 24 Jul 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

libcurl's ASN1 parser has this utf8asn1str() function used for parsing an ASN.1 UTF-8 string. Itcan detect an invalid field and return error. Unfortunately, when doing so it also invokes `free()` on a 4 byte localstack buffer.  Most modern malloc implementations detect this error and immediately abort. Some however accept the input pointer and add that memory to its list of available chunks. This leads to the overwriting of nearby stack memory. The content of the overwrite is decided by the `free()` implementation; likely to be memory pointers and a set of flags.  The most likely outcome of exploting this flaw is a crash, although it cannot be ruled out that more serious results can be had in special circumstances.

## Which versions are affected by CVE-2024-6197?

It affects 1 product.


Products: Haxx Libcurl.

## How do I fix CVE-2024-6197?

Upgrade to a fixed version.

## Is CVE-2024-6197 being exploited?

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

## Other vulnerabilities in Haxx Libcurl

- [CVE-2017-1000254](https://insights.sbomify.com/CVE-2017-1000254/): Memory corruption in n/a (high 7.5)
- [CVE-2016-7141](https://insights.sbomify.com/CVE-2016-7141/): Auth bypass in n/a (high 7.5)
- [CVE-2017-1000099](https://insights.sbomify.com/CVE-2017-1000099/): Information disclosure in n/a (medium 6.5)
- [CVE-2017-1000100](https://insights.sbomify.com/CVE-2017-1000100/): Information disclosure in n/a (medium 6.5)
- [CVE-2024-7264](https://insights.sbomify.com/CVE-2024-7264/): ASN.1 date parser overread (medium 6.3)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2024-6197 and fix it if it is affected.

What it is: CVE-2024-6197 is a high-severity memory corruption vulnerability in Haxx Libcurl, published on 24 Jul 2024. 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-2024-6197 in the wild and no public exploit code.

Affected product: Haxx Libcurl. No package-level version data is available, so check the vendor advisory linked from the reference page.

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-2024-6197/ (Markdown: https://insights.sbomify.com/CVE-2024-6197/index.md)
```

## Sources

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

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