CRLF Injection - http://stage-static-cdn.mackeeper.com/
The server reflected a CRLF sequence from the request path into the response headers, allowing an attacker to inject arbitrary headers. The report shows a custom header being added to the response.
- Triaged in 5 days
- Fixed in 3 months
- Paid in 15 days
- Disclosed after 7 months
Summary by the program
Summary
CRLF Injection - http://stage-static-cdn.mackeeper.com/
Steps To Reproduce
In the rawRequest we have added '%0D%0Avirus:%20value'
In Burp Repeater copy and paste the below rawRequest
Notice the response with header added
------rawRequest----------
GET /%0D%0Avirus:%20value HTTP/1.1
Connection: keep-alive
Accept: /
Accept-Encoding: gzip,deflate
Host: stage-static-cdn.mackeeper.com
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:64.0) Gecko/20100101 Firefox/64.0
------rawRequest----------
What the report shows
The target is the host stage-static-cdn.mackeeper.com. The report describes a CRLF injection on this host. The report does not describe a fix.
The reproduction is short. The researcher appended the encoded sequence %0D%0Avirus:%20value to the request path and observed that the response came back with an extra header added. The steps as given are:
- Add
'%0D%0Avirus:%20value'to the raw request. - Paste the raw request below into Burp Repeater.
- Notice the response with the header added.
The full request is reproduced exactly as it appears in the report:
------rawRequest----------
GET /%0D%0Avirus:%20value HTTP/1.1
Connection: keep-alive
Accept: /
Accept-Encoding: gzip,deflate
Host: stage-static-cdn.mackeeper.com
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:64.0) Gecko/20100101 Firefox/64.0
------rawRequest----------
The payload sits in the path of a GET request to the CDN host. %0D%0A is the percent-encoded carriage return and line feed pair, and virus:%20value is the header the researcher wanted to inject. The report states that the response contained the added header, which is the observable proof of the injection. It does not include the response itself, so the exact status line, the position of the injected header and any other headers returned are not shown.
Root cause
The likely cause is that the server takes part of the request URI, here the path, and writes it into a response header without stripping or rejecting CR and LF characters. When the application decodes %0D%0A before building the header, the decoded bytes terminate the intended header line and start a new one, so the attacker-controlled text becomes a header of its own. The report does not identify the specific component or header involved, so the exact sink is not established.
Impact
The demonstrated effect is response header injection on a staging CDN host. The report does not go further than that: it does not show script execution, cache poisoning, request smuggling or any other escalation, and it does not describe what an attacker could achieve beyond the added header. In general terms, header injection of this kind can matter when the injected header influences caching, redirects or content interpretation, but whether any of that applies here is not shown in the report. The report shows only a limited, proof-of-concept finding.
How this kind of bug works
HTTP/1.1 headers are line-based. Each header is a name, a colon and a value, terminated by CRLF, and the header block ends with an empty line. If an application copies user input into a header value without removing CR and LF, the input can close the current header and open a new one, or even end the header block early and start writing into the body.
The input usually arrives percent-encoded, because raw control characters are not valid in a request line or query string. The bug appears when the server decodes the value before using it. Variants include injecting into Location on redirects, into Set-Cookie, into custom headers, and splitting the response so that body content is attacker-controlled. The same class also appears in mail headers (SMTP header injection) and in log files (log injection), where the same newline handling mistake has different consequences.
Defences are straightforward: reject or strip CR and LF from any value that will be placed in a header, validate input against an allowlist where possible, and use framework APIs that encode header values rather than string concatenation. Modern HTTP libraries often refuse to emit headers containing control characters, which turns the bug into an error rather than an injection.
How to test for it
Look for parameters, path segments or filenames that end up reflected in response headers: redirect targets, download filenames in Content-Disposition, language or theme selectors, and anything that appears in Location, Set-Cookie or custom headers.
- Send a request with a benign marker in the candidate parameter and confirm it appears in a response header.
- Replace the marker with an encoded CRLF sequence followed by a harmless header, for example a percent-encoded carriage return and line feed and then a name and value pair. Try both
%0D%0Aand double-encoded forms such as%250D%250A, since some stacks decode twice. - Inspect the raw response, not the rendered view, to see whether the injected header appears on its own line.
- Try ending the header block early with a double CRLF to see whether body content can be influenced.
A positive result is a new header line in the response that you control. Common false positives are the marker appearing URL-encoded inside an existing header value, the server normalising the sequence back to literal characters, or a proxy or WAF reflecting your input in an error page rather than the application emitting it. Confirm the behaviour directly against the origin where possible, and check whether the injected header survives caching layers.
How it is fixed
Strip or reject CR and LF in all input that reaches a header, preferably at the point of use rather than only at input validation. Use the platform's header-setting API, which should refuse control characters, instead of building header strings by hand. Where a value must be reflected, encode it so that it cannot break the line structure. Add regression tests that send encoded CRLF sequences to every parameter that reaches a header.
Hunting notes
This class tends to hide in redirect handlers, file download endpoints that set Content-Disposition, localisation and theme parameters, and CDN or static hosts that echo parts of the path. Staging and CDN hostnames are good candidates because they often run older or less hardened code than production.
Recon signals include parameters whose values appear verbatim in response headers, hosts that reflect the request path in Location, and stacks that are known to decode input late. To make a report land, show the raw request and the raw response side by side, prove that the injected header is emitted by the origin and not by an intermediary, and state clearly what the injection enables. If the only effect is an extra header, say so plainly.
What happened, in plain words
This report is about a website host called stage-static-cdn.mackeeper.com. A bug bounty programme is a scheme where a company invites outside researchers to look for security problems and pays them for good findings. The report describes a CRLF injection. The report does not describe a fix.
To follow this you only need two ideas. First, a request: when you open a web page, your browser sends a short text message to a server asking for something, and the server sends back a response. Second, a header: both messages start with a block of lines of the form Name: value, which carry the boring but essential details, such as which site you asked for and what kind of content is coming back. Think of headers as the address and handling instructions written on an envelope, while the body of the message is the letter inside.
A CDN (content delivery network) is a set of servers that serve files such as images and scripts on a site's behalf, so the main site does not have to. The host in this report is a staging CDN, meaning a test copy of that setup rather than the live one.
The finding is short. The researcher put an encoded sequence into the part of the request that names the page being asked for, and the server answered with an extra header that the researcher had chosen. That is the whole proof: text the researcher supplied ended up as a header line in the response.
The steps as given are:
- Add
'%0D%0Avirus:%20value'to the raw request. - Paste the raw request below into Burp Repeater.
- Notice the response with the header added.
Burp Repeater is a tool that lets you send a hand-written request to a server over and over, changing one thing each time, and read the raw reply. A raw request is the request exactly as it goes over the network, rather than the tidied-up version a browser shows you. Step 1 matters because it is the actual attack: the encoded text is placed where the server will read it. Step 2 matters because it lets the researcher send that exact text without a browser altering it. Step 3 matters because the extra header in the reply is the evidence that the server copied the input into its own headers.
The full request is reproduced exactly as it appears in the report:
------rawRequest----------
GET /%0D%0Avirus:%20value HTTP/1.1
Connection: keep-alive
Accept: /
Accept-Encoding: gzip,deflate
Host: stage-static-cdn.mackeeper.com
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:64.0) Gecko/20100101 Firefox/64.0
------rawRequest----------
Line by line:
GET /%0D%0Avirus:%20value HTTP/1.1is the request line.GETmeans "give me this". The middle part is the path, the name of the thing being asked for, and here it is the payload.HTTP/1.1is the version of the protocol being spoken.Connection: keep-aliveasks the server to keep the network connection open after replying, so more requests can follow.Accept: /is the client saying which content types it will take. It is written this way in the report.Accept-Encoding: gzip,deflatesays the client can accept compressed replies.Host: stage-static-cdn.mackeeper.comnames the site being contacted. Servers often host many sites, so this line tells the server which one is wanted.User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:64.0) Gecko/20100101 Firefox/64.0identifies the browser and operating system. Here it simply imitates Firefox on Windows.- The empty line at the end marks the boundary between headers and body. A GET request normally has no body.
Now the payload itself. %0D is the percent-encoded form of a carriage return and %0A is the encoded form of a line feed. Together they are the two characters that end a line in HTTP headers. virus:%20value is the header the researcher wanted to create, with %20 being an encoded space. So the path, once the server decodes it, reads as a line break followed by virus: value. If the server copies that decoded text into a response header without cleaning it, the line break ends the server's own header and the researcher's text becomes a new header of its own.
The report states that the response contained the added header, which is the observable proof. It does not include the response itself, so the status line, where the injected header appeared, and any other headers returned are not shown.
In general, how this kind of bug works
HTTP/1.1 headers are line-based. Each header is a name, a colon and a value, ended by a carriage return and line feed pair, and the whole header block ends with an empty line. If a program copies input from a user into a header value without removing those two characters, the input can close the current header and open a new one, or even end the header block early and start writing into the body. This is called CRLF injection, after the two characters involved.
The input usually arrives percent-encoded, because raw control characters are not allowed in a request line or query string. The bug appears when the server decodes the value before using it. Variants include injecting into Location on redirects, into Set-Cookie, into custom headers, and splitting the response so that body content is attacker-controlled. The same class of mistake appears in email headers and in log files, where mishandled newlines have different consequences.
Defences are straightforward: reject or strip carriage returns and line feeds from any value that will be placed in a header, check input against an allowlist where possible, and use framework functions that encode header values rather than gluing strings together. Modern HTTP libraries often refuse to send headers containing control characters, which turns the bug into an error rather than an injection.
To test for it, look for parameters, path segments or filenames that end up reflected in response headers: redirect targets, download filenames in Content-Disposition, language or theme selectors, and anything that appears in Location, Set-Cookie or custom headers.
- Send a request with a harmless marker in the candidate parameter and confirm it appears in a response header.
- Replace the marker with an encoded CRLF sequence followed by a harmless header, for example a percent-encoded carriage return and line feed and then a name and value pair. Try both
%0D%0Aand double-encoded forms such as%250D%250A, since some stacks decode twice. - Inspect the raw response, not the rendered view, to see whether the injected header appears on its own line.
- Try ending the header block early with a double CRLF to see whether body content can be influenced.
A positive result is a new header line in the response that you control. Common false positives are the marker appearing URL-encoded inside an existing header value, the server turning the sequence back into literal characters, or a proxy or web application firewall reflecting your input in an error page rather than the application emitting it. Confirm the behaviour directly against the origin where possible, and check whether the injected header survives caching layers.
To fix it, strip or reject carriage returns and line feeds in all input that reaches a header, preferably at the point of use rather than only at input validation. Use the platform's header-setting function, which should refuse control characters, instead of building header strings by hand. Where a value must be reflected, encode it so that it cannot break the line structure. Add regression tests that send encoded CRLF sequences to every parameter that reaches a header.
This class tends to hide in redirect handlers, file download endpoints that set Content-Disposition, localisation and theme parameters, and CDN or static hosts that echo parts of the path. Staging and CDN hostnames are good candidates because they often run older or less hardened code than production. Signals worth watching for include parameters whose values appear verbatim in response headers, hosts that reflect the request path in Location, and stacks known to decode input late. To make a report land, show the raw request and the raw response side by side, prove that the injected header comes from the origin and not from an intermediary, and state clearly what the injection enables. If the only effect is an extra header, say so plainly.
Glossary
- Bug bounty programme: a scheme where a company pays outside researchers for reporting security problems.
- Request: the message a browser or tool sends to a server asking for something.
- Response: the message a server sends back.
- Header: a line of the form
Name: valueat the start of a request or response, carrying details about the message. - CDN (content delivery network): servers that deliver files on a site's behalf.
- Staging: a test copy of a system, separate from the live one.
- CRLF injection: getting line-break characters into a place where they break the structure of headers, letting an attacker add their own.
- Carriage return and line feed: the two control characters that mark the end of a line in HTTP headers.
- Percent-encoding: writing special characters as
%followed by two hexadecimal digits so they can travel safely in a URL. - Payload: the piece of input crafted to trigger the bug.
- Raw request: the request exactly as it goes over the network.
- Burp Repeater: a tool for sending a hand-edited request repeatedly and reading the raw reply.
- GET: the HTTP method meaning "give me this resource".
- Host header: the header naming which site on a server is being contacted.
- User-Agent: the header identifying the browser and operating system.
Location: the response header that tells a browser where to go on a redirect.Set-Cookie: the response header that asks the browser to store a cookie.Content-Disposition: the response header that tells a browser whether to display a file or download it, and under what name.- Allowlist: a list of values that are explicitly permitted, with everything else rejected.
- False positive: a result that looks like a bug but is not.
- Web application firewall (WAF): a filter placed in front of a site that inspects traffic and blocks suspicious input.
- Proxy: an intermediary that forwards traffic between a client and a server.
- Caching layer: a system that stores copies of responses to serve them faster later.
- Regression test: an automated test that checks a fixed bug stays fixed.