# GHSA-MP7H-J8PR-W35W: Prototype Pollution via the locale argument of mergeLocaleMessage, mergeDateTimeFormat and mergeNumberFormat

- Database: GitHub
- Severity: CVSS 7.3 (High)
- Published: 2026-10-10
- Modified: 2026-12-03

## Tracked as

- [CVE-2026-144409](https://cve.now/CVE-2026-144409.md): Vue I18n: Prototype Pollution via the locale argument of mergeLocaleMessage, mergeDateTimeFormat and mergeNumberFormat

## Affected versions

- vue-i18n (npm): from 7.0.0, fixed in 9.0.0
- vue-i18n (npm): from 9.0.0, fixed in 11.4.14
- vue-i18n (npm): from 12.0.0-alpha.1, fixed in 12.0.0-alpha.5
- petite-vue-i18n (npm): from 9.2.0-alpha.7, fixed in 11.4.14
- petite-vue-i18n (npm): from 12.0.0-alpha.1, fixed in 12.0.0-alpha.5
- @intlify/vue-i18n-core (npm): from 9.2.0-alpha.7, fixed in 11.4.14
- @intlify/vue-i18n-core (npm): from 12.0.0-alpha.1, fixed in 12.0.0-alpha.5
- @intlify/core-base (npm): from 12.0.0-alpha.1, fixed in 12.0.0-alpha.5
- @intlify/core (npm): from 12.0.0-alpha.1, fixed in 12.0.0-alpha.5
- vue-i18n-bridge (npm): through 10.0.0-alpha.1

## 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.

In v12 alpha, `setLocaleMessage(ctx, locale, messages)` of `@intlify/core-base`, which `@intlify/core` re-exports, assigns in the same way: with `'__proto__'`, it replaces the prototype of `ctx.messages`, the `messages` object passed to `createCoreContext()`.

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](https://github.com/intlify/vue-i18n/blob/v11.4.13/packages/vue-i18n-core/src/composer.ts#L2532-L2592)):

```ts
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.

`setLocaleMessage(ctx, locale, messages)` of `@intlify/core-base` v12 alpha assigns with `ctx.messages[locale] = messages` ([context.ts in v12.0.0-alpha.4](https://github.com/intlify/vue-i18n/blob/v12.0.0-alpha.4/packages/core-base/src/context.ts#L608-L614)), so `'__proto__'` replaces the prototype of `ctx.messages` in the same way.

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()`:

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

Output:

```text
Before Attack:  {}
After Attack:  {"pollutedKey":123}
```

```js
// 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()`:

```bash
node poc-constructor.mjs
```

Output:

```text
Before Attack:  function
After Attack:  object
TypeError: Object.keys is not a function
```

```js
// 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()`:

```bash
node poc-set.mjs
```

Output:

```text
Before Attack:  hello
After Attack:  injected
```

```js
// 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:

```js
// 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' })`.

```js
const SUPPORTED_LOCALES = ['en', 'ja']

if (SUPPORTED_LOCALES.includes(lang)) {
  i18n.global.mergeLocaleMessage(lang, messages)
}
```

### Patches

Fixed in 11.4.14 and 12.0.0-alpha.5. `mergeLocaleMessage()`, `mergeDateTimeFormat()`, `mergeNumberFormat()` and the three setters now ignore a locale that is a property name of `Object.prototype`, such as `'__proto__'`, `'constructor'` or `'toString'`, with a warning in development builds, and the getters and `tm()` look up only locales that the containers have as their own properties. The fix also covers `setLocaleMessage(ctx)` of `@intlify/core-base` in v12 alpha and the keys of the `sharedMessages` option of the Legacy API in v11.

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

### References

- [CWE-1321](https://cwe.mitre.org/data/definitions/1321.html)
- [CWE-915](https://cwe.mitre.org/data/definitions/915.html)
- [OWASP Prototype Pollution Prevention Cheat Sheet](https://cheatsheetseries.owasp.org/cheatsheets/Prototype_Pollution_Prevention_Cheat_Sheet.html)
- [GHSA-hjwq-mjwj-4x6c](https://github.com/intlify/vue-i18n/security/advisories/GHSA-hjwq-mjwj-4x6c) (CVE-2024-52810): prototype pollution in `deepCopy()` through its source

## References

- https://github.com/intlify/vue-i18n/security/advisories/GHSA-mp7h-j8pr-w35w

Page: https://cve.now/GHSA-MP7H-J8PR-W35W

Wrong or missing data? Send feedback: POST https://cve.now/api/v1/feedback (see https://cve.now/agents#feedback).
