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

CVE-2024-40631: Plate media plugins has a XSS in media embed element when using custom URL parsers

July 15, 2024

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 instead consume the url property directly may also be vulnerable if the URL is not sanitised.

The default parsers parseTwitterUrl and parseVideoUrl are not affected.

Examples of vulnerable code:

const { embed } = useMediaState({
urlParsers: [
// Custom parser that does not use an allowlist or validate the URL protocol
(url) => ({ url }),
],
});

return (
<iframe
src={embed!.url}
// ...
/>
);
const { url } = useMediaState();

return (
<iframe
// url property used directly from useMediaState() with no sanitisation
src={url}
// ...
/>
);
const { url } = element;

return (
<iframe
// url property used directly from element with no sanitisation
src={url}
// ...
/>
);

References

  • github.com/advisories/GHSA-h3pq-667x-r789
  • github.com/udecode/plate
  • github.com/udecode/plate/commit/1bc0971774fbfb770780c9bdb94746a6f0f196a0
  • github.com/udecode/plate/security/advisories/GHSA-h3pq-667x-r789
  • nvd.nist.gov/vuln/detail/CVE-2024-40631

Code Behaviors & Features

Detect and mitigate CVE-2024-40631 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 36.0.10

Fixed versions

  • 36.0.10

Solution

Upgrade to version 36.0.10 or above.

Impact 8.1 HIGH

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

Learn more about CVSS

Weakness

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

Source file

npm/@udecode/plate-media/CVE-2024-40631.yml

Spotted a mistake? Edit the file on GitLab.

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

Page generated Wed, 14 May 2025 12:15:11 +0000.