Bug 922956 - NSS encodes CKA_SERIAL_NUMBER wrong when doing CKO_NSS_TRUST lookups
NSS encodes CKA_SERIAL_NUMBER wrong when doing CKO_NSS_TRUST lookups
Product: Fedora
Classification: Fedora
Component: nss (Show other bugs)
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Elio Maldonado Batiz
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2013-03-18 17:10 EDT by Stef Walter
Modified: 2015-02-17 09:52 EST (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2015-02-17 09:52:21 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Stef Walter 2013-03-18 17:10:24 EDT
When doing lookups for CKO_NSS_TRUST objects, NSS puts an invalid value in the CKA_SERIAL_NUMBER attribute passed to C_FindObjectsInit().

Although CKO_NSS_TRUST is undocumented, talked with relyea about this on IRC, and apparently it's a bug not a feature ;)
Comment 1 Stef Walter 2013-03-18 17:12:21 EDT
There is code in libnssckbi.so which masks this issue:


In addition similar code was added to p11-kit as a work around until this is fixed for real:

Comment 2 Stef Walter 2013-03-18 17:28:57 EDT
This is a stack trace of the lookups in question:

(gdb) bt
#0  0x0000003f80a35ba5 in __GI_raise (sig=sig@entry=6)
    at ../nptl/sysdeps/unix/sysv/linux/raise.c:63
#1  0x0000003f80a37358 in __GI_abort () at abort.c:90
#2  0x00007fffddc74c21 in p11_debug_precond (format=
    0x7fffddc7b370 "finding serial number that's not DER encoded")
    at debug.c:151
#3  0x00007fffddc618d7 in sys_C_FindObjectsInit (handle=16, template=
    0x7fffed5fe430, count=4) at module.c:1105
#4  0x0000003e738718b0 in find_objects (tok=tok@entry=0x7fffdd538030, 
    obj_template=obj_template@entry=0x7fffed5fe430, otsize=otsize@entry=4, 
    maximumOpt=maximumOpt@entry=1, statusOpt=statusOpt@entry=0x0)
    at devtoken.c:300
#5  0x0000003e73871b90 in find_objects_by_template (token=0x7fffdd538030, 
    sessionOpt=0x7fffde475238, obj_template=obj_template@entry=0x7fffed5fe430, 
    otsize=4, maximumOpt=maximumOpt@entry=1, statusOpt=statusOpt@entry=0x0)
    at devtoken.c:436
#6  0x0000003e738730b7 in nssToken_FindTrustForCertificate (token=token@entry=
    0x7fffdd538030, sessionOpt=sessionOpt@entry=0x0, 
    certIssuer=certIssuer@entry=0x7fffdca0a8f8, certSerial=certSerial@entry=
    0x7fffdca0a918, searchType=searchType@entry=nssTokenSearchType_TokenOnly)
    at devtoken.c:1150
#7  0x0000003e7386b71b in nssTrustDomain_FindTrustForCertificate (td=
    0x7fffde475030, c=c@entry=0x7fffdca0a888) at trustdomain.c:1084
#8  0x0000003e7387019a in fill_CERTCertificateFields (forced=0, cc=
    0x7fffdca0ac20, c=0x7fffdca0a888) at pki3hack.c:800
#9  stan_GetCERTCertificate (c=c@entry=0x7fffdca0a888, 
    forceUpdate=forceUpdate@entry=0) at pki3hack.c:894
#10 0x0000003e73870447 in STAN_GetCERTCertificate (c=c@entry=0x7fffdca0a888)
    at pki3hack.c:926
#11 0x0000003e73865200 in CERT_NewTempCertificate (handle=<optimized out>, 
    derCert=derCert@entry=0x7fffed5fe730, nickname=nickname@entry=0x0, 
    isperm=isperm@entry=0, copyDER=copyDER@entry=1) at stanpcertdb.c:409
#12 0x0000003e75c14ac8 in ssl3_HandleCertificate (length=1892, b=
    0x7fffd90294a1 "", ss=0x7fffda250000) at ssl3con.c:8545
#13 ssl3_HandleHandshakeMessage (ss=ss@entry=0x7fffda250000, 
    b=<optimized out>, length=<optimized out>) at ssl3con.c:9462
#14 0x0000003e75c17519 in ssl3_HandleHandshake (origBuf=0x7fffda250398, ss=
    0x7fffda250000) at ssl3con.c:9592
#15 ssl3_HandleRecord (ss=ss@entry=0x7fffda250000, cText=cText@entry=
    0x7fffed5fea50, databuf=databuf@entry=0x7fffda250398) at ssl3con.c:10230
#16 0x0000003e75c18315 in ssl3_GatherCompleteHandshake (ss=0x7fffda250000, 
    flags=0) at ssl3gthr.c:361
#17 0x0000003e75c19915 in ssl_GatherRecord1stHandshake (ss=0x7fffda250000)
    at sslcon.c:1227
#18 0x0000003e75c20995 in ssl_Do1stHandshake (ss=ss@entry=0x7fffda250000)
    at sslsecur.c:120
#19 0x0000003e75c221a6 in ssl_SecureSend (ss=0x7fffda250000, buf=
    0x35882e3b67 "", len=0, flags=<optimized out>) at sslsecur.c:1209

#20 0x0000003e75c25dd6 in ssl_Send (fd=<optimized out>, buf=0x35882e3b67, len=
    0, flags=0, timeout=4294967295) at sslsock.c:2092
#21 0x0000003587afbe99 in PSMSend (fd=0x7fffda217100, buf=0x35882e3b67, 
    amount=<optimized out>, flags=0, timeout=<optimized out>)
    at /usr/src/debug/xulrunner-19.0.2/mozilla-release/security/manager/ssl/src/nsNSSIOLayer.cpp:1136
---Type <return> to continue, or q <return> to quit---
#22 0x00000035872a16e7 in nsSocketOutputStream::Write (this=0x7fffdf3885c0, 
    buf=0x35882e3b67 "", count=0, countWritten=0x7fffed5febf4)
    at /usr/src/debug/xulrunner-19.0.2/mozilla-release/netwerk/base/src/nsSocketTransport2.cpp:554
#23 0x00000035872e9d50 in nsHttpConnection::EnsureNPNComplete (this=this@entry=
    at /usr/src/debug/xulrunner-19.0.2/mozilla-release/netwerk/protocol/http/nsHttpConnection.cpp:271
#24 0x00000035872e9ec7 in nsHttpConnection::OnSocketWritable (this=
    at /usr/src/debug/xulrunner-19.0.2/mozilla-release/netwerk/protocol/http/nsHttpConnection.cpp:1229
#25 0x00000035872ea02f in nsHttpConnection::OnOutputStreamReady (this=
    0x7fffda2c4600, out=<optimized out>)
    at /usr/src/debug/xulrunner-19.0.2/mozilla-release/netwerk/protocol/http/nsHttpConnection.cpp:1544
#26 0x00000035872a125f in nsSocketOutputStream::OnSocketReady (this=this@entry=
    0x7fffdf3885c0, condition=condition@entry=NS_OK)
    at /usr/src/debug/xulrunner-19.0.2/mozilla-release/netwerk/base/src/nsSocketTransport2.cpp:493
#27 0x00000035872a1315 in nsSocketTransport::OnSocketReady (this=
    0x7fffdf388460, fd=0x7fffda217100, outFlags=2)
    at /usr/src/debug/xulrunner-19.0.2/mozilla-release/netwerk/base/src/nsSocketTransport2.cpp:1545
#28 0x00000035872a39cc in nsSocketTransportService::DoPollIteration (
    this=this@entry=0x7ffff1661ea0, wait=<optimized out>)
    at /usr/src/debug/xulrunner-19.0.2/mozilla-release/netwerk/base/src/nsSocketTransportService2.cpp:807
#29 0x00000035872a3b6c in nsSocketTransportService::Run (this=0x7ffff1661ea0)
    at /usr/src/debug/xulrunner-19.0.2/mozilla-release/netwerk/base/src/nsSocketTransportService2.cpp:646
#30 0x0000003587d97c0c in nsThread::ProcessNextEvent (this=0x7ffff7d4bfc0, 
    mayWait=<optimized out>, result=0x7fffed5fee3f)
    at /usr/src/debug/xulrunner-19.0.2/mozilla-release/xpcom/threads/nsThread.cpp:627
#31 0x0000003587d6cf75 in NS_ProcessNextEvent_P (thread=<optimized out>, 
    at /usr/src/debug/xulrunner-19.0.2/mozilla-release/objdir/xpcom/build/nsThreadUtils.cpp:238
#32 0x0000003587d98460 in nsThread::ThreadFunc (arg=0x7ffff7d4bfc0)
    at /usr/src/debug/xulrunner-19.0.2/mozilla-release/xpcom/threads/nsThread.cpp:265
#33 0x0000003e74428e23 in _pt_root (arg=0x7ffff7d22bf0)
    at ../../../mozilla/nsprpub/pr/src/pthreads/ptthread.c:156
#34 0x0000003f80e07d15 in start_thread (arg=0x7fffed5ff700)
    at pthread_create.c:308
#35 0x0000003f80af246d in clone ()
    at ../sysdeps/unix/sysv/linux/x86_64/clone.S:114

And here is some example debug output showing the invalid lookups:

(p11-kit:14906) sys_C_FindObjectsInit: in: 16, (4) [ { CKA_TOKEN = (1) "\x01" }, { CKA_CLASS = CKO_NSS_TRUST }, { CKA_ISSUER = (66) "0@1\x0b0\t\x06\x03U\x04\x06\x13\x02US1\x170\x15\x06\x03U\x04\n\x13\x0eGeoTrust, Inc.1\x180\x16\x06\x03U\x04\x03\x13\x0fGeoTrust SSL CA" }, { CKA_SERIAL_NUMBER = (3) "\x01\x04\xa7" } ]

(p11-kit:14906) sys_C_FindObjectsInit: in: 16, (4) [ { CKA_TOKEN = (1) "\x01" }, { CKA_CLASS = CKO_CERTIFICATE }, { CKA_ISSUER = (80) "0N1\x0b0\t\x06\x03U\x04\x06\x13\x02US1\x100\x0e\x06\x03U\x04\n\x13\x07Equifax1-0+\x06\x03U\x04\x0b\x13$Equifax Secure Certificate Authority" }, { CKA_SERIAL_NUMBER = (3) "\x12\xbb\xe6" } ]
Comment 3 Stef Walter 2013-06-17 12:00:14 EDT
Bob, I'm having a really hard time reproducing this again. Do you have any idea of how it might happen?
Comment 4 Stef Walter 2013-07-09 09:30:10 EDT
Not a blocker. For future work.
Comment 5 Fedora End Of Life 2015-01-09 12:46:52 EST
This message is a notice that Fedora 19 is now at end of life. Fedora 
has stopped maintaining and issuing updates for Fedora 19. It is 
Fedora's policy to close all bug reports from releases that are no 
longer maintained. Approximately 4 (four) weeks from now this bug will
be closed as EOL if it remains open with a Fedora 'version' of '19'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 19 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.
Comment 6 Fedora End Of Life 2015-02-17 09:52:21 EST
Fedora 19 changed to end-of-life (EOL) status on 2015-01-06. Fedora 19 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this

Thank you for reporting this bug and we are sorry it could not be fixed.

Note You need to log in before you can comment on or make changes to this bug.