Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB
CVE-2026-102601 Overview
CVE-2026-102601 is a path normalization bypass in Flysystem, an open source file storage library for PHP. Versions prior to 3.35.3 contain a flaw in the default WhitespacePathNormalizer located in src/WhitespacePathNormalizer.php. The normalizer calls preg_match with the u (Unicode) modifier and treats both false and 0 as falsy. A path containing malformed UTF-8 causes PCRE to return false, allowing paths that also embed control characters to bypass CorruptedPathDetected::forPath() inside normalizePath(). Attackers can then write filenames containing raw ANSI escape sequences, and Filesystem::listContents() returns those sequences unfiltered. The issue maps to improper neutralization of escape sequences in output [CWE-150] and is fixed in version 3.35.3.
Critical Impact
Authenticated users can store files whose names contain ANSI escape sequences, producing spoofed or hidden entries when an administrator lists directory contents in a terminal.
Affected Products
- Flysystem (thephpleague/flysystem) versions prior to 3.35.3
- PHP applications relying on the default WhitespacePathNormalizer across Flysystem adapters
- Administrative tooling that renders Filesystem::listContents() output to ANSI-capable terminals
Discovery Timeline
- 2026-09-29 - CVE-2026-102601 published to the National Vulnerability Database (NVD)
- 2026-09-30 - Last updated in NVD database
Technical Details for CVE-2026-102601
Vulnerability Analysis
The normalizePath() method in WhitespacePathNormalizer is intended to reject paths containing control characters via the regex #\p{C}+#u. The check uses preg_match and treats any non-truthy return as a passing result. PCRE returns false when it encounters malformed UTF-8 input under the u modifier, distinct from returning 0 for a genuine non-match. The original condition if (preg_match(...)) failed to distinguish these outcomes, so malformed UTF-8 sequences short-circuited the safety check even when the same string carried control bytes.
An attacker with write access can call Filesystem::write() with a filename that mixes invalid UTF-8 with ANSI escape codes. Subsequent calls to Filesystem::listContents() surface these raw sequences. When an administrator lists the directory in a terminal, the escape codes can reposition the cursor, overwrite prior lines, hide entries, or spoof filenames to disguise malicious payloads.
Root Cause
The root cause is improper error handling around preg_match. The function has three return states: 1 (match), 0 (no match), and false (error). Treating false as equivalent to 0 collapses the error state into a benign outcome, permitting corrupted input to bypass validation.
Attack Vector
Exploitation requires network-accessible write privileges to the Flysystem-managed store and user interaction from an administrator who displays directory listings in an ANSI-capable terminal. The attacker crafts a filename combining invalid UTF-8 bytes with escape sequences such as \\x1b[ to manipulate terminal rendering.
public function normalizePath(string $path): string
{
$unixPath = str_replace('\\', '/', $path);
+ $match = preg_match('#\p{C}+#u', $unixPath);
- if (preg_match('#\p{C}+#u', $unixPath)) {
+ if ($match !== 0) {
throw CorruptedPathDetected::forPath($path);
}
Source: GitHub commit ef4a9a5. The patch captures the return value and rejects any result other than 0, so both false (malformed UTF-8) and 1 (control character match) now raise CorruptedPathDetected.
Detection Methods for CVE-2026-102601
Indicators of Compromise
- Files stored via Flysystem whose names contain bytes in the 0x00–0x1F range, particularly 0x1B (ESC)
- Directory listings that visually reorder, hide, or overwrite entries when rendered in a terminal
- Application logs showing successful Filesystem::write() calls with non-printable characters in the path
Detection Strategies
- Scan managed storage backends for object keys containing control characters or invalid UTF-8 byte sequences
- Add filename validation in application code that rejects any path failing a strict UTF-8 decode before it reaches Flysystem
- Review the installed league/flysystem version across projects and flag any release earlier than 3.35.3
Monitoring Recommendations
- Log and alert on write operations where the raw filename bytes fail mb_check_encoding($name, 'UTF-8')
- Instrument administrative CLI tooling to sanitize or hex-encode filenames before printing to a terminal
- Track dependency inventories with software composition analysis to detect vulnerable Flysystem versions
How to Mitigate CVE-2026-102601
Immediate Actions Required
- Upgrade league/flysystem to version 3.35.3 or later in all PHP projects
- Audit existing object stores for filenames containing control characters and quarantine suspicious entries
- Wrap any administrative directory listing output with a sanitizer that strips or escapes ANSI sequences
Patch Information
The fix is available in Flysystem 3.35.3. See the GitHub Release 3.35.3 and the GitHub Security Advisory GHSA-cxf4-7mrp-vvpr for advisory details. The patch modifies normalizePath() to compare the preg_match return value against 0 explicitly, ensuring malformed UTF-8 also triggers CorruptedPathDetected::forPath().
Workarounds
- Add a pre-validation layer that calls mb_check_encoding($path, 'UTF-8') and rejects invalid input before invoking Flysystem
- Strip control bytes from user-supplied filenames using preg_replace('/[\\x00-\\x1F\\x7F]/', '', $name) prior to storage
- Render directory listings through a filter that escapes non-printable characters when 3.35.3 cannot be deployed immediately
# Upgrade to the patched release with Composer
composer require league/flysystem:^3.35.3
composer show league/flysystem | grep versions
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB

