Skip to content

chore(dependencies): update dependency crypto-js to v4.2.0 [security]#956

Open
renovate[bot] wants to merge 1 commit intomasterfrom
renovate/npm-crypto-js-vulnerability
Open

chore(dependencies): update dependency crypto-js to v4.2.0 [security]#956
renovate[bot] wants to merge 1 commit intomasterfrom
renovate/npm-crypto-js-vulnerability

Conversation

@renovate
Copy link
Copy Markdown
Contributor

@renovate renovate Bot commented Oct 26, 2023

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
crypto-js 4.1.14.2.0 age adoption passing confidence

crypto-js PBKDF2 1,000 times weaker than specified in 1993 and 1.3M times weaker than current standard

CVE-2023-46233 / GHSA-xwcq-pm8m-c4vf

More information

Details

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:

  1. If used to protect passwords, the impact is high.
  2. If used to generate signatures, the impact is high.

Probability / risk analysis / attack enumeration:

  1. For at most $45,000, an attacker, given control of only the beginning of a crypto-js PBKDF2 input, can create a value which has identical cryptographic signature to any chosen known value.
  2. Due to the length extension attack on SHA1, we can create a value that has identical signature to any unknown value, provided it is prefixed by a known value. It does not matter if PBKDF2 applies 'salt' or 'pepper' or any other secret unknown to the attacker. It will still create an identical signature.

Update: PBKDF2 requires a pseudo-random function that takes two inputs, so HMAC-SHA1 is used rather than plain SHA1. HMAC is not affected by length extension attacks. However, by defaulting to a single PBKDF2 iteration, the hashes do not benefit from the extra computational complexity that PBKDF2 is supposed to provide. The resulting hashes therefore have little protection against an offline brute-force attack.

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 an encryption_key that can be determined from the public username, but which requires the secret salt_or_pepper to 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_pepper to 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.

Severity

  • CVSS Score: 9.1 / 10 (Critical)
  • Vector String: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N

References

This data is provided by the GitHub Advisory Database (CC-BY 4.0).


Release Notes

brix/crypto-js (crypto-js)

v4.2.0

Compare Source


Configuration

📅 Schedule: (UTC)

  • Branch creation
    • ""
  • 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.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@vercel
Copy link
Copy Markdown

vercel Bot commented Oct 26, 2023

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
fulltextrssplz Ready Ready Preview, Comment Apr 29, 2026 2:01am

@codecov
Copy link
Copy Markdown

codecov Bot commented Oct 26, 2023

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (4f653de) to head (107b966).

Additional details and impacted files
@@            Coverage Diff            @@
##            master      #956   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            1         1           
  Lines            9         9           
=========================================
  Hits             9         9           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@renovate renovate Bot force-pushed the renovate/npm-crypto-js-vulnerability branch from 39f96d0 to f9a1fab Compare November 20, 2024 13:57
@renovate renovate Bot force-pushed the renovate/npm-crypto-js-vulnerability branch from f9a1fab to f2f54ba Compare January 23, 2025 20:46
@renovate renovate Bot force-pushed the renovate/npm-crypto-js-vulnerability branch from f2f54ba to 5b64137 Compare August 10, 2025 12:52
@renovate renovate Bot changed the title fix(dependencies): update dependency crypto-js to v4.2.0 [security] chore(dependencies): update dependency crypto-js to v4.2.0 [security] Sep 25, 2025
@renovate renovate Bot force-pushed the renovate/npm-crypto-js-vulnerability branch from 5b64137 to b115bc2 Compare January 4, 2026 21:32
@renovate renovate Bot force-pushed the renovate/npm-crypto-js-vulnerability branch from b115bc2 to db0c265 Compare February 28, 2026 06:37
@renovate renovate Bot force-pushed the renovate/npm-crypto-js-vulnerability branch from db0c265 to 979bc9e Compare February 28, 2026 09:12
@renovate renovate Bot force-pushed the renovate/npm-crypto-js-vulnerability branch from 979bc9e to 16a5574 Compare February 28, 2026 12:53
@renovate renovate Bot changed the title chore(dependencies): update dependency crypto-js to v4.2.0 [security] chore(dependencies): update dependency crypto-js to v4.2.0 [security] - autoclosed Mar 9, 2026
@renovate renovate Bot closed this Mar 9, 2026
@renovate renovate Bot deleted the renovate/npm-crypto-js-vulnerability branch March 9, 2026 17:53
@renovate renovate Bot changed the title chore(dependencies): update dependency crypto-js to v4.2.0 [security] - autoclosed chore(dependencies): update dependency crypto-js to v4.2.0 [security] Mar 9, 2026
@renovate renovate Bot reopened this Mar 9, 2026
@renovate renovate Bot force-pushed the renovate/npm-crypto-js-vulnerability branch 2 times, most recently from 16a5574 to 3084f48 Compare March 9, 2026 22:10
@renovate renovate Bot changed the title chore(dependencies): update dependency crypto-js to v4.2.0 [security] chore(dependencies): update dependency crypto-js to v4.2.0 [security] - autoclosed Mar 27, 2026
@renovate renovate Bot closed this Mar 27, 2026
@renovate renovate Bot changed the title chore(dependencies): update dependency crypto-js to v4.2.0 [security] - autoclosed chore(dependencies): update dependency crypto-js to v4.2.0 [security] Mar 30, 2026
@renovate renovate Bot force-pushed the renovate/npm-crypto-js-vulnerability branch from 354cb4a to 630ff2b Compare April 26, 2026 13:32
@renovate renovate Bot force-pushed the renovate/npm-crypto-js-vulnerability branch from 630ff2b to de2e64e Compare April 26, 2026 18:01
@renovate renovate Bot force-pushed the renovate/npm-crypto-js-vulnerability branch from de2e64e to 84ba202 Compare April 26, 2026 21:04
@renovate renovate Bot force-pushed the renovate/npm-crypto-js-vulnerability branch from 84ba202 to de6ff66 Compare April 27, 2026 02:29
@renovate renovate Bot force-pushed the renovate/npm-crypto-js-vulnerability branch from de6ff66 to 3c5da71 Compare April 27, 2026 05:20
@renovate renovate Bot force-pushed the renovate/npm-crypto-js-vulnerability branch from 3c5da71 to 56296d0 Compare April 27, 2026 11:35
@renovate renovate Bot force-pushed the renovate/npm-crypto-js-vulnerability branch from 56296d0 to 9ee7bd4 Compare April 27, 2026 15:05
@renovate renovate Bot force-pushed the renovate/npm-crypto-js-vulnerability branch from 9ee7bd4 to 7f0b266 Compare April 27, 2026 19:46
@renovate renovate Bot force-pushed the renovate/npm-crypto-js-vulnerability branch from 7f0b266 to e215d45 Compare April 27, 2026 22:07
@renovate renovate Bot force-pushed the renovate/npm-crypto-js-vulnerability branch from e215d45 to d31ac5e Compare April 28, 2026 06:04
@renovate renovate Bot force-pushed the renovate/npm-crypto-js-vulnerability branch from d31ac5e to abb297c Compare April 28, 2026 11:40
@renovate renovate Bot force-pushed the renovate/npm-crypto-js-vulnerability branch from abb297c to 7a8bf69 Compare April 28, 2026 16:55
@renovate renovate Bot force-pushed the renovate/npm-crypto-js-vulnerability branch from 7a8bf69 to 7b79510 Compare April 28, 2026 23:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants