Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@renovate
Copy link
Contributor

@renovate renovate bot commented Feb 25, 2024

This PR contains the following updates:

Package Change Age Confidence
crypto-js 4.1.1 -> 4.2.0 age confidence

GitHub 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:

  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.


Release Notes

brix/crypto-js (crypto-js)

v4.2.0

Compare 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 becomes conflicted, 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

vercel bot commented Feb 25, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
it-tools ✅ Ready (Inspect) Visit Preview Jul 2, 2025 7:00pm

@sonarqubecloud
Copy link

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@sonarqubecloud
Copy link

sonarqubecloud bot commented Aug 9, 2024

@renovate renovate bot changed the title fix(deps): update dependency crypto-js to v4.2.0 [security] fix(deps): update dependency crypto-js to v4.2.0 [security] - autoclosed Dec 8, 2024
@renovate renovate bot closed this Dec 8, 2024
@renovate renovate bot deleted the renovate/npm-crypto-js-vulnerability branch December 8, 2024 18:31
@renovate renovate bot changed the title fix(deps): update dependency crypto-js to v4.2.0 [security] - autoclosed fix(deps): update dependency crypto-js to v4.2.0 [security] Dec 8, 2024
@renovate renovate bot reopened this Dec 8, 2024
@renovate renovate bot force-pushed the renovate/npm-crypto-js-vulnerability branch 2 times, most recently from 4b67b59 to 85970b1 Compare December 14, 2024 11:16
@sonarqubecloud
Copy link

@renovate renovate bot force-pushed the renovate/npm-crypto-js-vulnerability branch from 40b4815 to 1a1100e Compare March 17, 2025 18:34
@renovate renovate bot force-pushed the renovate/npm-crypto-js-vulnerability branch from 1a1100e to 204bfe2 Compare April 1, 2025 11:15
@renovate renovate bot force-pushed the renovate/npm-crypto-js-vulnerability branch from 204bfe2 to a2f50d2 Compare April 8, 2025 10:34
@renovate renovate bot force-pushed the renovate/npm-crypto-js-vulnerability branch from a2f50d2 to dad277c Compare April 24, 2025 06:37
@renovate renovate bot force-pushed the renovate/npm-crypto-js-vulnerability branch from dad277c to 34629ab Compare May 19, 2025 17:37
@renovate renovate bot force-pushed the renovate/npm-crypto-js-vulnerability branch from 34629ab to 5207591 Compare May 28, 2025 13:57
@renovate renovate bot force-pushed the renovate/npm-crypto-js-vulnerability branch from 5207591 to 8437c7b Compare June 5, 2025 23:38
@renovate renovate bot force-pushed the renovate/npm-crypto-js-vulnerability branch from 8437c7b to 0f129ab Compare June 22, 2025 15:25
@renovate renovate bot force-pushed the renovate/npm-crypto-js-vulnerability branch from 0f129ab to 665edbf Compare July 2, 2025 18:55
@sonarqubecloud
Copy link

sonarqubecloud bot commented Jul 2, 2025

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Aug 10, 2025

Deploying it-tools with  Cloudflare Pages  Cloudflare Pages

Latest commit: 3c40d48
Status:🚫  Build failed.

View logs

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Aug 10, 2025

Deploying it-tools-legacy with  Cloudflare Pages  Cloudflare Pages

Latest commit: 3c40d48
Status: ✅  Deploy successful!
Preview URL: https://925cb6da.it-tools-legacy.pages.dev
Branch Preview URL: https://renovate-npm-crypto-js-vulne.it-tools-legacy.pages.dev

View logs

@renovate renovate bot force-pushed the renovate/npm-crypto-js-vulnerability branch 2 times, most recently from 37c9c95 to dfb14a2 Compare August 19, 2025 13:39
@renovate renovate bot force-pushed the renovate/npm-crypto-js-vulnerability branch from dfb14a2 to 1ce9cc9 Compare August 31, 2025 14:02
@renovate renovate bot changed the title fix(deps): update dependency crypto-js to v4.2.0 [security] chore(deps): 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 1ce9cc9 to c78fb6a Compare September 25, 2025 20:31
@renovate renovate bot force-pushed the renovate/npm-crypto-js-vulnerability branch from c78fb6a to 3c40d48 Compare October 22, 2025 01:11
@sonarqubecloud
Copy link

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