Advisory Database
  • Advisories
  • Dependency Scanning
  1. npm
  2. ›
  3. @udecode/plate-core
  4. ›
  5. CVE-2024-47061

CVE-2024-47061: Plate allows arbitrary DOM attributes in element.attributes and leaf.attributes

September 20, 2024

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.

Note: The attributes prop that is typically rendered alongside nodeProps is unrelated.

[{
type: 'p',
attributes: { 'data-my-attribute': 'This will be rendered on the paragraph element' },
children: [{
bold: true,
attributes: { 'data-my-attribute': 'This will be rendered on the bold leaf element' },
text: 'Bold text',
}],
}]
const ParagraphElement = ({ attributes, nodeProps, children }) => (
<p
{...attributes}
{...nodeProps} // Arbitrary DOM attributes are injected here
>
{children}
</p>
);

const BoldLeaf = ({ attributes, nodeProps, children }) => (
<strong
{...attributes}
{...nodeProps} // Arbitrary DOM attributes are injected here
>
{children}
</strong>
);

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.

<a
href={sanitizedHref}
{...attributes}
{...nodeProps} // Definitely vulnerable to XSS since `href` can be overridden
>
<a
{...attributes}
{...nodeProps} // Probably not vulnerable to XSS via `href`
href={sanitizedHref}
>
<a
{...attributes}
{...nodeProps} // May be vulnerable to XSS via `href` if `href` is sometimes omitted from `sanitizedLinkProps`
{...sanitizedLinkProps}
>

React does not allow passing a string to event handler props like onClick, so these are unlikely (but not impossible) to be vulnerable.

The attack surface is larger for users running older browsers, which may be vulnerable to XSS in DOM attributes that are less dangerous (although still vulnerable to information exposure) in modern browsers such as style or background.

Potential attack vectors for delivering malicious Slate content to users include:

  • Opening a malicious document stored on the server
  • Pasting a malicious Slate fragment into a document
  • Receiving malicious Slate operations on a collaborative document

References

  • github.com/advisories/GHSA-73rg-f94j-xvhx
  • github.com/udecode/plate
  • github.com/udecode/plate/commit/16df6074edac22d56c60e0283eae0740230401c9
  • github.com/udecode/plate/security/advisories/GHSA-73rg-f94j-xvhx
  • nvd.nist.gov/vuln/detail/CVE-2024-47061
  • www.npmjs.com/package/patch-package
  • yarnpkg.com/cli/patch

Code Behaviors & Features

Detect and mitigate CVE-2024-47061 with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →

Affected versions

All versions before 21.5.1, all versions starting from 22.0.0 before 36.5.9, all versions starting from 37.0.0 before 38.0.6

Fixed versions

  • 38.0.6
  • 36.5.9
  • 21.5.1

Solution

Upgrade to versions 21.5.1, 36.5.9, 38.0.6 or above.

Impact 8.3 HIGH

CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:L

Learn more about CVSS

Weakness

  • CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')

Source file

npm/@udecode/plate-core/CVE-2024-47061.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Wed, 14 May 2025 12:16:09 +0000.