/

CVE-2026-42353

Severity:

HIGH RISK

(8.2)

Input Validation / Path Traversal & SSRF in i18next-http-mid

CVE-2026-42353

Deferred

Vulnerability type

Category:

Input Validation / Path Traversal & SSRF

CWE:

CWE-22, CWE-918

Impact:

Path Traversal and Server-Side Request Forgery (SSRF)

Severity:

HIGH RISK

(8.2)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

i18next-http-middleware versions prior to 3.9.3 pass user-controlled language (lng) and namespace (ns) parameters directly into the i18next backend loader without validation.

Depending on the configured backend, this can allow attackers to traverse file system paths or trigger server-side requests to arbitrary URLs, turning simple localization requests into a high-impact attack surface.

Affected context

This vulnerability affects Node.js and Deno applications that:

  • Use i18next-http-middleware with frameworks like Express, Fastify, or similar
  • Expose endpoints that rely on getResourcesHandler or similar middleware to resolve translations
  • Configure backends that load translation resources from the file system, HTTP(S) endpoints, or other dynamic locations

The risk materializes when user input (e.g., query parameters or headers specifying lng and ns) is allowed to flow into the backend loader without constraints on allowed values or locations.

Exploit preconditions

  • Attack surface: HTTP endpoints where i18next-http-middleware processes requests and calls getResourcesHandler.
  • Required access: Network access to the vulnerable endpoint (typically unauthenticated, depending on the application).
  • Trigger point: Supplying crafted lng and/or ns parameters that are passed directly into i18next.services.backendConnector.load(languages, namespaces, …).
  • Why exploitation is possible: The middleware does not sanitize or constrain lng and ns, allowing an attacker to influence backend paths or URLs. Backends that derive file paths or remote URLs from these values can be coerced into path traversal or server-side HTTP requests.

Why this happens

The core issue is a lack of input validation and normalization on parameters that are treated as trusted configuration for resource loading.

i18next-http-middleware passes user-controlled lng and ns values directly into backendConnector.load, which in turn may construct file system paths or remote URLs. When these values are not constrained to a known-safe set (e.g., whitelisted languages and namespaces) and are combined with resource backends that interact with the file system or network, attackers can:

  • Inject directory traversal segments (e.g., ../) leading to CWE-22: Path Traversal
  • Inject arbitrary URLs or hostnames, resulting in CWE-918: Server-Side Request Forgery (SSRF)

This pattern reflects a broader class of bugs where user input controls low-level resource locators without proper validation or scoping.

Potential impact

  • Read access to unintended files within the server's file system, depending on backend behavior and permissions
  • Potential exposure of configuration files, secrets, or source code if the backend reads arbitrary paths
  • Server-Side Request Forgery, allowing the application to make HTTP requests to internal services or metadata endpoints
  • Use of the server as a pivot point to scan internal networks or interact with protected APIs
  • Degradation of service availability due to forced requests to slow or non-responsive endpoints

General mitigation guidance

Effective mitigation focuses on constraining and validating all user-controlled parameters that influence resource loading:

  • Enforce strict allowlists for supported lng (language codes) and ns (namespaces), rejecting or defaulting any unrecognized values.
  • Normalize and validate values before they reach backend loaders; avoid directly concatenating user input into file paths or URLs.
  • Configure i18next backends to operate within fixed, known-safe directories and disallow resolution outside these roots.
  • For HTTP-based backends, restrict outbound requests to trusted hosts or use a network egress policy that prevents arbitrary destinations.
  • Apply the principle of least privilege to the process: limit filesystem permissions and network reach so that a compromise yields minimal access.

How teams detect issues like this

Detection typically involves a combination of code-level and runtime analysis:

  • Static analysis: Look for flows where lng or ns are read from request objects (query, headers, cookies) and passed into i18next backend loaders without validation or mapping through a whitelist.
  • Code review cues: Flag middleware or route handlers that use getResourcesHandler or similar helpers without explicit checks on accepted languages and namespaces.
  • Configuration review: Examine i18next backend configuration for dynamic path or URL construction influenced by request parameters.
  • Runtime monitoring: Use application logs, WAFs, or API gateways to detect suspicious patterns like ../ segments in language/namespace parameters or unusual outbound HTTP destinations originating from translation requests.
  • Automated security scanning tools that model data flow can be configured to treat backendConnector usages as sensitive sinks for untrusted input.

Sources

SourceLink
github.comgithub.com/i18next/i18next-http-middleware/security/advisories/GHSA-jfgf-83c5-2c4m

Frequently asked

questions

Yes. If the affected endpoint is exposed over the network, an attacker can remotely supply crafted lng and ns parameters to attempt path traversal or SSRF, without needing local access to the server.

Not necessarily. Exploitation depends on how the application integrates i18next-http-middleware. If translation endpoints are accessible without authentication (which is common), an anonymous attacker may be able to exploit the issue.

The most robust pattern is to strictly constrain the values of lng and ns before they reach the backend. Implement a whitelist of supported language codes and namespaces, default or reject invalid inputs, and ensure backend configurations do not allow these parameters to escape defined directories or trusted host lists.

Design middleware and resource-loading logic so that user input never directly controls file paths or network destinations. Introduce central validation layers for localization parameters, use enumerated types or configuration-driven allowlists, and treat any parameter affecting resource location as sensitive data that requires explicit validation, normalization, and boundary enforcement.

Find out what's already
exploitable in your codebase.