Описание
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)
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
Пакеты
@intlify/core-base
>= 9.3.0, < 9.14.2
9.14.2
vue-i18n
>= 9.3.0, < 9.14.2
9.14.2
@intlify/core
>= 9.3.0, < 9.14.2
9.14.2
@intlify/vue-i18n-core
>= 9.3.0, < 9.14.2
9.14.2
petite-vue-i18n
>= 10.0.0, < 10.0.5
10.0.5
@intlify/core-base
>= 10.0.0, < 10.0.5
10.0.5
vue-i18n
>= 10.0.0, < 10.0.5
10.0.5
@intlify/core
>= 10.0.0, < 10.0.5
10.0.5
@intlify/vue-i18n-core
>= 10.0.0, < 10.0.5
10.0.5
Связанные уязвимости
vue-i18n is an internationalization plugin for Vue.js. In affected versions vue-i18n can be passed locale messages to `createI18n` or `useI18n`. When locale message ASTs are generated in development mode there is a possibility of Cross-site Scripting attack. This issue has been addressed in versions 9.14.2, and 10.0.5. Users are advised to upgrade. There are no known workarounds for this vulnerability.