Checklist (Please check before submitting)
Describe the bug
The CF receive path accepts remote CFDP metadata and stores the remote dest_filename verbatim in the RX transaction state. When the inbound transfer completes successfully, the receiver moves the temporary file into that same remote-controlled path.
In the reproduced native_std sample deployment, this is not only a static code issue. I reproduced an end-to-end chain where:
- a remote sender delivered valid inbound CFDP PDUs through the sample deployment's normal
UDP -> CI_LAB -> CFDP RX path,
- a control transaction used metadata destination
/cf/v31_control.txt,
- an exploit transaction changed only metadata destination to
/cf/tmp/v31_remote_path.txt, and
- the receiver retained the two files at exactly those two different on-target paths.
This proves that remote metadata directly controls the final retained receive path.
To Reproduce
- Run the standard
native_std sample deployment and start core-cpu1.
- Send a valid inbound CFDP transaction whose Metadata PDU specifies destination filename
/cf/v31_control.txt.
- Follow with valid File Data and EOF PDUs.
- Observe CF events showing metadata accepted and file retained at
/cf/v31_control.txt.
- Send a second valid inbound CFDP transaction through the same ingress path.
- Change only the Metadata PDU destination filename to
/cf/tmp/v31_remote_path.txt.
- Follow with valid File Data and EOF PDUs.
- Observe CF events showing metadata accepted and file retained at
/cf/tmp/v31_remote_path.txt.
Observed runtime evidence from reproduction:
CF R2(4:12592): md received, source: v31-control.bin, dest: /cf/v31_control.txt
CF R2(4:12592): successfully retained file as /cf/v31_control.txt
CF R2(4:12593): md received, source: v31-exploit.bin, dest: /cf/tmp/v31_remote_path.txt
CF R2(4:12593): successfully retained file as /cf/tmp/v31_remote_path.txt
Observed filesystem evidence from reproduction:
/workspace/src/build-native_std/exe/cpu1/cf/v31_control.txt
/workspace/src/build-native_std/exe/cpu1/cf/tmp/v31_remote_path.txt
Observed file contents:
visa31 control path
visa31 exploit path
Expected behavior
The CF receive path should not accept arbitrary remote output paths. RX destinations should be constrained to a configured allow-listed base directory, and absolute paths, traversal expressions, or path values outside that base should be rejected before they are stored or used.
Code snips
Remote metadata acceptance:
lv_ret = CF_CFDP_CopyStringFromLV(txn->history->fnames.dst_filename,
sizeof(txn->history->fnames.dst_filename),
&md->dest_filename);
Final retained-path sink:
MoveDest = txn->history->fnames.dst_filename;
...
OsStatus = OS_mv(SubjectFile, MoveDest);
System observed on:
- Hardware: containerized native sample deployment
- OS: Linux (containerized native target)
- Versions: cFS sample deployment built from this repository using
build-native_std; cFE/OSAL/PSP sample stack as shipped in-tree
Additional context
Important scope note: this reproduction did not depend on manually placing files into the target runtime filesystem. Both files were created by the target itself after receiving normal inbound CFDP traffic through the sample deployment's existing remote ingress path.
Important contrast note: the control and exploit transactions used the same ingress path, same receiver, and same overall transaction shape. The only relevant changed input was the remote Metadata PDU dest_filename value. That isolates the defect to remote metadata path trust.
Suggested fix:
- validate RX
dest_filename against a configured base directory before storing it;
- reject absolute paths or any path outside the mission-approved receive root;
- reject
.. segments and normalize/canonicalize before use;
- retain only the validated canonical destination path in transaction state.
Proposed severity view:
- This is a real trust-boundary weakness in the file-receive path.
- In the reproduced sample deployment, it results in remote control of the final retained on-target path with visible filesystem side effects.
- A CVSS v3.1 base score around
7.5 to 8.1 is defensible depending on deployment assumptions.
- In my view this is CVE-worthy because a lower-trust remote peer can directly determine where inbound content is retained on the target node.
Reporter Info
Prepared draft based on local reproduction and source review.
Checklist (Please check before submitting)
Describe the bug
The CF receive path accepts remote CFDP metadata and stores the remote
dest_filenameverbatim in the RX transaction state. When the inbound transfer completes successfully, the receiver moves the temporary file into that same remote-controlled path.In the reproduced
native_stdsample deployment, this is not only a static code issue. I reproduced an end-to-end chain where:UDP -> CI_LAB -> CFDP RXpath,/cf/v31_control.txt,/cf/tmp/v31_remote_path.txt, andThis proves that remote metadata directly controls the final retained receive path.
To Reproduce
native_stdsample deployment and startcore-cpu1./cf/v31_control.txt./cf/v31_control.txt./cf/tmp/v31_remote_path.txt./cf/tmp/v31_remote_path.txt.Observed runtime evidence from reproduction:
Observed filesystem evidence from reproduction:
Observed file contents:
Expected behavior
The CF receive path should not accept arbitrary remote output paths. RX destinations should be constrained to a configured allow-listed base directory, and absolute paths, traversal expressions, or path values outside that base should be rejected before they are stored or used.
Code snips
Remote metadata acceptance:
Final retained-path sink:
System observed on:
build-native_std; cFE/OSAL/PSP sample stack as shipped in-treeAdditional context
Important scope note: this reproduction did not depend on manually placing files into the target runtime filesystem. Both files were created by the target itself after receiving normal inbound CFDP traffic through the sample deployment's existing remote ingress path.
Important contrast note: the control and exploit transactions used the same ingress path, same receiver, and same overall transaction shape. The only relevant changed input was the remote Metadata PDU
dest_filenamevalue. That isolates the defect to remote metadata path trust.Suggested fix:
dest_filenameagainst a configured base directory before storing it;..segments and normalize/canonicalize before use;Proposed severity view:
7.5to8.1is defensible depending on deployment assumptions.Reporter Info
Prepared draft based on local reproduction and source review.