curl leaks destination IP via glibc getaddrinfo() UDP connect, bypassing SOCKS5/Tor
When curl is used with a SOCKS5 proxy such as Tor, glibc's getaddrinfo() makes direct UDP connect() probes to the destination address, bypassing the proxy. This can reveal the user's real IP address to the destination or a network observer, breaking the anonymity the proxy was meant to provide.
Originally disclosed on HackerOne
- Disclosed after under an hour
Summary:
When using curl with a SOCKS5 proxy (e.g. Tor on 127.0.0.1:9050), glibc getaddrinfo() performs direct UDP connect() probes to the target’s IP:443. These syscalls bypass the proxy and expose the user’s route to the destination, breaking anonymity expectations.
The IPs I got in my case:
116.202.120.181:443
[64:ff9b::74ca:78b5]:443
No AI was used in the report
Affected version
Curl 7.88.1 Debian 13.0
Steps To Reproduce:
- Run Tor locally on port 9050.
- Lauch curl with the tor proxy, with tracing, using strace or sockstrace to monitor the connect syscalls:
strace: strace -f -e trace=connect curl --proxy socks5://localhost:9050 https://check.torproject.org
sockstrace: go run main.go curl --args "--proxy" --args "socks5://localhost:9050" --args "https://check.torproject.org/" --logleaks
Observe that a connect() syscall is made to:
116.202.120.181:443
[64:ff9b::74ca:78b5]:443
Supporting Material/References:
Backtrace shows leak originates in glibc/getaddrinfo.c: try_connect() (attached)
Impact
Summary:
This issue allows the destination server (or any network observer) to learn the user’s real IP address even when curl is configured to use a SOCKS5 proxy such as Tor. The leak occurs before the proxied TCP connection is established, meaning anonymity is compromised. Any user relying on curl with Tor or other SOCKS5 proxies for privacy or censorship circumvention can be deanonymized.
Context
curl is a command-line tool and library for transferring data with URLs. One of its supported features is routing traffic through a proxy, including SOCKS5 proxies. A common privacy setup is to point curl at a local Tor SOCKS5 listener, typically on [redacted]:9050, so that the destination never sees the user's real address.
The report describes a case where that expectation breaks. Before curl establishes the proxied TCP connection, the name resolution path in glibc's getaddrinfo() performs its own direct connect() probes to the destination address on port 443. Those probes do not go through the SOCKS5 proxy, so they leave the host by the normal route and reveal the user's real address to the destination or to any network observer on that path.
The affected asset is the curl source repository at https://github.com/curl/curl. The weakness is classified as Information Disclosure.
Setup
The researcher lists the following environment:
| Item | Value |
|---|---|
| curl version | 7.88.1 |
| Distribution | Debian 13.0 |
| Proxy | SOCKS5, Tor listening locally on port 9050 |
| Tracing tools | strace, and a tool the researcher calls sockstrace |
Preconditions: Tor (or another SOCKS5 proxy) running locally on port 9050, and curl invoked with --proxy socks5://localhost:9050 against an HTTPS URL. The tracing tools are used to observe the connect syscalls curl and its libraries make.
Finding it
The researcher monitored the connect syscalls made while curl fetched a page through the Tor SOCKS5 proxy. Instead of seeing only the connection to the local proxy, the trace showed direct connect() calls to the destination's address on port 443. In the researcher's case the addresses observed were:
[redacted]:443
[64:ff9b::74ca:78b5]:443
One is an IPv4 address and the other an IPv6 address in the 64:ff9b::/96 range, which is the well-known prefix used for IPv4-embedded IPv6 addresses. The presence of a direct connection to the destination while a SOCKS5 proxy was configured is what made the behaviour look wrong: the whole point of the proxy is that traffic to the destination should not originate from the user's own address.
A backtrace, attached to the report, places the origin of the leak in glibc's getaddrinfo.c, in the function try_connect(). That is the resolver probing candidate addresses itself rather than leaving connection setup to curl and the proxy.
Exploitation
Step 1: Run Tor locally
Start Tor so that it listens as a SOCKS5 proxy on port 9050. This is the standard local Tor configuration and is the precondition for the rest of the reproduction.
Step 2: Run curl through the proxy under a syscall tracer
The researcher gives two equivalent ways to observe the syscalls. The first uses strace:
strace: strace -f -e trace=connect curl --proxy socks5://localhost:9050 https://check.torproject.org
-f follows child processes and threads, and -e trace=connect restricts output to connect syscalls. The curl invocation sets the SOCKS5 proxy to socks5://localhost:9050 and requests https://check.torproject.org, a page commonly used to confirm that traffic is going through Tor.
The second uses the researcher's sockstrace tool, which wraps the curl invocation and adds a leak-checking flag:
sockstrace: go run main.go curl --args "--proxy" --args "socks5://localhost:9050" --args "https://check.torproject.org/" --logleaks
Here each curl argument is passed with a separate --args, and --logleaks asks the tool to report leaks it detects.
Step 3: Observe the direct connections
In both cases the trace shows a connect() syscall to the destination address on port 443, outside the proxy:
[redacted]:443
[64:ff9b::74ca:78b5]:443
These are the same addresses the researcher obtained in their own run. They are direct connections from the host to the destination, made before the proxied TCP connection is established, and they are what the proxy was supposed to prevent.
Root cause
The leak comes from the name resolution path. glibc's getaddrinfo() performs its own connect() probes to candidate addresses; the backtrace in the report attributes the leak to glibc/getaddrinfo.c: try_connect(). Those probes are ordinary socket operations made by the resolver in the curl process, not by curl's proxy layer, so they are not routed through the SOCKS5 proxy. The backtrace in the report attributes the leak to glibc/getaddrinfo.c: try_connect().
Because the probes happen during resolution, they occur before curl has established the proxied TCP connection to the destination. The proxy configuration therefore does not cover them, and the anonymity guarantee the user expects from --proxy socks5://... does not hold for this part of the traffic.
Impact
According to the report, the destination server, or any network observer on the path, can learn the user's real IP address even when curl is configured to use a SOCKS5 proxy such as Tor. The leak occurs before the proxied TCP connection is established, so anonymity is compromised. Any user relying on curl with Tor or another SOCKS5 proxy for privacy or censorship circumvention can be deanonymised.
Fix
The report does not describe a fix or a change made in response.
Variants to test
- Run the same trace against other SOCKS5 proxies and other HTTPS destinations, and check whether direct
connect()calls to the destination's port 443 appear in the trace. A positive result is aconnectto the destination address that is not the local proxy address. - Test both address families. In the researcher's run both an IPv4 address and an IPv4-embedded IPv6 address appeared, so a positive result may show up on either or both.
- Compare behaviour across libc implementations and curl versions. The report ties the behaviour to glibc's
getaddrinfo()and lists curl 7.88.1 on Debian 13.0; whether other combinations behave the same is not stated. - Watch for the timing: the probes happen during resolution, before the proxied connection. A positive result is a direct connection that appears in the trace ahead of the proxy connection being set up.
Hunting notes
This kind of bug hides in the boundary between an application's proxy configuration and the libraries it calls for name resolution. The signal during testing is simple: configure a proxy, trace connect syscalls with strace -f -e trace=connect, and look for any destination address that is not the proxy's. The researcher showed the exact addresses contacted directly and pointed to the resolver function responsible.
What happened, in plain words
curl is a small program you run in a terminal (the text window where you type commands) to download things from the internet or send data to web servers. It is also a library, meaning other programs can borrow its code. One of the things curl can do is send its traffic through a proxy: a middleman server that forwards your requests for you. A popular kind of proxy is SOCKS5, and a very popular use of it is Tor, a network designed to hide who you are online.
The usual privacy setup is to tell curl to send everything through a Tor listener running on your own machine, normally at [redacted]:9050. [redacted] is a special address that always means "this same computer", and 9050 is a numbered door (a port) on it. The idea is that the website you visit never sees your real address, only the exit point of the Tor network.
This report shows that the idea breaks. Before curl even opens its proxied connection, a piece of the system called glibc (the standard C library on Linux, the bundle of basic code almost every program uses) does its own little test connections straight to the destination on port 443 (the port used by HTTPS, the encrypted web). Those test connections do not go through the proxy. They leave your computer by the normal route, so the destination, or anyone watching the network on the way, can see your real address.
The weakness is classified as Information Disclosure, which simply means "something that should have stayed private got revealed". The affected code is the curl source repository at https://github.com/curl/curl.
Setup
The researcher lists the following environment:
| Item | Value |
|---|---|
| curl version | 7.88.1 |
| Distribution | Debian 13.0 |
| Proxy | SOCKS5, Tor listening locally on port 9050 |
| Tracing tools | strace, and a tool the researcher calls sockstrace |
A distribution is a packaged version of the Linux operating system; Debian is one of them, and 13.0 is its release number. A tracing tool is a program that watches another program and writes down the low-level actions it takes, a bit like a security camera pointed at a single shop assistant.
What you need for this to happen: Tor (or another SOCKS5 proxy) running locally on port 9050, and curl started with --proxy socks5://localhost:9050 against an HTTPS address. localhost is just another name for [redacted], your own machine. The tracing tools are there to record the connect syscalls. A syscall (system call) is the moment a program asks the operating system to do something on its behalf, such as opening a network connection; connect is the specific syscall that starts a network connection to an address.
Finding it
The researcher watched the connect syscalls made while curl fetched a page through the Tor SOCKS5 proxy. If the proxy were doing its job, the only connection you would expect to see is the one to the local proxy. Instead, the trace showed direct connect() calls to the destination's address on port 443. In the researcher's case the addresses observed were:
[redacted]:443
[64:ff9b::74ca:78b5]:443
Line by line:
[redacted]:443is an IPv4 address (the classic four-number internet address format) followed by the port443. This is a direct connection to the destination, not to the proxy.[64:ff9b::74ca:78b5]:443is an IPv6 address (the newer, longer address format, written with colons and wrapped in square brackets when a port follows). The64:ff9b::/96range is a well-known prefix used to embed an IPv4 address inside an IPv6 one, so this is the same kind of destination reached over the newer address family.
Seeing a direct connection to the destination while a SOCKS5 proxy was configured is what made the behaviour look wrong: the whole point of the proxy is that traffic to the destination should not come from your own address.
A backtrace, attached to the report, is a list of the function calls that led to a particular moment, like a stack of plates showing which plate was put down last. It places the origin of the leak in glibc's getaddrinfo.c, in the function try_connect(). getaddrinfo() is the standard function programs call to turn a name like check.torproject.org into a numeric address; try_connect() is a helper inside it that tests candidate addresses. So the resolver, not curl's proxy layer, is the one making the connection.
Exploitation
Step 1: Run Tor locally
Start Tor so that it listens as a SOCKS5 proxy on port 9050. This is the standard local Tor configuration and is the precondition for the rest of the reproduction: without a proxy to compare against, you cannot tell which connections should have gone through it.
Step 2: Run curl through the proxy under a syscall tracer
The researcher gives two equivalent ways to observe the syscalls. The first uses strace:
strace: strace -f -e trace=connect curl --proxy socks5://localhost:9050 https://check.torproject.org
Line by line:
straceis the tracing program being run.-ftells it to follow child processes and threads, meaning any extra processes curl starts are watched too, not just the first one.-e trace=connectrestricts the output toconnectsyscalls only, so the log is not flooded with unrelated activity.curl --proxy socks5://localhost:9050 https://check.torproject.orgis the command being watched: it sets the SOCKS5 proxy tosocks5://localhost:9050and requestshttps://check.torproject.org, a page commonly used to confirm that traffic is going through Tor.
Why this step: you want a record of every connection attempt, so you can check whether any of them skip the proxy.
The second uses the researcher's sockstrace tool, which wraps the curl invocation and adds a leak-checking flag:
sockstrace: go run main.go curl --args "--proxy" --args "socks5://localhost:9050" --args "https://check.torproject.org/" --logleaks
Line by line:
go run main.goruns a program written in the Go programming language straight from its source file,main.go, without building it first.curlis the program being wrapped.- Each
--args "..."passes one argument through to curl: first--proxy, then the proxy addresssocks5://localhost:9050, then the targethttps://check.torproject.org/. --logleaksasks the tool to report leaks it detects, so you do not have to read the raw trace yourself.
Why this step: it is the same experiment as the strace version, but with a tool that flags the problem for you.
Step 3: Observe the direct connections
In both cases the trace shows a connect() syscall to the destination address on port 443, outside the proxy:
[redacted]:443
[64:ff9b::74ca:78b5]:443
These are the same addresses the researcher obtained in their own run. They are direct connections from the host to the destination, made before the proxied TCP connection is established, and they are exactly what the proxy was supposed to prevent. TCP is the basic protocol for reliable connections on the internet; "established" means the connection has been set up and is ready to carry data.
Root cause
The leak comes from the name resolution path. Name resolution is the act of turning a human-friendly name into a numeric address, like looking up a name in a phone book. glibc's getaddrinfo() performs its own connect() probes to candidate addresses; the backtrace in the report attributes the leak to glibc/getaddrinfo.c: try_connect(). Those probes are ordinary socket operations made by the resolver inside the curl process, not by curl's proxy layer, so they are not routed through the SOCKS5 proxy. The backtrace in the report attributes the leak to glibc/getaddrinfo.c: try_connect().
Because the probes happen during resolution, they occur before curl has established the proxied TCP connection to the destination. The proxy configuration therefore does not cover them, and the anonymity guarantee you expect from --proxy socks5://... does not hold for this part of the traffic.
Impact
According to the report, the destination server, or any network observer on the path, can learn your real IP address even when curl is configured to use a SOCKS5 proxy such as Tor. An IP address is the numeric label that identifies your connection on the internet, roughly like a return address on an envelope. The leak occurs before the proxied TCP connection is established, so anonymity is compromised. Anyone relying on curl with Tor or another SOCKS5 proxy for privacy or censorship circumvention can be deanonymised, meaning their real identity on the network can be worked out.
Fix
The report does not describe a fix or a change made in response.
Variants to test
- Run the same trace against other SOCKS5 proxies and other HTTPS destinations, and check whether direct
connect()calls to the destination's port 443 appear in the trace. A positive result is aconnectto the destination address that is not the local proxy address. - Test both address families. In the researcher's run both an IPv4 address and an IPv4-embedded IPv6 address appeared, so a positive result may show up on either or both.
- Compare behaviour across libc implementations and curl versions. libc is the standard C library; glibc is one implementation of it, and others exist. The report ties the behaviour to glibc's
getaddrinfo()and lists curl 7.88.1 on Debian 13.0; whether other combinations behave the same is not stated. - Watch for the timing: the probes happen during resolution, before the proxied connection. A positive result is a direct connection that appears in the trace ahead of the proxy connection being set up.
Hunting notes
This kind of bug hides in the boundary between an application's proxy configuration and the libraries it calls for name resolution. The signal during testing is simple: configure a proxy, trace connect syscalls with strace -f -e trace=connect, and look for any destination address that is not the proxy's. The researcher showed the exact addresses contacted directly and pointed to the resolver function responsible.
Glossary
- curl: a command-line tool and library for transferring data with URLs.
- Proxy: a middleman server that forwards your requests on your behalf.
- SOCKS5: a type of proxy protocol that can carry many kinds of traffic.
- Tor: a network designed to hide who you are online by routing traffic through several relays.
- Port: a numbered door on a computer that a particular service listens on.
[redacted]/localhost: special names meaning "this same computer".- glibc: the standard C library on Linux, the bundle of basic code most programs use.
- HTTPS: the encrypted version of the web protocol, normally on port 443.
- Information Disclosure: a weakness where something that should have stayed private gets revealed.
- Distribution: a packaged version of the Linux operating system, such as Debian.
- Tracing tool: a program that watches another program and records the low-level actions it takes.
- Syscall (system call): a request from a program to the operating system to do something, such as open a network connection.
connect: the syscall that starts a network connection to an address.- IPv4 address: the classic four-number internet address format.
- IPv6 address: the newer, longer internet address format, written with colons.
- Backtrace: a list of the function calls that led to a particular moment in a program.
getaddrinfo(): the standard function that turns a name into a numeric address.try_connect(): a helper inside glibc'sgetaddrinfo()that tests candidate addresses with its own connections.- Child process / thread: extra processes or execution paths a program starts alongside its main one.
- Go: a programming language;
go runruns a Go source file directly. - TCP: the basic protocol for reliable connections on the internet.
- Name resolution: turning a human-friendly name into a numeric address.
- IP address: the numeric label identifying your connection on the internet.
- libc: the standard C library; glibc is one implementation of it.
- Deanonymise: work out the real identity behind an anonymous connection.