Last Comment Bug 174193 - certutil doesn't verify signature on cert request before issuing cert
: certutil doesn't verify signature on cert request before issuing cert
Status: RESOLVED FIXED
:
Product: NSS
Classification: Components
Component: Tools (show other bugs)
: 3.6
: All All
: P1 normal (vote)
: 3.7
Assigned To: Nelson Bolyard (seldom reads bugmail)
: Bishakha Banerjee
:
Mentors:
Depends on:
Blocks: 343231
  Show dependency treegraph
 
Reported: 2002-10-13 00:24 PDT by Nelson Bolyard (seldom reads bugmail)
Modified: 2002-10-23 16:21 PDT (History)
1 user (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---


Attachments
new func to check signature on cert request, call from certutil (3.51 KB, patch)
2002-10-17 17:42 PDT, Nelson Bolyard (seldom reads bugmail)
rrelyea: review+
Details | Diff | Splinter Review
Add function CERT_VerifySignedDataWithPublicKey (3.12 KB, patch)
2002-10-23 16:21 PDT, Nelson Bolyard (seldom reads bugmail)
no flags Details | Diff | Splinter Review

Description Nelson Bolyard (seldom reads bugmail) 2002-10-13 00:24:13 PDT
A certificate request is a signed document.  The signature proves that
the requestor holds the private key that corresponds to the public key
in the cert request.  Any CA program, including certutil, should verify
that signature before honoring it.  

It appears to me that certutil decodes the signed data, but doesn't actually
verify it.  So, any requester can get a cert issued.  
This is very bad if someone is going to use certutil to try to be a real CA.

I think the solution is to do something very similar to CERT_VerifySignedData
except that the public key is taken from the request, not from a certificate.
Comment 1 Nelson Bolyard (seldom reads bugmail) 2002-10-17 17:42:38 PDT
Created attachment 103261 [details] [diff] [review]
new func to check signature on cert request, call from certutil

I created a new function 
SECStatus
CERT_VerifySignedDataWithPubKeyInfo(CERTSignedData *sd,
				    CERTSubjectPublicKeyInfo *pubKeyInfo,
				   void *wincx)

that checks the signature on a certrequest (or any signedData) using 
the public key info taken from a PublicKeyInfo, such as the one found in
the a cert request.  This new function will be exported from NSS.

I added a call to this function in certutil's function that imports
and parses a cert request.  

Please review.
Comment 2 Nelson Bolyard (seldom reads bugmail) 2002-10-17 17:44:32 PDT
Bob, please review the patch in this bug.  Thanks.
Comment 3 Nelson Bolyard (seldom reads bugmail) 2002-10-17 19:48:11 PDT
Taking bug, since I have a patch for it already.
Comment 4 Nelson Bolyard (seldom reads bugmail) 2002-10-17 20:40:34 PDT
Marking assigned.  Since I already have a patch for it.
Comment 5 Nelson Bolyard (seldom reads bugmail) 2002-10-18 15:11:19 PDT
Patch checked in.  Marking fixed.  
Comment 6 Robert Relyea 2002-10-21 13:53:38 PDT
Comment on attachment 103261 [details] [diff] [review]
new func to check signature on cert request, call from certutil

The patch looks fine, thought I would have preferred the interface to take the
public key and let the application do the SECKEY_ExtractPublicKey().

bob
Comment 7 Nelson Bolyard (seldom reads bugmail) 2002-10-23 16:21:26 PDT
Created attachment 103915 [details] [diff] [review]
Add function CERT_VerifySignedDataWithPublicKey

In light of Bob's comment above, I wrote a new function
CERT_VerifySignedDataWithPublicKey, and changed the existing functions
CERT_VerifySignedDataWithPubKeyInfo and CERT_VerifySignedData to use
this new function, since it contained logic previously common to both.

Bob, please review this patch.

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