CVE-2026-135803 — Symfony Symfony/filesystem (5.4.56) — CWE-22
Most methods of Symfony\Component\Filesystem\Path rely on Path::split(), which takes everything before the first :// as the root of a path. It doesn't check that this prefix is a URI scheme, so the .. segments in that prefix are never resolved. PHP sees a scheme only at the start of a string. So /base/../x://../secret.txt is a plain local path to /secret.txt for PHP, while Path::isBasePath('/base', '/base/../x://../secret.txt') returns true. canonicalize(), join(), makeAbsolute() and makeRelative() are affected the same way. Some applications check a path built from user input with isBasePath() or canonicalize(), and then open it. They can be made to read or write files outside the expected directory. On Symfony 6.4 and later, the AssetMapper component builds with Path::join() the path of the files that a remote package references from its CSS. A malicious or compromised package can therefore make importmap:require or importmap:install write a file of its choice outside assets/vendor. For example, the CSS url(../../../../../public/x://shell.php) writes public/x:/shell.php. A prefix is now a scheme only when PHP would look for a stream wrapper with that name. That is two or more letters, digits, +, - or ., followed by :// at the start of the path. Other prefixes are regular path segments, and the .. segments after them are resolved. Real schemes such as phar://, file://, vfs:// or compress.zlib:// keep working.
Most methods of Symfony\Component\Filesystem\Path rely on Path::split(), which takes everything before the first :// as the root of a path. It doesn't check that this prefix is a URI scheme, so the .. segments in that prefix are never resolved. PHP sees a scheme only at the start of a string. So /base/../x://../secret.txt is a plain local path to /secret.txt for PHP, while Path::isBasePath('/base', '/base/../x://../secret.txt') returns true. canonicalize(), join(), makeAbsolute() and makeRelative() are affected the same way. Some applications check a path built from user input with isBasePath() or canonicalize(), and then open it. They can be made to read or write files outside the expected directory. On Symfony 6.4 and later, the AssetMapper component builds with Path::join() the path of the files that a remote package references from its CSS. A malicious or compromised package can therefore make importmap:require or importmap:install write a file of its choice outside assets/vendor. For example, the CSS url(../../../../../public/x://shell.php) writes public/x:/shell.php. A prefix is now a scheme only when PHP would look for a stream wrapper with that name. That is two or more letters, digits, +, - or ., followed by :// at the start of the path. Other prefixes are regular path segments, and the .. segments after them are resolved. Real schemes such as phar://, file://, vfs:// or compress.zlib:// keep working.
🎯 What is this vulnerability?
This vulnerability is a Path Traversal (CWE-22) flaw within the Symfony\Component\Filesystem\Path utility class in Symfony 5.4.56. The core issue lies in the logic of Path::split(), which is used by isBasePath(), canonicalize(), join(), makeAbsolute(), and makeRelative().
The flaw is a logic mismatch between PHP's native path resolution and Symfony's custom path parsing:
1. PHP's Behavior: PHP treats a string as a URI (with a scheme) only if the scheme appears at the very beginning of the string (e.g., http://...). If a string starts with / or ./, PHP treats it as a local filesystem path, even if it contains :// later in the string.
2. Symfony's Flawed Behavior: Path::split() incorrectly identifies the "root" of a path as everything before the first ://. It does not verify that this prefix is a valid URI scheme (e.g., http, file, phar). Consequently, if an attacker crafts a path like /base/../x://../secret.txt, Symfony's Path::isBasePath('/base', ...) will incorrectly return true because it sees /base as the root and ignores the .. segments in the "scheme" part (x://). However, when PHP actually opens this file, it sees /base/../x://../secret.txt as a local path, resolves the .. segments, and accesses /secret.txt (outside the intended /base directory).
This allows an attacker to bypass path containment checks (like isBasePath) and read or write files outside the intended directory.
⚡ Attack Chain
1. Discovery & Reconnaissance
- Identify Symfony Version: Use tools like
whatweb,wappalyzer, or manual inspection ofcomposer.json(if exposed) or error pages to confirm the target is running Symfony 5.4.56. - Identify Vulnerable Components: Determine if the application uses
Symfony\Component\Filesystem\Pathfor user-supplied path validation. Common scenarios include:
* File upload/download features that validate paths against a base directory.
* The <base_dir>: The expected base directory (e.g.,/var/www/html/assets).<dummy_scheme>: A string that looks like a scheme but is not at the start of the string (e.g.,x,a,b).<traversal_segments>:../sequences to escape the base directory.<target_file>: The sensitive file to access (e.g.,/etc/passwd,../config/parameters.php).
AssetMapper component (Symfony 6.4+, but the underlying Path logic is shared) where CSS/JS files from remote packages are processed.
* Custom code that uses Path::isBasePath() or Path::canonicalize() on user input.2. Exploitation
The attacker crafts a path that contains:// in a position where PHP treats it as a local path, but Symfony's Path class treats it as a URI scheme boundary.Key Payload Structure:<base_dir>/../<dummy_scheme>://<traversal_segments>/<target_file>
Illustrative PoC (PHP Context):
Assume an application has a function readFile(string $path) that does:
$basePath = '/var/www/html/assets';
if (Path::isBasePath($basePath, $path)) {
// Vulnerable: Path::isBasePath returns true for malicious input
$content = file_get_contents($path); // PHP resolves the path correctly, bypassing the check
echo $content;
}Malicious Input:/var/www/html/assets/../x://../../etc/passwd
Path::isBasePath Logic:://. Root = /var/www/html/assets/...
Checks if /var/www/html/assets/.. starts with /var/www/html/assets. It does (after normalization in some contexts, or due to the flawed split logic described in the CVE). Note: The CVE states Path::isBasePath('/base', '/base/../x://../secret.txt') returns true.*
file_get_contents Logic:/var/www/html/assets/../x://../../etc/passwd.
* No scheme at start. Treats as local path.
* Resolves: /var/www/html/assets -> .. -> /var/www/html -> x:// (treated as directory name x:) -> .. -> /var/www -> .. -> / -> etc/passwd.
* Result: Reads /etc/passwd.AssetMapper Specific Exploit (Symfony 6.4+ context, but relevant to the Path flaw):
If the application uses importmap:require or importmap:install with a malicious package:
1. Attacker publishes a package with a CSS file containing:
@import url(../../../../../public/x://shell.php);2. Symfony's AssetMapper uses Path::join() to construct the path for the referenced file.
3. The Path class fails to resolve the .. segments correctly due to the :// in the path, leading to a path traversal.
4. The system writes shell.php to public/x:/shell.php (or similar, depending on OS path resolution quirks with :).
3. Post-Exploitation
/var/www/html/.env, /etc/passwd, /etc/shadow if permissions allow).shell.php to /var/www/html/public/shell.php.
* Access http://target/public/shell.php to execute arbitrary commands.
🌍 Real World Impact
Practical Consequences:
.env files leads to database and API key compromise.AssetMapper, a malicious npm/packagist package can compromise all applications that install it, leading to widespread RCE.🛡️ Remediation & Mitigation
1. Upgrade
Path logic).Path component has been corrected to only treat prefixes as schemes if they match PHP's stream wrapper naming conventions (2+ alphanumeric chars, +, -, . followed by :// at the start).composer update symfony/filesystem symfony/symfony2. Workarounds (If Immediate Upgrade is Not Possible)
Path::isBasePath for Security Checks: Do not rely solely on Path::isBasePath() or Path::canonicalize() for security validation of user-supplied paths.realpath() for Validation:$basePath = realpath('/var/www/html/assets');
$userPath = realpath($userInput);
if ($userPath && str_starts_with($userPath, $basePath . DIRECTORY_SEPARATOR)) {
// Safe to proceed
} else {
// Reject path
}Note: realpath() resolves .. segments and returns false if the path does not exist or is invalid, providing a more robust check.
:// unless it is explicitly expected and validated as a URI scheme at the start of the string.AssetMapper, disable the component to reduce attack surface.3. Detection (IoCs)
:// in path parameters, especially in file upload/download endpoints.GET /download?file=../../x://../../etc/passwd
/var/www/html/public/ with names containing : or unusual extensions.
/etc/passwd or /etc/shadow.⚠️ Urgency
CVSS Score: 0/10 (NONE) - Note: This score appears incorrect or placeholder in the provided data. Given the nature of the vulnerability (Path Traversal leading to RCE), the actual CVSS score should be High or Critical (e.g., 7.5-9.8).*
CISA KEV: No - Not currently listed in CISA's Known Exploited Vulnerabilities catalog, but this does not mean it is not being exploited.*
* This is a critical path traversal vulnerability that can lead to Remote Code Execution (RCE).
* It affects a widely used framework (Symfony).
* The fix is straightforward (upgrade).
* Recommendation: Patch immediately. If immediate patching is not possible, implement the
realpath() workaround and monitor for exploitation attempts.[🤖 CVE Professor AI Security Engine]
FOFA Query