/

CVE-2026-41683

Severity:

HIGH RISK

(8.6)

HTTP Response Splitting / Header Injection in i18next-http-m

CVE-2026-41683

Deferred

Vulnerability type

Category:

HTTP Response Splitting / Header Injection

CWE:

CWE-79, CWE-113

Impact:

HTTP Response Splitting and Cross-Site Scripting

Severity:

HIGH RISK

(8.6)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

i18next-http-middleware versions prior to 3.9.3 can be abused to inject attacker-controlled values into the Content-Language HTTP response header when language detection returns untrusted raw input.

By including CRLF sequences in the lng parameter, an attacker may perform HTTP response splitting or header injection, which can enable cross-site scripting, cache poisoning, or other response-manipulation attacks under certain deployment conditions.

Affected context

The vulnerability occurs in Node.js applications (or Deno setups) that:

  • Integrate i18next-http-middleware as localization middleware with Express, Fastify, or similar frameworks.
  • Use an older i18next core (< 19.5.0) or any configuration path that returns a raw, non-normalized language value.
  • Allow attackers to influence the lng parameter or other language detection sources (e.g., query string, cookie, header).

In this context, user-supplied language values are written directly into the Content-Language response header after passing through utils.escape(), which does not remove CRLF or other control characters.

Exploit preconditions

  • Attack surface: HTTP endpoints using i18next-http-middleware where the language can be set via query parameters, headers, cookies, or other user-controlled inputs (e.g., ?lng=).
  • Required access: Ability to send crafted HTTP requests to the affected application (no prior authentication is typically needed if language selection is public).
  • Trigger point: The middleware detects the language, processes it through utils.escape(), and calls res.setHeader('Content-Language', ...) with the unstripped value.
  • Why exploitation is possible: utils.escape() is an HTML entity encoder, not a header-sanitization routine; it preserves carriage return (\r) and line feed (\n) characters. With older i18next behavior or raw detection output, CRLF sequences in lng are written verbatim into the HTTP response status line and header section, enabling injection of additional headers or a second HTTP response.

Why this happens

The core issue is trusting user-controlled data when constructing HTTP response headers without performing header-specific validation and normalization.

i18next-http-middleware relied on utils.escape(), an HTML-entity encoder designed to mitigate XSS in HTML content, rather than a function that enforces header-safe character sets. Because CRLF and other control characters were not removed or rejected, an attacker could embed them in the language value. When this value was used directly in res.setHeader('Content-Language', ...), the HTTP response syntax could be manipulated, leading to HTTP response splitting and header injection.

This pattern maps to CWE-113: Improper Neutralization of CRLF Sequences in HTTP Headers, and can also manifest as CWE-79: Cross-Site Scripting (XSS) when injected responses deliver attacker-controlled HTML or scripts to clients.

Potential impact

  • Injection of arbitrary HTTP response headers (e.g., Set-Cookie, Location, or custom headers).
  • HTTP response splitting, potentially creating a second forged response controlled by the attacker.
  • Cross-site scripting (XSS) when an injected response contains attacker-controlled HTML or JavaScript.
  • HTTP cache poisoning by influencing how shared caches store and serve manipulated responses.
  • Security policy bypasses, such as weakening CSP or CORS headers in injected responses.

General mitigation guidance

Effective mitigation centers on treating header values as a constrained, well-defined format and decoupling them from raw user input:

  • Restrict language identifiers to a strict allowlist of known-good values (e.g., ISO language tags like en, en-US, de-DE) and reject or fall back on any unrecognized input.
  • Normalize and validate any data used in HTTP headers to ensure it contains only permitted characters (e.g., alphanumerics, hyphen, underscore) and explicitly remove or reject CR, LF, and other control characters.
  • Separate HTML-focused escaping from header construction; avoid using HTML encoders (utils.escape()-style) as a generic sanitization mechanism for headers or protocol-level fields.
  • Apply defensive defaults in middleware and framework configuration so that, when in doubt, a safe default language is chosen instead of echoing user-provided values.
  • Run applications behind security-aware reverse proxies or gateways that can enforce header hygiene policies and normalize upstream responses, reducing the blast radius of header injection bugs.

How teams detect issues like this

Organizations can detect and monitor this class of vulnerability using a combination of code-centric and runtime techniques:

  • Static analysis: Search for calls to res.setHeader, response.setHeader, or equivalent APIs where the value is derived from request-controlled fields (query parameters, cookies, headers) without strict validation or allowlisting.
  • Code review: Flag patterns where HTML encoders are used as general-purpose sanitizers for non-HTML contexts (e.g., headers, URLs, database keys) and verify that header values cannot contain CR, LF, or other control characters.
  • Unit and integration tests: Add tests that send inputs containing \r\n sequences in parameters such as lng and assert that the resulting response headers are either rejected, normalized, or cause errors rather than being returned as-is.
  • Dynamic scanning: Use security scanners or custom scripts to probe endpoints with crafted CRLF payloads and observe if responses exhibit signs of header injection or response splitting.
  • Policy enforcement: Integrate automated review tools in CI/CD pipelines to enforce safe header construction patterns (e.g., lint rules or security policies that require allowlisting for header values derived from user input).

Sources

SourceLink
github.comgithub.com/i18next/i18next-http-middleware/security/advisories/GHSA-c3h8-g69v-pjrg

Frequently asked

questions

Exploitability depends on whether attackers can control the language detection input (such as the lng parameter or similar sources) and whether intermediary components like proxies or load balancers preserve and forward the injected responses. In many typical web setups, an external attacker can send crafted requests and potentially trigger response splitting or header injection if these conditions are met.

Not necessarily. If the application exposes language selection to unauthenticated users (for example via query parameters, cookies, or headers), an attacker can exploit the bug without logging in. If language detection is only available to authenticated users or constrained to specific roles, the attack surface is reduced accordingly.

The most robust fix is to avoid using raw user input in HTTP headers at all. Instead, map any user-provided language indicators to a predefined set of supported language codes and use only the canonical values from that set. Additionally, enforce strict validation that strips or rejects CRLF and any non-compliant characters before interacting with header APIs.

Adopt a context-aware encoding and validation strategy: use allowlists and structured validation for protocol-level fields like headers, URLs, and cookies; reserve HTML escaping purely for rendering content in HTML contexts; and include automated checks in code review and CI pipelines that flag any header construction based on untrusted input. Coupled with secure framework defaults, this helps ensure header injection and response splitting bugs are caught early.

Find out what's already
exploitable in your codebase.