HandleCertificateDecode causes Null-dereference
Categories
(NSS :: Libraries, defect, P1)
Tracking
(firefox-esr115 unaffected, firefox122 unaffected, firefox123 unaffected, firefox124 unaffected)
| Tracking | Status | |
|---|---|---|
| firefox-esr115 | --- | unaffected |
| firefox122 | --- | unaffected |
| firefox123 | --- | unaffected |
| firefox124 | --- | unaffected |
People
(Reporter: anna.weine, Assigned: anna.weine)
References
Details
(Keywords: oss-fuzz, sec-low)
Attachments
(1 file)
https://oss-fuzz.com/testcase-detail/5816648133050368:
AddressSanitizer:DEADLYSIGNAL
=================================================================
==185569==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000058 (pc 0x0000006ec36d bp 0x7ffd3c5b9750 sp 0x7ffd3c5b9700 T0)
==185569==The signal is caused by a WRITE memory access.
==185569==Hint: address points to the zero page.
SCARINESS: 10 (null-deref)
#0 0x6ec36d in PK11_DigestOp nss/lib/pk11wrap/pk11cxt.c:1506:19
#1 0x5f34d0 in ssl3_UpdatePostHandshakeHashes nss/lib/ssl/ssl3con.c:4070:10
#2 0x6118f2 in ssl_HashHandshakeMessageInt nss/lib/ssl/ssl3con.c:12535:10
#3 0x6118f2 in ssl_HashPostHandshakeMessage nss/lib/ssl/ssl3con.c:12595:12
#4 0x586958 in tls13_HandleCertificateDecode nss/lib/ssl/tls13con.c:3866:14
#5 0x586958 in tls13_HandlePostHelloHandshakeMessage nss/lib/ssl/tls13con.c:1211:20
#6 0x612555 in ssl3_HandleHandshakeMessage nss/lib/ssl/ssl3con.c:12684:22
| Assignee | ||
Updated•2 years ago
|
| Assignee | ||
Comment 1•2 years ago
•
|
||
As John mentioned (and I checked) the bug is happening when the code is trying to hash a buffer with shaPostHandshake being null.
The quick working fix could be this, but I am not happy about the fix, because as for me it does not solve the problem, but removes the consequences.
if (ss->ssl3.hs.shaPostHandshake == NULL)
{
ss->ssl3.hs.shaPostHandshake = PK11_CloneContext(ss->ssl3.hs.sha);
if (ss->ssl3.hs.shaPostHandshake == NULL) {
ssl_MapLowLevelError(SSL_ERROR_SHA_DIGEST_FAILURE);
return SECFailure;
}
}
| Assignee | ||
Comment 2•2 years ago
•
|
||
The allocation of shaPostHandshake is happening either in tls13_SendCertificateRequest (https://searchfox.org/mozilla-central/source/security/nss/lib/ssl/tls13con.c#2677) or tls13_HandleCertificateRequest (https://searchfox.org/mozilla-central/source/security/nss/lib/ssl/tls13con.c#2989).
I don't immediately see how the certificate compression function causes this problem, as this function is somehow equivalent to HandleCertificate function. If the certificate is encoded we call tls13_HandleCertificateDecode, otherwise - tls13_HandleCertificate()
| Assignee | ||
Comment 3•2 years ago
|
||
Updated•2 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Comment 4•2 years ago
|
||
Updated•2 years ago
|
Comment 5•2 years ago
|
||
Does this affect NSS 3.90 also (used in ESR115)?
Updated•2 years ago
|
Comment 6•2 years ago
|
||
This was a short lived regression on NSS trunk. No NSS or Firefox releases were affected.
Updated•3 days ago
|
Description
•