Update dependency pbkdf2 to v3.1.3 [SECURITY] #1056
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.3
GitHub 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/browser
import, unlikely) / Bun (pbkdf2
top-level import is affected), the memory is not zero-filled but is uninitialized, asBuffer.allocUnsafe
is 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.jscrypto
module, returned predictable output onpbkdf2
(orcrypto
browser/bundlers polyfill)Beware of packages re-exporting this under a different signature, like (abstract):
In this case, the resulting
deriveKey
method 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/polfyillscrypto
require('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
pbkdf2
module / 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
pbkdf2
lib (e.g. viacrypto-browserify
or 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
pbkdf2
module directly (and then it is used), or throughcrypto-browserify
(and the usage depends on whether you or any of your subdeps were callingpbkdf2/pbkdf2Sync
methods from Node.js crypto inside your bundle)When targeting non-Node.js, prever avoiding Node.js crypto polyfill at all, and use
crypto.subtle
and/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
pbkdf2
claims to:Uint8Array
input (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
toBuffer
methodThis 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
pbkdf2
lib (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
crypto-browserify/pbkdf2 (pbkdf2)
v3.1.3
Compare Source
Commits
8b06730
9a76e2f
6fd84bf
auto-changelog
796c38d
3661fb0
7431b57
eb9f97a
26d4fd3
513906a
ab04da8
89694cf
d0d534b
to-buffer
e3102a8
fca0c9d
a2c7d93
files
tonpmignore
7f31fbc
8d628e8
fc61005
create-hmac
,safe-buffer
,sha.js
ae2a7d0
create-hash
,ripemd160
due to breaking changese079968
45fbcf3
19ea57b
645e252
Configuration
📅 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.