Use of insecure rand() function to generate cnonce value in HTTP digest auth
Categories
(Core :: Networking: HTTP, defect, P2)
Tracking
()
People
(Reporter: hanno, Assigned: kershaw)
References
Details
(Keywords: csectype-disclosure, reporter-external, sec-low, Whiteboard: [necko-triaged] [adv-main126+])
Attachments
(2 files)
The code for HTTP Digest authentication uses the rand() function to generate a random nonce value (the "cnonce").
This code in nsHttpDigestAuth.cpp:
nsAutoCString cnonce;
static const char hexChar[] = "0123456789abcdef";
for (int i = 0; i < 16; ++i) {
cnonce.Append(hexChar[(int)(15.0 * rand() / (RAND_MAX + 1.0))]);
}
Here: https://searchfox.org/mozilla-central/source/netwerk/protocol/http/nsHttpDigestAuth.cpp#326
This should probably use some secure random function. (Like RNG_GenerateGlobalRandomBytes from NSS.)
I am marking this as a security bug, but I should say that I am unsure what the exact security impact is. I am not familiar with the inner workings of the HTTP Digest authentication protocol and what a predictable cnonce would cause. However, this can probably be used to leak information about the state of the rand() RNG to an attacker. This could be bad if rand() is also used in other problematic places.
Comment 1•1 year ago
|
||
Comment 2•1 year ago
|
||
Looks like the "binary data to hex characters" bit is also broken and should use a common utility function instead.
Updated•1 year ago
|
Assignee | ||
Updated•1 year ago
|
Updated•1 year ago
|
Assignee | ||
Updated•11 months ago
|
Updated•10 months ago
|
Updated•9 months ago
|
Assignee | ||
Updated•9 months ago
|
Assignee | ||
Comment 3•9 months ago
|
||
Assignee | ||
Updated•9 months ago
|
Comment 5•9 months ago
|
||
Updated•9 months ago
|
Comment 6•9 months ago
|
||
The patch landed in nightly and beta is affected.
:kershaw, is this bug important enough to require an uplift?
- If yes, please nominate the patch for beta approval.
- If no, please set
status-firefox125
towontfix
.
For more information, please visit BugBot documentation.
Assignee | ||
Updated•9 months ago
|
Updated•9 months ago
|
Comment 7•8 months ago
|
||
Unfortunately this does not meet the severity level for our bug bounty program
Updated•8 months ago
|
Updated•7 months ago
|
Comment 8•7 months ago
|
||
Updated•7 months ago
|
Updated•6 months ago
|
Updated•6 months ago
|
Updated•3 months ago
|
Description
•