Skip to content
Heist/ feed
Back to feed
Low

use after free in handle close

Type: advisorySources: OSV

libcurl contains a heap use after free flaw in code related to closing an easy handle. When closing and cleaning up an "easy" handle in the `Curl_close()` function, the library code first frees a struct (without clearing the pointer) and might then subsequently erroneously write to a struct field within that already freed struct.

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

Source evidence

use after free in handle close

core-osv · Original source

Published 31 Oct 2018, 08:00 UTC

libcurl contains a heap use after free flaw in code related to closing an easy handle. When closing and cleaning up an "easy" handle in the `Curl_close()` function, the library code first frees a struct (without clearing the pointer) and might then subsequently erroneously write to a struct field within that already freed struct.

osv:CURL-CVE-2018-16840
Complete source record
{
  "id": "ef632015fbf9eed93dd36bfaf696c0f75b6d53263c43364479d09b7790962f11",
  "url": "https://osv.dev/vulnerability/CURL-CVE-2018-16840",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "use after free in handle close",
    "summary": "libcurl contains a heap use after free flaw in code related to closing an easy handle. When closing and cleaning up an \"easy\" handle in the `Curl_close()` function, the library code first frees a struct (without clearing the pointer) and might then subsequently erroneously write to a struct field within that already freed struct.",
    "evidence": "osv:CURL-CVE-2018-16840",
    "products": [],
    "severity": "low",
    "structured": {
      "id": "CURL-CVE-2018-16840",
      "aliases": [
        "CURL-CVE-2018-16840",
        "CVE-2018-16840"
      ],
      "affected": [
        {
          "ranges": [
            {
              "type": "SEMVER",
              "events": [
                {
                  "introduced": "7.59.0"
                },
                {
                  "fixed": "7.62.0"
                }
              ]
            },
            {
              "repo": "https://github.com/curl/curl.git",
              "type": "GIT",
              "events": [
                {
                  "introduced": "b46cfbc068ebe90f18e9777b9e877e4934c1b5e3"
                },
                {
                  "fixed": "81d135d67155c5295b1033679c606165d4e28f3f"
                }
              ]
            }
          ],
          "versions": [
            "7.61.1",
            "7.61.0",
            "7.60.0",
            "7.59.0",
            "curl-7_61_1",
            "curl-7_61_0",
            "curl-7_60_0",
            "curl-7_59_0"
          ],
          "database_specific": {
            "source": "https://curl.se/docs/CURL-CVE-2018-16840.json",
            "vanir_signatures": [
              {
                "id": "CURL-CVE-2018-16840-a87c499d",
                "digest": {
                  "threshold": 0.9,
                  "line_hashes": [
                    "76450436232552618053190577593466383274",
                    "56283251733270634435040735386618773715",
                    "225146506795074944162099681821124504277",
                    "72162716836877692358628916813877661635",
                    "28202728034268574745574819732142521908"
                  ]
                },
                "source": "https://github.com/curl/curl.git/commit/81d135d67155c5295b1033679c606165d4e28f3f",
                "target": {
                  "file": "lib/url.c"
                },
                "deprecated": false,
                "signature_type": "Line",
                "signature_version": "v1"
              },
              {
                "id": "CURL-CVE-2018-16840-ba2aaffc",
                "digest": {
                  "length": 1388,
                  "function_hash": "253867143457341161698845574111827314122"
                },
                "source": "https://github.com/curl/curl.git/commit/81d135d67155c5295b1033679c606165d4e28f3f",
                "target": {
                  "file": "lib/url.c",
                  "function": "Curl_close"
                },
                "deprecated": false,
                "signature_type": "Function",
                "signature_version": "v1"
              }
            ],
            "vanir_signatures_modified": "2026-10-25T01:05:32Z"
          }
        }
      ],
      "modified": "2026-10-25T01:05:32.549137113Z",
      "provider": "osv",
      "references": [],
      "provider_metadata": {
        "CWE": {
          "id": "CWE-416",
          "desc": "Use After Free"
        },
        "URL": "https://curl.se/docs/CVE-2018-16840.json",
        "www": "https://curl.se/docs/CVE-2018-16840.html",
        "award": {
          "amount": "100",
          "currency": "USD"
        },
        "affects": "both",
        "package": "curl",
        "severity": "Low",
        "last_affected": "7.61.1"
      }
    },
    "related_cves": [
      {
        "value": "CVE-2018-16840",
        "evidence": "/aliases"
      }
    ],
    "security_relevant": true,
    "severity_evidence": "/database_specific/severity"
  },
  "source_id": "core-osv",
  "document_id": 444398,
  "published_at": "2018-10-31T08:00:00+00:00"
}