Vulnerabilities

1 via 1 paths

Dependencies

52

Source

GitHub

Find, fix and prevent vulnerabilities in your code.

Severity
  • 1
Status
  • 1
  • 0
  • 0

medium severity
new

Modification of Assumed-Immutable Data (MAID)

  • Vulnerable module: i18next
  • Introduced through: i18next@20.6.1

Detailed paths

  • Introduced through: @stephenpoole/hex-tooltip@stephenpoole/hex-tooltip › i18next@20.6.1
    Remediation: Upgrade to i18next@26.3.4.

Overview

i18next is an internationalization framework for browser or any other javascript environment (eg. node.js).

Affected versions of this package are vulnerable to Modification of Assumed-Immutable Data (MAID) via the deepExtend function in src/utils.js, which uses the in operator to check for property existence on the target object. Because the in operator traverses the prototype chain, an attacker who can supply a malicious resource bundle containing a property named hasOwnProperty can overwrite Object.prototype.hasOwnProperty, causing process-wide corruption of that built-in and crashing any subsequent code that relies on it.

Note: This is only exploitable when deepExtend is invoked with deep merging enabled, such as through addResourceBundle with the deep parameter set to true.

PoC

import i18next from 'i18next';

await i18next.init({ lng: 'en', resources: { en: { translation: {} } } });

const payload = { hasOwnProperty: { call: 'corrupted' } };
i18next.addResourceBundle('en', 'translation', payload, /* deep */ true, /* overwrite */ true);

// Process-wide corruption:
Object.prototype.hasOwnProperty.call({}, 'test'); // TypeError: ... is not a function

Note: The PoC uses i18next initialised with a default English translation resource and demonstrates process-wide corruption by overwriting Object.prototype.hasOwnProperty via addResourceBundle with deep and overwrite flags set to true.

Remediation

Upgrade i18next to version 26.3.4 or higher.

References