{"id":"CVE-2026-41683","aliases":["CVE-2026-41683","GHSA-c3h8-g69v-pjrg"],"related":[],"kind":"vulnerability","state":"published","title":"HTTP response splitting and DoS in i18next-http-middleware via unsanitised Content-Language header","summary":"i18next-http-middleware is a middleware to be used with Node.js web frameworks like express or Fastify and also for Deno. Prior to version 3.9.3, i18next-http-middleware wrote user-controlled language values into the Content-Language response header after passing them through utils.escape(), which is an HTML-entity encoder that does not strip carriage return, line feed, or other control characters. When the application used an older i18next (< 19.5.0) that still exercised the backward-compatibility fallback at LanguageDetector.js:100 or otherwise produced a raw detected value, CRLF sequences in the attacker-controlled lng parameter reached res.setHeader('Content-Language', ...) verbatim. This issue has been patched in version 3.9.3.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"i18next-http-middleware is a middleware to be used with Node.js web frameworks like express or Fastify and also for Deno. Prior to version 3.9.3, i18next-http-middleware wrote user-controlled language values into the Content-Language response header after passing them through utils.escape(), which is an HTML-entity encoder that does not strip carriage return, line feed, or other control characters. When the application used an older i18next (< 19.5.0) that still exercised the backward-compatibility fallback at LanguageDetector.js:100 or otherwise produced a raw detected value, CRLF sequences in the attacker-controlled lng parameter reached res.setHeader('Content-Language', ...) verbatim. This issue has been patched in version 3.9.3.","source":"cvelist"},{"lang":"en","text":"### Summary\n\nVersions of `i18next-http-middleware` prior to 3.9.3 wrote user-controlled language values into the `Content-Language` response header after passing them through `utils.escape()`, which is an HTML-entity encoder that does not strip carriage return, line feed, or other control characters. When the application used an older `i18next` (< 19.5.0) that still exercised the backward-compatibility fallback at `LanguageDetector.js:100` or otherwise produced a raw detected value, CRLF sequences in the attacker-controlled `lng` parameter reached `res.setHeader('Content-Language', ...)` verbatim.\n\n### Impact\n\nTwo concrete outcomes depending on the Node.js version:\n\n- **Node.js < 14.6.0 — HTTP response splitting.** An attacker crafting a request like `GET /?lng=en%0d%0aX-Injected%3A+malicious` could inject arbitrary additional HTTP response headers, enabling:\n  - Session fixation via an injected `Set-Cookie`\n  - Cache poisoning (injecting `Location`, `Content-Type`, etc.)\n  - Reflected XSS in controlled response bodies\n- **Node.js ≥ 14.6.0 — denial of service.** `res.setHeader()` throws `ERR_INVALID_CHAR` when the value contains CRLF. Because the middleware did not catch this error, it propagated as an unhandled exception, returning a 500 response to **all concurrent users sharing that process** (in worker-pool deployments this can knock out a full server instance).\n\nThe same header-setting code path fires inside the `languageChanged` event listener and again in the main middleware flow, so the flaw was triggered at least twice per affected request.\n\n### Related (same release)\n\nVersion 3.9.3 also tightens the `hasXSS()` regex that was designed as a secondary filter on detected language values. The previous pattern `/<\\s*\\w+\\s*on\\w+\\s*=.*?>/i` only matched event handlers in the **first** attribute position, so payloads like `<input autofocus onfocus=alert(1)>` bypassed the filter. Applications that rendered `res.locals.language` into HTML with a context-unsafe templating mode (EJS `<%- %>`, Pug `!{…}`, Handlebars `{{{…}}}`) could be XSSed despite the filter being in place. This bypass is noted here because it is fixed in the same release, but the primary vulnerability reported in this advisory is the CRLF/header-injection path above.\n\n### Affected versions\n\n`< 3.9.3`.\n\n### Patch\n\nFixed in **3.9.3**. The patch introduces `utils.sanitizeHeaderValue(str)` which strips `\\r`, `\\n`, and other C0/C1 control characters, and replaces both `utils.escape(lng)` call sites in `lib/index.js` with it. The `hasXSS()` regex has also been tightened to match event-handler attributes at any position.\n\n### Workarounds\n\nNo workaround short of upgrading. Front-proxying the middleware with a WAF rule that rejects `\\r`/`\\n` in query parameters, cookies, and path segments is a partial mitigation.\n\n### Credits\n\nDiscovered via an internal security audit of the i18next ecosystem.","format":"markdown","source":"ghsa"},{"lang":"es","text":"i18next-http-middleware es un middleware para usar con frameworks web de Node.js como express o Fastify y también para Deno. Antes de la versión 3.9.3, i18next-http-middleware escribía valores de idioma controlados por el usuario en el encabezado de respuesta ’Content-Language’ después de pasarlos por utils.escape(), que es un codificador de entidades HTML que no elimina el retorno de carro, el salto de línea u otros caracteres de control. Cuando la aplicación usaba una versión anterior de i18next (menor que 19.5.0) que aún ejercía el fallback de compatibilidad con versiones anteriores en LanguageDetector.js:100 o de otro modo producía un valor detectado en bruto, las secuencias CRLF en el parámetro lng controlado por el atacante llegaban a res.setHeader(’Content-Language’, ...) literalmente. Este problema ha sido parcheado en la versión 3.9.3.","source":"nvd"}],"published":"2026-04-22T20:25:49.000Z","modified":"2026-10-26T18:10:00.173Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:H/A:L","score":8.6,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:H/A:L","score":8.6,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:H/A:L","score":8.6,"rating":"HIGH"}],"cwes":["CWE-79","CWE-113"],"affected":[{"ranges":[{"version":"< 3.9.3","status":"affected"}],"vendor":"i18next","product":"i18next-http-middleware","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"3.9.3"}],"ecosystem":"npm","package":"i18next-http-middleware","purl":"pkg:npm/i18next-http-middleware","source":"ghsa"}],"references":[{"url":"https://github.com/i18next/i18next-http-middleware/security/advisories/GHSA-c3h8-g69v-pjrg","tags":["web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-41683","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/i18next/i18next-http-middleware/commit/65301c194593d46a84623b64e5fde2f51d3550f6","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/i18next/i18next-http-middleware","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"yes","technicalImpact":"partial","date":"2026-05-08T23:28:40.338Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-41683","url":"https://www.cve.org/CVERecord?id=CVE-2026-41683","licence":"CVE Terms of Use","modified":"2026-05-08T23:29:00.230Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-c3h8-g69v-pjrg","url":"https://github.com/advisories/GHSA-c3h8-g69v-pjrg","licence":"CC-BY-4.0","modified":"2026-05-13T13:52:05.255Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-41683","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-41683","licence":"Public domain","modified":"2026-10-26T18:10:00.173Z"}],"updatedAt":"2026-11-25T22:59:21.094Z","epss":{"score":0.00327,"percentile":0.27881,"date":"2026-12-01T12:00:22.000Z"}}