GitHub Advisoryadvisory · npm

GHSA-cmh5-qc8w-xvcq Cross-Site Scripting in i18next

MEDIUM Published 2018-07-24 Modified 2023-09-08 Official page ↗
Aliases
CVE-2017-16010
Ecosystem
npm
Packages
i18next
Severity
Moderate
CVSS vector
CVSS:3.0/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
Weaknesses
CWE-79
Reviewed
2020-06-16

Affected packages

• npm i18next: >= 2.0.0, < 3.4.4 → fixed in 3.4.4

Description

Affected versions of `i18next` may fail to sanitize user input when certain configuration options are used. When using the `.init` method, passing interpolation options without passing an `escapeValue` will default to `undefined` rather than the assumed `true`. Proof of Concept ```js var init = i18n.init({ interpolation: { prefix: "__", suffix: "__", escapeValue: true } }, function(){ var test = i18n.t('__firstName__ __lastName__', { firstName: 'Bob', lastName: '["foo","bar"]', }); console.log(test); }); ``` When `escapeValue` is explicitly passed, the result of `test` is: ```html &lt;script&gt;alert(1)&lt;&#x2F;script&gt; Johnson ``` This is supposed to be the default. However, if `escapeValue` is not included, the result is the unescaped string: ```html alert(1) Johnson ``` Recommendation Update to version 3.4.4 or later.

Related

Alias · CVE (1)

  • CVE-2017-16010 i18next is a language translation framework. vulnerability

Weakness · CWE (1)

  • CWE-79 Improper Neutralization of Input During Web Page Generation weakness

References