Summary
Plate allows arbitrary DOM attributes in element.attributes and leaf.attributes
Plate >= 37
For custom plugins, specify the list of allowed attribute names in the node.dangerouslyAllowAttributes plugin configuration option.
const ImagePlugin = createPlatePlugin({
key: 'image',
node: {
isElement: true,
isVoid: true,
dangerouslyAllowAttributes: ['alt'],
},
});
To modify an existing plugin, use the extend method.
const MyImagePlugin = ImagePlugin.extend({
node: {
dangerouslyAllowAttributes: ['alt'],
},
});
Plate < 37
Note that the patch has been backported to versions @udecode/[email protected] and @udecode/[email protected] only.
For custom plugins, specify the list of allowed attribute names in the dangerouslyAllowAttributes plugin configuration option.
const createImagePlugin = createPluginFactory({
key: 'image',
isElement: true,
isVoid: true,
dangerouslyAllowAttributes: ['alt'],
});
To modify an existing plugin, pass dangerouslyAllowAttributes to the plugin factory.
createImagePlugin({
dangerouslyAllowAttributes: ['alt'],
});
Workarounds
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.
This logic can be found in the getRenderNodeProps function and looks something like this. The entire if statment can safely be removed.
if (!newProps.nodeProps && attributes) {
newProps.nodeProps = attributes;
}
After applying the patch, be sure to test its effectiveness by rendering a Slate value containing an attributes property on some element.
[{
type: 'p',
attributes: { 'data-vulnerable': true },
children: [{ text: 'My paragraph' }],
}]
If the patch was successful, the data-vulnerable="true" attribute should not be present on any DOM element when the Plate editor is rendered in the browser.
Impact
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
Untrusted input is rendered as active markup in a victim's browser, which can run script in their session. Typical impact: session or credential theft, and actions taken as the user.
CVE-2024-47061 has a CVSS score of 8.3 (High). The vector is network-reachable, low privileges required, and no user interaction. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (38.0.6, 36.5.9, 21.5.1); upgrading removes the vulnerable code path.
Affected versions
Security releases
Kodem intelligence
Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.
Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.
Already deployed Kodem?
See it in your environmentNew to Kodem? Get a demo →Remediation advice
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.
Frequently Asked Questions
- What is CVE-2024-47061? CVE-2024-47061 is a high-severity cross-site scripting (XSS) vulnerability in @udecode/plate-core (npm), affecting versions >= 37.0.0, < 38.0.6. It is fixed in 38.0.6, 36.5.9, 21.5.1. Untrusted input is rendered as active markup in a victim's browser, which can run script in their session.
- How severe is CVE-2024-47061? CVE-2024-47061 has a CVSS score of 8.3 (High). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
- Which versions of @udecode/plate-core are affected by CVE-2024-47061? @udecode/plate-core (npm) versions >= 37.0.0, < 38.0.6 is affected.
- Is there a fix for CVE-2024-47061? Yes. CVE-2024-47061 is fixed in 38.0.6, 36.5.9, 21.5.1. Upgrade to this version or later.
- Is CVE-2024-47061 exploitable, and should I be worried? Whether CVE-2024-47061 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
- What actually determines whether CVE-2024-47061 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
- How do I fix CVE-2024-47061?
- Upgrade
@udecode/plate-coreto 38.0.6 or later - Upgrade
@udecode/plate-coreto 36.5.9 or later - Upgrade
@udecode/plate-coreto 21.5.1 or later
- Upgrade