<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Http-Response-Splitting — CraftedSignal Threat Feed</title><link>https://feed.craftedsignal.io/tags/http-response-splitting/</link><description>Trending threats, MITRE ATT&amp;CK coverage, and detection metadata — refreshed continuously.</description><generator>Hugo</generator><language>en</language><managingEditor>hello@craftedsignal.io</managingEditor><webMaster>hello@craftedsignal.io</webMaster><lastBuildDate>Wed, 03 Jan 2024 12:00:00 +0000</lastBuildDate><atom:link href="https://feed.craftedsignal.io/tags/http-response-splitting/feed.xml" rel="self" type="application/rss+xml"/><item><title>i18next-http-middleware HTTP Response Splitting and DoS Vulnerability</title><link>https://feed.craftedsignal.io/briefs/2024-01-i18next-http-middleware-crlf/</link><pubDate>Wed, 03 Jan 2024 12:00:00 +0000</pubDate><author>hello@craftedsignal.io</author><guid isPermaLink="true">https://feed.craftedsignal.io/briefs/2024-01-i18next-http-middleware-crlf/</guid><description>i18next-http-middleware versions before 3.9.3 are vulnerable to HTTP response splitting and denial-of-service attacks due to unsanitized Content-Language headers, potentially leading to session fixation, cache poisoning, reflected XSS, or complete service disruption depending on the Node.js version.</description><content:encoded><![CDATA[<p>The <code>i18next-http-middleware</code> library, in versions prior to 3.9.3, exhibits a vulnerability stemming from insufficient sanitization of user-controlled language values. These values are written into the <code>Content-Language</code> HTTP response header. The <code>utils.escape()</code> function, employed for sanitization, performs HTML-entity encoding but fails to strip critical characters like carriage return and line feed. When the application uses an older <code>i18next</code> (&lt; 19.5.0) or produces raw detected values, CRLF sequences within the <code>lng</code> parameter reach <code>res.setHeader('Content-Language', ...)</code> without proper escaping. This flaw can result in HTTP response splitting (Node.js &lt; 14.6.0) or a denial-of-service condition (Node.js &gt;= 14.6.0), impacting all concurrent users of the affected process.  The same vulnerability is triggered multiple times per request. This issue is resolved in version 3.9.3.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>The attacker crafts a malicious HTTP request targeting an application using a vulnerable version of <code>i18next-http-middleware</code>. The request includes a <code>lng</code> parameter with a payload containing CRLF sequences (e.g., <code>%0d%0a</code>).</li>
<li>The <code>i18next-http-middleware</code> receives the request and extracts the language value from the <code>lng</code> parameter.</li>
<li>The extracted language value is passed through <code>utils.escape()</code>, which performs HTML-entity encoding but does not remove CRLF sequences.</li>
<li>The middleware attempts to set the <code>Content-Language</code> header using <code>res.setHeader()</code>, incorporating the unsanitized language value.</li>
<li>If the Node.js version is less than 14.6.0, the <code>res.setHeader()</code> function processes the CRLF sequences, resulting in HTTP response splitting. This allows the attacker to inject arbitrary headers and control parts of the response body.</li>
<li>If the Node.js version is 14.6.0 or greater, <code>res.setHeader()</code> throws an <code>ERR_INVALID_CHAR</code> error because the value contains CRLF sequences.</li>
<li>The middleware fails to catch this error, and the exception propagates, leading to an unhandled exception.</li>
<li>The unhandled exception causes the Node.js process to terminate or become unresponsive, resulting in a denial-of-service condition for all concurrent users sharing that process.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>Successful exploitation allows attackers to inject arbitrary HTTP headers, leading to session fixation, cache poisoning, or reflected XSS attacks. In Node.js versions 14.6.0 and later, exploitation leads to a denial-of-service condition, potentially impacting all users of an application instance. This can result in significant disruption of service availability and potential data compromise. The number of affected applications is unknown, but any application using a vulnerable version of <code>i18next-http-middleware</code> is at risk.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Upgrade <code>i18next-http-middleware</code> to version 3.9.3 or later to address the vulnerability by patching the <code>utils.sanitizeHeaderValue()</code> function, as described in the advisory.</li>
<li>Deploy the Sigma rule <code>Detect i18next-http-middleware CRLF Injection Attempt</code> to monitor for exploitation attempts by detecting suspicious URL-encoded characters in HTTP requests.</li>
<li>Implement a Web Application Firewall (WAF) rule to reject requests containing <code>\r</code> or <code>\n</code> characters in query parameters, cookies, and path segments as a partial mitigation, as suggested in the advisory.</li>
<li>Enable web server logging to ensure events related to potential exploits are captured for analysis.</li>
</ul>
]]></content:encoded><category domain="severity">medium</category><category domain="type">advisory</category><category>crlf-injection</category><category>http-response-splitting</category><category>denial-of-service</category><category>i18next</category></item></channel></rss>