curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

[SECURITY ADVISORY] curl: CVE-2023-38546

From: Daniel Stenberg via curl-library <>
Date: Wed, 11 Oct 2023 07:59:02 +0200 (CEST)

cookie injection with none file

Project curl Security Advisory, October 11 2023 -


This flaw allows an attacker to insert cookies at will into a running program
using libcurl, if the specific series of conditions are met.

libcurl performs transfers. In its API, an application creates "easy handles"
that are the individual handles for single transfers.

libcurl provides a function call that duplicates en easy handle called

If a transfer has cookies enabled when the handle is duplicated, the
cookie-enable state is also cloned - but without cloning the actual
cookies. If the source handle did not read any cookies from a specific file on
disk, the cloned version of the handle would instead store the file name as
`none` (using the four ASCII letters, no quotes).

Subsequent use of the cloned handle that does not explicitly set a source to
load cookies from would then inadvertently load cookies from a file named
`none` - if such a file exists and is readable in the current directory of the
program using libcurl. And if using the correct file format of course.

The Common Vulnerabilities and Exposures (CVE) project has assigned the name
CVE-2023-38546 to this issue.
CWE-73: External Control of File Name or Path
Severity: Low
We set it to low because the flaw requires a series of conditions to be met
and the likeliness that they shall allow an attacker to take advantage of it
is low. Even if the bug could be made to trigger, the risk that a cookie
injection can be done to cause harm is additionally also low.
- Affected versions: libcurl 7.9.1 to and including 8.3.0
- Not affected versions: libcurl < 7.9.1 and >= 8.4.0
- Introduced-in:
libcurl is used by many applications, but not always advertised as such!
The (flawed) logic that created this bug existed even before the
`curl_easy_duphandle()` function was added, but it did not become this problem
until this API was introduced.
This flaw is not accessible using the curl command line tool.
Starting in curl 8.4.0, curl not longer stores the file name in the cookie struct.
- Fixed-in:
  A - Upgrade curl to version 8.4.0
  B - Apply the patch to your local version
  C - Call `curl_easy_setopt(cloned_curl, CURLOPT_COOKIELIST, "ALL");` right
      after every `curl_easy_duphandle();` call.
This issue was reported to the curl project on September 14, 2023. We contacted
distros_at_openwall on October 3, 2023.
libcurl 8.4.0 was released on October 11 2023, coordinated with the
publication of this advisory.
- Reported-by: w0x42 on hackerone
- Patched-by: Daniel Stenberg
Thanks a lot!
Received on 2023-10-11