-
Notifications
You must be signed in to change notification settings - Fork 94
fix(deps)!: Update dependency crypto-js to v4 [SECURITY] #177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Collaborator
|
/gcbrun |
f2c3269 to
34a133d
Compare
Collaborator
|
/gcbrun |
34a133d to
16593f8
Compare
Collaborator
|
/gcbrun |
16593f8 to
470e13e
Compare
Collaborator
|
/gcbrun |
470e13e to
1fff79e
Compare
Collaborator
|
/gcbrun |
1fff79e to
1b058d5
Compare
Collaborator
|
/gcbrun |
1b058d5 to
9b34a3b
Compare
Collaborator
|
/gcbrun |
9b34a3b to
600001a
Compare
Collaborator
|
/gcbrun |
600001a to
7e5df31
Compare
Collaborator
|
/gcbrun |
7e5df31 to
bea1bc5
Compare
Collaborator
|
/gcbrun |
bea1bc5 to
082c06d
Compare
Collaborator
|
/gcbrun |
082c06d to
d3a5d73
Compare
Collaborator
|
/gcbrun |
d3a5d73 to
4c37898
Compare
Collaborator
|
/gcbrun |
4c37898 to
6eaafd9
Compare
Collaborator
|
/gcbrun |
Collaborator
|
/gcbrun |
fa3a76b to
a7827e8
Compare
Collaborator
|
/gcbrun |
a7827e8 to
0e17c05
Compare
Collaborator
|
/gcbrun |
0e17c05 to
8a29fa0
Compare
Collaborator
|
/gcbrun |
8a29fa0 to
cc88188
Compare
Collaborator
|
/gcbrun |
cc88188 to
98a2adc
Compare
Collaborator
|
/gcbrun |
98a2adc to
f7838a4
Compare
Collaborator
|
/gcbrun |
f7838a4 to
9af10a5
Compare
Collaborator
|
/gcbrun |
9af10a5 to
d7a0269
Compare
Collaborator
|
/gcbrun |
d7a0269 to
28f5dbd
Compare
Collaborator
|
/gcbrun |
28f5dbd to
7d25695
Compare
Collaborator
|
/gcbrun |
7d25695 to
bc03b0a
Compare
Collaborator
|
/gcbrun |
bc03b0a to
6942842
Compare
Collaborator
|
/gcbrun |
apeabody
approved these changes
Jan 8, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
^3.0.0->^4.2.0GitHub Vulnerability Alerts
CVE-2023-46233
Impact
Summary
Crypto-js PBKDF2 is 1,000 times weaker than originally specified in 1993, and at least 1,300,000 times weaker than current industry standard. This is because it both (1) defaults to SHA1, a cryptographic hash algorithm considered insecure since at least 2005 and (2) defaults to one single iteration, a 'strength' or 'difficulty' value specified at 1,000 when specified in 1993. PBKDF2 relies on iteration count as a countermeasure to preimage and collision attacks.
Potential Impact:
Probability / risk analysis / attack enumeration:
crypto-js has 10,642 public users as displayed on NPM, today October 11th 2023. The number of transient dependents is likely several orders of magnitude higher.
A very rough GitHub search shows 432 files cross GitHub using PBKDF2 in crypto-js in Typescript or JavaScript, but not specifying any number of iterations.
Affected versions
All versions are impacted. This code has been the same since crypto-js was first created.
Further Cryptanalysis
The issue here is especially egregious because the length extension attack makes useless any secret that might be appended to the plaintext before calculating its signature.
Consider a scheme in which a secret is created for a user's username, and that secret is used to protect e.g. their passwords. Let's say that password is 'fake-password', and their username is 'example-username'.
To encrypt the user password via symmetric encryption we might do
encrypt(plaintext: 'fake-password', encryption_key: cryptojs.pbkdf2(value: 'example username' + salt_or_pepper)). By this means, we would, in theory, create anencryption_keythat can be determined from the public username, but which requires the secretsalt_or_pepperto generate. This is a common scheme for protecting passwords, as exemplified in bcrypt & scrypt. Because the encryption key is symmetric, we can use this derived key to also decrypt the ciphertext.Because of the length extension issue, if the attacker obtains (via attack 1), a collision with 'example username', the attacker does not need to know
salt_or_pepperto decrypt their account data, only their public username.Description
PBKDF2 is a key-derivation is a key-derivation function that is used for two main purposes: (1) to stretch or squash a variable length password's entropy into a fixed size for consumption by another cryptographic operation and (2) to reduce the chance of downstream operations recovering the password input (for example, for password storage).
Unlike the modern webcrypto standard, crypto-js does not throw an error when a number of iterations is not specified, and defaults to one single iteration. In the year 2000, when PBKDF2 was originally specified, the minimum number of iterations suggested was set at 1,000. Today, OWASP recommends 1,300,000:
https://github.com/brix/crypto-js/blob/4dcaa7afd08f48cd285463b8f9499cdb242605fa/src/pbkdf2.js#L22-L26
Patches
No available patch. The package is not maintained.
Workarounds
Consult the OWASP PBKDF2 Cheatsheet. Configure to use SHA256 with at least 250,000 iterations.
Coordinated disclosure
This issue was simultaneously submitted to crypto-js and crypto-es on the 23rd of October 2023.
Caveats
This issue was found in a security review that was not scoped to crypto-js. This report is not an indication that crypto-js has undergone a formal security assessment by the author.
Release Notes
brix/crypto-js (crypto-js)
v4.2.0Compare Source
v4.1.1Compare Source
v4.1.0Compare Source
v4.0.0Compare Source
v3.3.0Compare Source
v3.2.1Compare Source
v3.2.0Compare Source
v3.1.8Compare Source
v3.1.7Compare Source
v3.1.6Compare Source
v3.1.5Compare Source
v3.1.4Compare Source
Configuration
📅 Schedule: Branch creation - "" (UTC), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR has been generated by Mend Renovate. View repository job log here.
BEGIN_COMMIT_OVERRIDE
fix(deps): Update dependency crypto-js to v4 [SECURITY] (#177)
END_COMMIT_OVERRIDE