Path traversal in Symfony Filesystem lets crafted paths escape the base directory

Note: This data is for reference and cybersecurity research purposes only.CyStack advises users not to use this information for unlawful purposes.

What is CVE-2026-135803?

CVE-2026-135803 is a vulnerability classified as Improper Limitation of a Pathname to a Restricted Directory, affecting symfony/filesystem (affected versions: 5.4.0 – < 5.4.56, 6.0.0 – < 6.4.50, and other affected versions) and symfony/symfony (affected versions: 5.4.0 – < 5.4.56, 6.0.0 – < 6.4.50, and other affected versions). The severity of this vulnerability has not yet been determined. There is not enough data to determine whether this vulnerability has been exploited.

Overview

Original source data

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.

Affected products and scope

The affected packages are symfony/filesystem and the symfony/symfony monorepo package, across several maintained release branches. Releases below the fixed versions listed in the vendor advisory are in scope, and versions outside those ranges are marked unaffected. The AssetMapper scenario applies to Symfony releases new enough to include that component; older releases without it are not exposed through that route. Applications that never pass untrusted paths to isBasePath(), canonicalize(), join(), makeAbsolute() or makeRelative() are not reachable through the first scenario.

Technical details

The weakness is a path traversal (CWE-22) in Symfony\Component\Filesystem\Path. Most methods of the class delegate to Path::split(), which treats everything before the first:// in a string as the root of the path. That prefix was accepted as a URI scheme without checking whether PHP would actually recognise it as one. Because PHP only honours a scheme at the very start of a string, /base/../x://../secret.txt is for PHP an ordinary local path that resolves to /secret.txt, yet Path::isBasePath('/base',...) reports that it is inside /base: the.. segments in the recognised prefix are never resolved. canonicalize(), join(), makeAbsolute() and makeRelative() inherit the same behaviour. In AssetMapper, the path of files referenced from a remote package's CSS is built with Path::join(), so a malicious or compromised package can make importmap:require or importmap:install write a file outside assets/vendor; the record gives the example of a CSS url() value that lands as public/x:/shell.php. The fix narrows scheme detection to prefixes PHP would look up as a stream wrapper: two or more letters, digits, +, - or., followed by:// at the start of the path. Other prefixes are treated as ordinary path segments and their.. segments are resolved, while real schemes such as phar://, file://, vfs:// and compress.zlib:// keep working.

Exploitability

This is a library flaw rather than a directly reachable network service, so whether it can be exploited depends on the calling application. The record describes two routes: an application that validates user-supplied input with isBasePath() or canonicalize() and then opens the path, and a build or install using AssetMapper against a malicious or compromised remote package. No authentication or user interaction requirement is stated for the first route because it depends entirely on how the application exposes that input. The record does not report exploitation in the wild or a public exploit; public detail on real-world attack traffic is limited.

Technical impact

An attacker gains the ability to read or write files outside the directory the application intended to restrict itself to, with the privileges of the PHP process. In the AssetMapper case the write target is chosen by the package author but still lands outside assets/vendor. The flaw does not by itself give remote code execution; that depends on what the attacker can overwrite and whether the application later executes or includes it. Where a path is only used for display or logging, the practical consequence is much smaller.

Business impact

An attacker who can influence a path that an application validates with these helpers can reach files the application was never meant to touch. That means reading configuration, credentials or other users' data, or overwriting application files with content of the attacker's choosing, which in the worst case turns into code execution under the web server account. The AssetMapper route matters for teams that pull front-end packages from remote sources: a single compromised dependency can drop a file outside the assets directory during a build or install step. Exposure is limited to code paths that pass untrusted input to these helpers, so teams should check where their own code does that before treating this as urgent. Integrity of shipped assets and the confidentiality of anything readable by the PHP process are the assets at stake.

Remediation

Apply the fixed release for your Symfony branch; the vendor advisory and the linked patch commit identify them. The patch changes scheme detection so that only prefixes PHP would treat as a stream wrapper are honoured, which restores correct resolution of.. segments in what are really ordinary path segments. If you cannot upgrade immediately, avoid passing untrusted input to the affected Path methods and resolve the real path yourself before opening a file, and avoid running importmap:require or importmap:install against remote packages you do not fully trust. Confirm which of these two routes your codebase actually uses; many applications use neither.

Detection

Search application code for calls to isBasePath(), canonicalize(), join(), makeAbsolute() and makeRelative() where the argument derives from a request, an upload, a header or a stored value a user controls. In request logs, look for parameters containing:// that does not sit at the start of the value, particularly values that mix../ segments with a:// sequence. For the AssetMapper route, review recent importmap:require and importmap:install runs and check for files created outside the assets/vendor directory, and compare installed assets against what the referenced packages declare.

Sources (7)
Learn more

Run an in-depth assessment with complete web risk management

CyStack VulnScan continuously discovers assets, validates vulnerabilities, and helps security teams prioritize remediation across the organization.