
Content by Label | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Info |
---|
Information for Editors |
Risk Assessment Summary
Rule | Severity | Likelihood | Remediation Cost | Priority | Level |
---|---|---|---|---|---|
FIO30-C | High | Likely | Medium | P18 | L1 |
FIO32-C | Medium | Unlikely | Medium | P4 | L3 |
FIO34-C | High | Probable | Medium | P12 | L1 |
FIO37-C | High | Probable | Medium | P12 | L1 |
FIO38-C | Low | Probable | Medium | P4 | L3 |
FIO39-C | Low | Likely | Medium | P6 | L2 |
FIO40-C | Low | Probable | Medium | P4 | L3 |
FIO41-C | Low | Unlikely | Medium | P2 | L3 |
FIO42-C | Medium | Unlikely | Medium | P4 | L3 |
FIO44-C | Medium | Unlikely | Medium | P4 | L3 |
FIO45-C | High | Probable | High | P6 | L2 |
FIO46-C | Medium | Unlikely | Medium | P4 | L3 |
FIO47-C | High | Unlikely | Medium | P6 | L2 |
Related Rules and Recommendations
Navigation Map | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
...
C programs often rely on files to load and store data needed during program execution. File functions, such as open, read, write, and close are built into the C programming language to simplify how C programs interact with files. However, it is the underlying operating system that manages files. Inconsistencies may exist between how C programs and the underlying operating system handle the files and the file system. Many of these descrepencies can lead to security vulnerabilities.
The following rules and recommendations are suggested to reduce the common errors associated with file operations in C. These guidelines are designed to by system independent. However, files and file management are inherently tied to the underlying operating system. Cases where security issues or recomendations are specific to an architecture are clearly marked as pertaining to that architecture.
Recommendations
FIO01-A. Use file descriptors instead of filenames
FIO02-A. Translate filenames into canonical form
FIO03-A. Create and open files in separate operations
Suggestions for file functions (UNIX)
Suggestions for file functions (Windows)
Rules
FIO31-C. Check properties before operating on a file
FIO32-C. Detect and handle file operation errors
FIO33-C. Do not create temporary files with predictable names
FIO34-C. Do not make assumptions about directory structure
FIO35-C. Ensure a file does not exist before attempting to create it