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.
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.
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
- Run curl against a telnet URL through an HTTP proxy on port 80.
- Run curl against an smb URL through the same proxy.
- Have the local proxy answer the CONNECT request with a 502.
- 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.