-
Notifications
You must be signed in to change notification settings - Fork 77
Update dependency pbkdf2 to v3.1.3 [SECURITY] #1056
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
Open
renovate
wants to merge
1
commit into
develop
Choose a base branch
from
renovate/npm-pbkdf2-vulnerability
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+283
−9
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
8098a65 to
52dd736
Compare
52dd736 to
3180710
Compare
Contributor
Author
|
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.1.2->3.1.3GitHub Vulnerability Alerts
CVE-2025-6545
Summary
This affects both:
sha3-256/sha3-512/sha512-256)Sha256/Sha512/SHA1/sha-1/sha-256/sha-512)All of those work correctly in Node.js, but this polyfill silently returns highly predictable ouput
Under Node.js (only with
pbkdf2/browserimport, unlikely) / Bun (pbkdf2top-level import is affected), the memory is not zero-filled but is uninitialized, asBuffer.allocUnsafeis usedUnder browsers, it just returns zero-filled buffers
(Which is also critical, those are completely unacceptable as kdf output and ruin security)
Were you affected?
The full list of arguments that were not affected were literal:
'md5''sha1''sha224''sha256''sha384''sha512''rmd160''ripemd160'Any other arguments, e.g. representation variations of the above ones like
'SHA-1'/'sha-256'/'SHA512'or different algos like'sha3-512'/'blake2b512', while supported on Node.jscryptomodule, returned predictable output onpbkdf2(orcryptobrowser/bundlers polyfill)Beware of packages re-exporting this under a different signature, like (abstract):
In this case, the resulting
deriveKeymethod is also affected (to the same extent / conditions as listed here).Environments
This affects
require('crypto')in polyfilled mode (e.g. fromcrypto-browserify,node-libs-browser,vite-plugin-node-polyfills,node-stdlib-browser, etc. -- basically everything that bundles/polfyillscryptorequire('crypto')andrequire('pbkdf2')require('pbkdf2')(orrequire('crypto')obviously), but affectsrequire('pbkdf2/browser')require('pbkdf2')andrequire('pbkdf2/browser')(and returns uninitialized memory, often zeros / sparse flipped bytes)PoC
Output (odd lines are Node.js, even is
pbkdf2module / polyfill):Uninitialized memory
Affected versions
Seems to be since browserify/pbkdf2@9699045
Impact
This is critical, browserifying code might silently generate zero-filled keys instead of proper ones, for code that was working on Node.js or in test environment
Just updating to a fixed version is not enough: if anyone was using
pbkdf2lib (e.g. viacrypto-browserifyor directly) on algos not from the literal string list (see "were you affected"), recheck where those keys went / how they were used, and take action accordinglyNote
Most likely, you receive this either through a subdep using
pbkdf2module directly (and then it is used), or throughcrypto-browserify(and the usage depends on whether you or any of your subdeps were callingpbkdf2/pbkdf2Syncmethods from Node.js crypto inside your bundle)When targeting non-Node.js, prever avoiding Node.js crypto polyfill at all, and use
crypto.subtleand/or modern/audited cryptography primitives insteadCVE-2025-6547
Summary
On historic but declared as supported Node.js versions (0.12-2.x), pbkdf2 silently disregards Uint8Array input
This only affects Node.js <3.0.0, but
pbkdf2claims to:Uint8Arrayinput (input is typechecked against Uint8Array, and the error message includes e.g. "Password must be a string, a Buffer, a typed array or a DataView"Details
The error is in
toBuffermethodThis vulnerability somehow even made it to tests: browserify/pbkdf2@eb9f97a
There,
resultsOld(where mismatchresults) are just invalid output generated from empty password/salt instead of the supplied onePoC
On Node.js/io.js < 3.0.0
Impact
Static hashes being outputted and used as keys/passwords can completely undermine security
That said, no one should be using those Node.js versions anywhere now, so I would recommend to just drop them
This lib should not pretend to work on those versions while outputting static data though
Just updating to a fixed version is not enough: if anyone was using
pbkdf2lib (do not confuse with Node.jscrypto.pbkdf2) or anything depending on it with Node.js/io.js < 3.0.0, recheck where those keys went / how they were used, and take action accordinglyRelease Notes
browserify/pbkdf2 (pbkdf2)
v3.1.3Compare Source
Commits
8b067309a76e2f6fd84bfauto-changelog796c38d3661fb07431b57eb9f97a26d4fd3513906aab04da889694cfd0d534bto-buffere3102a8fca0c9da2c7d93filestonpmignore7f31fbc8d628e8fc61005create-hmac,safe-buffer,sha.jsae2a7d0create-hash,ripemd160due to breaking changese07996845fbcf319ea57b645e252Configuration
📅 Schedule: Branch creation - "" (UTC), Automerge - At any time (no schedule defined).
🚦 Automerge: Enabled.
♻ 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 was generated by Mend Renovate. View the repository job log.