Repository navigation
Conversation
- Replace Math.random()-based byte loop with crypto.randomBytes(8) - Fixes predictable nonce generation flagged in issue SamDecrock#114
shtief
added a commit
to ClarkSource/node-http-ntlm
that referenced
this pull request
Sep 17, 2026
- Apply upstream PR SamDecrock#115 (SamDecrock/node-http-ntlm): replace weak Math.random() NTLMv2 client-challenge nonce with crypto.randomBytes(8) - Update unit tests to mock crypto.randomBytes instead of Math.random for deterministic NTLMv2 client-challenge assertions - Bump underscore dependency from ~1.12.1 to ^1.13.8 (GHSA-qpx9-hpmf-5gmw, unbounded recursion/DoS) - Rename package to @clark/httpntlm, bump version to 1.9.0 - Point bugs/repository URLs at the ClarkSource fork - Update README install/usage snippets to the new package name
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
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.
What
Replaces the
Math.random()-based byte-building loop increateType3Message()withcrypto.randomBytes(8)for generating the NTLMv2 client challenge nonce.Why
Math.random()is not a CSPRNG and its output is predictable, weakening the protocol's protection against replay/relay attacks (see #114).How
cryptois already required inntlm.js(used elsewhere for MD5/HMAC), so this is a drop-in replacement:This removes the manual loop and the
Buffer.from(..., 'ascii')step entirely.Closes #114