/

CVE-2026-45011

Severity:

HIGH RISK

(7.3)

Stored XSS (CWE-79) in ApostropheCMS image widget

CVE-2026-45011

Deferred

Vulnerability type

Category:

Cross-Site Scripting (XSS)

CWE:

CWE-79, CWE-116

Impact:

Stored Cross-Site Scripting leading to arbitrary JavaScript execution in victims' browsers

Severity:

HIGH RISK

(7.3)

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

ApostropheCMS 4.29.0 contains a stored cross-site scripting vulnerability in the image widget link configuration, allowing javascript: URLs to be saved and published by users with the Editor role.

When another user or site visitor clicks the malicious image/link, arbitrary JavaScript executes in their browser, enabling account compromise, data theft, or other client-side attacks.

Affected context

The vulnerability exists in ApostropheCMS 4.29.0 when using the image widget feature to create clickable images.

Editors are allowed to configure the link target for an image and can supply javascript: URLs without server-side sanitization or client-side blocking.

The risk materializes when such a widget is published to a live page and unsuspecting users, including administrators or public visitors, interact with the image, causing the embedded script to execute in their browser context.

Exploit preconditions

  • Attack surface: Web UI of sites built with ApostropheCMS 4.29.0, specifically pages containing image widgets.
  • Required access: An authenticated account with at least Editor permissions capable of configuring and publishing image widgets.
  • Trigger point: A victim (administrator, authenticated user, or public visitor) clicks on an affected image/link that has a javascript: URL configured.
  • Why exploitation is possible: The application accepts and stores javascript: URLs in image widget link fields without normalizing, sanitizing, or rejecting them, and browsers subsequently treat the link as executable script when activated by a user action.

Why this happens

This issue stems from insufficient output encoding and URL scheme validation in the image widget link configuration, corresponding to CWE-79: Improper Neutralization of Input During Web Page Generation (Cross-site Scripting).

The link field allows untrusted input to be stored and later rendered back into the page as an anchor or clickable element without stripping or blocking dangerous schemes like javascript:.

Because the resulting markup is delivered to end users' browsers in a trusted origin, clicking the widget executes attacker-supplied JavaScript with full access to that origin's DOM and storage.

The absence of robust URL validation and content-neutralization logic in this path embodies the general bug class of trusting user-controlled content in dynamic HTML/DOM contexts.

Potential impact

  • Arbitrary JavaScript execution in the context of the affected site.
  • Theft of session tokens, JWTs, or other authentication artifacts stored in browser-accessible storage.
  • Unauthorized actions performed on behalf of victims (e.g., content changes, configuration updates) via forged requests.
  • Phishing or UI redressing within the trusted site to capture credentials or sensitive data.
  • Lateral movement to more privileged accounts if administrators interact with malicious widgets.
  • Defacement of content or injection of malicious third-party scripts for further compromise.

General mitigation guidance

Effective mitigation typically focuses on hardening how user-supplied URLs are handled and rendered:

  • Enforce strict URL scheme allowlists for link fields, permitting only safe schemes (e.g., https, http, and optionally mailto) and rejecting or stripping others.
  • Apply robust server-side validation and canonicalization to all stored link values before persistence, treating content from privileged roles as untrusted.
  • Implement context-appropriate output encoding when rendering user-controlled values into HTML attributes (e.g., attribute encoding for href values).
  • Reduce the impact of successful XSS through security headers such as a restrictive Content Security Policy (CSP) that disallows inline scripts and limits external script origins.
  • Apply the principle of least privilege in permission models so that content creators cannot unintentionally introduce high-risk behavior beyond their intended editorial scope.
  • Consider using centralized helpers or components for rendering links and widgets so that validation and encoding rules are applied consistently across the application.

How teams detect issues like this

Detection can be approached at multiple layers:

  • Static analysis and linting: Configure linters or SAST tools to flag direct insertion of user-controlled values into HTML attributes like href, src, or event handlers without validation or encoding.
  • Code review practices: During manual reviews, scrutinize widget and content-rendering components for direct use of user-supplied URLs and insufficient scheme or domain validation.
  • Runtime and logging: Monitor application logs and database records for suspicious values in link fields, such as those starting with javascript: or containing obvious script patterns.
  • Security testing: Incorporate XSS-focused test cases into CI/CD pipelines, including automated scans against content creation flows and widgets to validate that dangerous schemes are rejected.
  • Policy enforcement: Adopt secure coding guidelines that mandate centralized URL validation utilities and encoded template helpers, and verify their use through code ownership and review gates.

Sources

SourceLink
github.comgithub.com/apostrophecms/apostrophe/releases/tag/apostrophe%404.29.0
github.comgithub.com/apostrophecms/apostrophe/security/advisories/GHSA-5f64-7vfc-rcx6

Frequently asked

questions

Yes. Once an editor has saved and published a malicious image widget, any remote user who can access the page and clicks the image can be impacted, including anonymous visitors.

The attacker must have at least Editor-level access or equivalent permissions that allow configuring and publishing image widgets, or must compromise such an account through other means.

The most robust fix is to implement centralized URL validation and sanitization for all link fields, enforcing an allowlist of safe schemes and domains, combined with context-appropriate output encoding when rendering these values into HTML.

Preventive measures include treating all user-generated content as untrusted regardless of role, enforcing strict validation and encoding at every render point, adopting a strong Content Security Policy, and integrating XSS-focused security checks into development, review, and testing workflows.

Find out what's already
exploitable in your codebase.