ZeroHour

CVE-2026-84374

large

Caller-controlled path file overwrite in Laravel Excel (maatwebsite/excel)

CVSS 3.1
7.5 high
EPSS
<1%p45
Published
()
Modified
AI analysis

Laravel Excel's export methods (Excel::store(), $export->store(), ->storeExcel()) resolved caller-supplied destination paths against the PHP process working directory instead of the configured filesystem disk, and when the path resolved to an already-existing file, the export was written directly via fopen(), bypassing Flysystem's containment checks. The flaw is triggered only when the application passes an unsanitized, user-controlled value as the export path, in which case attacker-influenced export content overwrites the targeted file (without truncation, leaving trailing bytes if the new content is shorter). An attacker gains an arbitrary overwrite of any existing file writable by the PHP process, and can achieve remote code execution when the overwritten file is executed by the web server, such as a PHP front controller or cached view, since CSV/HTML writers emit cell values verbatim. Affected are Laravel applications using maatwebsite/excel versions prior to 3.1.70 that pass user-controlled paths to exports; applications with fixed or server-derived paths are not affected. No public proof-of-concept, KEV listing, or confirmed in-the-wild exploitation is known (EPSS 0.6%).

What to do: Upgrade maatwebsite/excel to 3.1.70, which forces all writes through the configured filesystem disk so Flysystem enforces the disk root. If upgrading is not possible, validate and sanitize any user-controlled value before passing it as an export path (rejecting traversal sequences and absolute paths), and audit the codebase for store()/storeExcel() calls whose path argument derives from user input. Note the fix's behavior change: absolute paths previously wrote outside the disk once the file existed, so applications relying on that should configure a disk rooted at the target location.

Affected
Maatwebsite Laravel Excel (maatwebsite/excel Composer package)All versions prior to 3.1.70 (fixed in 3.1.70; exact introduced version not specified in available data)
Estimated exposure
largelikely on the order of 100,000+ Laravel applications use the package, though only the subset passing user-controlled export paths is exploitable — maatwebsite/excel is one of the most widely installed Composer packages in the Laravel ecosystem, but exploitation additionally requires the non-default pattern of passing user-supplied input as the export path, so the exploitable install…

Order-of-magnitude estimate by the model from install counts, market share and public scan data it knows; verify before quoting.

Description

Laravel Excel provides supercharged Excel exports and imports in Laravel. From 3.1.8 until 3.1.70, in src/Files/Disk.php the Maatwebsite\Excel\Files\Disk::copy() method resolves the caller-controlled $destination supplied through Excel::store(), $export->store(), or storeExcel() against the process working directory with realpath() instead of the configured filesystem disk. If the path names an existing writable file, Disk::copy() opens it with fopen() in rb+ mode and uses stream_copy_to_stream(), bypassing Flysystem path confinement and allowing an attacker whose application input controls the export path to overwrite arbitrary existing files with export content. The rb+ behavior creates a non-truncating overwrite and trailing bytes when the new export is shorter, and overwriting an executable PHP file can lead to remote code execution. This issue is fixed in version 3.1.70.

Ecosystems
composer
Weakness
CWE-22, CWE-73
Vector
CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H
GHSA
GHSA-c7r6-vx3h-w5g2 (high)

In the news

No ingested article mentions this CVE yet.