CVE-2024-52809: vue-i18n has cross-site scripting vulnerability with prototype pollution
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.
References
- github.com/advisories/GHSA-9r9m-ffp6-9x4v
- github.com/intlify/vue-i18n
- github.com/intlify/vue-i18n/commit/72f0d323006fc7363b18cab62d4522dadd874411
- github.com/intlify/vue-i18n/commit/9f20909ef8c9232a1072d7818e12ed6d6451024d
- github.com/intlify/vue-i18n/security/advisories/GHSA-9r9m-ffp6-9x4v
- nvd.nist.gov/vuln/detail/CVE-2024-52809
Detect and mitigate CVE-2024-52809 with GitLab Dependency Scanning
Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →