CVE-2023-36828: Statamic's Antlers sanitizer cannot effectively sanitize malicious SVG

Published Jul 5, 2023
·
Updated

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 }} 4. 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 - https://github.com/gogs/gogs/security/advisories/GHSA-ff28-f46g-r9g8 - https://huntr.dev/bounties/34a12146-3a5d-4efc-a0f8-7a3ae04b198d/ - https://blog.nintechnet.com/wordpress-elementor-plugin-fixed-svg-xss-protection-bypass-vulnerability/

Other sources

Statamic is a flat-first, Laravel and Git powered content management system. Prior to version 4.10.0, the SVG tag does not sanitize malicious SVG. Therefore, an attacker can exploit this vulnerability to perform cross-site scripting attacks using SVG, even when using the sanitize function. Version 4.10.0 contains a patch for this issue.

— MITRE

Statamic's Antlers sanitizer cannot effectively sanitize malicious SVG

— Packagist

Affected Software

3 affected componentsFixes available
Statamic Statamic<4.10.0
composer/statamic/cms<4.10.0
4.10.0
composer/statamic/cms<4.10.0
4.10.0

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade composer/statamic/cms to a version that resolves this vulnerability.

    Fixed in 4.10.0
  2. Upgrade

    Upgrade statamic/cms to a version that resolves this vulnerability.

    Fixed in 4.10.0
  3. Configuration

    Sanitize SVG content when outputting it, such as applying the `sanitize` modifier to the SVG in the template.

    Statamic SVG output sanitize = enabled

Event History

Jul 5, 2023
CVE Published
via MITRE·09:30 PM
Data Sourced
via MITRE·09:30 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·10:15 PM
RemedyDescriptionSeverityWeaknessAffected Software
Jul 6, 2023
Advisory Published
via GitHub·08:56 PM
Data Sourced
via GitHub·08:56 PM
DescriptionSeverityWeaknessAffected Software
Data Sourced
via Packagist·08:56 PM
DescriptionSeverityAffected Software

Frequently Asked Questions

1

What is CVE-2023-36828?

CVE-2023-36828 is a vulnerability in Statamic, a content management system, that allows attackers to perform cross-site scripting (XSS) attacks using malicious SVG tags.

2

What is the severity of CVE-2023-36828?

The severity of CVE-2023-36828 is medium, with a severity value of 5.4.

3

Which versions of Statamic are affected by CVE-2023-36828?

Versions up to 4.10.0 of Statamic are affected by CVE-2023-36828.

4

How can an attacker exploit CVE-2023-36828?

An attacker can exploit CVE-2023-36828 by using malicious SVG tags to perform cross-site scripting attacks.

5

Is there a fix for CVE-2023-36828?

Yes, the fix for CVE-2023-36828 is available in versions after 4.10.0 of Statamic.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203