Laravel-Mediable: path traversal vulnerability in the File::sanitizePath()
Impact
Laravel-Mediable before 7.0.0 contains a path traversal vulnerability in the File::sanitizePath() function that allows attackers to write uploaded files to arbitrary locations by controlling the directory argument passed to MediaUploader::toDestination(). Attackers can exploit the permissive character-class regex that allows both dot and slash characters combined with an ineffective trailing trim() call to bypass sanitization and upload files to sensitive locations such as the document root, environment configuration files, or application configuration directories, enabling remote code…
Source excerpt · OSVAffected packages
Start with the recorded fix for your release branch. Check your installed version and test compatibility before upgrading. Fixing this advisory does not rule out other vulnerabilities in the release.
| Affected range | Recorded fix |
|---|---|
| Earlier releases before 7.0.0Ecosystem versions | 7.0.0 |
Version evidence: OSV · GHSA-xv8g-76mx-2rxc
View original version evidence (91 explicit versions)
Original source description
Laravel-Mediable before 7.0.0 contains a path traversal vulnerability in the File::sanitizePath() function that allows attackers to write uploaded files to arbitrary locations by controlling the directory argument passed to MediaUploader::toDestination(). Attackers can exploit the permissive character-class regex that allows both dot and slash characters combined with an ineffective trailing trim() call to bypass sanitization and upload files to sensitive locations such as the document root, environment configuration files, or application configuration directories, enabling remote code execution.
References
- Security advisory nvd.nist.gov/vuln/detail/CVE-2026-49970
- Patch github.com/plank/laravel-mediable/pull/391
- Patch github.com/plank/laravel-mediable/commit/6d1e7fb39922fdfb3b2d120e13f4eb2e653ae082
- Source reference github.com/plank/laravel-mediable
- Release notes github.com/plank/laravel-mediable/releases/tag/7.0.0
- Security advisory www.vulncheck.com/advisories/laravel-mediable-path-traversal-via-file-sanitizepath