[SECURITY] Missing lower-bound validation in CI_LAB_DecodeInputMessage allows zero-length packets
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 70/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Tranquilla
- Stack tecnologico
- c
- Ambito
- networking, security
Direzione di ricerca
Inizia in apps/ci_lab/fsw/src/ci_lab_passthru_decode.c, in CI_LAB_DecodeInputMessage(), quindi risali al suo chiamante CI_LAB_ReadUpLink(). Riproduci il pacchetto CCSDS documentato di lunghezza zero e verifica che i messaggi di dimensioni insufficienti vengano rifiutati con CFE_STATUS_WRONG_MSG_LENGTH e non vengano inoltrati al Software Bus.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Describe the bug
CI_LAB_DecodeInputMessage() in ci_lab_passthru_decode.c validates the CCSDS MsgSize from the packet header against the received SourceSize using only an upper-bound check (MsgSize > SourceSize). There is no lower-bound validation.
An attacker can send a deliberately malformed CCSDS Space Packet with Length=0 (total MsgSize = 7 bytes, which is less than sizeof(CFE_MSG_Message_t) = 16 bytes for telemetry or 8 bytes for commands). Because 0 > 768 is false, the malformed packet passes validation with CFE_SUCCESS and is forwarded directly to the Software Bus via CFE_SB_TransmitBuffer().
This is the same root cause as:
- cFE #2697: Integer underflow in
CFE_SB_GetUserDataLength - cFE #2698: Heap exfiltration via undersized CCSDS Length in TO_LAB
- cFE #2699: Unbounded loop in
CFE_MSG_ComputeCheckSum
All of these stem from the cFE Message layer trusting the attacker-controlled CCSDS Length field without lower-bound validation.
To Reproduce
- Send a single UDP datagram to the CI_LAB ingest port (default UDP/5012) containing only a CCSDS Primary Header:
StreamId= any valid command MsgIdSequence= arbitraryLength=0x0000(decoded total = 7 bytes)
CI_LAB_ReadUpLink()receives the packet viaOS_SocketRecvFrom()CI_LAB_DecodeInputMessage()checksMsgSize > SourceSize→7 > 768→ false → passes validation- The 7-byte buffer is cast to
CFE_SB_Buffer_t *and sent toCFE_SB_TransmitBuffer() - Any subscriber that reads the message size via
CFE_MSG_GetSize()and uses it formemcpy, loop iteration, or buffer allocation will perform an out-of-bounds read or integer underflow
Expected behavior
CI_LAB_DecodeInputMessage() should validate that MsgSize >= sizeof(CFE_MSG_Header_t) (the minimum valid CCSDS Space Packet size) before accepting the packet. The check should be:
CFE_MSG_GetSize(&MsgBufPtr->Msg, &MsgSize);
if (MsgSize < sizeof(CFE_MSG_Message_t) || MsgSize > SourceSize)
{
Status = CFE_STATUS_WRONG_MSG_LENGTH;
}
else
{
Status = CFE_SUCCESS;
}
This is consistent with the fix applied in CFE_SB_MessageTxn_SetContentSize() (cFE PR #2702) which added the lower-bound check.
Code snips
File: apps/ci_lab/fsw/src/ci_lab_passthru_decode.c, lines 68-82:
CFE_MSG_GetSize(&MsgBufPtr->Msg, &MsgSize);
if (MsgSize > SourceSize) // ← Only upper bound
// ← No lower bound check!
{
Status = CFE_STATUS_WRONG_MSG_LENGTH;
CFE_EVS_SendEvent(CI_LAB_INGEST_LEN_ERR_EID, CFE_EVS_EventType_ERROR,
"CI: cmd dropped - length mismatch, ...");
}
else
{
Status = CFE_SUCCESS; // ← Attacker reaches here with MsgSize=7
}
System observed on
- Hardware: x86-64 (POSIX cFS / NOS3 simulator)
- OS: Linux 6.8.0 (Ubuntu 24.04)
- Versions: cFE v7.0.0-rc4+dev370 (bundle cFS Draco v7.0.0, commit
432c9302)
Additional context
- This is a distinct vulnerability from #952 (TO_LAB heap over-read) and #953 (CFE_SB_TransmitMsg memcpy), though all share the same root cause.
- The CI_LAB ingress path is reachable without authentication on any deployment that loads CI_LAB (default NOS3 configuration).
- The fix is a single-line change adding
MsgSize < sizeof(CFE_MSG_Message_t) ||to the existingifcondition. - Fixing this at the ingress point provides defense-in-depth, even after the SB layer is patched.
Reporter Info
Erfan, Independent Space Software Security Researcher
- Lingua principale
- C
- Stelle
- 1.6k
- Fork
- 421
- Merge medio
- 1g 42m
- PR unite (30g)
- 12
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la 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/cFS
-
[SECURITY] Off-by-one bounds check in SBN HKPeerCmd/HKNetCmd allows access to invalid net/peer slotsForse già presa @0x000NULL l’ha presa 38 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
I maintainer di solito rispondono entro 1 giorno
-
Update Workflow READMEApertacontinuous-integration
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
[SECURITY] Missing length validation for CFE_EVS_SEND_HK_MID in EVS ProcessCommandPacketForse già presa @linerfan5114 l’ha presa 204 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
[SECURITY] Missing length validation for CFE_ES_SEND_HK_MID in ES TaskPipeForse già presa @linerfan5114 l’ha presa 204 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
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