Cross-site Scripting (XSS)petite-vue-i18n is a Vue I18n lite version
Affected versions of this package are vulnerable to Cross-site Scripting (XSS) via sanitizeTranslatedHtml() in packages/shared/src/sanitize.ts, which fails to neutralize javascript: URLs in unterminated attribute values. When escapeParameter (or escapeParameterHtml in the Legacy API) is enabled, the sanitizer's quoted-attribute regex requires a closing quote inside the message, and the unquoted-attribute regex rejects any value beginning with a quote character. A translation message that opens an attribute value without closing it therefore passes through with its javascript: URL intact. In server-side rendering, the HTML tokenizer continues reading across the message boundary and closes the unterminated attribute at the next " in the surrounding page markup, causing the browser to emit an <iframe> or <a> element with an attacker-controlled javascript: URL as its src or href. An <iframe src="javascript:..."> executes without any user interaction in the application's origin, giving an attacker who controls translation content stored XSS against every visitor of the affected page.
Note: This is only exploitable when escapeParameter is enabled, translations are rendered as HTML on the server (via v-html/innerHTML in SSR, Nuxt, or pre-rendered pages), and the translation messages are not fully trusted (e.g. crowdsourced or externally stored).
How to fix Cross-site Scripting (XSS)? Upgrade petite-vue-i18n to version 11.4.19, 12.0.0-alpha.10 or higher.
| <11.4.19>=12.0.0-alpha.4 <12.0.0-alpha.10 |