nasa / nasa/cFS

[SECURITY] Missing length validation for CFE_EVS_SEND_HK_MID in EVS ProcessCommandPacket

Open Beginner friendly
#987 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
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

  1. Send a CFE_EVS_SEND_HK_MID packet with size < sizeof(CFE_EVS_SendHkCmd_t)
  2. EVS processes it without validation
  3. 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.