GHSA-q89c-q3h5-w34g
### Summary Versions 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. Affected call sites: - `_readAny` — `lib/index.js:64`: `interpolate(resolvedLoadPath, { lng: languages.join('+'), ns: namespaces.join('+') })` - `create` — `lib/index.js:123` (pre-patch): `interpolate(addPath, { lng, ns: namespace })` The 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. ### Impact An attacker who can influence the resolved `lng` or `ns` value can alter the URL in several ways: - **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. - **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. - **Fragment truncation** — `lng = 'en#anything'` silently discards the rest of the path in browser fetches (client cannot see the final URL). - **URL-encoded bypasses** — `lng = 'en%2F..'`, after server-side URL decoding, resolves to `en/..` — the attacker bypasse
Properties
- ghsa_id
- GHSA-q89c-q3h5-w34g
- severity
- medium
- summary
- i18next-http-backend has Path Traversal & URL Injection via Unsanitised lng/ns
- cvss_score
- 6.5
- cve_id
- GHSA-q89c-q3h5-w34g
- cvss_vector
- CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N
- is_ghsa_only
- true
- ghsa_published
- 2026-04-22T17:41:24Z
- source_url
- https://github.com/advisories/GHSA-q89c-q3h5-w34g
- ghsa_updated
- 2026-04-22T17:41:27Z
Related Entities (5)
VULNERABLE_TO (1)
AFFECTS (1)
HAS_WEAKNESS (2)
REPORTED_BY (1)
Explore deeper with Ninja Signal's threat intelligence graph