Skip to main content
Vulnerability Database/CVE-2024-52809

CVE-2024-52809: Vue-i18n XSS Vulnerability

CVE-2024-52809 is a cross-site scripting flaw in vue-i18n internationalization plugin that occurs during AST generation in development mode. This post explains its impact, affected versions, and mitigation steps.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2024-52809 Overview

CVE-2024-52809 is a Cross-Site Scripting (XSS) vulnerability [CWE-79] in vue-i18n, the internationalization plugin for Vue.js. The flaw affects applications that pass locale messages to createI18n or useI18n when locale message Abstract Syntax Trees (ASTs) are generated in development mode. An attacker who can influence Object.prototype through prototype pollution can trigger script execution during message compilation. The issue is resolved in versions 9.14.2 and 10.0.5. There are no known workarounds, and users must upgrade to a fixed release.

Critical Impact

Prototype pollution combined with vue-i18n's development-mode AST compilation can lead to arbitrary JavaScript execution in the browser context.

Affected Products

  • vue-i18n versions prior to 9.14.2 (9.x branch)
  • vue-i18n versions prior to 10.0.5 (10.x branch)
  • Applications generating locale message ASTs in development mode

Discovery Timeline

  • 2024-11-29 - CVE-2024-52809 published to the National Vulnerability Database (NVD)
  • 2026-06-17 - Last updated in NVD database

Technical Details for CVE-2024-52809

Vulnerability Analysis

vue-i18n compiles locale messages into an optimized AST representation that is consumed at runtime by the message compiler. In development mode, or when applications supply their own ASTs rather than relying on the production-time optimizer @intlify/unplugin-vue-i18n, the compiler reads node properties such as static directly from AST objects. The lookup does not verify that the property is an own property of the node, so the resolver falls through to Object.prototype.

If attacker-controlled code has polluted Object.prototype with a static getter, that getter executes when vue-i18n resolves the AST node type. The getter can return attacker-chosen strings that flow into rendered DOM output, producing stored or reflected XSS depending on where the compiled message is displayed.

Root Cause

The root cause is unsafe property access on untrusted or prototype-polluted objects inside packages/core-base/src/compilation.ts and packages/core-base/src/context.ts. The fix introduces hasOwn guards, a resolveType helper, and create to build prototype-less objects, preventing lookups from walking the prototype chain.

Attack Vector

Exploitation requires a secondary vector that pollutes Object.prototype, such as a prototype pollution gadget elsewhere in the application, a supply-chain compromise of a loaded script, or a malicious third-party dependency. Once pollution occurs, any vue-i18n message rendered through the development-mode AST path triggers the attacker-defined getter.

html
<!doctype html>
<html>
  <head>
    <meta charset="utf-8" />
    <title>vue-i18n XSS</title>
    <script src="../../node_modules/vue/dist/vue.global.js"></script>
    <script src="../../packages/vue-i18n/dist/vue-i18n.global.js"></script>
    <script>
      // Prototype pollution gadget injected via supply chain or malicious script
      Object.defineProperty(Object.prototype, 'static', {
        configurable: true,
        get() {
          alert('prototype polluted!')
          return 'prototype pollution'
        }
      })
    </script>
  </head>
  <body>
    <div id="app">
      <p>{{ t('hello') }}</p>
    </div>
  </body>
</html>

Source: GitHub Commit 72f0d32 - e2e/hotfix/CVE-2024-52809.html

Detection Methods for CVE-2024-52809

Indicators of Compromise

  • Unexpected script execution or alert-style dialogs rendered inside Vue components backed by vue-i18n translations.
  • Browser console entries indicating property access on Object.prototype for properties such as static, type, or body.
  • Outbound requests from end-user browsers to domains not referenced by legitimate application code.

Detection Strategies

  • Inventory package.json and lockfiles across repositories to identify vue-i18n versions below 9.14.2 or 10.0.5.
  • Audit dependencies for known prototype pollution gadgets using tools such as npm audit, Snyk, or OSV-Scanner.
  • Review build pipelines to confirm production bundles use @intlify/unplugin-vue-i18n AST optimization rather than development-mode compilation.

Monitoring Recommendations

  • Enable Content Security Policy (CSP) reporting to capture inline script violations originating from vue-i18n rendered content.
  • Monitor web application logs for anomalous payloads in URL parameters or user-controlled strings that reach i18n message interpolation.
  • Alert on new or modified JavaScript assets introduced into third-party dependency trees via software composition analysis.

How to Mitigate CVE-2024-52809

Immediate Actions Required

  • Upgrade vue-i18n to version 9.14.2 on the 9.x branch or 10.0.5 on the 10.x branch.
  • Rebuild and redeploy any Vue.js applications that bundle vue-i18n after the upgrade.
  • Audit the dependency tree for packages that write to Object.prototype and remove or replace them.

Patch Information

The maintainers released fixes in commits 72f0d32 and 9f20909. The patches add hasOwn guards to AST node property resolution, introduce a resolveType helper, and use a create utility to construct prototype-less context objects. See the GitHub Security Advisory GHSA-9r9m-ffp6-9x4v for full details.

Workarounds

  • No official workaround exists; upgrading to a patched version is required.
  • As a defense-in-depth measure, enforce a strict Content Security Policy to limit the impact of injected scripts.
  • Use @intlify/unplugin-vue-i18n to pre-compile locale messages for production builds and avoid shipping development-mode AST generation.
bash
# Upgrade vue-i18n to a patched release
npm install vue-i18n@^9.14.2
# or for the 10.x branch
npm install vue-i18n@^10.0.5

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.