Closed
Bug 1454072
(CVE-2022-34480)
Opened 7 years ago
Closed 3 years ago
Use of uninitialized pointer in lg_init()
Categories
(NSS :: Libraries, enhancement)
Tracking
(firefox-esr91 wontfix, firefox100 wontfix, firefox101 wontfix, firefox102 fixed)
RESOLVED
FIXED
3.79
People
(Reporter: mozillabugs, Assigned: jschanck)
Details
(Keywords: csectype-uninitialized, reporter-external, sec-low, Whiteboard: [post-critsmash-triage][adv-main102+])
Attachments
(2 files)
lg_init() (security\nss\lib\softoken\legacydb\lginit.c) can use an uninitialized pointer on error. The bug is that line 504 does not initialize the block pointed to by |lgdb_p|. If line 511 fails (as with an OOM), causing lines 512-14 to transfer control to lines 544 et seq, line 552 will read the uninitialized pointer |lgdb->hashtable|, and if it is nonzero (likely), line 553 will attempt to destroy it, in the process reading and writing hyperspace:
491: CK_RV
492: lg_init(SDB **pSdb, int flags, NSSLOWCERTCertDBHandle *certdbPtr,
493: NSSLOWKEYDBHandle *keydbPtr)
494: {
495: SDB *sdb = NULL;
496: LGPrivate *lgdb_p = NULL;
497: CK_RV error = CKR_HOST_MEMORY;
498:
499: *pSdb = NULL;
500: sdb = (SDB *)PORT_Alloc(sizeof(SDB));
501: if (sdb == NULL) {
502: goto loser;
503: }
504: lgdb_p = (LGPrivate *)PORT_Alloc(sizeof(LGPrivate));
505: if (lgdb_p == NULL) {
506: goto loser;
507: }
508: /* invariant fields */
509: lgdb_p->certDB = certdbPtr;
510: lgdb_p->keyDB = keydbPtr;
511: lgdb_p->dbLock = PR_NewLock();
512: if (lgdb_p->dbLock == NULL) {
513: goto loser;
514: }
515: lgdb_p->hashTable = PL_NewHashTable(64, lg_HashNumber, PL_CompareValues,
516: SECITEM_HashCompare, NULL, 0);
517: if (lgdb_p->hashTable == NULL) {
518: goto loser;
519: }
520:
...
541: *pSdb = sdb;
542: return CKR_OK;
543:
544: loser:
545: if (sdb) {
546: PORT_Free(sdb);
547: }
548: if (lgdb_p) {
549: if (lgdb_p->dbLock) {
550: PR_DestroyLock(lgdb_p->dbLock);
551: }
552: if (lgdb_p->hashTable) {
553: PL_HashTableDestroy(lgdb_p->hashTable);
554: }
555: PORT_Free(lgdb_p);
556: }
557: return error;
558: }
FF typically poisons memory blocks with 0xe4 or 0xe5, but I don't know whether poisoning is guaranteed in all environments that NSS supports.
Updated•7 years ago
|
Flags: sec-bounty?
Updated•7 years ago
|
Keywords: csectype-uninitialized,
sec-low
Comment 1•7 years ago
|
||
Could happen, but more a bug than something that could be intentionally exploited since you'd have to successfully get past all those PORT_Allocs and then OOM in just the right place.
Flags: sec-bounty? → sec-bounty-
Assignee | ||
Updated•3 years ago
|
Assignee: nobody → jschanck
Assignee | ||
Comment 2•3 years ago
|
||
Assignee | ||
Comment 3•3 years ago
|
||
Status: UNCONFIRMED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Updated•3 years ago
|
Group: crypto-core-security → core-security-release
status-firefox100:
--- → wontfix
status-firefox101:
--- → wontfix
status-firefox102:
--- → fixed
status-firefox-esr91:
--- → wontfix
Target Milestone: --- → 3.79
Updated•3 years ago
|
Flags: qe-verify-
Whiteboard: [post-critsmash-triage]
Updated•3 years ago
|
Whiteboard: [post-critsmash-triage] → [post-critsmash-triage][adv-main102+]
Comment 4•3 years ago
|
||
Updated•3 years ago
|
Alias: CVE-2022-34480
Updated•2 years ago
|
Flags: sec-bounty-hof+
Updated•2 years ago
|
Group: core-security-release
Updated•8 months ago
|
Keywords: reporter-external
You need to log in
before you can comment on or make changes to this bug.
Description
•