Skip to content

Missing key derivation #1

@akx

Description

@akx

Hi,

It looks like you're not using any sort of key derivation algorithm, so it's very easy/fast to brute-force keys to try and decrypt the chaabi file.

The crypto.createCipher documentation touches upon this, and notes that it's not safe to use createCipher with CTR mode, either:

The implementation of crypto.createCipher() derives keys using the OpenSSL function EVP_BytesToKey with the digest algorithm set to MD5, one iteration, and no salt. The lack of salt allows dictionary attacks as the same password always creates the same key. The low iteration count and non-cryptographically secure hash algorithm allow passwords to be tested very rapidly.
In line with OpenSSL's recommendation to use pbkdf2 instead of EVP_BytesToKey it is recommended that developers derive a key and IV on their own using crypto.pbkdf2() and to use crypto.createCipheriv() to create the Cipher object. Users should not use ciphers with counter mode (e.g. CTR, GCM or CCM) in crypto.createCipher().

ps. Found the project via https://dev.to/ben/what-are-some-useful-npm-packages-i-might-not-know-about-55i

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions