# CVE-2024-47061: Arbitrary DOM attributes in element.attributes and leaf.attributes in Platejs

> Attackers can inject malicious DOM attributes into Plate.js editors, leading to cross-site scripting and potential information disclosure of user IP addresses.

- **Severity:** High 8.3 (`CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:L`)
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 20 Sep 2024
- **Updated:** 20 Sep 2024
- **Also known as:** GHSA-73rg-f94j-xvhx

## What is CVE-2024-47061?

CVE-2024-47061 is a high-severity cross-site scripting vulnerability in udecode plate, published on 20 Sep 2024. Any signed-in user can exploit it over the network, with no action from the victim.

### Official description

Plate is a javascript toolkit that makes it easier for you to develop with Slate, a popular framework for building text editors. One longstanding feature of Plate is the ability to add custom DOM attributes to any element or leaf using the `attributes` property. These attributes are passed to the node component using the `nodeProps` prop. It has come to our attention that this feature can be used for malicious purposes, including cross-site scripting (XSS) and information exposure (specifically, users' IP addresses and whether or not they have opened a malicious document). Note that the risk of information exposure via attributes is only relevant to applications in which web requests to arbitrary URLs are not ordinarily allowed. Plate editors that allow users to embed images from arbitrary URLs, for example, already carry the risk of leaking users' IP addresses to third parties. All Plate editors using an affected version of @udecode/plate-core are vulnerable to these information exposure attacks via the style attribute and other attributes that can cause web requests to be sent. In addition, whether or not a Plate editor is vulnerable to cross-site scripting attacks using attributes depends on a number of factors. The most likely DOM attributes to be vulnerable are href and src on links and iframes respectively. Any component that spreads {...nodeProps} onto an <a> or <iframe> element and does not later override href or src will be vulnerable to XSS. In patched versions of Plate, we have disabled element.attributes and leaf.attributes for most attribute names by default, with some exceptions including target, alt, width, height, colspan and rowspan on the link, image, video, table cell and table header cell plugins. If this is a breaking change for you, you can selectively re-enable attributes for certain plugins as follows. Please carefully research and assess the security implications of any attribute you allow, as even seemingly innocuous attributes such as style can be used maliciously. If you are unable to upgrade to any of the patched versions, you should use a tool like patch-package or yarn patch to remove the logic from @udecode/plate-core that adds attributes to nodeProps.

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

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

6 open source packages ship an affected version, including @udecode/plate-core.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `@udecode/plate-core` | npm | All versions | 21.5.1 |
| `@udecode/plate-core` | npm | All versions | 21.5.1 |
| `@udecode/plate-core` | npm | From 22.0.0 | 36.5.9 |
| `@udecode/plate-core` | npm | From 22.0.0 | 36.5.9 |
| `@udecode/plate-core` | npm | From 37.0.0 | 38.0.6 |
| `@udecode/plate-core` | npm | From 37.0.0 | 38.0.6 |

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

Upgrade @udecode/plate-core to a fixed version for your release line: 21.5.1, 36.5.9 or 38.0.6.

## Is CVE-2024-47061 being exploited?

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

## Fix prompt for AI coding agents

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

What it is: CVE-2024-47061 is a high-severity cross-site scripting vulnerability in udecode plate, published on 20 Sep 2024. Any signed-in user can exploit it over the network, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2024-47061 in the wild and no public exploit code.

Affected packages and fixed versions:
- @udecode/plate-core (npm): affected all versions; fixed in 21.5.1
- @udecode/plate-core (npm): affected all versions; fixed in 21.5.1
- @udecode/plate-core (npm): affected from 22.0.0; fixed in 36.5.9
- @udecode/plate-core (npm): affected from 22.0.0; fixed in 36.5.9
- @udecode/plate-core (npm): affected from 37.0.0; fixed in 38.0.6
- @udecode/plate-core (npm): affected from 37.0.0; fixed in 38.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-47061/ (Markdown: https://insights.sbomify.com/CVE-2024-47061/index.md)
```

## Sources

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

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