Rekey SA binds a key that is not Active (no key-state check)
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 65/100
Línea de trabajo
Lee sa_rekey en src/sa/internal/sa_interface_inmemory.template.c y compara su validación de claves con Crypto_Key_OTAR en src/core/crypto_key_mgmt.c. Comprueba cómo prueba el proyecto los errores de estado de las claves y, después, verifica que Rekey SA devuelve KEY_ID_ERROR para una clave desconocida y KEY_STATE_INVALID para una clave que no está en estado Active, mientras acepta una clave en estado Active.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Description
Summary
CCSDS 355.1-B-1 sec. 3.3.3.3.2 requires the new key at Rekey SA to be in the Active state. On v1.5.1 (5b98c8b; v1.5.0 shares the code), sa_rekey stores the Encryption Key ID from the PDU without consulting the key's state, so it accepts a PreActivation key, a Deactivated key, or a key id that does not exist. A following Start SA then makes the SA Operational, but every frame fails at the transmit/receive path with KEY_STATE_INVALID (-61) because the bound key cannot be used: management reports SUCCESS while no traffic can flow.
The library already does the right check elsewhere: Crypto_Key_OTAR (src/core/crypto_key_mgmt.c:117-126) refuses non-Active keys, and the key directives themselves refuse wrong-state transitions (-59) and unknown ids (-47). sa_rekey simply lacks the equivalent guard.
Code site
sa_rekey, src/sa/internal/sa_interface_inmemory.template.c (ekid parse): stores ekid from the PDU with no key_if->get_key state check.
Impact
Conformance / robustness. An out-of-order EP flow can leave an SA reporting Operational while bound to an unusable key; management answers SUCCESS, data answers KEY_STATE_INVALID on every frame. No memory-safety issue.
Suggested fix
After parsing ekid, look the key up with key_if->get_key(ekid) and return KEY_ID_ERROR (-47) for an unknown id and KEY_STATE_INVALID (-61) for a non-Active key, exactly as Crypto_Key_OTAR does. Valid rekeys onto Active keys are unchanged. I have a compile-checked patch verified with a standalone C PoC and can open a PR or share the PoC on request.
Found with active automata learning (AutoSDLS) and confirmed with a standalone C PoC that uses none of that tooling.
Branch Name
No response
Reproduction steps
1. Build CryptoLib v1.5.1 (`5b98c8b`) with the in-memory SA interface.
2. Create an SA, and have a key whose state is not Active (PreActivation or Deactivated), or use a key id that does not exist.
3. Send a Rekey SA directive binding that key id to the SA.
4. Observe `sa_rekey` returns `CRYPTO_LIB_SUCCESS` and stores the ekid, with no key-state check.
5. Start the SA (it goes Operational), then send a frame: every frame fails with `KEY_STATE_INVALID` (-61), so management reports success while no traffic can flow.
A standalone C PoC reproducing this (independent of the discovery tooling) is available on request.
Screenshots

Logs
OS
Linux
- Lenguaje dominante
- C
- Estrellas
- 178
- Forks
- 70
- Merge medio
- 1 h 32 min
- PR fusionados (30 d)
- 1
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Sin guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de nasa/CryptoLib
-
🐛 [BUG] - `sa_delete` Zeros `abm_len` but Never `est`/`ast`Posiblemente ocupada @sylvesterkaczmarek la tomó hace 57 días. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
-
🐛 [BUG] - `sa_create` Silently Returns Success for an Out-of-Range SPIPosiblemente ocupada @Hashim1999164 la tomó hace 65 días. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
-
🐛 [BUG] - Conformance - TLV Procedure-Type Bit Written to the Wrong Struct Field — Reply PDUs Executed as CommandsPosiblemente ocupada @sylvesterkaczmarek la tomó hace 74 días. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
-
🐛 [BUG] - Conformance - sa_setARSNW Does Not Enforce the SA's Authentication-Capability PreconditionPosiblemente ocupada @sylvesterkaczmarek la tomó hace 74 días. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
-
🐛 [BUG] - Implementation Standard - Unrecognized SA-Management PID Silently Returns SuccessPosiblemente ocupada @Sushanth012 la tomó hace 88 días. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
Todos los issues de nasa/CryptoLib
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
python-pillow/Pillow#10590 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
CCExtractor/ccextractor#2478 ·
Los mantenedores suelen responder en 7 días
-
增加kmod-nft-queueAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 80/100
ESPresense/ESPresense#2680 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
OpenPrinting/cups#1828 · 4 comentarios ·
Los mantenedores suelen responder en 1 día