Description
The Grav API plugin (getgrav/grav-plugin-api) before 1.0.3 fails to sanitize SVG files uploaded through the POST /api/v1/media endpoint. The HandlesMediaUploads::processUploadedFile() method validates only the file extension and never invokes Security::sanitizeSVG(), so an authenticated attacker with the api.media.write permission can upload an SVG containing arbitrary JavaScript. The file is stored unmodified and served with Content-Type: image/svg+xml; when an administrator opens it in a browser (directly or via <object>/<iframe>), the embedded script executes in their session context, enabling cookie theft and session hijacking.
Published: 2026-07-10
Score: 5.1 Medium
EPSS: < 1% Very Low
KEV: No
Impact: n/a
Action: n/a
AI Analysis

Impact

The Grav API plugin contains a flaw that allows an authenticated user with the api.media.write permission to upload SVG files that contain arbitrary JavaScript. Because the plugin does not invoke the Security::sanitizeSVG() routine and only validates the file extension, the malicious SVG is stored exactly as created. When an administrator later opens the file—or if the file is embedded in a page using <object> or <iframe>—the script runs in the context of the administrator’s session, enabling cookie theft and session hijacking. Based on the description, it is inferred that this client‑side execution can ultimately be used to compromise the entire site by leveraging the stolen session credentials.

Affected Systems

The vulnerability affects installations of the Grav content‑management system that use the getgrav/grav-plugin-api plugin prior to version 1.0.3. Any site that has the API plugin at a version earlier than 1.0.3 and allows media uploads through the POST /api/v1/media endpoint is susceptible; the issue is tied to the plugin’s version rather than a specific Grav core release. Based on the description, it is inferred that this problem is confined to the plugin and not to the Grav core itself.

Risk and Exploitability

The CVSS v3.1 score of 5.1 indicates a moderate security risk. The EPSS score of 0.00141 shows a very low likelihood of exploitation, and the vulnerability is not listed in the CISA KEV catalog. An attacker must be authenticated with permission to write media, but once that prerequisite is met, the exploitation path is straightforward: upload a crafted SVG, wait for an administrator to retrieve it, and trigger client‑side code execution, resulting in administrative access through session hijacking that can lead to full compromise of the site. Based on the description, it is inferred that the attacker can hijack the administrator’s session and then use that session to gain unrestricted control over the site.

Generated by OpenCVE AI on July 28, 2026 at 08:18 UTC.

Remediation

No vendor fix or workaround currently provided.

OpenCVE Recommended Actions

  • Upgrade the Grav API plugin to version 1.0.3 or later, which applies proper SVG sanitization.
  • If an upgrade is not feasible, disable the /api/v1/media endpoint or revoke the api.media.write permission from users who should not upload files.
  • For sites that must still accept SVG uploads, enforce additional server‑side sanitization to strip embedded scripts before storage and ensure that stored SVG files are served with a MIME type that does not allow script execution.

Generated by OpenCVE AI on July 28, 2026 at 08:18 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories yet.

History

Fri, 10 Jul 2026 14:45:00 +0000

Type Values Removed Values Added
Description The Grav API plugin (getgrav/grav-plugin-api) before 1.0.3 fails to sanitize SVG files uploaded through the POST /api/v1/media endpoint. The HandlesMediaUploads::processUploadedFile() method validates only the file extension and never invokes Security::sanitizeSVG(), so an authenticated attacker with the api.media.write permission can upload an SVG containing arbitrary JavaScript. The file is stored unmodified and served with Content-Type: image/svg+xml; when an administrator opens it in a browser (directly or via <object>/<iframe>), the embedded script executes in their session context, enabling cookie theft and session hijacking.
Title Grav before 1.0.3 Stored XSS via SVG Upload API
First Time appeared Getgrav
Getgrav grav
Weaknesses CWE-79
CPEs cpe:2.3:a:getgrav:grav:*:*:*:*:*:*:*:*
Vendors & Products Getgrav
Getgrav grav
References
Metrics cvssV3_1

{'score': 4.6, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:L/I:L/A:N'}

cvssV4_0

{'score': 5.1, 'vector': 'CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:P/VC:L/VI:L/VA:N/SC:N/SI:N/SA:N'}


cve-icon MITRE

Status: PUBLISHED

Assigner: VulnCheck

Published:

Updated: 2026-07-10T14:45:32.763Z

Reserved: 2026-07-09T14:07:55.624Z

Link: CVE-2026-61456

cve-icon Vulnrichment

No data.

cve-icon NVD

No data.

cve-icon Redhat

No data.

cve-icon OpenCVE Enrichment

Updated: 2026-07-28T08:30:18Z

Weaknesses
  • CWE-79

    Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')