In `github.com/eclipse-keypont/crypto11/v2` versions `<= 2.0.0-rc8` (and the deprecated v1 module paths `github.com/eclipse-keypont/crypto11 <= 1.6.8`, `github.com/ThalesGroup/crypto11 <= 1.7.0-rc1` and `github.com/ThalesIgnite/crypto11 <= 1.2.5`), the `cipher.AEAD` returned by `SecretKey.NewGCM()` passes whatever nonce it is given straight to `CK_GCM_PARAMS` without checking its length against `NonceSize()`, and accepts an empty nonce. На токене, который принимает нулевую длину GCM IV — SoftHSM2 делает — каждый Seal с пустым nonce шифруется под тем же IV, повторно используя поток ключей и раскрывая ключ аутентификации GHASH, который позволяет подделки. Отдельно, Config.UseGCMIVFromHSM отправляет токен NULL IV с нулевой длиной, если GCMIVFromHSMControl.SupplyIvForHSMGCMEncrypt также не установлен, поэтому токен не имеет места для записи генерируемого IV: Seal с непустой паникой nonce после того, как открытый текст уже был зашифрован, и Seal с пустым nonce возвращает шифротекст под пустым IV без ошибки.
В режиме v1 строки HSM-IV дополнительно никогда не копирует генерируемый токеном IV обратно звонящему, поэтому звонящий сохраняет свой собственный nonce, пока данные были зашифрованы под другим.
Показать оригинальное описание (EN)
In `github.com/eclipse-keypont/crypto11/v2` versions `<= 2.0.0-rc8` (and the deprecated v1 module paths `github.com/eclipse-keypont/crypto11 <= 1.6.8`, `github.com/ThalesGroup/crypto11 <= 1.7.0-rc1` and `github.com/ThalesIgnite/crypto11 <= 1.2.5`), the `cipher.AEAD` returned by `SecretKey.NewGCM()` passes whatever nonce it is given straight to `CK_GCM_PARAMS` without checking its length against `NonceSize()`, and accepts an empty nonce. On a token that accepts a zero-length GCM IV — SoftHSM2 does — every `Seal` with an empty nonce encrypts under the same IV, reusing the keystream and exposing the GHASH authentication key, which allows forgeries. Separately, `Config.UseGCMIVFromHSM` sends a NULL IV with length zero to the token unless `GCMIVFromHSMControl.SupplyIvForHSMGCMEncrypt` is also set, so the token has nowhere to write the IV it generates: a `Seal` with a non-empty nonce panics after the plaintext has already been encrypted, and a `Seal` with an empty nonce returns ciphertext under an empty IV without error. On the v1 line HSM-IV mode additionally never copies the token-generated IV back to the caller, so the caller keeps its own nonce while the data was encrypted under another one.
Характеристики атаки
Последствия
Строка CVSS v4.0