# CVE-2024-47765: Minecraft MOTD Parser's HtmlGenerator vulnerable to XSS

> An attacker can inject malicious HTML into web pages via crafted Minecraft MOTD data processed by the HtmlGenerator class in this PHP library.

- **Severity:** Medium 6.9 (`CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 4 Oct 2024
- **Updated:** 4 Oct 2024
- **Also known as:** GHSA-q898-frwq-f3qp

## What is CVE-2024-47765?

CVE-2024-47765 is a medium-severity cross-site scripting vulnerability in jgniecki MinecraftMotdParser, published on 4 Oct 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

Minecraft MOTD Parser is a PHP library to parse minecraft server motd. The HtmlGenerator class is subject to potential cross-site scripting (XSS) attack through a parsed malformed Minecraft server MOTD. The HtmlGenerator iterates through objects of MotdItem that are contained in an object of MotdItemCollection to generate a HTML string. An attacker can make malicious inputs to the color and text properties of MotdItem to inject own HTML into a web page during web page generation. For example by sending a malicious MOTD from a Minecraft server under their control that was queried and passed to the HtmlGenerator. This XSS vulnerability exists because the values of these properties are neither filtered nor escaped. This vulnerability is fixed in 1.0.6.

Weakness: CWE-80 (Improper Neutralization of Script-Related HTML Tags in a Web Page), CWE-79 (Improper Neutralization of Input During Web Page Generation)

## Which versions are affected by CVE-2024-47765?

2 open source packages ship an affected version, including dev-lancer/minecraft-motd-parser. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `dev-lancer/minecraft-motd-parser` | Packagist | All versions | 1.0.6 |
| `dev-lancer/minecraft-motd-parser` | Packagist | All versions | 1.0.6 |

Products: Jgniecki Minecraft Motd Parser.

## How do I fix CVE-2024-47765?

Upgrade dev-lancer/minecraft-motd-parser to 1.0.6 or later.

## Is CVE-2024-47765 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-47765 exists.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2024-47765 and fix it if it is affected.

What it is: CVE-2024-47765 is a medium-severity cross-site scripting vulnerability in jgniecki MinecraftMotdParser, published on 4 Oct 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-47765 exists.

Affected packages and fixed versions:
- dev-lancer/minecraft-motd-parser (Packagist): affected all versions; fixed in 1.0.6
- dev-lancer/minecraft-motd-parser (Packagist): affected all versions; fixed in 1.0.6

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2024-47765/ (Markdown: https://insights.sbomify.com/CVE-2024-47765/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2024-47765
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2024-47765
- OSV: https://osv.dev/vulnerability/CVE-2024-47765

---
From sbomify Insights: https://insights.sbomify.com/CVE-2024-47765/
Summaries are generated and may contain mistakes; the official description above is the record.
