Skip to content
Memory corruption Write-up Advanced

cURL audit: How a joke led to significant findings

The audit found memory corruption bugs in cURL's command-line interface, including double-free and use-after-free issues, by fuzzing command-line arguments. An attacker could potentially exploit these to cause crashes or, under specific conditions, execute code.

Maciej Domanski Follow

Published on blog.trailofbits.com

In fall 2022, Trail of Bits audited cURL, a widely-used command-line utility that transfers data between a server and supports various protocols. The project coincided with a Trail of Bits maker week, which meant that we had more manpower than we usually do, allowing us to take a nonstandard approach to the audit.

Maciej Domanski, on blog.trailofbits.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

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

How it worked

Root cause

Likely improper memory management in error and cleanup paths when handling certain command-line options and protocols.

Impact

The vulnerabilities could cause crashes and potentially lead to code execution, but exploitation may be limited by the need to control freed memory contents.

What the attacker needed

Ability to supply crafted command-line arguments; specific protocols or options used

The fix

The vulnerabilities were fixed in cURL versions 7.86.0 and 7.87.0.

How it was found

  1. Set up a fuzzing environment with AFL++ and compile cURL with AddressSanitizer.
  2. Use the argv fuzzing feature to feed random command-line arguments to cURL.
  3. Redirect network traffic to a local netcat listener to simulate remote services.
  4. Run the fuzzer for a month and analyze crashes.

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 write-up has not been written yet. The Original tab links to the source.

cURL is a tool for transferring data. The researchers tested how it handles command-line options and found bugs where it misuses memory. These bugs could let an attacker crash the program or possibly run malicious code.

What is Memory corruption?

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.

More from Internet Bug Bounty (curl)

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.