Critical
Security advisory
A heap use-after-free flaw was found in curl versions from 7.59.0 through 7.61.1 in the 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 nulling 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
- 31 Oct 2026, 12:26 UTC · Revision 1
Source evidence
A heap use-after-free flaw was found in curl versions from 7.59.0 through 7.61.1 in the 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 nulling the pointer) and might then subsequently erroneously write to a struct field within that already freed struct.
osv:CVE-2018-16840
Complete source record
{
"id": "42ab9097c003c4b92b1a1e7b4b11ece31f87fcc4cd3df48a6ad1f45b7e348f21",
"url": "https://osv.dev/vulnerability/CVE-2018-16840",
"method": "structured",
"payload": {
"kind": "advisory",
"title": "CVE-2018-16840",
"summary": "A heap use-after-free flaw was found in curl versions from 7.59.0 through 7.61.1 in the 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 nulling the pointer) and might then subsequently erroneously write to a struct field within that already freed struct.",
"evidence": "osv:CVE-2018-16840",
"products": [],
"severity": "critical",
"structured": {
"id": "CVE-2018-16840",
"aliases": [
"CURL-CVE-2018-16840",
"CVE-2018-16840"
],
"metrics": [
{
"type": "CVSS_V3",
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"
}
],
"affected": [
{
"ranges": [
{
"repo": "https://github.com/curl/curl",
"type": "GIT",
"events": [
{
"introduced": "4d6bd91ab33328c6d27eddc32e064defc02dc4fd"
},
{
"fixed": "196677150f711a96c38ed123e621f1d4e995b2e5"
},
{
"fixed": "81d135d67155c5295b1033679c606165d4e28f3f"
}
],
"database_specific": {
"extracted_events": [
{
"cpe": "cpe:2.3:a:haxx:curl:*:*:*:*:*:*:*:*",
"range": [
{
"introduced": "7.59.0"
},
{
"fixed": "7.62.0"
}
],
"source": "CPE_RANGE"
},
{
"range": [
{
"fixed": "81d135d67155c5295b1033679c606165d4e28f3f"
}
],
"source": "REFERENCES_COMMIT"
}
]
}
}
],
"versions": [
"curl-7_61_1",
"curl-7_61_0",
"curl-7_60_0",
"curl-7_59_0"
],
"database_specific": {
"source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2018-16840.json",
"vanir_signatures": [
{
"id": "CVE-2018-16840-5a294ae8",
"digest": {
"length": 1388,
"function_hash": "253867143457341161698845574111827314122"
},
"source": "https://github.com/curl/curl/commit/81d135d67155c5295b1033679c606165d4e28f3f",
"target": {
"file": "lib/url.c",
"function": "Curl_close"
},
"deprecated": false,
"signature_type": "Function",
"signature_version": "v1"
},
{
"id": "CVE-2018-16840-97a670ad",
"digest": {
"threshold": 0.9,
"line_hashes": [
"76450436232552618053190577593466383274",
"56283251733270634435040735386618773715",
"225146506795074944162099681821124504277",
"72162716836877692358628916813877661635",
"28202728034268574745574819732142521908"
]
},
"source": "https://github.com/curl/curl/commit/81d135d67155c5295b1033679c606165d4e28f3f",
"target": {
"file": "lib/url.c"
},
"deprecated": false,
"signature_type": "Line",
"signature_version": "v1"
}
],
"vanir_signatures_modified": "2026-10-20T13:32:43Z"
}
}
],
"modified": "2026-10-20T13:32:43.153925769Z",
"provider": "osv",
"references": [
"https://security.gentoo.org/glsa/201903-03",
"https://usn.ubuntu.com/3805-1/",
"https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2018-16840",
"https://curl.haxx.se/docs/CVE-2018-16840.html",
"https://github.com/curl/curl/commit/81d135d67155c5295b1033679c606165d4e28f3f"
],
"provider_metadata": {
"unresolved_ranges": [
{
"cpes": [
"cpe:2.3:o:canonical:ubuntu_linux:14.04:*:*:*:lts:*:*:*",
"cpe:2.3:o:canonical:ubuntu_linux:16.04:*:*:*:lts:*:*:*",
"cpe:2.3:o:canonical:ubuntu_linux:18.04:*:*:*:lts:*:*:*",
"cpe:2.3:o:canonical:ubuntu_linux:18.10:*:*:*:*:*:*:*"
],
"vendor_product": "canonical:ubuntu_linux",
"extracted_events": [
{
"range": [
{
"introduced": "14.04"
},
{
"last_affected": "14.04"
},
{
"introduced": "16.04"
},
{
"last_affected": "16.04"
},
{
"introduced": "18.04"
},
{
"last_affected": "18.04"
},
{
"introduced": "18.10"
},
{
"last_affected": "18.10"
}
],
"source": "CPE_STRING"
}
]
}
]
}
},
"related_cves": [
{
"value": "CVE-2018-16840",
"evidence": "/id"
}
],
"security_relevant": true,
"severity_evidence": "/severity/0/score"
},
"source_id": "core-osv",
"document_id": 387800,
"published_at": "2018-10-31T18:29:00.307+00:00"
}