Descripción
En `github.com/eclipse-keypont/crypto11/v2` versiones `<= 2.0.0-rc8` (y en las rutas obsoletas del módulo v1 `github.com/eclipse-keypont/crypto11 <= 1.6.8`, `github.com/ThalesGroup/crypto11 <= 1.7.0-rc1` y `github.com/ThalesIgnite/crypto11 <= 1.2.5`), el `cipher.AEAD` devuelto por `SecretKey.NewGCM()` pasa cualquier nonce que reciba directamente a `CK_GCM_PARAMS` sin verificar su longitud frente a `NonceSize()`, y acepta un nonce vacío. En un token que acepta un IV de GCM de longitud cero —como SoftHSM2—, cada `Seal` con un nonce vacío cifra con el mismo IV, reutilizando el flujo de clave y exponiendo la clave de autenticación GHASH, lo que permite falsificaciones. Por otra parte, `Config.UseGCMIVFromHSM` envía al token un IV NULL de longitud cero a menos que también se configure `GCMIVFromHSMControl.SupplyIvForHSMGCMEncrypt`, por lo que el token no tiene dónde escribir el IV que genera: un `Seal` con un nonce no vacío provoca un panic después de que el texto plano ya fue cifrado, y un `Seal` con un nonce vacío devuelve texto cifrado con un IV vacío sin error. En la línea v1, el modo HSM-IV además nunca copia de vuelta al llamador el IV generado por el token, por lo que el llamador conserva su propio nonce mientras los datos se cifraron con otro.
Qué hacer
Revisa si usas el producto afectado y en qué versión, y aplica la actualización o la mitigación que indique el aviso del fabricante. CISA no ha confirmado que se esté explotando; si eso cambia, esta ficha pasa a «explotada» y te avisamos en el boletín.
Versiones afectadas
- Producto no informado Afectadas: hasta 2.0.0-rc8 No afectadas: 2.0.0-rc9
- Producto no informado Afectadas: hasta 1.6.8
- Producto no informado Afectadas: hasta 1.7.0-rc1
- Producto no informado Afectadas: hasta 1.2.5
Según el registro de la vulnerabilidad en CVE.org, tal como lo publicó el fabricante. Confirma tu versión exacta en el aviso del fabricante.
Referencias
- Aviso del fabricantegithub.com/eclipse-keypont/crypto11/security/advisories/GHSA-c2cp-4qw…
- Parchegithub.com/eclipse-keypont/crypto11/commit/8d99b73c721c173ad85c0ca4e0…
- Referencia en gitlab.eclipse.orggitlab.eclipse.org/security/cve-assignment/-/work_items/491
Ver el texto original en inglés (CVE.org)
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.