Media

Laravel Backpack CRUD: SingleBase64Image accepts any base64 payload behind a `data:image` prefix — SVG-with-script lands on the public disk

  • Publicada: 20.08.2026
  • Actualizado: 11.10.2026 10:22

Summary

SingleBase64Image::uploadFiles — the uploader bound to image-typed fields via withFiles() — only verifies that the submitted value starts with the string data:image. The MIME subtype and the base64-decoded bytes are never inspected or validated. A related bug in FileNameGenerator causes the stored file to receive an extensionless filename, because mime_content_type() returns false when given a data URI instead of a filesystem path.

The combination allows an authenticated admin to store a file of arbitrary type on the configured disk under a name without a recognizable extension.

Details

php
// src/app/Library/Uploaders/SingleBase64Image.php
if (Str::startsWith($value, 'data:image')) {
    // MIME subtype and decoded bytes are not validated
    $base64Image = Str::after($value, ';base64,');
    $finalPath   = $this->getPath() . $this->getFileName($value);
    Storage::disk($this->getDisk())->put($finalPath, base64_decode($base64Image));
    return $finalPath;
}

// src/app/Library/Uploaders/Support/FileNameGenerator.php
private function getExtensionFromFile(string|UploadedFile $file): string
{
    return is_a($file, UploadedFile::class, true)
        ? $file->extension()
        : Str::after(mime_content_type($file), '/'); // returns false on data URIs → empty string
}

The stored filename ends with a trailing dot and no extension.

Impact

An authenticated admin submitting a malicious payload to a Backpack image field stored with withFiles() can write arbitrary file content to the configured storage disk. Depending on server configuration and how stored files are served, this may lead to stored XSS or other unintended behavior when the file is later accessed.

Fix

The fix validates the declared MIME subtype against an allowlist, decodes the base64 payload, and verifies the actual file bytes with finfo before storing. The extension is derived from the detected MIME type rather than the data URI string. Applied in SingleBase64Image::uploadFiles and uploadRepeatableFiles; FileNameGenerator::getExtensionFromFile now rejects inputs that produce an empty extension.

Setting X-Content-Type-Options: nosniff on admin responses is a useful defense-in-depth complement.

Affected versions

  • >= 6.0.0, < 6.8.14
  • >= 7.0.0, < 7.0.38

Patched versions

  • 6.8.14
  • 7.0.38

Software afectado

Haz clic en una tecnología para ver todas sus vulnerabilidades.

PlataformaPaqueteVersiones vulnerablesCorregida en
Paquete de Composer backpack/crud >= 6.0.0, < 6.8.14, >= 7.0.0, < 7.0.38 6.8.14, 7.0.38

Referencias

Puntuación CVSS 4.4/10
Vector CVSS
CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:C/C:L/I:L/A:N
Debilidad (CWE)
CWE-434, CWE-79
Plataforma
Composer
Paquete
backpack/crud
Publicada
20.08.2026
Actualizado
11.10.2026 10:22

Fuentes y licencias

OSV / GitHub Advisory Database - GHSA-8hw4-7qjr-3wxg - CC BY 4.0

Historial de vulnerabilidades: backpack/crud

Todas las vulnerabilidades publicadas de este paquete (Paquete de Composer), de la más reciente a la más antigua. Muestra si es un fallo aislado o un paquete que hay que vigilar.

Todas (11) en el archivo
Entradas en total
11
Primera → última
05.2022 08.2026
Sin corrección
0
Explotada en ataques
0

Distribución por gravedad

  • Alta 4
  • Media 7

Divulgaciones por año

  1. 2022: 1
  2. 2023: 0
  3. 2024: 0
  4. 2025: 0
  5. 2026: 10
Gravedad:
  1. Alta · 8.1 CVE-2026-54182 >= 4.1.0, < 4.1.72, >= 5.0.0, < 5.6.2, >= 6.0.0, < 6.8.13, >= 7.0.0, < 7.0.36 4.1.72, 5.6.2, 6.8.13, 7.0.36
  2. Alta · 7.6 CVE-2026-54180 >= 6.0.0, < 6.8.14, >= 7.0.0, < 7.0.38 6.8.14, 7.0.38
  3. Laravel Backpack CRUD: SingleBase64Image accepts any base64 payload behind a `data:image` prefix — SVG-with-script lands on the public disk esta entrada
    Media · 4.4 CVE-2026-54179 >= 6.0.0, < 6.8.14, >= 7.0.0, < 7.0.38 6.8.14, 7.0.38
  4. Alta · 8.1 CVE-2026-54178 >= 5.0.0, >= 6.0.0, < 6.8.12, >= 7.0.0, < 7.0.35 6.8.12, 7.0.35
  5. Alta · 7.6 CVE-2026-54175 < 6.8.11, >= 7.0.0-alpha.1, < 7.0.34 6.8.11, 7.0.34

Identifica las vulnerabilidades de tu aplicación

Con la integración de DockRay y el inventario de software activado, DockRay compara las versiones notificadas de los componentes con las vulnerabilidades conocidas y avisa de las coincidencias confirmadas. La cobertura depende de la tecnología compatible y de los avisos disponibles.

Conectar tu aplicación
Newsletter DockRay

La seguridad de tus aplicaciones en tu correo

Vulnerabilidades importantes, recomendaciones concretas y consejos prácticos para tus aplicaciones. Elige tus tecnologías y sigue lo que importa para tu proyecto.

  • Un resumen diario de nuevas vulnerabilidades, también las críticas.
  • Avisos sobre actualizaciones importantes.
  • Consejos prácticos sobre seguridad y monitorización de aplicaciones.

Déjalo vacío para recibir avisos de todas las tecnologías.

Suscripción gratuita. Date de baja con un clic en cualquier correo.