# CVE-2024-40631: Cross-site Scripting (XSS) in media embed element when using custom URL parsers in plate media

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** HIGH 8.1
- **CVSS:** 8.1 (v3.1, CNA) `CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N`
- **CVSS metrics:** Attack vector: Network; Attack complexity: Low; Privileges required: Low; User interaction: None; Scope: Unchanged; Confidentiality impact: High; Integrity impact: High; Availability impact: None
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Remote, login needed
- **EPSS:** 0.92% (percentile 59, 2026-11-26)
- **CWE:** CWE-79
- **Aliases:** GHSA-h3pq-667x-r789
- **Published:** 2024-07-15T18:21:16.323Z
- **Modified:** 2026-09-10T03:50:16.698Z

## Who should check

- Projects that depend on npm package @udecode/plate-media (\< 36.0.10)
- Anyone running udecode plate \< 36.0.10

## Description

Plate media is an open source, rich-text editor for React. Editors that use \`MediaEmbedElement\` and pass custom \`urlParsers\` to the \`useMediaState\` hook may be vulnerable to XSS if a custom parser allows \`javascript:\`, \`data:\` or \`vbscript:\` URLs to be embedded. Editors that do not use \`urlParsers\` and consume the \`url\` property directly may also be vulnerable if the URL is not sanitised. The default parsers \`parseTwitterUrl\` and \`parseVideoUrl\` are not affected. \`@udecode/plate-media\` 36.0.10 resolves this issue by only allowing HTTP and HTTPS URLs during parsing. This affects only the \`embed\` property returned from \`useMediaState\`. In addition, the \`url\` property returned from \`useMediaState\` has been renamed to \`unsafeUrl\` to indicate that it has not been sanitised. The \`url\` property on \`element\` is also unsafe, but has not been renamed. If you're using either of these properties directly, you will still need to validate the URL yourself. Users are advised to upgrade. Users unable to upgrade should ensure that any custom \`urlParsers\` do not allow \`javascript:\`, \`data:\` or \`vbscript:\` URLs to be returned in the \`url\` property of their return values. If \`url\` is consumed directly, validate the URL protocol before passing it to the \`iframe\` element.

## Affected and fixed versions

- npm `@udecode/plate-media`: affected \< 36.0.10; fixed 36.0.10 (osv)
- udecode plate: \< 36.0.10 (cvelist)

## Mitigation

- Upgrade @udecode/plate-media to 36.0.10 or later.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2024-40631. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2024-40631.md
Affected: @udecode/plate-media < 36.0.10
Fixed in: 36.0.10

Steps:
1. Search this machine and project for @udecode/plate-media (npm), udecode plate: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2024-40631 being exploited?

There is no confirmed exploitation: CVE-2024-40631 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.92% chance of exploitation in the next 30 days (as of 2026-11-26).

### How serious is CVE-2024-40631?

High: CVSS 8.1 (v3.1, scored by CNA). Remote, login needed.

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

@udecode/plate-media \< 36.0.10.

### Is there a fix for CVE-2024-40631?

Yes. Fixed in 36.0.10. Upgrade @udecode/plate-media to 36.0.10 or later.

### How do I check if I'm affected by CVE-2024-40631?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- vendor: <https://github.com/udecode/plate/security/advisories/GHSA-h3pq-667x-r789>
- vendor: <https://nvd.nist.gov/vuln/detail/CVE-2024-40631>
- patch: <https://github.com/udecode/plate/commit/1bc0971774fbfb770780c9bdb94746a6f0f196a0>
- other: <https://stackoverflow.com/a/43467144>
- other: <https://github.com/udecode/plate>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2024-40631>
- OSV: CC-BY 4.0 <https://osv.dev/vulnerability/GHSA-h3pq-667x-r789> (license: <https://creativecommons.org/licenses/by/4.0/>)

HTML: <https://flawdb.com/CVE-2024-40631> · JSON: <https://flawdb.com/api/v1/entries/CVE-2024-40631>
