Rekey SA binds a key that is not Active (no key-state check)
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 65/100
Direzione di ricerca
Leggi sa_rekey in src/sa/internal/sa_interface_inmemory.template.c e confronta la sua convalida delle chiavi con Crypto_Key_OTAR in src/core/crypto_key_mgmt.c. Verifica come il progetto testa gli errori di stato delle chiavi, quindi controlla che Rekey SA restituisca KEY_ID_ERROR per una chiave sconosciuta e KEY_STATE_INVALID per una chiave non in stato Active, accettando una chiave in stato Active.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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
- Lingua principale
- C
- Stelle
- 178
- Fork
- 70
- Merge medio
- 1h 32m
- PR unite (30g)
- 1
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di nasa/CryptoLib
-
🐛 [BUG] - `sa_delete` Zeros `abm_len` but Never `est`/`ast`Forse già presa @sylvesterkaczmarek l’ha presa 57 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
-
🐛 [BUG] - `sa_create` Silently Returns Success for an Out-of-Range SPIForse già presa @Hashim1999164 l’ha presa 65 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
-
🐛 [BUG] - Conformance - TLV Procedure-Type Bit Written to the Wrong Struct Field — Reply PDUs Executed as CommandsForse già presa @sylvesterkaczmarek l’ha presa 74 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
-
🐛 [BUG] - Conformance - sa_setARSNW Does Not Enforce the SA's Authentication-Capability PreconditionForse già presa @sylvesterkaczmarek l’ha presa 74 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
🐛 [BUG] - Implementation Standard - Unrecognized SA-Management PID Silently Returns SuccessForse già presa @Sushanth012 l’ha presa 88 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
Tutte le issue di nasa/CryptoLib
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
ESPresense/ESPresense#2680 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
OpenPrinting/cups#1828 · 4 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
ImageMagick/ImageMagick#9134 ·
I maintainer di solito rispondono entro 1 giorno
-
Builder: a structure opened without calculation data shows the Diffraction (fibre) view by defaultApertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
FriendsofECCE/ECCE#1245 · 1 commento ·
-
Arch: ARM/AArch64 Doc
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
RT-Thread/rt-thread#12082 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni