CWE-179: Incorrect Behavior Order: Early Validation
Incorrect Behavior Order: Early Validation
Weakness ID: 179 (Weakness Base)
Status: Incomplete
Description
Description Summary
The software validates input before applying protection
mechanisms that modify the input, which could allow an attacker to bypass the
validation via dangerous inputs that only arise after the
modification.
Extended Description
Software needs to validate data at the proper time, after data has been
canonicalized and cleansed. Early validation is susceptible to various
manipulations that result in dangerous inputs that are produced by
canonicalization and cleansing.
Time of Introduction
Implementation
Applicable Platforms
Languages
All
Modes of Introduction
Since early validation errors usually arise from improperly implemented
defensive mechanisms, it is likely that these will be introduced more
frequently as secure programming becomes implemented more widely.
Potential Mitigations
Phase
Description
Inputs should be decoded and canonicalized to the application's
current internal representation before being validated. Make sure that
your application does not decode the same input twice. Such errors could
be used to bypass whitelist schemes by introducing dangerous inputs
after they have been checked.