[SECURITY] Missing length validation for CFE_EVS_SEND_HK_MID in EVS ProcessCommandPacket
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 1.5k
- Forks
- 391
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 19
Description
Describe the bug
CFE_EVS_ProcessCommandPacket() processes SEND_HK_MID messages by directly casting the buffer to CFE_EVS_SendHkCmd_t * without calling CFE_EVS_VerifyCmdLength(). All other command codes in CFE_EVS_ProcessGroundCommand() use VerifyCmdLength before casting. A malformed/truncated packet can cause OOB read when EVS accesses the struct fields.
This is the same root cause as #971 (TIME DATA_CMD_MID missing length validation) and #986 (ES SEND_HK_MID missing length validation).
To Reproduce
- Send a
CFE_EVS_SEND_HK_MIDpacket with size <sizeof(CFE_EVS_SendHkCmd_t) - EVS processes it without validation
- OOB read when fields are accessed
Expected behavior
CFE_EVS_ProcessCommandPacket() should call CFE_EVS_VerifyCmdLength(&SBBufPtr->Msg, sizeof(CFE_EVS_SendHkCmd_t)) before casting.
Code snips
File: cfe/modules/evs/fsw/src/cfe_evs_dispatch.c, function CFE_EVS_ProcessCommandPacket():
if (CFE_SB_MsgId_Equal(MessageID, SEND_HK_MID))
{
CFE_EVS_SendHkCmd((const CFE_EVS_SendHkCmd_t *)SBBufPtr); // بدون VerifyCmdLength!
}
Reporter Info
Erfan, Independent Space Software Security Researcher
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in cfe/modules/evs/fsw/src/cfe_evs_dispatch.c at CFE_EVS_ProcessCommandPacket(), and compare the SEND_HK_MID branch with the other command-code branches that call CFE_EVS_VerifyCmdLength(). The work is complete when truncated CFE_EVS_SEND_HK_MID packets are rejected before the command structure is accessed, without changing valid-packet handling.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- embedded-iot, security
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 76/100