-
Notifications
You must be signed in to change notification settings - Fork 339
Description
1. Describe the bug
A Denial of Service (DoS) vulnerability exists in the Checksum (CS) application of the NASA core Flight System (cFS). The issue stems from insufficient memory address validation in the CS_OneShotCmd() function.
While the application uses CFE_PSP_MemValidateRange() to check user-supplied addresses, this function may return CFE_SUCCESS for non-existent or invalid memory regions depending on the PSP implementation. Consequently, the child task CS_OneShotChildTask() attempts to calculate a CRC on an invalid pointer, leading to a Segmentation Fault and the abnormal termination of the CS application.
2. System observed on
Hardware: x86_64 / ARM (Generic)
OS: Linux
Versions: cFE (core Flight Executive) & CS Application (Latest versions)
Component: Checksum (CS) Application
3. Vulnerability Analysis
3.1. Technical Details
The vulnerability occurs during the processing of a "OneShot" checksum command.
- Inadequate Validation: In
CS_OneShotCmd(), the payload address and size are validated usingCFE_PSP_MemValidateRange(). In many environments, this function lacks strict boundary checks for the entire physical/virtual memory map.
- Pointer Dereference in Child Task: The validated (but actually invalid) address is stored in
CS_AppData.HkPacket.Payload.LastOneShotAddressand passed to the child task. - The Crash: Inside
CS_OneShotChildTask(), the function callsCFE_ES_CalculateCRC()with the unverified address. WhenCFE_ES_CalculateCRC()attempts to read from this memory location, the system triggers a segmentation fault.
3.2. Code Snippets
Location: CS_OneShotCmd()
void CS_OneShotCmd(const CS_OneShotCmd_t *CmdPtr)
{
CFE_Status_t Status;
/* Insufficient validation: returns CFE_SUCCESS for some invalid addresses */
Status = CFE_PSP_MemValidateRange(CmdPtr->Payload.Address, CmdPtr->Payload.Size, CFE_PSP_MEM_ANY);
if (Status == CFE_SUCCESS) {
/* Proceed to spawn child task with invalid Address */
}
}Location: CS_OneShotChildTask()
void CS_OneShotChildTask(void)
{
cpuaddr FirstAddrThisCycle = CS_AppData.HkPacket.Payload.LastOneShotAddress;
// ...
/* CRASH: Direct memory access to invalid FirstAddrThisCycle */
NewChecksumValue = CFE_ES_CalculateCRC((void *)(FirstAddrThisCycle),
NumBytesThisCycle,
NewChecksumValue,
CS_DEFAULT_ALGORITHM);
// ...
}4. To Reproduce (PoC)
- Preparation: Deploy the cFS framework with the CS application enabled.
- Craft Packet: Create a
CS_OneShotCmdground command packet. - Inject Payload: Set the
Addressfield to a known non-mapped memory address (e.g.,0xDEADBEEF) and a validSize(e.g.,100). - Send Command: Dispatch the command to the cFS software bus.
- Observe: The CS child task will trigger a Segmentation Fault, causing the CS application to crash or the OS to terminate the process.
5. Expected behavior
The CS_OneShotCmd() should perform a more rigorous check against the actual available memory map. If an address is outside the permitted operational memory range, the command should be rejected with an error telemetry packet, and no child task should be spawned.
6. Mitigation & Recommendations
- Enhanced PSP Validation: Strengthen the logic within
CFE_PSP_MemValidateRange()to strictly adhere to the specific hardware's memory map. - Application-Level Bounds Checking: Implement a secondary check within the CS application that compares the requested address against a "Safe Memory Table" defined for the specific mission.
- Error Handling: Implement robust exception handling or memory access guards (if supported by the OSAL/PSP) within the CRC calculation loop to prevent a full application crash.
Reporter Info
Space Cybersecurity Council