# CVE-2018-6341: Cross-Site Scripting in react-dom

> Attackers can execute arbitrary scripts in user browsers via unescaped attribute names in server-rendered React applications.

- **Severity:** Medium 6.1 (`CVSS:3.1/AV:N/AC:L/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:** 31 Dec 2018
- **Updated:** 6 May 2025
- **Also known as:** CLSA-2026-1775521831, CLSA-2026-1792161467, CLSA-2026-1792161489, CLSA-2026-1792267914, CLSA-2026-1792287259, GHSA-mvjj-gqq2-p4hw

## What is CVE-2018-6341?

CVE-2018-6341 is a medium-severity cross-site scripting vulnerability in Facebook react-dom, published on 31 Dec 2018. 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

React applications which rendered to HTML using the ReactDOMServer API were not escaping user-supplied attribute names at render-time. That lack of escaping could lead to a cross-site scripting vulnerability. This issue affected minor releases 16.0.x, 16.1.x, 16.2.x, 16.3.x, and 16.4.x. It was fixed in 16.0.1, 16.1.2, 16.2.1, 16.3.3, and 16.4.2.

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

## Which versions are affected by CVE-2018-6341?

10 open source packages ship an affected version, including react-dom. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `react-dom` | npm | From 16.0.0 | 16.0.1 |
| `react-dom` | npm | From 16.0.0 | 16.0.1 |
| `react-dom` | npm | From 16.1.0 | 16.1.2 |
| `react-dom` | npm | From 16.1.0 | 16.1.2 |
| `react-dom` | npm | From 16.2.0 | 16.2.1 |
| `react-dom` | npm | From 16.2.0 | 16.2.1 |
| `react-dom` | npm | From 16.3.0 | 16.3.3 |
| `react-dom` | npm | From 16.3.0 | 16.3.3 |
| `react-dom` | npm | From 16.4.0 | 16.4.2 |
| `react-dom` | npm | From 16.4.0 | 16.4.2 |

Products: Facebook React.

## How do I fix CVE-2018-6341?

Upgrade react-dom to a fixed version for your release line: 16.0.1, 16.1.2, 16.2.1 or 16.3.3.

## Is CVE-2018-6341 being exploited?

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

Public exploit code:

- CVE-2018-6341 (github_poc): https://github.com/diwangs/react16-ssr

## Other vulnerabilities in Facebook react-dom

- [CVE-2025-55182](https://insights.sbomify.com/CVE-2025-55182/): Meta React Server Components Remote Code Execution (critical 10.0, exploited in the wild)
- [CVE-2026-23864](https://insights.sbomify.com/CVE-2026-23864/): React Server Components have multiple Denial of Service Vulnerabilities (high 7.5)
- [CVE-2025-55184](https://insights.sbomify.com/CVE-2025-55184/): Denial of Service Vulnerability in React Server Components (high 7.5)
- [CVE-2025-67779](https://insights.sbomify.com/CVE-2025-67779/): Denial of Service Vulnerability in React Server Components (high 7.5)
- [CVE-2025-55183](https://insights.sbomify.com/CVE-2025-55183/): Source Code Exposure Vulnerability in React Server Components (medium 5.3)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2018-6341 and fix it if it is affected.

What it is: CVE-2018-6341 is a medium-severity cross-site scripting vulnerability in Facebook react-dom, published on 31 Dec 2018. 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-2018-6341 in the wild and no public exploit code.

Affected packages and fixed versions:
- react-dom (npm): affected from 16.0.0; fixed in 16.0.1
- react-dom (npm): affected from 16.0.0; fixed in 16.0.1
- react-dom (npm): affected from 16.1.0; fixed in 16.1.2
- react-dom (npm): affected from 16.1.0; fixed in 16.1.2
- react-dom (npm): affected from 16.2.0; fixed in 16.2.1
- react-dom (npm): affected from 16.2.0; fixed in 16.2.1
- react-dom (npm): affected from 16.3.0; fixed in 16.3.3
- react-dom (npm): affected from 16.3.0; fixed in 16.3.3
- react-dom (npm): affected from 16.4.0; fixed in 16.4.2
- react-dom (npm): affected from 16.4.0; fixed in 16.4.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-2018-6341/ (Markdown: https://insights.sbomify.com/CVE-2018-6341/index.md)
```

## Sources

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

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