Skip to content
DoS Disclosed report Advanced CVE-2022-34476

"consumed == child->consumed" assert failed in sec_asn1d_reuse_encoding

A malformed ASN.1 certificate input causes an assertion failure in NSS's ASN.1 decoder when the pretty-printer tool parses it. The tool aborts instead of handling the bad input gracefully.

Gustavo Grieco Follow

Originally disclosed on Mozilla

  • Fixed in 4.8 years
  • Paid in 4.9 years
  • Disclosed after 4.8 years
Text
Created attachment 8894384
crash.asn1

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:54.0) Gecko/20100101 Firefox/54.0
Build ID: 20170630112252

Steps to reproduce:

Hi,

We found a failed assertion in the last revision of nss (a0a4e05dcdd5) when we try to print a certificate using pp.

To reproduce execute: ./pp -t c -i crash.asn1


Actual results:

It aborts:

Certificate:
Assertion failure: consumed == child->consumed, at secasn1d.c:1565

Using gdb, we can obtain the backtrace:

Program received signal SIGABRT, Aborted.
0x00007f66a124f8c0 in raise () from /usr/lib/libc.so.6
(gdb) bt
#0  0x00007f66a124f8c0 in raise () from /usr/lib/libc.so.6
#1  0x00007f66a1250f72 in abort () from /usr/lib/libc.so.6
#2  0x00007f66a22148b2 in PR_Assert (s=0x7f66a28879ee "consumed == child->consumed", file=0x7f66a2887480 "secasn1d.c", ln=1565)
    at ../../../../pr/src/io/prlog.c:553
#3  0x00007f66a28741f0 in sec_asn1d_reuse_encoding (state=0x100231908) at secasn1d.c:1565
#4  0x00007f66a287616c in SEC_ASN1DecoderUpdate_Util (cx=0x100231810, buf=0x100230597 "0\200\030", '\060' <repeats 49 times>, "\030\001\060", len=78)
    at secasn1d.c:2804
#5  0x00007f66a287681e in SEC_ASN1Decode_Util (poolp=0x100230dc0, dest=0x100230ef0, theTemplate=0x7f66a1d545e0 <CERT_CertificateTemplate>, 
    buf=0x100230490 "0\200\002\002\200", len=341) at secasn1d.c:3107
#6  0x00007f66a2876880 in SEC_ASN1DecodeItem_Util (poolp=0x100230dc0, dest=0x100230ef0, theTemplate=0x7f66a1d545e0 <CERT_CertificateTemplate>, 
    src=0x1002301c0) at secasn1d.c:3121
#7  0x000000010000cb3a in SECU_PrintCertificate (out=0x7f66a15bd580 <_IO_2_1_stdout_>, der=0x1002301c0, m=0x10001250b "Data", level=1)
    at secutil.c:2384
#8  0x000000010000f205 in secu_PrintSignedDataSigOpt (out=0x7f66a15bd580 <_IO_2_1_stdout_>, der=0x7fffffffdf50, m=0x10001175b "Certificate", level=0, 
    inner=0x10000cab6 <SECU_PrintCertificate>, withSignature=withSignature) at secutil.c:3194
#9  0x000000010000f2e4 in SECU_PrintSignedData (out=0x7f66a15bd580 <_IO_2_1_stdout_>, der=0x7fffffffdf50, m=0x10001175b "Certificate", level=0, 
    inner=0x10000cab6 <SECU_PrintCertificate>) at secutil.c:3212
#10 0x0000000100004b96 in main (argc=5, argv=0x7fffffffe058) at pp.c:150


Expected results:

It shouldn't abort.

The original report as published on Mozilla's Bugzilla, by Gustavo Grieco. Images and videos are our own copies; raw HTML is shown as text. View it on Mozilla's Bugzilla.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the ASN.1 decoder's reuse-encoding path does not handle a malformed length/encoding combination, so an internal consistency assertion fires.

Impact

A malformed certificate causes a denial of service (abort) in the pp tool; the text does not show impact beyond that tool.

What the attacker needed

Malformed ASN.1 certificate file; running the pp tool

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

A certificate is a structured blob of data, and the library that reads it (NSS) expects certain internal bookkeeping to add up. When given a deliberately malformed certificate, one of those internal checks failed and the program crashed instead of reporting a parse error. This is a robustness bug: bad input should be rejected, not crash the tool.

What is DoS?

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.

More by Gustavo Grieco

View all

4 more disclosed reports, best first.

More from Mozilla

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.