/

CVE-2026-41693

Severity:

HIGH RISK

(8.2)

Path Traversal / Arbitrary File Access in i18next-fs-backend

CVE-2026-41693

Deferred

Vulnerability type

Category:

Path Traversal / Arbitrary File Access

CWE:

CWE-22, CWE-73

Impact:

Arbitrary File Read and Potential Arbitrary File Write

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-fs-backend previously interpolated user-controllable language (lng) and namespace (ns) values directly into file paths without validation, enabling path traversal.

When these values are derived from untrusted HTTP input, an attacker can craft values that cause the backend to read or overwrite arbitrary files outside the intended locales directory.

Affected context

This vulnerability arises in Node.js or Deno applications using i18next-fs-backend where:

  • The backend is configured with loadPath and/or addPath templates that incorporate {{lng}} and {{ns}}.
  • lng and/or ns values can be influenced directly or indirectly by end users (for example via i18next-http-middleware, query strings, cookies, or headers).
  • No additional server-side validation or normalization is applied to constrain these values to known-safe locale and namespace identifiers.

In such setups, a malicious value containing path traversal sequences, path separators, or extremely long strings can divert file operations away from the designated translation directory.

Exploit preconditions

  • Attack surface: Web-facing applications that expose language or namespace selection via HTTP (query parameters, cookies, headers, or route parameters) and use i18next-fs-backend for filesystem-based translations.
  • Required access: Ability to send requests that influence lng and/or ns values; no application-level authentication may be required if language selection is public.
  • Trigger point: Any request that causes i18next-fs-backend to resolve loadPath or addPath with attacker-controlled lng/ns and then perform a filesystem read or write.
  • Why exploitation is possible: The backend directly interpolates lng and ns into file path templates without encoding, normalization, or validation, allowing directory traversal (../), control characters, or crafted keys to escape the intended locale directory and target arbitrary filesystem paths.

Why this happens

The core issue is improper neutralization of user input when constructing filesystem paths.

i18next-fs-backend takes lng and ns values and substitutes them into the configured loadPath / addPath templates, then uses the resulting string as a path for read or write operations.

Because these values are treated as trusted and are neither normalized nor restricted to an allowed set, adversaries can embed .., path separators, or other special sequences to traverse out of the locale directory and interact with arbitrary files on the host.

This behavior maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') and is closely related to CWE-73: External Control of File Name or Path, where external input controls what file is opened.

Potential impact

  • Read access to sensitive files such as /etc/passwd, application configuration files, or API keys, depending on process permissions.
  • Overwriting or corrupting files reachable by the application user, potentially affecting logs, translation files, or other application data.
  • Indirect information disclosure about the filesystem layout and environment through error messages or timing.
  • Facilitation of further attacks if overwritten files are later interpreted as code, templates, or configuration by other components.

General mitigation guidance

Defensive strategies focus on constraining and sanitizing all data that influences filesystem paths and avoiding direct string interpolation:

  • Treat lng and ns as untrusted and normalize them before usage: enforce strict whitelists of allowed language codes and namespace identifiers and reject unknown or malformed values.
  • Avoid directly interpolating raw user-controlled values into file path templates; instead, resolve requested languages and namespaces to known-safe directory names or IDs.
  • Use path-joining and normalization utilities that operate on canonicalized paths and then enforce a rule that the final path must remain within a designated base directory (for example, the locales root).
  • Impose maximum length and character-set constraints on lng and ns to prevent abuse with extremely long or control-character-laden inputs.
  • Run the application under least-privilege accounts with minimal filesystem access so that even if a path escapes the intended directory, the set of readable and writable targets is limited.

How teams detect issues like this

Organizations can pursue multiple approaches to detect this pattern and similar issues:

  • Static analysis: Define rules that flag direct concatenation or template substitution of external input into file paths, particularly around i18next-fs-backend configuration (loadPath, addPath) and any fs or Deno filesystem calls.
  • Configuration review: During code review, examine translation backend configuration to ensure lng/ns are not used raw and that there is a validation or mapping layer between HTTP-level inputs and filesystem paths.
  • Runtime monitoring: Instrument logging for suspicious path access patterns, such as requests attempting to reach ../, absolute paths, or non-locale directories; set alerts for repeated traversal attempts.
  • Security testing: Incorporate automated tests or dynamic scanners that attempt language and namespace values containing ../, path separators, or overly long values and verify that access outside the locale directory is blocked.

Sources

SourceLink
github.comgithub.com/i18next/i18next-fs-backend/security/advisories/GHSA-8847-338w-5hcj

Frequently asked

questions

Yes. If a web application allows clients to influence the lng or ns values (for example, via query parameters, cookies, or headers) and uses i18next-fs-backend, an attacker can exploit the bug by issuing crafted HTTP requests.

Not necessarily. If language selection is available to unauthenticated users, exploitation can occur without any login. If only authenticated users can control lng or ns, then an attacker would need at least that level of access.

Introduce a strict validation and mapping layer for lng and ns that only permits a predefined set of language codes and namespaces, normalize the values, and ensure the resolved file paths are computed from this sanitized set and are constrained to the intended locales directory.

Treat all parameters that influence filenames or paths as untrusted, avoid direct string interpolation into paths, enforce allowlists and character constraints, and add automated checks (static analysis and tests) that assert any computed path remains under a designated base directory before performing filesystem operations.

Find out what's already
exploitable in your codebase.