Summary
Mealie's I18n Locale Provider has a path traversal flaw in locale handling. A remote attacker who can reach the affected functionality may manipulate the Accept-Language argument to cause access to paths outside the intended locale location.
Affected context
The issue occurs in the I18n Locale Provider, in the get function of mealie/pkgs/i18n/provider_factory.py, when processing the Accept-Language argument. It is relevant when attacker-controlled language input can influence a filesystem path without sufficient normalization or containment checks.
Exploit preconditions
- Attack surface: A remotely reachable Mealie function that processes locale preferences
- Required access: Network access to the affected functionality; authentication requirements may depend on deployment configuration
- Trigger point: Handling of a request containing an
Accept-Languagevalue - Why exploitation is possible: The value may influence a filesystem path without adequate safeguards against traversal
Why this happens
The underlying issue is insufficient validation or containment of attacker-controlled input used in filesystem path construction. If locale input can introduce path components that escape the intended directory, the application may resolve paths outside that directory. This maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
Potential impact
- An attacker may cause the application to resolve paths outside the intended locale directory.
- Depending on accessible files and application behavior, this could expose information or interfere with normal locale handling.
- The issue could provide a foothold for further attacks if sensitive data or useful filesystem resources are accessible.
General mitigation guidance
Mitigation generally focuses on ensuring that user-controlled locale values cannot determine unrestricted filesystem paths.
Common defensive patterns include:
- Mapping accepted locale identifiers to a fixed set of known values.
- Resolving candidate paths and verifying that they remain within the intended directory.
- Rejecting unexpected path separators and traversal components through allowlist-based validation.
- Avoiding filesystem lookups based directly on request headers when a fixed mapping is sufficient.
- Limiting the application process's filesystem permissions to reduce the impact of path-handling flaws.
How teams detect issues like this
High-level detection approaches include:
- Reviewing code that converts request headers or locale values into filesystem paths.
- Using static analysis to identify path construction involving untrusted input without containment checks.
- Testing locale handling with policy-approved traversal cases in controlled environments.
- Enforcing code-review or CI policies that require allowlists and verified path containment for filesystem access.

