Skip to content
Memory corruption Disclosed report Advanced CVE-2022-43552

CVE-2022-43552: HTTP Proxy deny use-after-free

libcurl could access and use already freed heap memory when handling telnet or smb URLs through an HTTP proxy. An attacker able to influence such requests could trigger a use-after-free for both reads and writes.

Daniel Stenberg Follow

Originally disclosed on HackerOne

  • Triaged in 4 days
  • Fixed in 44 days
  • Disclosed after 49 days

Issue(s) reported by Trail of Bits. This is either one or two issues.

Summary:

./src/curl 0 -x0:80 telnet:/[j-u][j-u]//0 -m 01 ./src/curl 0 -x0:80 smb:/[j-u][j-u]//0 -m 01

Both command line ends up having libcurl access and use already freed heap-memory. For read and write.

Steps To Reproduce:

See above, run with valgrind for full report.

I have a local HTTP server on localhost host port 80 that will send back a 502 on the CONNECT requests curl issues to it for these protocols.

Supporting Material/References:

See logs.

Impact

Use after free stuff.

The original report as published on HackerOne, by bagder. 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 the proxy CONNECT handling for telnet and smb protocols freed a structure that later code still referenced.

Impact

The report describes a use-after-free for reads and writes, with no demonstrated exploitation beyond that.

What the attacker needed

Curl built with telnet and smb support; an HTTP proxy the request is sent through; proxy returns 502 to CONNECT

How it was found

  1. Run curl against a telnet URL through an HTTP proxy on port 80.
  2. Run curl against an smb URL through the same proxy.
  3. Have the local proxy answer the CONNECT request with a 502.
  4. Observe the use-after-free under valgrind.

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.

When a program frees a block of memory, it should stop using it. Here libcurl kept reading and writing memory it had already released, which can crash the program or let an attacker corrupt data. The trigger involved asking curl to reach telnet or smb addresses through an HTTP proxy.

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 by Daniel Stenberg

View all

6 more disclosed reports, best first.

More from 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.