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 2175145 - In FIPS mode, openssl should always run the PBKDF2 lower bounds checks or provide an indicator when the pkcs5 parameter is set to 1
Summary: In FIPS mode, openssl should always run the PBKDF2 lower bounds checks or pro...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: openssl
Version: 9.0
Hardware: x86_64
OS: Linux
urgent
high
Target Milestone: rc
: ---
Assignee: Clemens Lang
QA Contact: Alicja Kario
URL:
Whiteboard:
Depends On:
Blocks: 2178137 2178138 2178139
TreeView+ depends on / blocked
 
Reported: 2023-03-03 11:01 UTC by Clemens Lang
Modified: 2023-11-07 11:26 UTC (History)
4 users (show)

Fixed In Version: openssl-3.0.7-17.el9
Doc Type: No Doc Update
Doc Text:
Clone Of:
: 2178137 2178138 2178139 (view as bug list)
Environment:
Last Closed: 2023-11-07 08:53:05 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Reproducer for arbitrary KDFs (now supports PBKDF2 and setting the pkcs5 property for PBKDF2) (10.61 KB, text/x-csrc)
2023-03-03 11:05 UTC, Clemens Lang
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Github openssl openssl pull 20429 0 None open fips: Use salt >= 16 bytes in PBKDF2 selftest 2023-03-03 11:37:08 UTC
Gitlab redhat/centos-stream/rpms openssl merge_requests 93 0 None opened Draft: KDF: Add FIPS indicators 2023-03-06 12:30:44 UTC
Red Hat Issue Tracker CRYPTO-9679 0 None None None 2023-03-03 11:04:55 UTC
Red Hat Issue Tracker FIPS-97 0 None None None 2023-03-03 11:01:31 UTC
Red Hat Issue Tracker RHELPLAN-150577 0 None None None 2023-03-03 11:02:14 UTC
Red Hat Product Errata RHBA-2023:6627 0 None None None 2023-11-07 08:53:54 UTC

Description Clemens Lang 2023-03-03 11:01:32 UTC
Description of problem:
SP 800-132 and FIPS 140-3 IG D.N define 4 checks that need to be performed by the module when performing PBKDF key derivation.

These checks are implemented in OpenSSL 3, but they can be bypassed by setting the "pkcs5" parameter (see https://www.openssl.org/docs/man3.0/man7/EVP_KDF-PBKDF2.html) to 1. When this parameter is set, the module must return a non-approved service indicator. Alternatively, this parameter could be ignored (i.e. always perform the checks). Note that ignoring the parameter and always running the checks will require adjusting the tests, since some of them fail.

Additionally, the OpenSSL 3 PBKDF2 self-test uses a 5 byte salt length, which is below the minimum of 16 bytes required by SP 800-132 section 5.1.


Version-Release number of selected component (if applicable):
openssl-3.0.1-46.el9_0

How reproducible:
Run the attached reproducer with the last parameter set to 1, and see that it will support a lower limit than required.

Steps to Reproduce:
1. Approved as expected:
$(head -1 kdf2.c | sed -E 's#^// ##g') && ./kdf2 PBKDF2 SHA256 HMAC 16 0 8 14 0
ERR Failed to duplicate EVP_KDF_CTX, this may be unsupported by your version of OpenSSL; using original context
OK (indicator: not implemented in provider): 0x57c04624699b881c8ec4e80f7
2. Lowering any of salt length, password length, or output key length fails the call:
$(head -1 kdf2.c | sed -E 's#^// ##g') && ./kdf2 PBKDF2 SHA256 HMAC 15 0 7 13 0
ERR Failed to set EVP_KDF_CTX parameters: error:1C800069:Provider routines::invalid key length (in function kdf_pbkdf2_set_ctx_params in providers/implementations/kdfs/pbkdf2.c:207):
ERR Failed to set EVP_KDF_CTX parameters: error:1C800070:Provider routines::invalid salt length (in function kdf_pbkdf2_set_ctx_params in providers/implementations/kdfs/pbkdf2.c:217):
ERR Failed to derive key: error:1C8000AB:Provider routines::key size too small (in function pbkdf2_derive in providers/implementations/kdfs/pbkdf2.c:326):
3. Running the same command with the pkcs5 parameter set to 1 passes:
$(head -1 kdf2.c | sed -E 's#^// ##g') && ./kdf2 PBKDF2 SHA256 HMAC 15 0 7 13 1
ERR Failed to duplicate EVP_KDF_CTX, this may be unsupported by your version of OpenSSL; using original context
OK (indicator: not implemented in provider): 0x712fad9de3f4c1ee726ca5932

Actual results:
Setting the pkcs5 parameter to 1 allows behavior that is not valid in FIPS mode.

Expected results:
Either setting the pkcs5 parameter to 1 causes an explicit indicator to show that the call was unapproved, or disabling the lower bounds checks is not possible in FIPS mode.

Comment 2 Clemens Lang 2023-03-03 11:05:33 UTC
Created attachment 1947670 [details]
Reproducer for arbitrary KDFs (now supports PBKDF2 and setting the pkcs5 property for PBKDF2)

Comment 3 Clemens Lang 2023-03-03 11:37:08 UTC
See https://github.com/openssl/openssl/pull/20429 for a patch fixing the self-test.

Comment 18 errata-xmlrpc 2023-11-07 08:53:05 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 (openssl 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/RHBA-2023:6627


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