Closed
Bug 2072633
Opened 15 days ago
Closed 15 days ago
jpake_Round1/Round2/Final in jpakesftk.c ignore PORT_NewArena() failure
Categories
(NSS :: Libraries, defect)
NSS
Libraries
Tracking
(nss 3.130)
RESOLVED
FIXED
| Tracking | Status | |
|---|---|---|
| nss | --- | 3.130 |
People
(Reporter: aruttigran1203, Assigned: aruttigran1203)
Details
Attachments
(1 file)
Steps to reproduce:
Found by static analysis and code review of lib/softoken/jpakesftk.c (current master).
All three J-PAKE functions handle a PORT_NewArena() failure like this:
arena = PORT_NewArena(NSS_SOFTOKEN_DEFAULT_CHUNKSIZE);
if (arena == NULL)
crv = CKR_HOST_MEMORY; /* no return */
crv = sftk_MultipleAttribute2SecItem(arena, ...); /* crv overwritten */
Actual results:
CKR_HOST_MEMORY is overwritten and the NULL arena is passed on:
- sftk_MultipleAttribute2SecItem() falls back to heap allocations for session objects (as does DSA_NewRandom() for x1 in round 1). These buffers, including secret values (x1, x2, x2s), are leaked without being zeroed.
- The next freebl call (JPAKE_Sign, JPAKE_Verify or JPAKE_Round2) rejects the NULL arena with SEC_ERROR_INVALID_ARGS, so the caller gets CKR_MECHANISM_PARAM_INVALID instead of CKR_HOST_MEMORY.
- In debug builds, round 1 hits PORT_Assert(arena != NULL) in jpake_Sign().
Expected results:
Each function should return CKR_HOST_MEMORY immediately when PORT_NewArena() fails, as the rest of lib/softoken does. Nothing is allocated before that point, so an early return is safe:
if (arena == NULL)
return CKR_HOST_MEMORY;
| Assignee | ||
Comment 1•15 days ago
|
||
Updated•15 days ago
|
Assignee: nobody → aruttigran1203
Severity: -- → S4
Pushed by dkeeler@mozilla.com:
https://hg.mozilla.org/projects/nss/rev/ae4848691f24
return CKR_HOST_MEMORY when PORT_NewArena fails in jpakesftk.c. r=nss-reviewers,keeler
Status: UNCONFIRMED → RESOLVED
Closed: 15 days ago
Resolution: --- → FIXED
Updated•8 days ago
|
status-nss:
--- → 3.130
You need to log in
before you can comment on or make changes to this bug.
Description
•