Improper Input Validation¶
Rule ID¶
MI101
Definition¶
The software receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.
Example¶
See one of the applicable code examples from CWE.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
|
While this code checks to make sure the user cannot specify large, positive integers and consume too much memory, it does not check for negative values supplied by the user. As a result, an attacker can perform a resource consumption (CWE-400) attack against this program by specifying two, large negative values that will not overflow, resulting in a very large memory allocation (CWE-789) and possibly a system crash. Alternatively, an attacker can provide very large negative values which will cause an integer overflow (CWE-190) and unexpected behavior will follow depending on how the values are treated in the remainder of the program.
References¶
- Common Weakness Enumeration: CWE-20