Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 2137577

Summary: in FIPS mode, libgcrypt PBKDF2 should enforce minimum input passphrase size (and potentially also salt length and iterations)
Product: Red Hat Enterprise Linux 9 Reporter: Clemens Lang <cllang>
Component: libgcryptAssignee: Jakub Jelen <jjelen>
Status: CLOSED CURRENTRELEASE QA Contact: Stanislav Zidek <szidek>
Severity: urgent Docs Contact:
Priority: high    
Version: 9.0CC: ssorce
Target Milestone: rcKeywords: Triaged, ZStream
Target Release: 9.2Flags: pm-rhel: mirror+
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libgcrypt-1.10.0-9.el9_1 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of:
: 2168656 2168657 (view as bug list) Environment:
Last Closed: 2023-06-01 11:18:38 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2168656, 2168657    
Attachments:
Description Flags
gcry pbkdf2 reproducer none

Description Clemens Lang 2022-10-25 14:41:12 UTC
Created attachment 1920295 [details]
gcry pbkdf2 reproducer

Description of problem:
After further clarification from Atsec, we should enforce a minimum password length in PBKDF2; see FIPS 140-3 IG D.N:

The strength of the Data Protection Key is based on the strength of the Password and/or Passphrase used in key derivation. SP 800-132 does not impose any strictly defined requirements on the strength of a password. It says that “passwords should be strong enough so that it is infeasible for attackers to get access by guessing a password.” Therefore, the vendor shall document in the module’s Security Policy the length of a password/passphrase used in key derivation and establish an upper bound for the probability of having this parameter guessed at random. This probability shall take into account not only the length of the password/passphrase, but also the difficulty of guessing it. The decision on the minimum length of a password used for key derivation is the vendor’s, but the vendor shall at a minimum informally justify the decision.

Additionally, OpenSSL implements minimums for salt length and iteration count, referencing SP 800-132, so we should probably take a look at that and ensure that we're compliant. See the documentation for OSSL_KDF_PARAM_PKCS5 in https://www.openssl.org/docs/man3.0/man7/EVP_KDF-PBKDF2.html.

Note that ACVP testing does check password lengths of 8 bytes, so we should either implement an explicit indicator for this, or choose 8 bytes as minimum acceptable password length so we don't fail that (see also https://bugzilla.redhat.com/show_bug.cgi?id=2136492, which was filed for that reason).

Version-Release number of selected component (if applicable):
1.10.0-8.el9_0

How reproducible:
Run the attached reproducer with short passwords, low salt length, or low iteration count.

Steps to Reproduce:
1. cc -std=c99 -Wall -Werror -pedantic -D_XOPEN_SOURCE=600 -o gcry_pbkdf2 gcry_pbkdf2.c -lgcrypt
2. ./gcry_pbkdf2 sha256 1 1 14 ""

Actual results:
OK: 0x779fe14ace88156df8abe4456825

Expected results:
ERR gcry_kdf_derive() failed: Invalid value

Comment 1 Jakub Jelen 2022-11-15 10:43:41 UTC
Opened merge request: https://gitlab.com/redhat-crypto/libgcrypt/libgcrypt-mirror/-/merge_requests/10

Comment 2 Jakub Jelen 2022-11-29 13:08:30 UTC
One more change we can anticipate is the maximum salt length for RSA-PSS, which was brought up in OpenSSL reviews as it has larger defaults. The changes proposed upstream are here:

https://gitlab.com/redhat-crypto/libgcrypt/libgcrypt-mirror/-/merge_requests/11

Comment 3 Jakub Jelen 2022-12-01 12:42:00 UTC
Another issue was reported by our lab in regards to the x9.31 keygen. Possible fix is available here, waiting for feedback before I will submit it upstream:

https://gitlab.com/redhat-crypto/libgcrypt/libgcrypt-mirror/-/merge_requests/12