Tainted Data Defects
Tainted data defects flag the use of tainted data in certain operations. Data that comes from unsecure sources is tainted data. Polyspace® considers these sources as unsecure:
Volatile objects.
External inputs obtained by using standard library functions. External input can include:
User input
Environment variables
File content or file path
Data obtained from hardware
Before using the data, validate the tainted data obtained from such unsecure sources. Malicious attackers can use tainted data that has not been validated to attack your program and cause failures. Tainted data defects flag the use of tainted data that has not been validated in certain operations. For instance, Polyspace flags:
Tainted data in different numerical operations.
Externally controlled elements, such as paths, commands, environment variables, and host IDs.
Tainted data in memory operations such as allocation and dereferencing.
Polyspace Results
Array access with tainted index | Array index from unsecure source possibly outside array bounds |
Command executed from externally controlled path | Path argument from an unsecure source |
Execution of externally controlled command | Command argument from an unsecure source vulnerable to operating system command injection |
Host change using externally controlled elements | Changing host ID from an unsecure source |
Library loaded from externally controlled path | Using a library argument from an externally controlled path |
Loop bounded with tainted value | Loop controlled by a value from an unsecure source |
Memory allocation with tainted size | Size argument to memory function is from an unsecure source |
Pointer dereference with tainted offset | Offset is from an unsecure source and dereference might be out of bounds |
Tainted division operand | Operands of division operation (/ ) come from an unsecure
source |
Tainted modulo operand | Operands of remainder operation (% ) come from an unsecure
source |
Tainted NULL or non-null-terminated string | Argument is from an unsecure source and might be NULL or not NULL-terminated |
Tainted sign change conversion | Value from an unsecure source changes sign |
Tainted size of variable length array | Size of the variable-length array (VLA) is from an unsecure source and might be zero, negative, or too large |
Tainted source used with sensitive function | Data obtained from an untrusted source is passed to user-defined sensitive function (Since R2023b) |
Tainted string format | Input format argument is from an unsecure source |
Use of externally controlled environment variable | Value of environment variable is from an unsecure source |
Use of tainted pointer | Pointer from an unsecure source may be NULL or point to unknown memory |
Topics
- Sources of Tainting in a Polyspace Analysis
Validate tainted data obtained from external sources to avoid security risks.
- Bug Finder Defect Groups
The Bug Finder defect checkers are classified into groups such as data flow, concurrency, numerical, and so on.