Advisory Database
  • Advisories
  • Dependency Scanning
  1. npm
  2. ›
  3. vite
  4. ›
  5. CVE-2024-45812

CVE-2024-45812: Vite DOM Clobbering gadget found in vite bundled scripts that leads to XSS

September 17, 2024 (updated September 19, 2024)

We discovered a DOM Clobbering vulnerability in Vite when building scripts to cjs/iife/umd output format. The DOM Clobbering gadget in the module can lead to cross-site scripting (XSS) in web pages where scriptless attacker-controlled HTML elements (e.g., an img tag with an unsanitized name attribute) are present.

Note that, we have identified similar security issues in Webpack: https://github.com/webpack/webpack/security/advisories/GHSA-4vvj-4cpr-p986

References

  • github.com/advisories/GHSA-64vr-g452-qvp3
  • github.com/vitejs/vite
  • github.com/vitejs/vite/commit/179b17773cf35c73ddb041f9e6c703fd9f3126af
  • github.com/vitejs/vite/commit/2691bb3ff6b073b41fb9046909e1e03a74e36675
  • github.com/vitejs/vite/commit/2ddd8541ec3b2d2e5b698749e0f2362ef28056bd
  • github.com/vitejs/vite/commit/ade1d89660e17eedfd35652165b0c26905259fad
  • github.com/vitejs/vite/commit/e8127166979e7ace6eeaa2c3b733c8994caa31f3
  • github.com/vitejs/vite/commit/ebb94c5b3bf41950f45562595adec117a4d0ba5e
  • github.com/vitejs/vite/security/advisories/GHSA-64vr-g452-qvp3
  • github.com/webpack/webpack/security/advisories/GHSA-4vvj-4cpr-p986
  • nvd.nist.gov/vuln/detail/CVE-2024-45812
  • research.securitum.com/xss-in-amp4email-dom-clobbering
  • scnps.co/papers/sp23_domclob.pdf

Code Behaviors & Features

Detect and mitigate CVE-2024-45812 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 3.2.11, all versions starting from 4.0.0 before 4.5.4, all versions starting from 5.0.0 before 5.1.8, all versions starting from 5.2.0 before 5.2.14, all versions starting from 5.3.0 before 5.3.6, all versions starting from 5.4.0 before 5.4.6

Fixed versions

  • 5.4.6
  • 5.3.6
  • 5.2.14
  • 4.5.4
  • 3.2.11
  • 5.1.8

Solution

Upgrade to versions 3.2.11, 4.5.4, 5.1.8, 5.2.14, 5.3.6, 5.4.6 or above.

Impact 6.4 MEDIUM

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

Learn more about CVSS

Weakness

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

Source file

npm/vite/CVE-2024-45812.yml

Spotted a mistake? Edit the file on GitLab.

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

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