Skip to content
Race condition Disclosed report Advanced CVE-2025-0665

CVE-2025-0665: eventfd double close

A double close of a file descriptor in libcurl's multi-threaded code could let an attacker race to have a sensitive file's descriptor reused for a network connection, leaking data or enabling code execution. The report is a private comment pointing to an existing GitHub issue and a fix.

ankomcoper Follow

Originally disclosed on HackerOne

  • Triaged in 3 hours
  • Fixed in 14 days
  • Disclosed after 16 days

Summary:

GitHub issue 15725 describes a double close in libcurl 8.11.1. I believe that a double close in multi threaded code should be considered a security vulnerability. A fix already exists for this, so it should be good in the next release. I am not 100% sure this is the place to be making such a comment, but I felt it was better make this private rather than commenting about it on GitHub. I do not want a reward for a bug which I was not the first to find, I just want the software I use and create to be secure.

Affected version

libcurl 8.11.1

Steps To Reproduce:

  1. Have three threads, one writing a sensitive file (writer), one listening for outside connections (listener), and one using curl (curl thread).
  2. The curl thread uses curl, and gets to the first of the two closes. It closes file descriptor X.
  3. The writer opens the sensitive file. This file could be a script, a password file, a configuration file, or any other file containing sensitive data. The open file is assigned file descriptor X.
  4. The curl thread gets to the second close, closing file descriptor X again.
  5. The listener accepts a connection from the attacker. This connection is then assigned the file descriptor X.
  6. The writer begins writing (or continues to write) sensitive data to descriptor X, which would now be sent to the attacker.

A similar condition could cause the reading data from an attacker controlled stream, rather than a trusted file.

Supporting Material/References:

https://github.com/curl/curl/issues/15725

Impact

Summary:

Potential for attacker control of arbitrary file descriptors, provided a race condition. Potential for remote code execution, or leaking of sensitive information.

The original report as published on HackerOne, by ankomcoper. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely a race condition in libcurl's eventfd handling causes the same file descriptor to be closed twice.

Impact

An attacker could potentially control arbitrary file descriptors, leading to remote code execution or leaking of sensitive information, but only if the race condition is won.

What the attacker needed

Multi-threaded use of libcurl; attacker can race the double close; attacker can connect to the listener

The fix

A fix already exists and should be in the next release.

How it was found

  1. Have a writer thread, a listener thread and a curl thread.
  2. The curl thread performs the first close of file descriptor X.
  3. The writer opens a sensitive file, which is assigned descriptor X.
  4. The curl thread performs the second close of descriptor X.
  5. The listener accepts an attacker connection, which is assigned descriptor X.
  6. The writer writes sensitive data to descriptor X, sending it to the attacker.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

A file descriptor is a small number the operating system uses to track an open file or network connection. If a program closes the same number twice, another part of the program can open something else and get that same number, so later writes meant for a private file can go to an attacker's connection instead.

What is Race condition?

Parallel requests reach a state the code assumed could not happen: a coupon used twice, a limit overrun, a check skipped.

More from curl

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Race conditions

The lesson behind this report.

Parallel requests reach a state the code assumed could not happen: a coupon used twice, a limit overrun, a check skipped.