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

- Severity: High 9.8 (CVSS:3.1, scored by GitHub) `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Published: 2020-09-01T21:22:35.000Z
- Modified: 2021-10-01T13:30:18.000Z
- Weaknesses: CWE-506

## 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.

(As written by GitHub Advisory Database.)

## Affected

- text-qrcode (npm): from 0.0.0

## References

- <https://www.npmjs.com/advisories/738> (web)

## Sources

- GitHub Advisory Database: [GHSA-h5vj-f7r9-w564](https://github.com/advisories/GHSA-h5vj-f7r9-w564), CC-BY-4.0, modified 2021-10-01

---

Page: https://cve.day/GHSA-h5vj-f7r9-w564 · Whole record: https://cve.day/GHSA-h5vj-f7r9-w564.json · Rebuilt by cve.day 2026-11-25T22:56:45.542Z
