Details
CVSS 4.0 rationale:
AV:N: the issue is exploitable through the web application.AC:L: no special race condition or complex setup is required after page editing access is obtained.AT:P: exploitation requires the malicious Markdown/media reference to be stored in page content and later rendered to a victim.PR:H: the attacker needs page editing capability.UI:P: a victim must view the affected page. The demonstratedonloadpayload executes on passive page rendering, without requiring a click or form submission by the victim.VC:H/VI:L/VA:N: confidentiality impact can be high when the victim is an administrator or reviewer; integrity impact is limited; no direct availability impact was demonstrated.SC:H/SI:L/SA:N: the injected script executes in the browser/application context and may affect subsequent same-origin interactions available to the victim.
Maintainer note — fix applied (2026-04-24)
Fixed in Grav core on the 2.0 branch: commit `5a12f9be8` — will ship in 2.0.0-beta.2.
What changed: MediaObjectTrait::attribute() — the sink reached by Markdown like ) — now gates the attribute name through an allowlist regex (^[A-Za-z][A-Za-z0-9_:.\-]*$) plus an explicit denylist of script-context names:
- any
on*handler (case-insensitive) style(inline CSS expression risk)xmlns(XML namespace tricks)srcdoc(iframe sandbox bypass)formaction(form action override)
Invalid names are silently dropped — the attribute isn't stored, so it doesn't survive into the rendered <img>. src/href/data-*/aria-*/standard media attributes are unaffected.
Files:
- `system/src/Grav/Common/Media/Traits/MediaObjectTrait.php` — new
isSafeAttributeName()gate. - `tests/unit/Grav/Common/Security/MediaAttributeSecurityTest.php` — 28 cases (14 dangerous-name rejections, 14 safe-name round-trips).
Discoverers
@K-Czaplicki
@morzelowski
---