Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Simple, effective, easy to implement encryption for JavaScript
const { encrypt, decrypt, hash, hashCompare } = require('keyhasher');
const passCode = process.env.PASS_CODE || 572; // set a passCode in .env or use directly
var encryptedWord = encrypt('passwordInput', passCode);
console.log(`Encrypted Phrase: ${encryptedWord}`) // Output: "QGFkX1NeEkVXYGZXYFVX"
var rawWord = decrypt(encryptedWord, passCode);
console.log(`Output: ${rawWord}`) // Output: "Normal Sentence"
const hashed = hash(encryptedWord); // encryption + hashing
console.log(`Hashed: ${hashed}`) // Output: "5bf22a00c0df8757f68e700066bd56c5edffc4103f9587666ccbde062a0f52f5"
const isCorrect = hashCompare(hash('user given password'), hashed);
// it hashes user input And compares with the hashed value stored in database
console.log(isCorrect); // returns a boolean
The hashCompare() function can't be affected with Timing attack.
Timing attacks are a type of attack that can be used to determine the contents of a secret string by measuring the time it takes to compare two strings character-by-character. To prevent timing attacks, Keyhasher uses a constant-time string comparison algorithm.
The use of Buffer in the implementation of the secure string comparison function is to convert the input strings into a format that can be easily compared byte-by-byte in a constant-time manner. Buffer is a built-in class in Node.js that provides a way to represent binary data in the form of a fixed-size sequence of bytes.
FAQs
Simple, effective, easy to implement encryption for JavaScript
We found that keyhasher demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.