RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1670239 - libpkix name constraints check treats CN as DNS name when it should not
Summary: libpkix name constraints check treats CN as DNS name when it should not
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: nss
Version: 7.6
Hardware: All
OS: Linux
urgent
urgent
Target Milestone: rc
: ---
Assignee: Daiki Ueno
QA Contact: Alexander Sosedkin
URL:
Whiteboard:
Depends On: 1645231
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-01-29 01:50 UTC by Fraser Tweedale
Modified: 2019-10-07 15:32 UTC (History)
16 users (show)

Fixed In Version: nss-3.43.0-2.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-08-23 10:35:12 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Mozilla Foundation 1523484 0 -- RESOLVED libpkix name constraints check treats CN as DNS name when it should not 2021-02-15 15:09:11 UTC
Red Hat Product Errata RHSA-2019:2237 0 None None None 2019-08-06 13:08:29 UTC

Internal Links: 1737910 1825270

Description Fraser Tweedale 2019-01-29 01:50:56 UTC
How reproducible: always


Steps to reproduce:

1. Have a CA with DNS name constraints permitted subtree.

2. Verify a certificate with an Extended Key Usage not containing id-kp-serverAuth
   (e.g. an OCSP signing certificate), whose Subject DN CN attribute does not
   resemble a DNS name within the permitted subtree.

3. Verify the certificate (using libpkix):

    NSS_ENABLE_PKIX_VERIFY=1 certutil -d $NSSDB -f $PWDFILE -V -e -n $NICKNAME -u O


Actual results:

Verification fails:

    # NSS_ENABLE_PKIX_VERIFY=1 certutil -d $NSSDB -f $PWDFILE -V -e -n $NICKNAME -u O
    certutil: certificate is invalid: The Certifying Authority for this certificate is not permitted to issue a certificate with this name.


Expected results:

Verification should succeed. The CN should not be treated as a DNS name unless
the certificate being validated is a server authentication certificate (i.e.
id-kp-serverAuth is asserted in the Extended Key Usage extension). For
compatibility, it may be acceptable to continue treating CN as a DNS name if
the certificate does not have the EKU extension.


Version-Release number of selected component (if applicable): 

nss-3.36.0-7.el7_5.x86_64 (but AFAICT the bug is present in all currently supported versions,
and upstream master).



Additional info:

I filed upstream bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1523484.
Patch has been posted there.

Comment 2 Fraser Tweedale 2019-02-07 11:19:19 UTC
Fix has been merged upstream: https://hg.mozilla.org/projects/nss/rev/db68b6975216

Moving to POST.

Comment 3 Simo Sorce 2019-02-11 15:39:51 UTC
This issue was not selected to be included either in Red Hat Enterprise Linux 7.7 because it is seen either as low or moderate impact to a small amount of use-cases. The next release will be in Maintenance Support 1 Phase, which means that qualified Critical and Important Security errata advisories (RHSAs) and Urgent Priority Bug Fix errata advisories (RHBAs) may be released as they become available. We will now close this issue, but if you believe that it qualifies for the Maintenance Support 1 Phase, please re-open; otherwise we recommend moving the request to Red Hat Enterprise Linux 8 if applicable.

Comment 41 Rob Crittenden 2019-08-01 13:43:15 UTC
The Apache, 389-ds and KDC certs are renewed by proxying through IPA using the cert-request command. The CA subsystem certificates are renewed directly against the CA.

The error reported by certmonger is an SSL error coming out of curl and unfortunately it provides no details on the cause. It might help to try other tools to see if they provide additional details:

curl -v --cert /var/lib/ipa/ra-agent.pem --key /var/lib/ipa/ra-agent.key -d "serialNumber=1&xml=true" https://`hostname`:8443/ca/agent/ca/displayBySerial

and

openssl s_client -host `hostname` -port 8443 -cert /var/lib/ipa/ra-agent.pem -key /var/lib/ipa/ra-agent.key

Once connected you'll need to type/paste this in:
POST /ca/agent/ca/displayBySerial HTTP/1.1
Host: <the IPA master hostname>
Content-Length: 23
Content-Type: application/x-www-form-urlencoded

serialNumber=1&xml=true

If they both succeed they'll return a big blob of cert output, the content of which is not important. These commands will exercise both the NSS and OpenSSL client libraries.

Comment 45 Alicja Kario 2019-08-02 09:10:58 UTC
(In reply to Rob Crittenden from comment #41)
> The Apache, 389-ds and KDC certs are renewed by proxying through IPA using
> the cert-request command. The CA subsystem certificates are renewed directly
> against the CA.
> 
> The error reported by certmonger is an SSL error coming out of curl and
> unfortunately it provides no details on the cause. It might help to try
> other tools to see if they provide additional details:
> 
> curl -v --cert /var/lib/ipa/ra-agent.pem --key /var/lib/ipa/ra-agent.key -d
> "serialNumber=1&xml=true" https://`hostname`:8443/ca/agent/ca/displayBySerial
> 
> and
> 
> openssl s_client -host `hostname` -port 8443 -cert /var/lib/ipa/ra-agent.pem
> -key /var/lib/ipa/ra-agent.key

> If they both succeed they'll return a big blob of cert output, the content
> of which is not important. These commands will exercise both the NSS and
> OpenSSL client libraries.

note though that the s_client will NOT abort the connection if it cannot verify server certificate
one needs to look also for `Verify return code: 0 (ok)` in the s_client output

Comment 56 Fraser Tweedale 2019-08-06 11:32:01 UTC
Filed a new bug for the new issue:

RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1737910
Mozilla: https://bugzilla.mozilla.org/show_bug.cgi?id=1571677

Comment 60 Fraser Tweedale 2019-08-07 03:53:30 UTC
Hubert, thank you, you are correct and let me explain:

I was using the vfychain program to perform verification.  An NSSDB contains the constrained
CA cert with trust 'CT,C,C', then I execute:

  [NSS_ENABLE_PKIX_VERIFY=1] /usr/lib64/nss/unsupported-tools/vfychain -d . -a ipara.pem

The problem was I was not supplying '-u 0' to indicate client usage.  Adding that flag, I
observe that the legacy verifier succeeds and libpkix verifier fails.

I will clarify this in mozbz:1571677.

Comment 64 Alicja Kario 2019-08-23 10:35:12 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2019:2237


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