File descriptor exposure to child process
Copied file descriptor used in multiple processes
Description
This defect occurs when a process is forked and the child process uses file descriptors inherited from the parent process.
Risk
When you fork a child process, file descriptors are copied from the parent process, which means that you can have concurrent operations on the same file. Use of the same file descriptor in the parent and child processes can lead to race conditions that may not be caught during standard debugging. If you do not properly manage the file descriptor permissions and privileges, the file content is vulnerable to attacks targeting the child process.
Fix
Check that the file has not been modified before forking the process. Close all inherited file descriptors and reopen them with stricter permissions and privileges, such as read-only permission.
Examples
Result Information
Group: Security |
Language: C | C++ |
Default: Off |
Command-Line Syntax:
FILE_EXPOSURE_TO_CHILD
|
Impact: Medium |
Version History
Introduced in R2017b
See Also
Topics
- Interpret Bug Finder Results in Polyspace Desktop User Interface
- Interpret Bug Finder Results in Polyspace Access Web Interface (Polyspace Access)
- Address Results in Polyspace User Interface Through Bug Fixes or Justifications
- Address Results in Polyspace Access Through Bug Fixes or Justifications (Polyspace Access)