Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB
CVE-2024-47765 Overview
CVE-2024-47765 is a cross-site scripting (XSS) vulnerability in the Minecraft MOTD Parser, a PHP library used to parse Minecraft server Message of the Day (MOTD) strings. The flaw resides in the HtmlGenerator class, which iterates through MotdItem objects contained in a MotdItemCollection to render HTML. The library fails to filter or escape the color and text properties of each MotdItem. An attacker who controls a Minecraft server can return a malformed MOTD that injects HTML into any web page that queries the server and passes the response to HtmlGenerator. The vulnerability is tracked as [CWE-79] and is fixed in version 1.0.6.
Critical Impact
Attackers can inject arbitrary HTML and JavaScript into web pages that render Minecraft server MOTDs, enabling session theft, phishing, and client-side code execution.
Affected Products
- jgniecki Minecraft MOTD Parser (PHP library)
- All versions prior to 1.0.6
- Web applications that render untrusted MOTD data via HtmlGenerator
Discovery Timeline
- 2024-10-04 - CVE-2024-47765 published to NVD
- 2026-06-17 - Last updated in NVD database
Technical Details for CVE-2024-47765
Vulnerability Analysis
The Minecraft MOTD Parser converts Minecraft server MOTD payloads into HTML suitable for display in a browser. The HtmlGenerator class walks a MotdItemCollection and builds <span> tags that reflect formatting attributes such as color and text content. The generator concatenates the color property directly into a CSS style attribute and inserts the text property into HTML without sanitization. An attacker controlling a Minecraft server can craft an MOTD whose color field contains CSS or HTML control characters, or whose text field contains script-bearing markup. When a downstream web application queries the server and passes the response to HtmlGenerator, the attacker-controlled markup is embedded in the generated page.
Root Cause
The root cause is missing output encoding in src/Generator/HtmlGenerator.php. The library trusted that color values resembled hex codes and that text values were plain strings. Neither assumption was enforced through validation or escaping. This matches [CWE-79]: Improper Neutralization of Input During Web Page Generation.
Attack Vector
Exploitation is network based and requires no authentication or user interaction beyond visiting the vulnerable page. An attacker stands up a Minecraft server, waits for a vulnerable site to query it, and returns a malicious MOTD. The injected payload executes in the context of the rendering site's origin.
if ($motdItem->getColor()) {
if (str_contains($motdItem->getColor(), '#')) {
- $tags['span'][] = sprintf('color: %s;', $motdItem->getColor());
+ // Only allow valid hex color codes (without alpha channel), such as #FFF and #000000.
+ if(!preg_match('/^#(([0-9A-Fa-f]{2}){3}|[0-9A-Fa-f]{3})$/i', $motdItem->getColor())) {
+ continue;
+ }
+
+ $tags['span'][] = sprintf('color: %s;', $this->escape($motdItem->getColor()));
} else {
$color = $this->colorCollection->get($motdItem->getColor());
if (!$color) {
Source: GitHub commit b0ab9d6. The patch rejects color strings that do not match a strict hex pattern and escapes the value before inserting it into the style attribute.
Detection Methods for CVE-2024-47765
Indicators of Compromise
- Outbound TCP connections from PHP web workers to arbitrary Minecraft server ports (default 25565) that are not on an allowlist.
- MOTD response payloads containing <, >, ", or script substrings in the text or extra.color fields.
- Rendered HTML pages containing <span style="color: ..."> values that do not match a valid hex color pattern.
- Browser-side Content Security Policy (CSP) violation reports originating from pages that render MOTD data.
Detection Strategies
- Inspect application logs for raw MOTD payloads and flag any entries where the JSON color field fails a ^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$ regex.
- Deploy a web application firewall (WAF) rule that inspects responses rendered from the MOTD endpoint for inline <script> tags or event-handler attributes.
- Perform static analysis on PHP dependencies to identify jgniecki/minecraft_motd_parser versions earlier than 1.0.6 in composer.lock.
Monitoring Recommendations
- Enable CSP reporting on any page that renders MOTD data and route violation reports to a central log pipeline.
- Monitor dependency inventories for the jgniecki:minecraft_motd_parser component and alert when outdated versions are reintroduced.
- Capture egress telemetry for Minecraft query protocol traffic to identify queries to attacker-controlled servers.
How to Mitigate CVE-2024-47765
Immediate Actions Required
- Upgrade jgniecki/minecraft_motd_parser to version 1.0.6 or later using Composer.
- Audit all code paths that pass remote MOTD responses to HtmlGenerator and confirm the data is rendered inside a sandboxed context until the upgrade is deployed.
- Enforce a strict CSP that disables inline scripts on pages that render MOTD content.
Patch Information
The fix is published in version 1.0.6. The relevant change in src/Generator/HtmlGenerator.php validates color values against a hex-code regular expression and routes the value through an escape() helper before writing it to the style attribute. Refer to GitHub Security Advisory GHSA-q898-frwq-f3qp and the upstream patch commit for the authoritative diff.
Workarounds
- Restrict MOTD queries to a server allowlist that the application operator controls.
- Sanitize the color and text fields of each MotdItem with an HTML-escaping function and a hex-code regex before passing data to HtmlGenerator.
- Render MOTD output inside an iframe with the sandbox attribute set to prevent script execution against the parent origin.
# Upgrade the vulnerable library via Composer
composer require jgniecki/minecraft-motd-parser:^1.0.6
composer update jgniecki/minecraft-motd-parser
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB

