Repository navigation
reject non-DNS subjectAltName values in cupsSignCredentialsRequest - #227
Open
tanjiroK-coder wants to merge 1 commit into
Open
tanjiroK-coder wants to merge 1 commit into
tanjiroK-coder wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
cupsSignCredentialsRequestis documented to run every subjectAltName in the request through the SAN callback, but the OpenSSL backend only passes dNSName entries to it and skips every other GeneralName type, then copies the request's subjectAltName extension into the new certificate. A CSR forCN=printerwithDNS:printer,IP:192.168.1.1(or a URI, email address or UPN otherName) is therefore signed by the site CA, andopenssl verify -CAfile _site_.crt -verify_ip 192.168.1.1accepts the result, so anyone who can get a request signed, for example withcups-x509 ca, gets a certificate trusted for addresses and identities the callback never saw, while the same request withDNS:www.example.comis refused. The same loop also stopped validating when an element ran past the extension, accepted an empty dNSName without calling the callback, and validated a dNSName only up to an embedded NUL. I found it reading the SAN loop next to the common name check and confirmed it by signing those CSRs with a_site_CA built from this tree (LibreSSL 4.0): the IP, URI, email and UPN requests are signed on master and refused with "Bad subjectAltName extension in X.509 certificate request." with this change, whileDNS:printer,DNS:printer.localstill signs. Since the callback only takes host names, the fix rejects anything that is not a non-empty dNSName without NUL bytes and says so in the function documentation;cupsCreateCredentialsRequestonly writes DNS names, so libcups' own requests are unaffected. The GnuTLS loop had the same gap (onlyGNUTLS_SAN_DNSNAMEwas checked, and any error or more than 100 entries ended validation). Its certificates do not carry the request extensions today, but I changed it the same way so both backends refuse the same requests.The new testcreds case signs an embedded
CN=altprinter,DNS:altprinter,IP:192.168.1.1request; it fails on master ("Expected a failure") and passes with this change. I ran testcreds on a Windows/LibreSSL build, where the only other failures are the POSIX key file permission checks, the same before and after. I have not run the GnuTLS build, so that hunk is only compile-checked.Proposed changelog entry:
cupsSignCredentialsRequestto reject requests with subjectAltName values other than DNS names.