Skip to content
Heist/ feed
Back to feed
Medium

freeing stack buffer in utf8asn1str

Type: advisorySources: OSV

libcurl's ASN1 parser has this `utf8asn1str()` function used for parsing an ASN.1 UTF-8 string. It can detect an invalid field and return error. Unfortunately, when doing so it also invokes `free()` on a 4 byte local stack 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 exploiting this flaw is a crash, although it cannot be ruled out that more serious results can be had in special circumstances.

Products
Not specified
Affected versions
Not specified
Fixed versions
Not specified
CVEs
CVE-2024-6197
Confirmed fixed CVEs
Not specified
Updated in this feed
1 Nov 2026, 09:39 UTC · Revision 1

Source evidence

freeing stack buffer in utf8asn1str

core-osv · Original source

Published 24 Jul 2024, 08:00 UTC

libcurl's ASN1 parser has this `utf8asn1str()` function used for parsing an ASN.1 UTF-8 string. It can detect an invalid field and return error. Unfortunately, when doing so it also invokes `free()` on a 4 byte local stack 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 exploiting this flaw is a crash, although it cannot be ruled out that more serious results can be had in special circumstances.

osv:CURL-CVE-2024-6197
Complete source record
{
  "id": "a8018d4f5dfe39713f143b5e6ae231f067f77b5d0d89eb94d5976ea05fedf6a4",
  "url": "https://osv.dev/vulnerability/CURL-CVE-2024-6197",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "freeing stack buffer in utf8asn1str",
    "summary": "libcurl's ASN1 parser has this `utf8asn1str()` function used for parsing an ASN.1 UTF-8 string. It can detect an invalid field and return error. Unfortunately, when doing so it also invokes `free()` on a 4 byte local stack 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 exploiting this flaw is a crash, although it cannot be ruled out that more serious results can be had in special circumstances.",
    "evidence": "osv:CURL-CVE-2024-6197",
    "products": [],
    "severity": "medium",
    "structured": {
      "id": "CURL-CVE-2024-6197",
      "aliases": [
        "CURL-CVE-2024-6197",
        "CVE-2024-6197"
      ],
      "affected": [
        {
          "ranges": [
            {
              "type": "SEMVER",
              "events": [
                {
                  "introduced": "8.6.0"
                },
                {
                  "fixed": "8.9.0"
                }
              ]
            },
            {
              "repo": "https://github.com/curl/curl.git",
              "type": "GIT",
              "events": [
                {
                  "introduced": "623c3a8fa0bdb2751f14b3741760d81910b7ec64"
                },
                {
                  "fixed": "3a537a4db9e65e545ec45b1b5d5575ee09a2569d"
                }
              ]
            }
          ],
          "versions": [
            "8.8.0",
            "8.7.1",
            "8.7.0",
            "8.6.0",
            "curl-8_8_0",
            "curl-8_7_1",
            "curl-8_7_0",
            "curl-8_6_0"
          ],
          "database_specific": {
            "source": "https://curl.se/docs/CURL-CVE-2024-6197.json",
            "vanir_signatures": [
              {
                "id": "CURL-CVE-2024-6197-30fe796b",
                "digest": {
                  "length": 1635,
                  "function_hash": "93029967338058506930174009721303081412"
                },
                "source": "https://github.com/curl/curl.git/commit/3a537a4db9e65e545ec45b1b5d5575ee09a2569d",
                "target": {
                  "file": "lib/vtls/x509asn1.c",
                  "function": "utf8asn1str"
                },
                "deprecated": false,
                "signature_type": "Function",
                "signature_version": "v1"
              },
              {
                "id": "CURL-CVE-2024-6197-c8706841",
                "digest": {
                  "threshold": 0.9,
                  "line_hashes": [
                    "51958416006947950476431544216547178666",
                    "299273009271053043586874986129068299942",
                    "184994429828236905684305584888099753146",
                    "26791432400550624243581513650400640798"
                  ]
                },
                "source": "https://github.com/curl/curl.git/commit/3a537a4db9e65e545ec45b1b5d5575ee09a2569d",
                "target": {
                  "file": "lib/vtls/x509asn1.c"
                },
                "deprecated": false,
                "signature_type": "Line",
                "signature_version": "v1"
              }
            ],
            "vanir_signatures_modified": "2026-10-25T01:05:24Z"
          }
        }
      ],
      "modified": "2026-10-25T01:05:24.522932384Z",
      "provider": "osv",
      "references": [],
      "provider_metadata": {
        "CWE": {
          "id": "CWE-590",
          "desc": "Free of Memory not on the Heap"
        },
        "URL": "https://curl.se/docs/CVE-2024-6197.json",
        "www": "https://curl.se/docs/CVE-2024-6197.html",
        "award": {
          "amount": "2540",
          "currency": "USD"
        },
        "issue": "https://hackerone.com/reports/2559516",
        "affects": "both",
        "package": "curl",
        "severity": "Medium",
        "last_affected": "8.8.0"
      }
    },
    "related_cves": [
      {
        "value": "CVE-2024-6197",
        "evidence": "/aliases"
      }
    ],
    "security_relevant": true,
    "severity_evidence": "/database_specific/severity"
  },
  "source_id": "core-osv",
  "document_id": 444383,
  "published_at": "2024-07-24T08:00:00+00:00"
}