Activity log for bug #1983160

Date Who What changed Old value New value Message
2022-07-30 00:13:36 Chris Coulson bug added bug
2022-07-30 00:13:49 Chris Coulson bug added subscriber Andrew Cloke
2022-07-30 00:14:02 Chris Coulson bug added subscriber Chris Newcomer
2022-07-30 00:14:08 Chris Coulson nominated for series Ubuntu Focal
2022-07-30 00:14:08 Chris Coulson bug task added tpm2-tss (Ubuntu Focal)
2022-07-30 00:14:14 Chris Coulson tpm2-tss (Ubuntu): status New Fix Released
2022-07-30 00:14:18 Chris Coulson tpm2-tss (Ubuntu Focal): status New Triaged
2022-08-01 11:15:34 Ivan Kapelyukhin bug added subscriber Ivan Kapelyukhin
2022-08-02 09:18:45 Utkarsh Gupta nominated for series Ubuntu Jammy
2022-08-02 09:18:45 Utkarsh Gupta bug task added tpm2-tss (Ubuntu Jammy)
2022-08-02 09:18:53 Utkarsh Gupta tpm2-tss (Ubuntu Jammy): status New Fix Released
2022-08-15 19:00:23 Utkarsh Gupta bug watch added https://github.com/tpm2-software/tpm2-pkcs11/issues/655
2022-08-15 19:02:41 Utkarsh Gupta description When configuring SSH to use a TPM protected key for authentication using tpm2-pkcs11 following the steps documented in https://github.com/tpm2-software/tpm2-pkcs11/blob/master/docs/SSH.md, it fails when trying to login on a system that is running in FIPS mode, with the following error message: WARNING:esys:src/tss2-esys/api/Esys_StartAuthSession.c:383:Esys_StartAuthSession_Finish() Received TPM Error ERROR:esys:src/tss2-esys/api/Esys_StartAuthSession.c:136:Esys_StartAuthSession() Esys Finish ErrorCode (0x000002c4) ERROR: Esys_StartAuthSession: tpm:parameter(2):value is out of range or is not correct for the context ERROR: Could not start Auth Session with the TPM. ERROR: Error unsealing wrapping key C_Login failed: 5 login failed pkcs11_get_key failed sign_and_send_pubkey: signing failed for RSA "": error in libcrypto Parameter 2 in this case is the encrypted salt supplied to the TPM2_StartAuthSession command. tpm2-pkcs11 is creating a session that is salted with a value which is encrypted with the public part of a TPM protected RSA key before being sent to the TPM. This encryption happens in iesys_cryptossl_pk_encrypt which has a bug in the version in focal that was fixed accidentally in https://github.com/tpm2-software/tpm2-tss/commit/362fda1daa398da2944e76013c215500761d46a5. In focal, iesys_cryptossl_pk_encrypt generates a RSA key using openssl and then overwrites the public modulus with the one associated with the TPM key. This fails when running a FIPS certified version of openssl in FIPS mode because openssl performs a test on the generated key, which results in the Montgomery value associated with the generated public modulus being cached. The cached value isn't updated when the public modulus is changed, and the incorrect value is used in the subsequent encryption operation. [Impact] It's not possible to use tpm2-pkcs11 on a system that is running in FIPS mode with the version of tpm2-tss in focal. This is fixed by partially backporting https://github.com/tpm2-software/tpm2-tss/commit/362fda1daa398da2944e76013c215500761d46a5 so that iesys_cryptossl_pk_encrypt does not perform an unnecessary key generation. [Test plan] Follow the instructions detailed in https://github.com/tpm2-software/tpm2-pkcs11/blob/master/docs/SSH.md and verify that it is possible to login to localhost with the TPM protected key. You will need to compile tpm2-pkcs11 from source. 1.6.0 is compatible with the version of tpm2-tss in focal. [Regression potential] This is minimal - iesys_cryptossl_pk_encrypt is implemented this way already in releases after focal. It's also only used by StartAuthSession when called with a TPM key, which isn't that usual. When configuring SSH to use a TPM protected key for authentication using tpm2-pkcs11 following the steps documented in https://github.com/tpm2-software/tpm2-pkcs11/blob/master/docs/SSH.md, it fails when trying to login on a system that is running in FIPS mode, with the following error message: WARNING:esys:src/tss2-esys/api/Esys_StartAuthSession.c:383:Esys_StartAuthSession_Finish() Received TPM Error ERROR:esys:src/tss2-esys/api/Esys_StartAuthSession.c:136:Esys_StartAuthSession() Esys Finish ErrorCode (0x000002c4) ERROR: Esys_StartAuthSession: tpm:parameter(2):value is out of range or is not correct for the context ERROR: Could not start Auth Session with the TPM. ERROR: Error unsealing wrapping key C_Login failed: 5 login failed pkcs11_get_key failed sign_and_send_pubkey: signing failed for RSA "": error in libcrypto Parameter 2 in this case is the encrypted salt supplied to the TPM2_StartAuthSession command. tpm2-pkcs11 is creating a session that is salted with a value which is encrypted with the public part of a TPM protected RSA key before being sent to the TPM. This encryption happens in iesys_cryptossl_pk_encrypt which has a bug in the version in focal that was fixed accidentally in https://github.com/tpm2-software/tpm2-tss/commit/362fda1daa398da2944e76013c215500761d46a5. In focal, iesys_cryptossl_pk_encrypt generates a RSA key using openssl and then overwrites the public modulus with the one associated with the TPM key. This fails when running a FIPS certified version of openssl in FIPS mode because openssl performs a test on the generated key, which results in the Montgomery value associated with the generated public modulus being cached. The cached value isn't updated when the public modulus is changed, and the incorrect value is used in the subsequent encryption operation. [Impact] It's not possible to use tpm2-pkcs11 on a system that is running in FIPS mode with the version of tpm2-tss in focal. This is fixed by partially backporting https://github.com/tpm2-software/tpm2-tss/commit/362fda1daa398da2944e76013c215500761d46a5 so that iesys_cryptossl_pk_encrypt does not perform an unnecessary key generation. [Test plan] Follow the instructions detailed in https://github.com/tpm2-software/tpm2-pkcs11/blob/master/docs/SSH.md and verify that it is possible to login to localhost with the TPM protected key. Or is the tiny reproducer meanwhile: ``` # Add the key ``` sudo usermod -a -G tss $USER tpm2_ptool init tpm2_ptool addtoken --pid=1 --label=ssh --userpin=MySecretPassword --sopin=MyRecoveryPassword tpm2_ptool addkey --label=ssh --userpin=MySecretPassword --algorithm=rsa2048 ``` # List the public SSH keys ``` ssh-keygen -D /usr/local/lib/libtpm2_pkcs11.so 2>/dev/null ``` Those warnings/errors are displayed, but can be ignored from what I can understand (see https://github.com/tpm2-software/tpm2-pkcs11/issues/655): ``` WARNING:fapi:src/tss2-fapi/api/Fapi_List.c:226:Fapi_List_Finish() Profile of path not provisioned: /HS/SRK ERROR:fapi:src/tss2-fapi/api/Fapi_List.c:81:Fapi_List() ErrorCode (0x00060034) Entities_List ERROR: Listing FAPI token objects failed. ``` # Add the SSH key authorized_keys Add this key to root's authorized keys: ``` ssh-keygen -D /usr/local/lib/libtpm2_pkcs11.so 2>/dev/null | sudo tee -a /root/.ssh/authorized_keys ``` # SSH as root Pin is `MySecretPassword`: ``` ssh -I /usr/local/lib/libtpm2_pkcs11.so root@localhost ``` Observe the error. ``` [Regression potential] This is minimal - iesys_cryptossl_pk_encrypt is implemented this way already in releases after focal. It's also only used by StartAuthSession when called with a TPM key, which isn't that usual.
2022-08-24 19:31:06 Andreas Hasenack bug added subscriber Andreas Hasenack
2022-08-24 20:20:56 Robie Basak tpm2-tss (Ubuntu Focal): status Triaged Fix Committed
2022-08-24 20:20:58 Robie Basak bug added subscriber Ubuntu Stable Release Updates Team
2022-08-24 20:20:59 Robie Basak bug added subscriber SRU Verification
2022-08-24 20:21:03 Robie Basak tags verification-needed verification-needed-focal
2022-08-24 20:22:07 Robie Basak description When configuring SSH to use a TPM protected key for authentication using tpm2-pkcs11 following the steps documented in https://github.com/tpm2-software/tpm2-pkcs11/blob/master/docs/SSH.md, it fails when trying to login on a system that is running in FIPS mode, with the following error message: WARNING:esys:src/tss2-esys/api/Esys_StartAuthSession.c:383:Esys_StartAuthSession_Finish() Received TPM Error ERROR:esys:src/tss2-esys/api/Esys_StartAuthSession.c:136:Esys_StartAuthSession() Esys Finish ErrorCode (0x000002c4) ERROR: Esys_StartAuthSession: tpm:parameter(2):value is out of range or is not correct for the context ERROR: Could not start Auth Session with the TPM. ERROR: Error unsealing wrapping key C_Login failed: 5 login failed pkcs11_get_key failed sign_and_send_pubkey: signing failed for RSA "": error in libcrypto Parameter 2 in this case is the encrypted salt supplied to the TPM2_StartAuthSession command. tpm2-pkcs11 is creating a session that is salted with a value which is encrypted with the public part of a TPM protected RSA key before being sent to the TPM. This encryption happens in iesys_cryptossl_pk_encrypt which has a bug in the version in focal that was fixed accidentally in https://github.com/tpm2-software/tpm2-tss/commit/362fda1daa398da2944e76013c215500761d46a5. In focal, iesys_cryptossl_pk_encrypt generates a RSA key using openssl and then overwrites the public modulus with the one associated with the TPM key. This fails when running a FIPS certified version of openssl in FIPS mode because openssl performs a test on the generated key, which results in the Montgomery value associated with the generated public modulus being cached. The cached value isn't updated when the public modulus is changed, and the incorrect value is used in the subsequent encryption operation. [Impact] It's not possible to use tpm2-pkcs11 on a system that is running in FIPS mode with the version of tpm2-tss in focal. This is fixed by partially backporting https://github.com/tpm2-software/tpm2-tss/commit/362fda1daa398da2944e76013c215500761d46a5 so that iesys_cryptossl_pk_encrypt does not perform an unnecessary key generation. [Test plan] Follow the instructions detailed in https://github.com/tpm2-software/tpm2-pkcs11/blob/master/docs/SSH.md and verify that it is possible to login to localhost with the TPM protected key. Or is the tiny reproducer meanwhile: ``` # Add the key ``` sudo usermod -a -G tss $USER tpm2_ptool init tpm2_ptool addtoken --pid=1 --label=ssh --userpin=MySecretPassword --sopin=MyRecoveryPassword tpm2_ptool addkey --label=ssh --userpin=MySecretPassword --algorithm=rsa2048 ``` # List the public SSH keys ``` ssh-keygen -D /usr/local/lib/libtpm2_pkcs11.so 2>/dev/null ``` Those warnings/errors are displayed, but can be ignored from what I can understand (see https://github.com/tpm2-software/tpm2-pkcs11/issues/655): ``` WARNING:fapi:src/tss2-fapi/api/Fapi_List.c:226:Fapi_List_Finish() Profile of path not provisioned: /HS/SRK ERROR:fapi:src/tss2-fapi/api/Fapi_List.c:81:Fapi_List() ErrorCode (0x00060034) Entities_List ERROR: Listing FAPI token objects failed. ``` # Add the SSH key authorized_keys Add this key to root's authorized keys: ``` ssh-keygen -D /usr/local/lib/libtpm2_pkcs11.so 2>/dev/null | sudo tee -a /root/.ssh/authorized_keys ``` # SSH as root Pin is `MySecretPassword`: ``` ssh -I /usr/local/lib/libtpm2_pkcs11.so root@localhost ``` Observe the error. ``` [Regression potential] This is minimal - iesys_cryptossl_pk_encrypt is implemented this way already in releases after focal. It's also only used by StartAuthSession when called with a TPM key, which isn't that usual. When configuring SSH to use a TPM protected key for authentication using tpm2-pkcs11 following the steps documented in https://github.com/tpm2-software/tpm2-pkcs11/blob/master/docs/SSH.md, it fails when trying to login on a system that is running in FIPS mode, with the following error message: WARNING:esys:src/tss2-esys/api/Esys_StartAuthSession.c:383:Esys_StartAuthSession_Finish() Received TPM Error ERROR:esys:src/tss2-esys/api/Esys_StartAuthSession.c:136:Esys_StartAuthSession() Esys Finish ErrorCode (0x000002c4) ERROR: Esys_StartAuthSession: tpm:parameter(2):value is out of range or is not correct for the context ERROR: Could not start Auth Session with the TPM. ERROR: Error unsealing wrapping key C_Login failed: 5 login failed pkcs11_get_key failed sign_and_send_pubkey: signing failed for RSA "": error in libcrypto Parameter 2 in this case is the encrypted salt supplied to the TPM2_StartAuthSession command. tpm2-pkcs11 is creating a session that is salted with a value which is encrypted with the public part of a TPM protected RSA key before being sent to the TPM. This encryption happens in iesys_cryptossl_pk_encrypt which has a bug in the version in focal that was fixed accidentally in https://github.com/tpm2-software/tpm2-tss/commit/362fda1daa398da2944e76013c215500761d46a5. In focal, iesys_cryptossl_pk_encrypt generates a RSA key using openssl and then overwrites the public modulus with the one associated with the TPM key. This fails when running a FIPS certified version of openssl in FIPS mode because openssl performs a test on the generated key, which results in the Montgomery value associated with the generated public modulus being cached. The cached value isn't updated when the public modulus is changed, and the incorrect value is used in the subsequent encryption operation. [Impact] It's not possible to use tpm2-pkcs11 on a system that is running in FIPS mode with the version of tpm2-tss in focal. This is fixed by partially backporting https://github.com/tpm2-software/tpm2-tss/commit/362fda1daa398da2944e76013c215500761d46a5 so that iesys_cryptossl_pk_encrypt does not perform an unnecessary key generation. [Test plan] [racb: pending amendment - see comment 3 below] Follow the instructions detailed in https://github.com/tpm2-software/tpm2-pkcs11/blob/master/docs/SSH.md and verify that it is possible to login to localhost with the TPM protected key. Or is the tiny reproducer meanwhile: ``` # Add the key ``` sudo usermod -a -G tss $USER tpm2_ptool init tpm2_ptool addtoken --pid=1 --label=ssh --userpin=MySecretPassword --sopin=MyRecoveryPassword tpm2_ptool addkey --label=ssh --userpin=MySecretPassword --algorithm=rsa2048 ``` # List the public SSH keys ``` ssh-keygen -D /usr/local/lib/libtpm2_pkcs11.so 2>/dev/null ``` Those warnings/errors are displayed, but can be ignored from what I can understand (see https://github.com/tpm2-software/tpm2-pkcs11/issues/655): ``` WARNING:fapi:src/tss2-fapi/api/Fapi_List.c:226:Fapi_List_Finish() Profile of path not provisioned: /HS/SRK ERROR:fapi:src/tss2-fapi/api/Fapi_List.c:81:Fapi_List() ErrorCode (0x00060034) Entities_List ERROR: Listing FAPI token objects failed. ``` # Add the SSH key authorized_keys Add this key to root's authorized keys: ``` ssh-keygen -D /usr/local/lib/libtpm2_pkcs11.so 2>/dev/null | sudo tee -a /root/.ssh/authorized_keys ``` # SSH as root Pin is `MySecretPassword`: ``` ssh -I /usr/local/lib/libtpm2_pkcs11.so root@localhost ``` Observe the error. ``` [Regression potential] This is minimal - iesys_cryptossl_pk_encrypt is implemented this way already in releases after focal. It's also only used by StartAuthSession when called with a TPM key, which isn't that usual.
2022-09-02 09:40:07 Ivan Kapelyukhin tags verification-needed verification-needed-focal verification-done verification-done-focal
2022-09-02 11:31:09 Andrew Cloke description When configuring SSH to use a TPM protected key for authentication using tpm2-pkcs11 following the steps documented in https://github.com/tpm2-software/tpm2-pkcs11/blob/master/docs/SSH.md, it fails when trying to login on a system that is running in FIPS mode, with the following error message: WARNING:esys:src/tss2-esys/api/Esys_StartAuthSession.c:383:Esys_StartAuthSession_Finish() Received TPM Error ERROR:esys:src/tss2-esys/api/Esys_StartAuthSession.c:136:Esys_StartAuthSession() Esys Finish ErrorCode (0x000002c4) ERROR: Esys_StartAuthSession: tpm:parameter(2):value is out of range or is not correct for the context ERROR: Could not start Auth Session with the TPM. ERROR: Error unsealing wrapping key C_Login failed: 5 login failed pkcs11_get_key failed sign_and_send_pubkey: signing failed for RSA "": error in libcrypto Parameter 2 in this case is the encrypted salt supplied to the TPM2_StartAuthSession command. tpm2-pkcs11 is creating a session that is salted with a value which is encrypted with the public part of a TPM protected RSA key before being sent to the TPM. This encryption happens in iesys_cryptossl_pk_encrypt which has a bug in the version in focal that was fixed accidentally in https://github.com/tpm2-software/tpm2-tss/commit/362fda1daa398da2944e76013c215500761d46a5. In focal, iesys_cryptossl_pk_encrypt generates a RSA key using openssl and then overwrites the public modulus with the one associated with the TPM key. This fails when running a FIPS certified version of openssl in FIPS mode because openssl performs a test on the generated key, which results in the Montgomery value associated with the generated public modulus being cached. The cached value isn't updated when the public modulus is changed, and the incorrect value is used in the subsequent encryption operation. [Impact] It's not possible to use tpm2-pkcs11 on a system that is running in FIPS mode with the version of tpm2-tss in focal. This is fixed by partially backporting https://github.com/tpm2-software/tpm2-tss/commit/362fda1daa398da2944e76013c215500761d46a5 so that iesys_cryptossl_pk_encrypt does not perform an unnecessary key generation. [Test plan] [racb: pending amendment - see comment 3 below] Follow the instructions detailed in https://github.com/tpm2-software/tpm2-pkcs11/blob/master/docs/SSH.md and verify that it is possible to login to localhost with the TPM protected key. Or is the tiny reproducer meanwhile: ``` # Add the key ``` sudo usermod -a -G tss $USER tpm2_ptool init tpm2_ptool addtoken --pid=1 --label=ssh --userpin=MySecretPassword --sopin=MyRecoveryPassword tpm2_ptool addkey --label=ssh --userpin=MySecretPassword --algorithm=rsa2048 ``` # List the public SSH keys ``` ssh-keygen -D /usr/local/lib/libtpm2_pkcs11.so 2>/dev/null ``` Those warnings/errors are displayed, but can be ignored from what I can understand (see https://github.com/tpm2-software/tpm2-pkcs11/issues/655): ``` WARNING:fapi:src/tss2-fapi/api/Fapi_List.c:226:Fapi_List_Finish() Profile of path not provisioned: /HS/SRK ERROR:fapi:src/tss2-fapi/api/Fapi_List.c:81:Fapi_List() ErrorCode (0x00060034) Entities_List ERROR: Listing FAPI token objects failed. ``` # Add the SSH key authorized_keys Add this key to root's authorized keys: ``` ssh-keygen -D /usr/local/lib/libtpm2_pkcs11.so 2>/dev/null | sudo tee -a /root/.ssh/authorized_keys ``` # SSH as root Pin is `MySecretPassword`: ``` ssh -I /usr/local/lib/libtpm2_pkcs11.so root@localhost ``` Observe the error. ``` [Regression potential] This is minimal - iesys_cryptossl_pk_encrypt is implemented this way already in releases after focal. It's also only used by StartAuthSession when called with a TPM key, which isn't that usual. When configuring SSH to use a TPM protected key for authentication using tpm2-pkcs11 following the steps documented in https://github.com/tpm2-software/tpm2-pkcs11/blob/master/docs/SSH.md, it fails when trying to login on a system that is running in FIPS mode, with the following error message: WARNING:esys:src/tss2-esys/api/Esys_StartAuthSession.c:383:Esys_StartAuthSession_Finish() Received TPM Error ERROR:esys:src/tss2-esys/api/Esys_StartAuthSession.c:136:Esys_StartAuthSession() Esys Finish ErrorCode (0x000002c4) ERROR: Esys_StartAuthSession: tpm:parameter(2):value is out of range or is not correct for the context ERROR: Could not start Auth Session with the TPM. ERROR: Error unsealing wrapping key C_Login failed: 5 login failed pkcs11_get_key failed sign_and_send_pubkey: signing failed for RSA "": error in libcrypto Parameter 2 in this case is the encrypted salt supplied to the TPM2_StartAuthSession command. tpm2-pkcs11 is creating a session that is salted with a value which is encrypted with the public part of a TPM protected RSA key before being sent to the TPM. This encryption happens in iesys_cryptossl_pk_encrypt which has a bug in the version in focal that was fixed accidentally in https://github.com/tpm2-software/tpm2-tss/commit/362fda1daa398da2944e76013c215500761d46a5. In focal, iesys_cryptossl_pk_encrypt generates a RSA key using openssl and then overwrites the public modulus with the one associated with the TPM key. This fails when running a FIPS certified version of openssl in FIPS mode because openssl performs a test on the generated key, which results in the Montgomery value associated with the generated public modulus being cached. The cached value isn't updated when the public modulus is changed, and the incorrect value is used in the subsequent encryption operation. [Impact] It's not possible to use tpm2-pkcs11 on a system that is running in FIPS mode with the version of tpm2-tss in focal. This is fixed by partially backporting https://github.com/tpm2-software/tpm2-tss/commit/362fda1daa398da2944e76013c215500761d46a5 so that iesys_cryptossl_pk_encrypt does not perform an unnecessary key generation. [Test plan] [racb: pending amendment - see comment 3 below] [amc: Test plan updated with the additional information that addresses 2 of the 3 points in comment #3. The third point is addressed in comment #5] Follow the instructions detailed in https://github.com/tpm2-software/tpm2-pkcs11/blob/master/docs/SSH.md and verify that it is possible to login to localhost with the TPM protected key. Or follow the reproduction steps below in both FIPS mode and non-FIPS mode (see https://ubuntu.com/security/certifications/docs/fips-enablement for steps to enable and disable FIPS): ``` # Add the key ``` sudo usermod -a -G tss $USER tpm2_ptool init tpm2_ptool addtoken --pid=1 --label=ssh --userpin=MySecretPassword --sopin=MyRecoveryPassword tpm2_ptool addkey --label=ssh --userpin=MySecretPassword --algorithm=rsa2048 ``` # List the public SSH keys ``` ssh-keygen -D /usr/local/lib/libtpm2_pkcs11.so 2>/dev/null ``` Those warnings/errors are displayed, but can be ignored from what I can understand (see https://github.com/tpm2-software/tpm2-pkcs11/issues/655): ``` WARNING:fapi:src/tss2-fapi/api/Fapi_List.c:226:Fapi_List_Finish() Profile of path not provisioned: /HS/SRK ERROR:fapi:src/tss2-fapi/api/Fapi_List.c:81:Fapi_List() ErrorCode (0x00060034) Entities_List ERROR: Listing FAPI token objects failed. ``` # Add the SSH key authorized_keys Add this key to root's authorized keys: ``` ssh-keygen -D /usr/local/lib/libtpm2_pkcs11.so 2>/dev/null | sudo tee -a /root/.ssh/authorized_keys ``` # SSH as root Pin is `MySecretPassword`: ``` ssh -I /usr/local/lib/libtpm2_pkcs11.so root@localhost ``` Observe the error. ``` [Regression potential] This is minimal - iesys_cryptossl_pk_encrypt is implemented this way already in releases after focal. It's also only used by StartAuthSession when called with a TPM key, which isn't that usual.
2022-09-05 08:35:31 Launchpad Janitor tpm2-tss (Ubuntu Focal): status Fix Committed Fix Released
2022-09-05 08:35:36 Ɓukasz Zemczak removed subscriber Ubuntu Stable Release Updates Team