🐛 [BUG] - Implementation Standard - Unrecognized SA-Management PID Silently Returns Success
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 84/100
Direzione di ricerca
Inizia in src/core/crypto.c, in Crypto_SG_SA_MGMT, intorno alle righe 629–700 e segui il PID switch. Poi riproduci il frame fornito pid=0x8 per confermare lo stato di successo attuale. Aggiorna il percorso per i PID non riconosciuti in modo che restituisca un errore e verifica che la diagnostica rimanga corretta e che la riproduzione non riporti più lo stato 0. Controlla i dispatcher di service-group adiacenti solo se il tempo lo consente.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Description
Bug Report: Unrecognized SA-Management PID Silently Returns Success
Summary
| Field | Value |
|---|---|
| Product | NASA CryptoLib (SDLS Protocol Implementation) |
| Version | 1.4.2 |
| Component | src/core/crypto.c — Crypto_SG_SA_MGMT |
| Issue | The SA-management command dispatcher's default: case for an unrecognized Procedure Identification Field (PID) never sets an error status, so the function returns CRYPTO_LIB_SUCCESS from its initialized value |
| Bug Type | Conformance |
| Severity | Low-Medium |
| Impact | A malformed or unsupported SA-management command is silently accepted rather than rejected — a ground segment sending a PID CryptoLib doesn't implement gets no indication the command was not processed |
Description
Crypto_SG_SA_MGMT dispatches an incoming SA-management command by its pid field to one of
the PID_CREATE_SA/PID_SA_STATUS/etc. handlers. status is initialized to
CRYPTO_LIB_SUCCESS at function entry. The switch's default: case, reached for any pid
value outside the defined set, prints a debug diagnostic and breaks — it never assigns
status anything else — so the function returns success for a PDU it explicitly could not
interpret.
Affected Code
Crypto_SG_SA_MGMT (src/core/crypto.c:629-700)
int32_t Crypto_SG_SA_MGMT(uint8_t *ingest, TC_t *tc_frame)
{
int status = CRYPTO_LIB_SUCCESS;
switch (sdls_frame.tlv_pdu.hdr.pid)
{
case PID_CREATE_SA:
status = sa_if->sa_create(tc_frame);
break;
// ... PID_DELETE_SA, PID_SETARSNW, PID_REKEY_SA, PID_EXPIRE_SA,
// PID_SETARSN, PID_START_SA, PID_STOP_SA, PID_READ_ARSN, PID_SA_STATUS ...
default:
#ifdef PDU_DEBUG
printf(KRED "Error: Crypto_PDU failed interpreting SA Procedure Identification Field! \n" RESET);
#endif
break; // status never set — still CRYPTO_LIB_SUCCESS from initialization
}
return status;
}
Reproduction Sequence (from the fuzzing logs)
Replaying the full multi-packet mismatch pcap (crypto_triage, -DDEBUG=ON); only the final
frame is needed to trigger the bug (the dispatch is stateless with respect to pid — earlier
frames just exercise other unrelated SA-management commands in the same fuzzer-generated
sequence):
| # | Direction | Hex | Meaning |
|---|---|---|---|
| 8 | ground → flight | 002c100c0000000098cf70e150 |
TC frame, sg=0x1, pid=0x8 — not one of the defined PID_* values for the SA-management service group |
Debug replay of that frame:
TLV PDU
sg = 0x1
pid = 0x8
pdu_len = 0xcf70
data[0] = 0x00
Error: Crypto_PDU failed interpreting SA Procedure Identification Field!
Status code: 0
CryptoLib prints its own diagnostic confirming it could not interpret the PID, then returns
Status code: 0 (success) anyway.
Suggested Fix
Assign a real error code in the default: branch instead of leaving status at its initialized
success value:
default:
#ifdef PDU_DEBUG
printf(KRED "Error: Crypto_PDU failed interpreting SA Procedure Identification Field! \n" RESET);
#endif
status = CRYPTO_LIB_ERROR; // or a more specific "unrecognized PID" code
break;
Worth checking whether the sibling dispatch functions for the other service groups (Key
Management, Monitoring & Control) have the same default:-falls-through-to-success shape, since
this looks like a copy-pasted dispatch pattern rather than something unique to SA management.
Discovered using the StratoFuzz protocol fuzzing framework.
Branch Name
dev
Reproduction steps
## Reproduction Sequence (from the fuzzing logs)
Replaying the full multi-packet mismatch pcap (`crypto_triage`, `-DDEBUG=ON`); only the final
frame is needed to trigger the bug (the dispatch is stateless with respect to `pid` — earlier
frames just exercise other unrelated SA-management commands in the same fuzzer-generated
sequence):
| # | Direction | Hex | Meaning |
|---|-----------|-----|---------|
| 8 | ground → flight | `002c100c0000000098cf70e150` | TC frame, `sg=0x1, pid=0x8` — not one of the defined `PID_*` values for the SA-management service group |
Debug replay of that frame:
TLV PDU
sg = 0x1
pid = 0x8
pdu_len = 0xcf70
data[0] = 0x00
Error: Crypto_PDU failed interpreting SA Procedure Identification Field!
Status code: 0
CryptoLib prints its own diagnostic confirming it could not interpret the PID, then returns
`Status code: 0` (success) anyway.
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
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
-
🐛 [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
Tutte le issue di nasa/CryptoLib
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
python-pillow/Pillow#10590 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
CCExtractor/ccextractor#2478 ·
I maintainer di solito rispondono entro 7 giorni
-
增加kmod-nft-queueAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
-
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