Binary output bypass
curl's binary-output detection can be bypassed when a response is padded with enough characters before a null byte, so curl writes binary data to the terminal. An attacker-controlled server could use this to corrupt or confuse the user's terminal session.
Originally disclosed on HackerOne
- Disclosed after 35 days
Binary output check bypass
Summary:
When curl outputs content, it checks for binary output. If the output is large enough, it bypasses the check for binary output. This can mess with the terminal.
Steps To Reproduce:
- Setup a server of your choice.
- Create a function f with these arguments: char and num. Num is number of characters repeating.
- Before serving at a given endpoint, create an offset f(".", 16384)
- Create the payload with unicode 0x0 like this f("unicode 0x0", 1)
- Make the server serve this at a given endpoint.
- Run this command: curl "Accept: application/xml" -H "Content-Type: application/xml" http://localhost:8080/yourendpoint
- Change the offset f(".", 16384) to f(".", 16383) to check if it worked.
curlpayload.png is the code execution.png is output for when it worked failed.png is when it failed, when I changed the offset to 16383
Impact
There could be some further impact by this exploit. As of now it can make the terminal really buggy at times, but further implementations could lead to something else.
Attachments



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 binary-output check only inspects a limited leading portion of the response, so padding pushes the binary content past the inspected window.
Impact
The terminal can become buggy or corrupted, and the author suggests further impact may be possible.
What the attacker needed
Victim runs curl against attacker server
How it was found
- Set up a server that serves a chosen endpoint.
- Define a helper that repeats a character a given number of times.
- Before serving, pad the response with a large offset of harmless characters.
- Append a single null byte to form the payload.
- Serve that response at the endpoint.
- Request the endpoint with curl and compare behaviour when the offset is reduced by one.
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.
curl is a command-line tool for fetching web content. It normally tries to avoid printing raw binary data to your terminal, because that can garble the display. This report shows that padding the response with many harmless characters before a special null byte tricks curl into printing the binary anyway, which can leave the terminal in a broken state.
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.