Discovering a CRLF Injection Vulnerability: My Journey into the MSRC Blog Website
A CRLF injection vulnerability was found in the MSRC Blog website, allowing an attacker to inject arbitrary HTTP response headers. This could enable session fixation, cookie manipulation, or cross-site scripting.
Published on ibrahimxss.medium.com
One quiet afternoon, I found myself exploring various Microsoft domains, driven by a curiosity to uncover hidden vulnerabilities. This time, I decided to delve into the Microsoft Security Response Center (MSRC) Blog website: https://msrc-blog.microsoft.com/.
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
The target of this assessment was the Microsoft Security Response Center (MSRC) Blog, served at https://msrc-blog.microsoft.com/. The MSRC Blog is a Microsoft website at that address. The feature that turned out to be interesting was not a form or an API endpoint but the way the site handled user-supplied input in its HTTP response headers: the researcher found that user-supplied input reached the HTTP response headers without the CRLF sequence being neutralised..
A CRLF injection is a header-injection class of bug. HTTP responses are a status line, a set of headers, a blank line and a body, and the boundaries between them are carriage-return/line-feed pairs. If an application copies user input into a header value without stripping CR and LF, the attacker can terminate the current header and start new ones, or end the header block early and write into the body. The report describes exactly this behaviour on the MSRC Blog.
Setup
No accounts, roles, tools or versions are described in the report. The work was done by browsing Microsoft domains and testing the MSRC Blog directly with crafted URLs. The only precondition stated is that the site reflects the supplied input into the response headers, which the researcher confirmed by observing the server response.
Finding it
The researcher was exploring various Microsoft domains and chose the MSRC Blog as a target. The starting point was simply visiting the site:
https://msrc-blog.microsoft.com/
From there, the input was placed in the request path rather than in a query parameter or a body. The payload used was:
%0aSet-Cookie:whoami=ibro
%0a is the URL-encoded line feed. The encoded line feed ends the current header line and the text after it becomes a new header. The rest of the payload, Set-Cookie:whoami=ibro, is the header the researcher wanted the server to emit. The full URL tested was:
https://msrc-blog.microsoft.com/%0aSet-Cookie:whoami=ibro
What made this look wrong is that the server did not reject or sanitise the encoded line feed. Instead, the response came back containing the injected header: the researcher verified that a Set-Cookie header with the value whoami=ibro was present in the server response. That is the confirmation of the injection: a header that the application never intended to send, produced from attacker-controlled input.
Exploitation
Step 1: Inject a response header
The first step is the request above. The important parts are the encoded line feed, which breaks out of the header the server is writing, and the Set-Cookie header that follows it. The result is a Set-Cookie header with the value whoami=ibro in the server response. The report notes that this lets an attacker set arbitrary cookies in the user's browser, which can lead to session fixation attacks or other malicious activity.






Step 2: Escalate beyond a single header
The researcher then escalated the issue. By manipulating the headers further, it was possible to inject text content into the webpage, producing a content spoofing scenario. The report states that the escalation allowed injecting new headers, injecting arbitrary text, stopping redirections, and overwriting the status of the response. The report lists these four capabilities without explaining how each was achieved.




The report presents this escalation as evidence of the critical nature of the vulnerability and its potential impact. It does not give the specific payloads used for the escalation steps.
Root cause
The report attributes the bug to the handling of user-supplied input in the HTTP response headers of the MSRC Blog. User-supplied input is written into a response header without CR and LF being removed or encoded, so an encoded %0a is interpreted as the end of a header line. The report does not describe the server-side code, the framework or the specific header that was being built, so the exact implementation mistake is not shown.
Impact
The report lists the following potential exploitation scenarios, each conditional on how the application behaves:
- XSS via cookie: if the value of the cookie is reflected somewhere without output encoding.
- Bypass of Double Submit Cookie CSRF protection: if the application uses that mechanism as its CSRF defence.
- Session fixation: if the application does not renew the session cookie (for example
JSESSIONID) after login.
Beyond cookie setting, the escalation showed content spoofing by injecting text into the page, plus the ability to inject headers, stop redirections and overwrite the response status. The report also mentions session hijacking, cookie manipulation and XSS as possible malicious activities, and says successful exploitation may result in unauthorised access to user accounts, leakage of sensitive information, or further compromise of the site's security. These outcomes are described as potential and depend on the conditions above; the report does not demonstrate account takeover or data leakage.
The report classifies the issue as a CRLF injection of medium severity with moderate exploitability, affecting the domain https://msrc-blog.microsoft.com in its HTTP response header handling. No CVE ID is given; the report notes it was to be assigned by the MSRC team.
Fix
The remediation it argues for is prompt handling of the issue so that the security of the applications, the protection of users and trust in the brand are maintained. The report gives no specific remediation steps.
Variants to test
- Encoded line breaks in the path: send
%0a,%0d%0aand%0din a path segment on other hosts. A positive result is a response containing a header you supplied, such as aSet-Cookieyou chose. - Encoded line breaks in query parameters: repeat the same payloads in parameters that are reflected into headers, for example in redirect or language parameters. A positive result is a new header line in the response.
- Header injection through redirects: look for endpoints that build a
Locationheader from input. A positive result is a second header appearing after the injected line break, or the redirect being suppressed. - Status line overwrite: try to place a full status line after the injected line break. A positive result is a response status different from the one the endpoint normally returns.
- Body injection: inject a line break followed by a blank line and text. A positive result is your text appearing at the start of the response body, which is the content spoofing case described in the report.
- Cookie-based follow-on: after setting a cookie, check whether its value is reflected without encoding, whether it is used for CSRF double-submit validation, and whether the session identifier is renewed at login. A positive result in any of these turns the header injection into XSS, CSRF bypass or session fixation respectively.
What happened, in plain words
A security researcher was browsing Microsoft websites looking for mistakes. One of the sites he visited was the Microsoft Security Response Center (MSRC) Blog, at https://msrc-blog.microsoft.com/. The MSRC Blog is a Microsoft website at that address. The interesting part was the way the site built its replies to the browser.
When your browser asks a website for a page, the server answers with a message made of two parts. The first part is a small block of text called the HTTP response headers: short labelled lines that tell the browser things like what type of content follows, whether to store a cookie, or whether to redirect somewhere else. The second part is the page itself, the body. The two parts are separated by an invisible blank line, and each header line ends with a special pair of invisible characters: a carriage return and a line feed, together called CRLF.
The researcher found that a special encoded character in the request ended up in the site's reply headers without being cleaned. That encoded character is a line feed, which the browser treats as "this header line ends here". So the researcher could end the header the site was writing and start a brand new header of his own choosing. This class of mistake is called CRLF injection, or header injection.
With that trick he made the site send a cookie he invented, then went further: he could add headers, write text into the page, cancel redirects and change the response status. The report calls the issue medium severity with moderate exploitability and says a CVE ID was to be assigned by the MSRC team.
The starting point
The researcher was exploring various Microsoft domains out of curiosity and picked the MSRC Blog as a target. The first thing he did was simply open the site:
https://msrc-blog.microsoft.com/
That line is just the address of the blog's home page. Opening it tells you the site is alive and lets you watch, in your browser's developer tools, what the server sends back. Nothing unusual happens on a normal visit; the point of this step is to have a baseline to compare against later.
Finding the flaw
The input was not placed in a search box or a form. It was placed directly in the path of the URL, the part after the domain name that normally names the page. The payload was:
%0aSet-Cookie:whoami=ibro
Line by line, in plain words:
%0ais how a line feed character is written inside a URL. URLs cannot contain raw invisible characters, so they are written as a percent sign followed by two hexadecimal digits.%0ameans "line feed", the character that ends a line.Set-Cookie:is the name of a standard HTTP response header. A server uses it to tell the browser "please store this small piece of data".whoami=ibrois the data itself: a cookie namedwhoamiwith the valueibro. A cookie is a small label the browser keeps for a website and sends back on later requests; sites use cookies to remember who you are or to keep settings.
The idea is that if the server copies this text into its headers without cleaning it, the %0a becomes a real line break, the header line the server was writing ends there, and Set-Cookie:whoami=ibro becomes a fresh header line that the server never meant to send.
The full address tested was:
https://msrc-blog.microsoft.com/%0aSet-Cookie:whoami=ibro
Reading it left to right: the normal site address, a slash, then the encoded line feed, then the header text. The researcher then looked at the server's reply. The reply contained a Set-Cookie header with the value whoami=ibro, which is the proof: a header produced from input the attacker controls. The server had not rejected or cleaned the encoded line break.
Step 1: make the site set a cookie you chose
The first step is the request above. Two pieces matter. The encoded line feed breaks out of the header the server is writing. The Set-Cookie text that follows becomes a new header. The result is a Set-Cookie header with the value whoami=ibro in the server response.
Why does that matter? Because a site's cookies are trusted by that site. If an attacker can make the site hand out a cookie of their choosing, they can try to abuse whatever the site does with cookies. The report names session fixation as one possible consequence: a session is the site's memory of your logged-in visit, usually identified by a cookie, and session fixation means tricking you into using a session identifier the attacker already knows.






Step 2: go beyond a single header
The researcher then pushed the bug further. By manipulating the headers more, he could put his own text content into the webpage, which the report calls a content spoofing scenario: the page shows words the attacker wrote, which can mislead a visitor about what the real site is saying. The report lists four things the escalation allowed: injecting new headers, injecting arbitrary text, stopping redirections, and overwriting the status of the response.
Each of those follows from control of the header block:
- New headers: once you can end a header line, you can start another one, so any header can be added.
- Arbitrary text in the page: headers end at a blank line, and everything after that blank line is the body. If you can produce that blank line early, your text becomes the start of the page content.
- Stopping redirections: a redirect is a header called
Locationthat tells the browser to go elsewhere. If you can interfere with the headers, you can neutralise that instruction so the redirect no longer happens. - Overwriting the status: the first line of a response is a status line, for example the familiar "200 OK" or "404 Not Found". If you can inject line breaks, you can replace that line with a different status.




The report does not give the specific payloads used for these escalation steps.
Why it happened
The report puts the cause down to how the MSRC Blog handled user-supplied input in its HTTP response headers. User-supplied input was written into a response header without carriage return and line feed characters being removed or encoded. So an encoded %0a in the URL survived decoding and was read by the browser as the end of a header line. The report does not describe the server-side code, the framework, or which header was being built, so the exact programming mistake is not shown, and it does not say why existing defences failed to stop it.
What an attacker could do with it
The report lists three possible follow-on attacks, each depending on how the application behaves:
- XSS via cookie: if the value of the cookie is later shown on a page without being encoded. XSS, cross-site scripting, means getting a site to run attacker-supplied script in a victim's browser.
- Bypassing Double Submit Cookie CSRF protection: if the site uses that technique to defend against CSRF, cross-site request forgery, where another site silently makes your browser send a request you did not intend. The double submit technique relies on a cookie value matching a value in the request, so a cookie the attacker can set may undermine it.
- Session fixation: if the site does not give you a fresh session cookie after you log in, for example a
JSESSIONIDcookie.
Beyond cookies, the escalation showed content spoofing by injecting text into the page, plus the ability to inject headers, stop redirections and overwrite the response status. The report also mentions session hijacking, cookie manipulation and XSS as possible malicious activities, and says successful exploitation may lead to unauthorised access to user accounts, leakage of sensitive information, or further compromise of the site's security. These are described as potential outcomes that depend on the conditions above; the report does not demonstrate account takeover or data leakage.
The report classifies the issue as a CRLF injection of medium severity with moderate exploitability, affecting the domain https://msrc-blog.microsoft.com in its HTTP response header handling. No CVE ID is given; the report says it was to be assigned by the MSRC team. A CVE ID is a public reference number given to a known vulnerability so people can talk about it unambiguously.
The fix
What it argues for is prompt handling of the issue so that the security of the applications, the protection of users and trust in the brand are maintained. The report gives no specific remediation steps.
Other places to look for the same bug
- Encoded line breaks in the path: send
%0a,%0d%0aand%0din a path segment on other hosts. A positive result is a response containing a header you supplied, such as aSet-Cookieyou chose. - Encoded line breaks in query parameters: repeat the same payloads in parameters that end up in headers, for example redirect or language parameters. A positive result is a new header line in the response.
- Header injection through redirects: look for endpoints that build a
Locationheader from input. A positive result is a second header appearing after the injected line break, or the redirect being suppressed. - Status line overwrite: try to place a full status line after the injected line break. A positive result is a response status different from the one the endpoint normally returns.
- Body injection: inject a line break followed by a blank line and text. A positive result is your text appearing at the start of the response body, which is the content spoofing case described in the report.
- Cookie-based follow-on: after setting a cookie, check whether its value is shown without encoding, whether it is used for CSRF double-submit validation, and whether the session identifier is renewed at login. A positive result in any of these turns the header injection into XSS, CSRF bypass or session fixation respectively.
Glossary
- HTTP response headers: the short labelled lines a server sends before the page content, telling the browser how to handle the reply.
- Body: the page content that follows the headers in a response.
- CRLF: carriage return plus line feed, the invisible character pair that marks the end of a line in HTTP messages.
- CRLF injection: a bug where user input containing line breaks is copied into headers, letting an attacker add or change headers and content.
- Header injection: another name for the same class of bug.
- Payload: the crafted text an attacker sends to trigger a bug.
- URL encoding: writing special or invisible characters in a URL as a percent sign plus two hexadecimal digits, such as
%0afor a line feed. - Path: the part of a URL after the domain name that normally names the page.
- Query parameter: a name and value pair after a question mark in a URL.
- Cookie: a small piece of data a site asks the browser to store and send back on later requests.
- Set-Cookie: the response header a server uses to give the browser a cookie.
- Session: a site's memory of your visit, usually identified by a cookie.
- Session fixation: tricking a victim into using a session identifier the attacker already knows.
- Session hijacking: taking over someone else's session.
- XSS (cross-site scripting): getting a site to run attacker-supplied script in a victim's browser.
- CSRF (cross-site request forgery): making a victim's browser send a request to a site without the victim intending it.
- Double Submit Cookie: a CSRF defence where a cookie value must match a value sent in the request.
- Content spoofing: making a page display text the attacker wrote, so visitors are misled about what the site says.
- Redirect: a response that tells the browser to go to a different address, using the
Locationheader. - Status line: the first line of a response, such as "200 OK" or "404 Not Found".
- CVE ID: a public reference number assigned to a known vulnerability.
- Severity: a rough rating of how serious a vulnerability is, here medium.
- Exploitability: how easy a vulnerability is to abuse, here moderate.
- MSRC: the Microsoft Security Response Center, Microsoft's team that handles security reports.