# CVE-2024-53257: Vitess allows HTML injection in /debug/querylogz & /debug/env

> Attackers can inject HTML into Vitess debug pages via unescaped queries, potentially leading to script execution in admin browsers.

- **Severity:** Medium 4.9 (`CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:N/I:H/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** An administrator
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 3 Dec 2024
- **Updated:** 3 Dec 2024
- **Also known as:** AZL-53970, AZL-53977, GHSA-7mwh-q3xm-qh6p, GO-2024-3306

## What is CVE-2024-53257?

CVE-2024-53257 is a medium-severity cross-site scripting vulnerability in vitessio vitess, published on 3 Dec 2024. An attacker needs administrator access to exploit it, with no action from the victim.

### Official description

Vitess is a database clustering system for horizontal scaling of MySQL. The /debug/querylogz and /debug/env pages for vtgate and vttablet do not properly escape user input. The result is that queries executed by Vitess can write HTML into the monitoring page at will. These pages are rendered using text/template instead of rendering with a proper HTML templating engine. This vulnerability is fixed in 21.0.1, 20.0.4, and 19.0.8.

Weakness: CWE-79 (Improper Neutralization of Input During Web Page Generation)

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

7 open source packages ship an affected version, including vitess.io/vitess.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `vitess.io/vitess` | Go | All versions | 0.19.8, 0.20.4, 0.21.1 |
| `vitess.io/vitess` | Go | All versions | 0.19.8 |
| `vitess.io/vitess` | Go | All versions | 0.19.8 |
| `vitess.io/vitess` | Go | From 0.20.0-rc1 | 0.20.4 |
| `vitess.io/vitess` | Go | From 0.20.0-rc1 | 0.20.4 |
| `vitess.io/vitess` | Go | From 0.21.0-rc1 | 0.21.1 |
| `vitess.io/vitess` | Go | From 0.21.0-rc1 | 0.21.1 |

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

Upgrade vitess.io/vitess to a fixed version for your release line: 0.19.8, 0.20.4 or 0.21.1.

## Is CVE-2024-53257 being exploited?

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

## Fix prompt for AI coding agents

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

What it is: CVE-2024-53257 is a medium-severity cross-site scripting vulnerability in vitessio vitess, published on 3 Dec 2024. An attacker needs administrator access to exploit it, with no action from the victim.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-53257 exists.

Affected packages and fixed versions:
- vitess.io/vitess (Go): affected all versions; fixed in 0.19.8, 0.20.4, 0.21.1
- vitess.io/vitess (Go): affected all versions; fixed in 0.19.8
- vitess.io/vitess (Go): affected all versions; fixed in 0.19.8
- vitess.io/vitess (Go): affected from 0.20.0-rc1; fixed in 0.20.4
- vitess.io/vitess (Go): affected from 0.20.0-rc1; fixed in 0.20.4
- vitess.io/vitess (Go): affected from 0.21.0-rc1; fixed in 0.21.1
- vitess.io/vitess (Go): affected from 0.21.0-rc1; fixed in 0.21.1

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-53257/ (Markdown: https://insights.sbomify.com/CVE-2024-53257/index.md)
```

## Sources

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

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