Skip to content
Laskyr

spatie/laravel-medialibrary security advisory

CVE-2026-48557: Spatie Laravel Media Library contains a file upload restriction bypass

CVE-2026-48557 is a high-severity security vulnerability in the PHP package spatie/laravel-medialibrary (CVSS 8.8), published 29 May 2026. It is fixed in 11.23.0; earlier versions are affected. Exploiting it needs a low-privilege user account.

high 8.8 published 2026-05-29 · updated 2026-10-08

Fixed in spatie/laravel-medialibrary 11.23.0

This security issue affects spatie/laravel-medialibrary versions < 11.23.0. Upgrade to the fixed version for your release line (11.23.0). The newest release, 11.23.11, is not affected.

Affected versions
< 11.23.0
Fixed in
11.23.0
Newest release
11.23.11
Severity
High · CVSS 8.8
Type
Security issue
CWE-184
Exploited in the wild
Not on the CISA KEV list
checked 2026-11-04

Is your spatie/laravel-medialibrary version affected?

Run composer show spatie/laravel-medialibrary in your project, then enter the version. We check it against this and every other known spatie/laravel-medialibrary advisory.

Who can exploit CVE-2026-48557

CVSS vector (scored by VulnCheck): CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

Your app is only exposed if it uses the affected part of spatie/laravel-medialibrary. The advisory below says which part that is. If you are not sure, upgrade anyway: it costs less than finding out.

How to fix CVE-2026-48557 in spatie/laravel-medialibrary

  1. Find the installed version: composer show spatie/laravel-medialibrary. If you never required it yourself, composer why spatie/laravel-medialibrary shows which package pulls it in.
  2. Update it: composer update spatie/laravel-medialibrary --with-all-dependencies. You need 11.23.0 or newer.
  3. If Composer will not go that high, your composer.json constraint is holding it back. Widen it (for example "spatie/laravel-medialibrary": "^11.23.0" if you can take that version), or upgrade the package that requires it.
  4. Run composer audit. It reads the same advisory data and should no longer list CVE-2026-48557.
  5. Commit composer.lock and deploy it. On the server, run composer install --no-dev from the lock file, not composer update.

If you cannot upgrade yet

General hardening for this kind of issue while the upgrade waits. None of it replaces the fix.

The CVE-2026-48557 advisory

Spatie Laravel Media Library before version 11.23.0 contains a file upload restriction bypass in FileAdder::defaultSanitizer(). The sanitizer checks only the final filename suffix, allowing double-extension filenames such as shell.php.jpg to bypass the blocklist, with pathinfo() preserving inner .php stems in saved filenames. The blocklist also omits executable extensions including .php6, .shtml, and .htaccess. The double-extension bypass requires a legacy Apache AddHandler configuration to achieve PHP execution; the incomplete blocklist bypass does not.

Description from the CVE record, published by VulnCheck (the CVE Numbering Authority), via the NVD entry for CVE-2026-48557. Advisory title: “Spatie Laravel Media Library contains a file upload restriction bypass”.

References

Other spatie/laravel-medialibrary advisories

Related

Need help patching or upgrading? Laskyr does PHP and Laravel security fixes and upgrades. Tell us what you run and we reply with a plan and a price.

Ask about a fix

Where this data comes from

First hour checklist

If the site was just hacked, read the emergency kit before you delete files. The page is free. Email is optional.

Read the emergency kit