1500$: CR/LF Injection
A file upload feature failed to validate CR/LF characters in the Content-Disposition header, allowing an attacker to inject extra HTTP headers. This could force other users to be logged out or set cookies in their sessions.
Published on medium.com
{{media:0}}
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.
Context
ExaHub is the virtual name the author gives to a private program he tested. In his description it is a platform for people who work with the Exa programming language: a high-level language he presents as known for speed and performance and used in scientific computing, machine learning and data science. ExaHub is described as a central place where users access resources, collaborate on projects and use tools built around that ecosystem, from project management to data visualisation.
The feature involved is file upload. Users have a "Files" section where they upload files, and other users can later download them. The upload request carries a Content-Disposition header that names the file, and that header is where the problem sits.

Setup
The author does not describe any special tooling, versions or roles beyond a normal ExaHub account. The precondition is the ability to upload a file and to intercept the resulting HTTP request, which implies a proxy such as Burp Suite or an equivalent. The effect appears when another user downloads the uploaded file.
Finding it
The author frames the bug as a CR/LF injection. CR and LF are the two ASCII control characters Carriage Return (13) and Line Feed (10), used in text to mark the end of a line. When such characters reach a place where the application builds headers, they can terminate the current header and start a new one, so an attacker who controls part of the input controls part of the header block.
In ExaHub the input that reaches the header block is the filename in the upload request. The author attributes the issue to inadequate input validation during the file upload process: the filename is placed into the Content-Disposition header without the CR/LF characters being rejected or encoded.
Exploitation
The author's reproduction is short and does not include the raw request or response, only the header change and the payload. The steps are as follows.
Step 1: reach the upload feature
- Access your ExaHub account.
- Navigate to the "Files" section.
- Upload a file and intercept the uploading request.
Step 2: inject into Content-Disposition
- Modify the Content-Disposition header by appending the payload
%0AClear-Site-Data%3A%22cookies%22%0Aafter the filename.
The payload is URL-encoded. Decoded, %0A is a line feed, %3A is a colon and %22 is a double quote, so the injected text becomes a new header line:
Clear-Site-Data is a response header that tells the browser to drop stored data for the origin; the "cookies" directive makes it clear cookies. The author's steps append the payload to the filename in the upload request and then download the file.
Step 3: trigger it on a victim
- Send the modified request and attempt to download the uploaded file.
- When other user download the file they got locked out this is one of the multiple task which can be performed by cr/lf injection.
So the effect is not seen by the uploader but by any other user who downloads the file: other users who download the file got locked out, which the author describes as one of several things CR/LF injection can achieve here.. The author describes this as one of several things CR/LF injection can achieve here.
Root cause
The author states the root cause directly: inadequate input validation during the file upload process. The report does not show the server-side code, so the exact point at which decoding happens is not documented.
Impact
The demonstrated impact is a forced logout: other users who download the file have their cookies cleared and are locked out. The author also lists further possibilities that the same injection enables:
- manipulating headers in general;
- manipulating and setting cookies of other users, with payloads such as
%0ASet-Cookie%3A+crlfinjection%3D+value+; - session hijacking and unauthorised access;
- cross-site scripting, for which he gives this payload:
• /%3f%0d%0aLocation:%0d%0aContent-Type:text/html%0d%0aX-XSS-Protection%3a0%0d%0a%0d%0a%3Cscript%3Ealert%28document.domain%29%3C/script%3E ``
These are presented as potential exploits rather than as things he demonstrated; only the forced logout is shown as a result. The impact is conditional on a victim downloading the crafted file, and the author does not state which browsers or configurations were tested.
Fix
The author reports that the ExaHub security team acknowledged the issue's validity and initiated a fix. He does not describe what the fix was. The general remedy implied by his root-cause statement is to validate the filename on upload and reject or encode CR and LF before it is placed into any header.
Variants to test
- Filename in
Content-Dispositionon download. Upload a file whose name contains%0d%0afollowed by a header of your choice, then download it. A positive result is the extra header appearing in the download response. - Other headers built from user input. Try the same sequence in any parameter that ends up in a response header, such as a redirect target, a language or theme value, or a filename echoed in a
Locationheader. A positive result is a new header line or a changed status line. Set-Cookieinjection. Use the author's%0ASet-Cookie%3A+crlfinjection%3D+value+pattern. A positive result is a cookie set in the victim's browser by the application's own response.- Response splitting to script. Use the author's
Location/Content-Type/X-XSS-Protectionpayload. A positive result is the injected body being rendered as HTML in the victim's browser. Clear-Site-Dataagainst other storage. Replace"cookies"with other directives the header supports and confirm the browser acts on them, which shows the injection reaches the response intact.
In every case, test with a second account, because the effect appears on the victim's download, not on the uploader's.
What happened, in plain words
A security researcher found a bug in a private bug bounty program, which he calls ExaHub in his write-up. ExaHub is a website where people who use a programming language called Exa can store files, work on projects together and use various tools. The bug let him slip extra instructions into a file upload, and other users who downloaded the file got locked out. The result was that other users got logged out. The company paid him 1,500 US dollars for reporting it.
The bug class is called CR/LF injection. CR and LF are two invisible characters that computers use to mark the end of a line of text, much like pressing Enter at the end of a sentence. Many parts of the web treat a line break as "this piece of information is finished, the next one starts here". If a website lets you put a line break into something that later becomes part of a message to a browser, you can end the part the website intended and start a new part of your own. That is the whole idea, and the rest of this article walks through how it played out here.

The picture above is the author's profile image on the platform where he published the write-up.
The background you need first
Before the steps make sense, a few everyday ideas need explaining.
A request and a response. When you use a website, your browser sends a message to a server asking for something (a page, a file, an action), and the server sends a message back. The first is the request, the second is the response. Think of it as posting a letter with a question and receiving a letter with the answer.
Headers. Both requests and responses start with a block of headers: short labelled lines that describe the message. A request header might say what kind of file you are sending; a response header might say what type of content is coming back or tell the browser to store something. Each header is one line, in the form Name: value. The line break is what separates one header from the next, which is exactly why line breaks matter for this bug.
A cookie. A cookie is a small piece of data a website asks your browser to keep and send back with later requests. It is how a site remembers that you are logged in: after you sign in, the server sets a cookie, and on every later visit your browser presents it, like a wristband at an event that proves you already paid to get in. If the cookie disappears, the site no longer recognises you and you are logged out.
A proxy. A proxy is a tool that sits between your browser and the website and lets you see and edit the messages going each way. Security testers use one to change a request after the browser has built it but before it reaches the server. The author's steps include intercepting the upload request.
The Content-Disposition header. When a file is uploaded, the request includes a header that describes the file, including its filename. This header is where the author's input ended up, and therefore where the bug lived.
Clear-Site-Data. This is a response header a server can send to tell the browser to throw away stored data for that site. One of the things it can throw away is cookies. If a browser receives it, it obeys: the cookies go, and the user is signed out.
URL encoding. Some characters cannot travel safely inside a web address or a header value, so they are written in a coded form: a percent sign followed by two characters. %0A means "line feed", %0D means "carriage return", %3A means a colon and %22 means a double quote. The server decodes these back into the real characters when it processes the input.
The target and the feature
ExaHub, as the author describes it, is a platform for people who work with the Exa programming language. He presents Exa as a high-level language known for speed and performance, used in scientific computing, machine learning and data science. ExaHub is the central place where those users find resources, collaborate on projects and use tools built around the language, from managing projects to visualising data.
The feature involved is file upload. Users have a "Files" section where they upload files, and other users can download them later. That sharing is what makes the bug serious: the payload does not affect the person who uploads it, it affects whoever downloads it.
Setting up
The author does not describe any special tools, software versions or account roles beyond a normal ExaHub account. The steps require the ability to upload a file and intercept the upload request, which means a proxy.
Finding the bug
The author describes the flaw as a CR/LF injection. CR stands for Carriage Return (character code 13) and LF for Line Feed (character code 10). These are the two control characters that mark the end of a line in text. When they reach a place where the application is assembling headers, they can end the current header and begin a new one. An attacker who controls part of the input therefore controls part of the header block.
In ExaHub, the input that reached the header block was the filename in the upload request. The author puts the cause down to inadequate input validation during upload: the filename was placed into the Content-Disposition header without the CR and LF characters being rejected or encoded.
Reproducing it, step by step
The author's reproduction is short. It does not include the raw request or response, only the header change and the payload. Here are his steps, with the reasoning behind each one.
Step 1: reach the upload feature
- Access your ExaHub account.
- Navigate to the "Files" section.
- Upload a file and intercept the uploading request.
You start by logging in and going to the Files section, because that is the feature under test. You upload any file, but you switch on your proxy first so that the request pauses on its way out. The point of intercepting is to get a chance to edit the message after the browser has written it but before the server reads it. Without that pause you could not change the filename in transit.
Step 2: inject into Content-Disposition
- Modify the Content-Disposition header by appending the payload
%0AClear-Site-Data%3A%22cookies%22%0Aafter the filename.
This is the actual attack. You take the header that names your file and add the coded payload to the end of the filename. The server will decode it, and the decoded text is a new header line:
Line by line, the payload works like this:
%0Ais a line feed. It ends the current header line, so whatever comes next is treated as a new header.Clear-Site-Datais the name of the header being created.%3Ais a colon, the separator between a header's name and its value.%22cookies%22is the word cookies wrapped in double quotes, which is the value that tells the browser to delete its cookies.- The final
%0Ais another line feed, which closes the injected header so that the rest of the message stays intact.
The author's steps append the payload to the filename in the upload request and then download the file.
Step 3: trigger it on a victim
- Send the modified request and attempt to download the uploaded file.
- When other user download the file they got locked out this is one of the multiple task which can be performed by cr/lf injection.
You let the modified request through and then download the file yourself to check that the upload worked and the file is retrievable. The real effect, though, is on other people. When another user downloads the file, they got locked out, which the author describes as one of several things CR/LF injection can do here. The author notes that this forced logout is only one of several things CR/LF injection can do here.
Why it works
The author states the root cause plainly: inadequate input validation during the file upload process. The report does not show the server-side code, so the exact point where the decoding happens is not documented.
What an attacker could do with it
The demonstrated impact is a forced logout: other users who download the file have their cookies cleared and are locked out. The author also lists further possibilities that the same injection opens up:
- manipulating headers in general;
- manipulating and setting cookies of other users, with payloads such as
%0ASet-Cookie%3A+crlfinjection%3D+value+; - session hijacking and unauthorised access;
- cross-site scripting, for which he gives this payload:
• /%3f%0d%0aLocation:%0d%0aContent-Type:text/html%0d%0aX-XSS-Protection%3a0%0d%0a%0d%0a%3Cscript%3Ealert%28document.domain%29%3C/script%3E ``
That last payload is worth decoding, because it shows how far the idea can go. %3f is a question mark, %0d%0a is a carriage return followed by a line feed (a full line break), and the rest builds several new headers: a Location header (which tells the browser to go to another address), a Content-Type: text/html header (which tells the browser the content is a web page), and an X-XSS-Protection: 0 header (which switches off an old browser protection). After two more line breaks comes %3Cscript%3Ealert%28document.domain%29%3C/script%3E, which decodes to a small script that pops up an alert showing the site's domain. In other words, the payload tries to make the browser treat injected text as a real web page containing a script.
These are presented as potential exploits, not as things the author demonstrated. Only the forced logout is shown as a result. The impact also depends on a victim downloading the crafted file, and the author does not say which browsers or configurations were tested.
The response and the fix
The author reports that the ExaHub security team acknowledged the issue's validity and initiated a fix. He does not describe what the fix was. The general remedy that follows from his root-cause statement is to validate the filename on upload and reject or encode CR and LF before it is placed into any header.
Other places to try the same idea
The author's write-up is about one feature, but the same pattern can be tested elsewhere. These are variants to try:
- Filename in
Content-Dispositionon download. Upload a file whose name contains%0d%0afollowed by a header of your choice, then download it. A positive result is the extra header appearing in the download response. - Other headers built from user input. Try the same sequence in any parameter that ends up in a response header, such as a redirect target, a language or theme value, or a filename echoed in a
Locationheader. A positive result is a new header line or a changed status line. Set-Cookieinjection. Use the author's%0ASet-Cookie%3A+crlfinjection%3D+value+pattern. A positive result is a cookie set in the victim's browser by the application's own response.- Response splitting to script. Use the author's
Location/Content-Type/X-XSS-Protectionpayload. A positive result is the injected body being rendered as HTML in the victim's browser. Clear-Site-Dataagainst other storage. Replace"cookies"with other directives the header supports and confirm the browser acts on them, which shows the injection reaches the response intact.
In every case, test with a second account, because the effect appears on the victim's download, not on the uploader's.
What to take away
The author's closing advice is to be thorough in testing and to try injecting all sorts of characters, including special ones like CR and LF. You never know what you might find, and testing widely means problems get found and fixed before someone with bad intentions exploits them.
Glossary
- Bug bounty program: a scheme where an organisation pays people for reporting security problems in its systems.
- Private program: a bounty program that only invited researchers can take part in, so its details are not public.
- CR/LF injection: a vulnerability where carriage return and line feed characters are inserted into input that later becomes part of a message's headers, letting an attacker add or change headers.
- Carriage Return (CR): the control character with code 13, historically used to move a printer or cursor back to the start of a line.
- Line Feed (LF): the control character with code 10, used to move to the next line; in text it marks the end of a line.
- Request: the message a browser sends to a server asking for a page, a file or an action.
- Response: the message a server sends back to the browser.
- Header: a labelled line at the start of a request or response that describes the message, in the form
Name: value. Content-Disposition: a header that describes a file being sent, including its filename.Clear-Site-Data: a response header that tells the browser to delete stored data for the site, such as cookies.- Cookie: a small piece of data a site asks the browser to store and send back later, commonly used to keep you logged in.
- Session: the period during which a site recognises you as logged in, usually maintained by a cookie.
- Session hijacking: taking over another user's logged-in session, for example by stealing or setting their cookie.
- Logout / forced logout: ending a user's session so they must sign in again; here it is caused by deleting their cookies.
- Proxy: a tool placed between browser and server that lets you view and edit the messages passing between them.
- Intercept: to pause a request or response in a proxy so it can be inspected or changed before it continues.
- URL encoding (percent encoding): writing characters in a coded form, a percent sign plus two characters, so they can travel safely in addresses and headers.
- Decoding: turning encoded characters such as
%0Aback into the real characters they stand for. - Input validation: checking data a user supplies and rejecting or cleaning anything that should not be allowed.
- Payload: the crafted piece of input an attacker sends to trigger a vulnerability.
- Cross-site scripting (XSS): a vulnerability where an attacker gets their own script to run in another user's browser as if it came from the website.
Locationheader: a response header that tells the browser to navigate to a different address.Content-Typeheader: a header that says what kind of content is being sent, such as a web page or an image.Set-Cookieheader: a response header that asks the browser to store a cookie.- Response splitting: crafting input so that one response is split into two, letting the attacker control the second one.
- Severity: a rating of how serious a vulnerability is, often from low to critical.
- Responsible disclosure: reporting a vulnerability privately to the organisation so it can be fixed before details are made public.