/

CVE-2026-33172

Severity:

HIGH RISK

(8.7)

Cross-Site Scripting (XSS) in Statamic CMS

CVE-2026-33172

Analyzed

Vulnerability type

Category:

Cross-Site Scripting (XSS)

CWE:

CWE-79

Impact:

Stored Cross-Site Scripting leading to account compromise and unauthorized actions

Severity:

HIGH RISK

(8.7)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Statamic CMS contained a stored cross-site scripting (XSS) issue in its SVG asset reupload functionality, where previously uploaded SVGs could bypass sanitization.

Authenticated users with asset upload permissions could inject malicious JavaScript into SVG files that would execute in a victim's browser when the asset was viewed.

Affected context

This vulnerability appears in Statamic instances where:

  • SVG assets are allowed and handled by the asset management subsystem
  • Users other than full administrators have permissions to upload or reupload assets
  • Uploaded SVG files are later rendered or previewed in a browser (e.g., in the control panel, media views, or embedded in pages)

The risk is most significant in multi-user deployments (e.g., editorial teams, client sites) where potentially untrusted or semi-trusted users can manage media assets and where SVG previews or direct views occur within authenticated contexts.

Exploit preconditions

  • Attack surface: Statamic control panel or any interface that allows SVG asset upload/reupload and later renders those assets for viewing.
  • Required access: Authenticated account with permission to upload or reupload assets, including SVG files. No elevated administrator role is strictly required if asset upload is delegated.
  • Trigger point: A victim (such as an administrator or another authenticated user) views or previews the malicious SVG through the CMS interface or any page that renders it in the browser.
  • Why exploitation is possible: The SVG sanitization logic can be bypassed during asset reupload, allowing attacker-controlled JavaScript to persist inside the SVG markup and execute in the context of the application origin whenever the SVG is rendered by a browser.

Why this happens

The underlying issue is incomplete or inconsistent output sanitization applied to SVG content during the reupload path.

While sanitization may be applied on initial upload or for other asset types, the logic for handling SVG reuploads fails to fully neutralize scriptable constructs, event handlers, or other active content.

This aligns with CWE-79: Improper Neutralization of Input During Web Page Generation (Cross-Site Scripting), where untrusted input (here, SVG XML content controlled by an authenticated user) is incorporated into a web page or DOM without sufficient sanitization and context-aware encoding, enabling JavaScript execution in a victim's browser.

Potential impact

  • Execution of arbitrary JavaScript in the browser of users who view the malicious SVG asset
  • Theft of session tokens or other sensitive data accessible via the browser context
  • Unauthorized actions performed on behalf of victims (e.g., changing configuration, managing content, creating new users) via CSRF-like behavior within the same origin
  • Escalation of privileges if an administrator or higher-privileged user views the malicious asset
  • Persistent compromise of parts of the CMS interface until the malicious SVG is removed

General mitigation guidance

Effective mitigation generally focuses on strict handling of active content in SVGs and enforcing strong output-encoding practices:

  • Treat SVG files as active content and either disallow them entirely for non-administrative users or restrict allowed elements and attributes to a safe subset.
  • Apply robust SVG sanitization that strips script elements, event-handler attributes, external resource references, and other active or scriptable constructs, including during both initial upload and any subsequent reupload or update operations.
  • When displaying SVGs in the UI, consider using defensive rendering techniques such as serving SVGs as files (e.g., via <img> tags) rather than inline <svg> markup when feasible, to reduce the attack surface for script execution.
  • Enforce the principle of least privilege for asset upload permissions, granting SVG upload and reupload capability only to trusted user roles that genuinely require it.
  • Implement defense-in-depth measures at the HTTP layer (e.g., Content Security Policy) to limit the impact of any script execution that might bypass sanitization.

How teams detect issues like this

Detection efforts can focus on both code-level patterns and runtime behavior:

  • Static analysis and code review:
  • Identify code paths where SVG content is accepted, transformed, or re-saved, and verify that the same sanitization and validation logic is applied consistently to both upload and reupload flows.
  • Look for direct passthrough of user-controlled SVG data into templates or views without context-aware encoding or sanitization.
  • Flag usages where inline SVG is rendered directly into HTML without appropriate sanitization routines.
  • Configuration and policy checks:
  • Review role and permission settings to identify low-trust roles that have SVG upload or asset management capabilities.
  • Enforce secure coding policies that require specialized sanitization for complex asset types like SVG.
  • Runtime monitoring:
  • Monitor administrative and media-related routes for unusual patterns, such as repeated uploads or reuploads of SVG files.
  • Use browser security headers (e.g., CSP report endpoints) to collect violation reports that might indicate inline script execution within SVGs.
  • Automated security scanners and SAST tools can help surface missing sanitization and dangerous markup patterns in asset-handling components when integrated into CI/CD pipelines.

Sources

SourceLink
github.comgithub.com/statamic/cms/security/advisories/GHSA-7rcv-55mj-chg7

Frequently asked

questions

It can be exploited remotely in deployments where the Statamic control panel or relevant upload endpoints are exposed over the internet and an attacker can obtain credentials with asset upload permissions. Exploitation is not anonymous; it requires an authenticated user who can upload or reupload SVG assets.

The attacker needs an authenticated account in the Statamic instance with permissions to upload or reupload assets, specifically SVG files. They do not necessarily need full administrator rights, which makes multi-user environments with delegated content roles more exposed.

The safest pattern is to enforce robust SVG sanitization on all ingestion paths (upload and reupload), strip any active content (scripts, event handlers, external resources), and ensure that rendering paths do not inline untrusted SVG markup directly without sanitation. Where possible, limit who can upload SVGs and prefer rendering them as static images instead of inline, script-capable content.

Preventing similar issues involves adopting a defense-in-depth strategy: consistently apply context-aware sanitization and output encoding for all user-controlled content, treat complex formats like SVG as potentially executable, restrict powerful capabilities (such as file uploads) to trusted roles, and enforce automated security checks (code review guidelines, SAST rules, and CSP) to catch missing sanitization or unsafe rendering patterns early in the development lifecycle.

Find out what's already
exploitable in your codebase.