Advisory

GHSA-cmh5-qc8w-xvcq

Also known as: CVE-2017-16010

Summary

Cross-Site Scripting in i18next

Details

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

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:

<script>alert(1)</script> Johnson

This is supposed to be the default. However, if escapeValue is not included, the result is the unescaped string:

<script>alert(1)</script> Johnson

Recommendation

Update to version 3.4.4 or later.

Severity

Medium Basis: The source's own band: MODERATE

Dates

Published
2018-07-24 19:58 UTC
Modified
2023-11-08 03:58 UTC

Affected packages and fixes

i18next

npm · All systems

Affected

  • introduced 2.0.0, fixed 3.4.4 (semver)

Fixed versions

3.4.4

Fix

Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.

Check your own computer: guard packages check

View this record on OSV.dev

Source

Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0

Sources & licences