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 1952628 - CRMF requests with extensions other than SKID cannot be processed
Summary: CRMF requests with extensions other than SKID cannot be processed
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: pki-core
Version: 8.3
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: beta
: ---
Assignee: Christina Fu
QA Contact: PKI QE
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-04-22 17:11 UTC by Chris Zinda
Modified: 2021-11-10 00:32 UTC (History)
4 users (show)

Fixed In Version: pki-core-10.6-8050020210812105402.01d2cef5
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-11-09 18:39:04 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2021:4239 0 None None None 2021-11-09 18:39:26 UTC

Description Chris Zinda 2021-04-22 17:11:45 UTC
Description of problem:
CRMF Requests with any extensions other the SubjectKeyIdentifier are not being handled correctly by RedHat CS


[13/Apr/2021:20:36:41][ajp-bio-127.0.0.1-6116-exec-2]: EnrollProfile: Start parseCRMF(): 
[13/Apr/2021:20:36:41][ajp-bio-127.0.0.1-6116-exec-2]: EnrollInput ::in verifyPOP
[13/Apr/2021:20:36:41][ajp-bio-127.0.0.1-6116-exec-2]: EnrollInput: verifyPOP: CertReqMsg has not POP, return
[13/Apr/2021:20:36:41][ajp-bio-127.0.0.1-6116-exec-2]: EnrollProfile: fillCertReqMsg: Start parseCertReqMsg 
[13/Apr/2021:20:36:41][ajp-bio-127.0.0.1-6116-exec-2]: EnrollProfile:  requested notBefore: Wed Nov 20 00:00:00 UTC 2019
[13/Apr/2021:20:36:41][ajp-bio-127.0.0.1-6116-exec-2]: EnrollProfile:  requested notAfter:  Sun Nov 20 23:59:59 UTC 2022
[13/Apr/2021:20:36:41][ajp-bio-127.0.0.1-6116-exec-2]: EnrollProfile:  current CA time:     Tue Apr 13 20:36:41 UTC 2021
[13/Apr/2021:20:36:41][ajp-bio-127.0.0.1-6116-exec-2]: EnrollProfile: fillCertReqMsg: found extension:{2 5 29 15}
[13/Apr/2021:20:36:41][ajp-bio-127.0.0.1-6116-exec-2]: EnrollProfile: Unable to fill certificate request message: java.io.IOException: java.lang.NullPointerException
java.io.IOException: java.lang.NullPointerException
	at netscape.security.x509.CertificateExtensions.parseExtension(CertificateExtensions.java:103)
	at com.netscape.cms.profile.common.EnrollProfile.fillCertReqMsg(EnrollProfile.java:2292)
	at com.netscape.cms.profile.input.CertReqInput.populate(CertReqInput.java:151)
	at com.netscape.cms.profile.common.BasicProfile.populateInput(BasicProfile.java:1090)
	at com.netscape.cms.profile.common.EnrollProfile.populateInput(EnrollProfile.java:2600)
	at com.netscape.cms.servlet.cert.CertProcessor.populateRequests(CertProcessor.java:374)
	at com.netscape.cms.servlet.cert.EnrollmentProcessor.processEnrollment(EnrollmentProcessor.java:188)
	at com.netscape.cms.servlet.cert.EnrollmentProcessor.processEnrollment(EnrollmentProcessor.java:96)
	at com.netscape.cms.servlet.profile.ProfileSubmitServlet.processEnrollment(ProfileSubmitServlet.java:279)
	at com.netscape.cms.servlet.profile.ProfileSubmitServlet.process(ProfileSubmitServlet.java:131)
	at com.netscape.cms.servlet.base.CMSServlet.service(CMSServlet.java:493)
	<even more call stack>

The SKID comment and problematic line of code is here (from <dogtag>/base/server/cms/src/com/netscape/cms/profile/common/EnrollProfile.java)

                /*
                 * there seems to be an issue with constructor in Extension
                 * when feeding SubjectKeyIdentifierExtension;
                 * Special-case it
                 */
                OBJECT_IDENTIFIER SKIoid =
                        new OBJECT_IDENTIFIER(PKIXExtensions.SubjectKey_Id.toString());
                for (int j = 0; j < numexts; j++) {
                    org.mozilla.jss.pkix.cert.Extension jssext =
                            certTemplate.extensionAt(j);
                    boolean isCritical = jssext.getCritical();
                    org.mozilla.jss.asn1.OBJECT_IDENTIFIER jssoid =
                            jssext.getExtnId();
                    CMS.debug(method + "found extension:" + jssoid.toString());
                    long[] numbers = jssoid.getNumbers();
                    int[] oidNumbers = new int[numbers.length];

                    for (int k = numbers.length - 1; k >= 0; k--) {
                        oidNumbers[k] = (int) numbers[k];
                    }
                    ObjectIdentifier oid =
                            new ObjectIdentifier(oidNumbers);
                    org.mozilla.jss.asn1.OCTET_STRING jssvalue =
                            jssext.getExtnValue();
                    ByteArrayOutputStream jssvalueout =
                            new ByteArrayOutputStream();

                    jssvalue.encode(jssvalueout);
                    byte[] extValue = jssvalueout.toByteArray();

                    Extension ext = null;
                    if (jssoid.equals(SKIoid)) {
                        CMS.debug(method + "found SUBJECT_KEY_IDENTIFIER extension");
                        ext = new SubjectKeyIdentifierExtension(false,
                                jssext.getExtnValue().toByteArray());
                    } else {
                        new Extension(oid, isCritical, extValue);  < --- 2
                    }

                    extensions.parseExtension(ext);	<--- 1
                }

The problem is that when we reach <--- 1 with a SKID, ext is set. When we reach that point for anything else it is not because " new Extension(oid, isCritical, extValue);" is not assigned to ext. The else block should read:

ext = new Extension(oid, isCritical, extValue);

The line of code as it appears in github is:

https://github.com/dogtagpki/pki/blob/v10.6.10/base/server/cms/src/com/netscape/cms/profile/common/EnrollProfile.java#L2276

https://github.com/dogtagpki/pki/blob/v10.5.18/base/server/cms/src/com/netscape/cms/profile/common/EnrollProfile.java#L2289

. 




Version-Release number of selected component (if applicable):
9.x and 10.x

How reproducible:
Very

Steps to Reproduce:
1. CRMF Requests with any extensions other the SubjectKeyIdentifier are not being handled correctly by RedHat CS

2.
3.

Actual results:
Request is being rejected.

Expected results:
Issue cert with other extensions.

Additional info:

Comment 7 errata-xmlrpc 2021-11-09 18:39:04 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 (pki-core bug fix and enhancement update), 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/RHEA-2021:4239


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