# CVE-2023-38500: By-passing Cross-Site Scripting Protection in HTML Sanitizer

> Attackers can bypass XSS protection in TYPO3 HTML Sanitizer via malicious markup in noscript elements when that feature is enabled.

- **Severity:** Medium 4.7 (`CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 25 Jul 2023
- **Updated:** 10 Oct 2024
- **Also known as:** GHSA-59jf-3q9v-rh6g

## What is CVE-2023-38500?

CVE-2023-38500 is a medium-severity cross-site scripting vulnerability in TYPO3 html-sanitizer, published on 25 Jul 2023. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

### Official description

TYPO3 HTML Sanitizer is an HTML sanitizer, written in PHP, aiming to provide cross-site-scripting-safe markup based on explicitly allowed tags, attributes and values. Starting in version 1.0.0 and prior to versions 1.5.1 and 2.1.2, due to an encoding issue in the serialization layer, malicious markup nested in a `noscript` element was not encoded correctly. `noscript` is disabled in the default configuration, but might have been enabled in custom scenarios. This allows bypassing the cross-site scripting mechanism of TYPO3 HTML Sanitizer. Versions 1.5.1 and 2.1.2 fix the problem.

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

## Which versions are affected by CVE-2023-38500?

4 open source packages ship an affected version, including typo3/html-sanitizer. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `typo3/html-sanitizer` | Packagist | From 1.0.0 | 1.5.1 |
| `typo3/html-sanitizer` | Packagist | From 1.0.0 | 1.5.1 |
| `typo3/html-sanitizer` | Packagist | From 2.0.0 | 2.1.2 |
| `typo3/html-sanitizer` | Packagist | From 2.0.0 | 2.1.2 |

Products: Typo3 Html Sanitizer.

## How do I fix CVE-2023-38500?

Upgrade typo3/html-sanitizer to a fixed version for your release line: 1.5.1 or 2.1.2.

## Is CVE-2023-38500 being exploited?

There is no known exploitation of CVE-2023-38500 in the wild and no public exploit code.

## Other vulnerabilities in TYPO3 html-sanitizer

- [CVE-2022-23499](https://insights.sbomify.com/CVE-2022-23499/): Cross-Site Scripting Protection bypass in HTML Sanitizer (medium 6.1)
- [CVE-2022-36020](https://insights.sbomify.com/CVE-2022-36020/): Bypass of Cross-Site Scripting Protection in typo3/html-sanitizer (medium 6.1)
- [CVE-2023-47125](https://insights.sbomify.com/CVE-2023-47125/): By-passing Cross-Site Scripting Protection in HTML Sanitizer (medium 4.7)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2023-38500 and fix it if it is affected.

What it is: CVE-2023-38500 is a medium-severity cross-site scripting vulnerability in TYPO3 html-sanitizer, published on 25 Jul 2023. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of CVE-2023-38500 in the wild and no public exploit code.

Affected packages and fixed versions:
- typo3/html-sanitizer (Packagist): affected from 1.0.0; fixed in 1.5.1
- typo3/html-sanitizer (Packagist): affected from 1.0.0; fixed in 1.5.1
- typo3/html-sanitizer (Packagist): affected from 2.0.0; fixed in 2.1.2
- typo3/html-sanitizer (Packagist): affected from 2.0.0; fixed in 2.1.2

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

## Sources

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

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