Open Bug 1305750 Opened 9 years ago Updated 2 years ago

Certutil produces malformed IP name constraints when creating certificates

Categories

(NSS :: Tools, defect, P5)

3.27

Tracking

(Not tracked)

People

(Reporter: mukrop, Unassigned)

References

(Blocks 1 open bug)

Details

(Whiteboard: [nss-nofx])

User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.116 Safari/537.36 Steps to reproduce: Use case: Creating certificates containing IP name constraints using certutil. 1) Create auxiliary password and noise files, create new database echo password >passwd certutil -N -d . -f passwd echo noisenoisenoisenoise >noise 2) Create a self-signed CA with name constraint of permitted subtree 97.97.97.97/32 echo -e "8\n\x61\x61\x61\x61\xff\xff\xff\xff\n1\nn\ny\n" >args certutil -S -d . -n test1CA -x -t CT,C, -s "CN=Test1CA" -m 1 --extNC -f passwd -z noise <args certutil -L -d . -n test1CA 3) Create end certificate signed by above CA with SAN IP:97.97.97.97 certutil -S -d . -n test1Server -c test1CA -t ,, -s "CN=Test1Server" -m 2 --extSAN ip:97.97.97.97 -f passwd -z noise <args certutil -L -d . -n test1Server 4) Validate above created end certificate with IP SAN certutil -V -d . -n test1Server -u C 5) Create another self-signed CA with name constraint of permitted subtree 97.97.97.97/16 echo -e "8\n\x61\x61\x61\x61\xff\xff\x00\x00\n1\nn\ny\n" >args certutil -S -d . -n test2 -x -t ,, -s "CN=Test2" -m 3 --extNC -f passwd -z noise <args certutil -L -d . -n test2 Actual results: 2) The certificate's name constraint extension has an IP range of 87:08:61:61:61:61:ff:ff:ff:ff. Certutil prefixes with 2 bytes that are not supposed to be there (name type and length). Furthermore, name constraints IP extension with lenght not 8 (IPv4) nor 32 (IPv6) is invalid. This is done since the name constraints names are handled the same way as subject alternative names, see nss/cmd/certutil/certext.c, function getGeneralName (lines 169-186). 4) The end certificate fails to validate (due to extra first 2 bytes in IP range). Same certificate created by GnuTLS validates OK in NSS. 5) The CA certificate IP constraint misses last 2 bytes (that were \x00) (and also has the extra prefix as described above). Expected results: 2) The certificate's name constraints extension IP rangne should have been 61:61:61:61:ff:ff:ff:ff. 4) The end certificate should be considered valid (IP 97.97.97.97 in in permitted range of 97.97.97.97/32). 5) The certificate's name constraints extension IP rangne should have been 61:61:61:61:ff:ff:00:00.
Blocks: 757854
OS: Unspecified → All
Hardware: Unspecified → All
Status: UNCONFIRMED → NEW
Ever confirmed: true
Severity: normal → S3
Severity: S3 → S4
Priority: -- → P5
Whiteboard: [nss-nofx]
You need to log in before you can comment on or make changes to this bug.