The primary vulnerability in i18next-http-backend prior to version 3.0.5 is a path traversal and URL injection issue (CWE-22, CWE-74). The root cause lies in the interpolate function in lib/utils.js, which was used to construct resource URLs. This function did not sanitize the lng (language) and ns (namespace) parameters before inserting them into the URL path template. Since these parameters can be controlled by a user (e.g., via query parameters like ?lng=...), an attacker could provide crafted values containing characters like ../ to traverse the file system and access unintended files, especially in server-side rendering (SSR) environments using file:// schemes. This could lead to sensitive information disclosure or SSRF.
The patch addresses this by introducing a new function, interpolateUrl, which validates the lng and ns values against a denylist of unsafe characters and patterns using the isSafeUrlSegment helper. The vulnerable call sites in _readAny and create within lib/index.js were updated to use this new secure function.
Additionally, the security patch hardens the library against prototype pollution vulnerabilities in addQueryString and requestWithXmlHttpRequest by replacing for...in loops with Object.keys(), preventing the injection of unintended query parameters or HTTP headers from a polluted Object.prototype.