GitHub Advisoryadvisory · npm

GHSA-h5vj-f7r9-w564 Entropy Backdoor in text-qrcode

HIGH Published 2020-09-01 Modified 2021-10-01 Official page ↗
Ecosystem
npm
Packages
text-qrcode
Severity
High
CVSS vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Weaknesses
CWE-506
Reviewed
2020-08-31

Affected packages

• npm text-qrcode: >= 0.0.0 (no fix yet)

Description

All versions of `text-qrcode` contain malicious code that overwrites the `randomBytes` method for the `crypto` module with a function that generates weak entropy. Instead of generating 32 bytes, the infected randomBytes will generate 3 bytes of entropy and hash them, resulting in a 32 byte value being returned, but one that is easily guessable. Recommendation Uninstall `text-qrcode` immediately. If the module was used to generate entropy that is load bearing, all such instances of generated entropy must be replaced. This includes things like bitcoin wallets, private keys, encrypted messages, etc.

Related

Weakness · CWE (1)

  • CWE-506 Embedded Malicious Code weakness

References