Media

Statamic's Antlers sanitizer cannot effectively sanitize malicious SVG

  • Publicada: 06.07.2023
  • Actualizado: 11.10.2026 10:22

Antlers sanitizer cannot effectively sanitize malicious SVG

Summary

The SVG tag does not sanitize malicious SVG. Therefore, an attacker can exploit this vulnerability to perform XSS attacks using SVG, even when using the sanitize function.

Details

Regarding the previous discussion mentioned here, it has been identified that the default blacklist in the FilesFieldtypeController (located at this link) only blocks certain file extensions such as php, php3, php4, php5, and phtml. This allows a malicious user to upload a manipulated SVG file disguised as a social media icon, potentially triggering an XSS vulnerability.

PoC Screenshot

image

PoC

  1. Create new Global set, let's say "Settings"
  2. Create a "Grid" field in Blueprint (named: social), then add somefields Name (text), URL (text) and Icon (Assets) in the section Fields.
  3. When calling the social setting in the _footer.antlers.html, remember to sanitize
{{ settings:social }}
    <a href="{{ $url }}" class="ml-4" aria-label="{{ $name }}" rel="noopener">
        {{ svg :src="icon" class="h-6 w-6 hover:text-hot-pink" | sanitize }}
    </a>
{{ /settings:social }}
  1. Upload the malicious SVG image, here is the code:
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">

<svg width="500" height="500" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
   <text x="20" y="35">Statamic</text>
   <foreignObject width="500" height="500">
            <iframe xmlns="http://www.w3.org/1999/xhtml" src="javascript:confirm(document.cookie);" width="400" height="250"/>
   </foreignObject>
</svg>

Impact

Since the social media icon is displayed in the footer layout, any user can view it, potentially leading to the execution of XSS.

Suggestions to Mitigate or Resolve the Issue:

Sanitize when outputing the svg. This vulnerability caused by unsanitized File::get() when retrieving the SVG, it is crucial to sanitize the SVG when outputting it. The issue can be found in the following file: https://github.com/statamic/cms/blob/f806b6b007ddcf066082eef175653c5beaa96d60/src/Tags/Svg.php#L36-L40.

It is highly recommended to implement proper sanitization measures to ensure the security of the SVG content. One effective approach is to utilize a reliable package, such as https://github.com/darylldoyle/svg-sanitizer ,which provides comprehensive SVG sanitization capabilities.

So the code becomes:

php
use enshrined\svgSanitize\Sanitizer;

if (File::exists($file)) {
                
    $sanitizer = new Sanitizer();
    $dirtySVG = File::get($file);

    $svg = $sanitizer->sanitize($dirtySVG);
    break;
}

Reference

Software afectado

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

PlataformaPaqueteVersiones vulnerablesCorregida en
Paquete de Composer statamic/cms < 4.10.0 4.10.0

Referencias

Puntuación CVSS 5.5/10
Vector CVSS
CVSS:3.1/AV:N/AC:H/PR:L/UI:R/S:C/C:L/I:L/A:L
Debilidad (CWE)
CWE-79
Plataforma
Composer
Paquete
statamic/cms
Publicada
06.07.2023
Actualizado
11.10.2026 10:22

Fuentes y licencias

OSV / GitHub Advisory Database - GHSA-6r5g-cq4q-327g - CC BY 4.0

Historial de vulnerabilidades: statamic/cms

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 (44) en el archivo
Entradas en total
44
Primera → última
03.2022 08.2026
Sin corrección
1
Explotada en ataques
0

Distribución por gravedad

  • Crítica 1
  • Alta 15
  • Media 25
  • Baja 3

Divulgaciones por año

  1. 2022: 2
  2. 2023: 4
  3. 2024: 3
  4. 2025: 1
  5. 2026: 34
Gravedad:
  1. Alta · 8.1 CVE-2026-64665 < 5.74.1, >= 6.0.0, < 6.24.0 5.74.1, 6.24.0
  2. Alta · 7.4 CVE-2026-49287 < 5.73.23, >= 6.0.0, < 6.20.0 5.73.23, 6.20.0
  3. Alta · 8.1 CVE-2026-41175 < 5.73.20, >= 6.0.0-alpha.1, < 6.13.0 5.73.20, 6.13.0
  4. Alta · 8.7 CVE-2026-33172 >= 6.0.0-alpha.1, < 6.7.0, < 5.73.14 6.7.0, 5.73.14
  5. Alta · 8.7 CVE-2026-28426 < 5.73.11, >= 6.0.0-alpha.1, < 6.4.0 5.73.11, 6.4.0
  6. Alta · 8.0 CVE-2026-28425 < 5.73.16, >= 6.0.0-alpha.1, < 6.7.2 5.73.16, 6.7.2
  7. Crítica · 9.3 CVE-2026-27593 < 5.73.10, >= 6.0.0-alpha.1, < 6.7.1 5.73.10, 6.7.1
  8. Alta · 8.1 CVE-2026-27196 >= 6.0.0-alpha.1, < 6.3.2, < 5.73.9 6.3.2, 5.73.9
  9. Alta · 8.7 CVE-2026-25759 >= 6.0.0, < 6.2.3 6.2.3
  10. Alta · 8.2 CVE-2024-24570 >= 4.00, < 4.46.0, < 3.4.17 4.46.0, 3.4.17
  11. Alta · 7.5 CVE-2023-48701 < 3.4.15, >= 4.0.0, < 4.36.0 3.4.15, 4.36.0
  12. Alta · 8.8 CVE-2023-48217 >= 4.0.0, < 4.34.0, < 3.4.14 4.34.0, 3.4.14
  13. Alta · 8.3 CVE-2023-47129 >= 4.0.0, < 4.33.0, < 3.4.13 4.33.0, 3.4.13
  14. Statamic's Antlers sanitizer cannot effectively sanitize malicious SVG esta entrada
    Media · 5.5 CVE-2023-36828 < 4.10.0 4.10.0
  15. Alta · 8.8 CVE-2017-11422 < 2.6.0 2.6.0

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.