Closed
Bug 1211543
Opened 10 years ago
Closed 9 years ago
UBSan: null pointer passed as argument in SECKEY_DestroyPrivateKeyInfo
Categories
(NSS :: Libraries, defect)
Tracking
(firefox44 affected)
RESOLVED
FIXED
3.25
| Tracking | Status | |
|---|---|---|
| firefox44 | --- | affected |
People
(Reporter: tsmith, Assigned: ttaubert)
References
(Blocks 1 open bug)
Details
(Keywords: csectype-nullptr, testcase)
Attachments
(2 files)
|
16 bytes,
application/x-x509-ca-cert
|
Details | |
|
1.40 KB,
patch
|
franziskus
:
review+
|
Details | Diff | Splinter Review |
seckey.c:1567:18: runtime error: null pointer passed as argument 1, which is declared to never be null
/usr/include/string.h:66:62: note: nonnull attribute specified here
#0 0x7f827a29b98b in SECKEY_DestroyPrivateKeyInfo /home/user/code/fuzz_nss/nss/lib/cryptohi/seckey.c:1567:6
#1 0x7f827a3546ea in PK11_ImportDERPrivateKeyInfoAndReturnKey /home/user/code/fuzz_nss/nss/lib/pk11wrap/pk11pk12.c:249:5
#2 0x4e112c in fuzz /home/user/code/fuzz_nss/nss/cmd/checkcert/checkcert.c:22:9
#3 0x4e147c in main /home/user/code/fuzz_nss/nss/cmd/checkcert/checkcert.c:60:5
#4 0x7f8278f1dec4 in __libc_start_main /build/buildd/eglibc-2.19/csu/libc-start.c:287
#5 0x41b8f5 in _start (/home/user/Desktop/prv/checkcert+0x41b8f5)
| Assignee | ||
Comment 1•10 years ago
|
||
Reduced the test case a little:
30 0A [SEQUENCE(10)]
02 01 30 [INT(len=1) = 48]
30 05 [SEQUENCE(5)]
06 01 30 [OID(len=1) = 1.8]
04 00 [OCTET STRING(len=0)]
Basically we have a valid SECKEY_PrivateKeyInfoTemplate, but with an invalid OID that leads to us bailing out here:
http://hg.mozilla.org/mozilla-central/annotate/d1c5a7c5b433/security/nss/lib/pk11wrap/pk11pk12.c#l482
That's before |pki->privateKey| was set, so |pki->privateKey.data| is still NULL.
| Assignee | ||
Comment 2•10 years ago
|
||
Correction:
This isn't related to the invalid OID. All we need is a valid SECKEY_PrivateKeyInfoTemplate construct with an empty OCTET STRING. An OCTET STRING is required but we do accept one with length zero too. This is how we end up with |pki->privateKey.data == NULL|.
| Assignee | ||
Comment 3•10 years ago
|
||
After trying to parse the PrivateKeyInfoTemplate, should we check whether |pki->privateKey.data == NULL| and bail out, freeing the arena? Or should the ASN.1 parser reject input with zero-length, required OCTET STRINGs?
(Also, I believe this isn't security-sensitive.)
Martin, Eric, thoughts?
Flags: needinfo?(martin.thomson)
Flags: needinfo?(ekr)
Updated•10 years ago
|
Flags: needinfo?(martin.thomson)
| Reporter | ||
Updated•10 years ago
|
Group: crypto-core-security
| Assignee | ||
Comment 4•9 years ago
|
||
(In reply to Tim Taubert [:ttaubert] from comment #3)
> After trying to parse the PrivateKeyInfoTemplate, should we check whether
> |pki->privateKey.data == NULL| and bail out, freeing the arena? Or should
> the ASN.1 parser reject input with zero-length, required OCTET STRINGs?
Looking at this again after a few months, I think that a zero-length octet string is indeed valid ASN.1 and the template parses correctly as the item is given. It's just nothing. So I think the right thing to do is to check whether |pki->privateKey.data == NULL|.
Flags: needinfo?(ekr)
Updated•9 years ago
|
Assignee: nobody → ttaubert
| Assignee | ||
Comment 5•9 years ago
|
||
Attachment #8744256 -
Flags: review?(franziskuskiefer)
| Assignee | ||
Updated•9 years ago
|
Severity: critical → normal
Status: NEW → ASSIGNED
Comment 6•9 years ago
|
||
Comment on attachment 8744256 [details] [diff] [review]
0001-Bug-1211543-Don-t-call-SECKEY_DestroyPrivateKeyInfo-.patch
Review of attachment 8744256 [details] [diff] [review]:
-----------------------------------------------------------------
lgtm
Attachment #8744256 -
Flags: review?(franziskuskiefer) → review+
| Assignee | ||
Comment 7•9 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
| Assignee | ||
Updated•9 years ago
|
Target Milestone: --- → 3.25
You need to log in
before you can comment on or make changes to this bug.
Description
•