{"id":"CVE-2026-41691","aliases":["CVE-2026-41691","GHSA-q89c-q3h5-w34g"],"related":[],"kind":"vulnerability","state":"published","title":"i18next-http-backend has Path Traversal & URL Injection via Unsanitised lng/ns","summary":"Copilot said: i18nextify is a JavaScript library that adds\ni18nextify is a JavaScript library that adds website internationalization via a script tag, without source code changes. Versions prior to 3.0.5 interpolate the lng and ns values directly into the configured loadPath / addPath URL template without any encoding, validation, or path sanitisation. When an application exposes the language-code selection to user-controlled input (the default — i18next-browser-languagedetector reads ?lng= query params, cookies, localStorage, and request headers), an attacker can inject characters that change the structure of the outgoing request URL. This is a single URL-injection vulnerability. The attacker-controlled value is neutralised before it is used as part of an output URL string; the attack shape covers both path traversal and broader URL-structure injection — both are closed by the one interpolateUrl sanitisation fix. This issue has been fixed in version 3.0.5. If users cannot upgrade immediately, they can work around the issue by sanitising lng / ns before they reach i18next (strip .., /, \\, ?, #, %, whitespace, and control characters; cap the length).","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Copilot said: i18nextify is a JavaScript library that adds\ni18nextify is a JavaScript library that adds website internationalization via a script tag, without source code changes. Versions prior to 3.0.5 interpolate the lng and ns values directly into the configured loadPath / addPath URL template without any encoding, validation, or path sanitisation. When an application exposes the language-code selection to user-controlled input (the default — i18next-browser-languagedetector reads ?lng= query params, cookies, localStorage, and request headers), an attacker can inject characters that change the structure of the outgoing request URL. This is a single URL-injection vulnerability. The attacker-controlled value is neutralised before it is used as part of an output URL string; the attack shape covers both path traversal and broader URL-structure injection — both are closed by the one interpolateUrl sanitisation fix. This issue has been fixed in version 3.0.5. If users cannot upgrade immediately, they can work around the issue by sanitising lng / ns before they reach i18next (strip .., /, \\, ?, #, %, whitespace, and control characters; cap the length).","source":"cvelist"},{"lang":"en","text":"### Summary\n\nVersions of `i18next-http-backend` prior to 3.0.5 interpolate the `lng` and `ns` values directly into the configured `loadPath` / `addPath` URL template without any encoding, validation, or path sanitisation. When an application exposes the language-code selection to user-controlled input (the default — `i18next-browser-languagedetector` reads `?lng=` query params, cookies, `localStorage`, and request headers), an attacker can inject characters that change the structure of the outgoing request URL.\n\nAffected call sites:\n\n- `_readAny` — `lib/index.js:64`: `interpolate(resolvedLoadPath, { lng: languages.join('+'), ns: namespaces.join('+') })`\n- `create` — `lib/index.js:123` (pre-patch): `interpolate(addPath, { lng, ns: namespace })`\n\nThe helper `interpolate` (`lib/utils.js`) previously returned the raw value with no encoding. In contrast, `addQueryString` already correctly uses `encodeURIComponent` for each query-string param — only the URL-path substitution was unprotected.\n\n### Impact\n\nAn attacker who can influence the resolved `lng` or `ns` value can alter the URL in several ways:\n\n- **Path traversal** — `lng = '../../config'` turns `/locales/{{lng}}/{{ns}}.json` into `/locales/../../config/translation.json`. On a misconfigured web server, this can cause the request to target a different resource than intended; in SSR pipelines that use `file://` or similar schemes for `loadPath`, it can read arbitrary files from the host filesystem.\n- **Query-string injection** — `lng = 'en?admin=true'` turns `/locales/{{lng}}/{{ns}}.json` into `/locales/en?admin=true/translation.json`. Some server frameworks parse the query portion with higher priority than the path and branch on attacker-controlled flags.\n- **Fragment truncation** — `lng = 'en#anything'` silently discards the rest of the path in browser fetches (client cannot see the final URL).\n- **URL-encoded bypasses** — `lng = 'en%2F..'`, after server-side URL decoding, resolves to `en/..` — the attacker bypasses the absence of a literal `/` in their input.\n\nThe practical worst case is **SSRF** when `loadPath` is an internal or file-scheme URL, and **path-based authorisation bypass** against servers that segment access by URL prefix.\n\n### Also fixed in 3.0.5\n\n- **Per-instance `omitFetchOptions`.** A module-level boolean in `lib/request.js` was flipped to `true` the first time any backend instance hit a \"not implemented\" fetch error. Once flipped, **all** subsequent requests from **all** backend instances in the same module silently stripped every user-configured fetch option — including security-relevant `credentials`, `mode`, and `cache`. One misbehaving instance (for example during SSR hydration or in React Native) permanently removed these protections process-wide. 3.0.5 scopes the flag to the backend's `options` object (`options._omitFetchOptions`) so one instance's fallback cannot pollute siblings.\n- **Log forging via control characters in `lng`/`ns`.** Error callbacks embedded the raw `lng`/`ns`/URL in the message string. Crafted CR/LF values could inject fake log lines into file-backed log aggregators (CWE-117). 3.0.5 strips C0/C1 control chars before concatenation.\n- **Basic-auth credentials leaked into error callbacks.** If `loadPath` contained a `user:password@host` authority, the full URL (including the credentials) ended up in the error message strings returned to the caller. 3.0.5 redacts `user:password@` before logging.\n- **Prototype-pollution amplification via `for...in`.** `addQueryString` and the XHR `customHeaders` loop used `for...in` which walks the prototype chain. Polluted `Object.prototype` entries could leak into URL query parameters and request headers. 3.0.5 uses `Object.keys` and an explicit prototype-key guard.\n\n### Affected versions\n\nAll versions of `i18next-http-backend` prior to **3.0.5**.\n\n### Patch\n\nFixed in **3.0.5**. Summary of the hardening:\n\n1. New `utils.interpolateUrl` (used by `_readAny` and `create`) returns `null` if any substitution fails the URL-segment safety check (blocks `..`, `/`, `\\`, `?`, `#`, `%`, `@`, whitespace, control chars, prototype keys, and values > 128 chars). Multi-language joins (`en+de`) are validated per-segment. The call sites now refuse to issue a request when the check fails and call back with a clear error.\n2. `omitFetchOptions` is stored per-instance on `options._omitFetchOptions`.\n3. Error-callback messages sanitise strings and redact URL credentials.\n4. `for...in` over untrusted objects replaced with `Object.keys` + prototype-key guard.\n\n### Workarounds\n\nNo workaround short of upgrading. If you cannot upgrade immediately, sanitise `lng` / `ns` yourself before they reach i18next (strip `..`, `/`, `\\`, `?`, `#`, `%`, whitespace, and control characters; cap the length).\n\n### Credits\n\nDiscovered via an internal security audit of the i18next ecosystem.","format":"markdown","source":"ghsa"},{"lang":"es","text":"Copilot dijo: i18nextify es una biblioteca de JavaScript que añade internacionalización de sitios web a través de una etiqueta de script, sin cambios en el código fuente. Las versiones anteriores a la 3.0.5 interpolan los valores lng y ns directamente en la plantilla de URL loadPath / addPath configurada sin ninguna codificación, validación o saneamiento de ruta. Cuando una aplicación expone la selección de código de idioma a una entrada controlada por el usuario (el valor predeterminado - i18next-browser-languagedetector lee los parámetros de consulta ?lng=, cookies, localStorage y encabezados de solicitud), un atacante puede inyectar caracteres que cambian la estructura de la URL de la solicitud saliente. Esta es una vulnerabilidad de inyección de URL única. El valor controlado por el atacante se neutraliza antes de ser utilizado como parte de una cadena de URL de salida; la forma del ataque cubre tanto el salto de ruta como la inyección de estructura de URL más amplia - ambos se cierran con la única corrección de saneamiento de interpolateUrl. Este problema ha sido solucionado en la versión 3.0.5. Si los usuarios no pueden actualizar inmediatamente, pueden solucionar el problema saneando lng / ns antes de que lleguen a i18next (eliminar .., /, \\, ?, #, %, espacios en blanco y caracteres de control; limitar la longitud).","source":"nvd"}],"published":"2026-04-22T17:41:24.000Z","modified":"2026-10-26T20:10:00.160Z","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:L/A:N","score":6.5,"rating":"MEDIUM"},"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:L/A:N","score":6.5,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N","score":6.5,"rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N","score":9.1,"rating":"CRITICAL"}],"cwes":["CWE-22","CWE-74"],"affected":[{"ranges":[{"version":"< 3.0.5","status":"affected"}],"vendor":"i18next","product":"i18next-http-backend","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"3.0.5"}],"ecosystem":"npm","package":"i18next-http-backend","purl":"pkg:npm/i18next-http-backend","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"3.0.5"}],"vendor":"i18next","product":"i18next-http-backend","cpe":"cpe:2.3:a:i18next:i18next-http-backend:*:*:*:*:*:node.js:*:*","source":"nvd"}],"references":[{"url":"https://github.com/i18next/i18next-http-backend/security/advisories/GHSA-q89c-q3h5-w34g","tags":["mitigation","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/i18next/i18next-http-backend/commit/4cee84f229c637b9c182366d3156f726d407a621","tags":["patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-41691","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/i18next/i18next-http-backend","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"yes","technicalImpact":"partial","date":"2026-05-08T13:08:33.422Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-41691","url":"https://www.cve.org/CVERecord?id=CVE-2026-41691","licence":"CVE Terms of Use","modified":"2026-05-08T13:08:58.684Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-q89c-q3h5-w34g","url":"https://github.com/advisories/GHSA-q89c-q3h5-w34g","licence":"CC-BY-4.0","modified":"2026-05-11T13:53:06.620Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-41691","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-41691","licence":"Public domain","modified":"2026-10-26T20:10:00.160Z"}],"updatedAt":"2026-11-25T22:59:20.924Z","epss":{"score":0.00387,"percentile":0.24492,"date":"2026-11-30T12:00:22.000Z"}}