This vulnerability occurs when software fails to properly check for or handle undefined, null, or unsupported values passed to parameters, configuration fields, or function arguments. Instead of rejecting or safely converting these values, the system proceeds with an unexpected state, often leading to crashes or security flaws.
At its core, this weakness is about missing validation gates. When a function, API, or system component receives input like a `null` where a string is expected, an empty field where data is required, or an out-of-range numeric code, it should explicitly decide what to do. Common mistakes include not checking for these states at all, using the undefined value in operations (causing errors like null pointer dereferences), or making incorrect assumptions that lead to logic flaws, data corruption, or exposure of sensitive information. To prevent this, developers should adopt a defensive coding posture. Explicitly validate all inputs at trust boundaries and internal interfaces. Define clear policies for handling missing or unsupported values—such as rejecting the request, applying a secure default, or throwing a controlled exception. Using strongly-typed languages, schema validation for configuration, and comprehensive test cases that include edge cases with undefined data are key strategies to build resilience against this common but dangerous oversight.
Impact: Unexpected State
java