Your RSA-2048 keys break in 2030. Find every one of them before attackers do.
🐘 Packagist

GHSA-6r5g-cq4q-327g

MEDIUM

Statamic's Antlers sanitizer cannot effectively sanitize malicious SVG

Also known asCVE-2023-36828
Published
Jul 6, 2023
Updated
Feb 16, 2024
Affected
1 pkg
Patched
1 / 1
Exploits
1 known

EPSS Exploitation Probability

via FIRST.org ↗
0.5%probability of exploitation in next 30 days
Lower Risk42th percentile+0.25%
0.00%0.35%0.70%1.05%0.2%0.5%Dec 25Apr 26Jun 26

EPSS (Exploit Prediction Scoring System) is a daily probability model maintained by FIRST.org. It estimates the likelihood a CVE will be exploited in production environments within the next 30 days, derived from real-world threat intelligence signals.

Blast Radius

1 pkg affected
🐘statamic/cms

Real-time download stats are indexed for npm and PyPI packages. This vulnerability affects Packagist packages — download data is not available via public APIs for these ecosystems.

Description

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:

use enshrined\svgSanitize\Sanitizer;

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

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

Reference

Affected Packages

1 total 1 fixed
EcosystemPackageVulnerable rangeFix
🐘Packagiststatamic/cmsall versions4.10.0
Exploits & PoCs
1

Research use only. For defensive security, authorized penetration testing, and academic research only. Never execute exploit code against systems without explicit written authorization.

Detection & mitigation playbook

Open-source dependency
  1. Detect

    Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for statamic/cms. O3's reachability analysis confirms whether the vulnerable code path is actually invoked in your application, so you act on real exposure instead of every transitive match.

  2. Fix

    Update statamic/cms to 4.10.0 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-6r5g-cq4q-327g is resolved across your whole dependency graph.

  3. Workarounds

    If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.

  4. How O3 protects you

    O3 pinpoints whether GHSA-6r5g-cq4q-327g is reachable in your code and exactly where to fix it, then blocks exploitation in production at runtime until the patched version is deployed.

Tailored to GHSA-6r5g-cq4q-327g. Runtime protection reduces exposure until a permanent patch is applied and verified — it complements patching, it doesn't replace it.

Frequently Asked Questions

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](https://github.com/statamic/cms/security/advisories/GHSA-jvw9-rrc5-39g6#advisory-comment-84322), it has been identified that the default blacklist in the **FilesFieldtypeController** (located at this [link](https://github.com/statamic/cms/blob/f806b6b007ddcf066082eef175653c5beaa96d60/src/
O3 Security · Impact-Aware SCA

Is GHSA-6r5g-cq4q-327g in your dependencies?

O3 detects GHSA-6r5g-cq4q-327g across Packagist dependencies and uses function-level reachability to confirm whether the vulnerable code path is actually reachable — not just present. No false positives.

GHSA-6r5g-cq4q-327g: statamic/cms Cross-Site Scripting (Medium… | O3 Security