OWASP Cheat Sheet: Input Validation Cheat Sheet / GUIDANCE
Input Validation Cheat Sheet
Input validation checks whether data meets an application's requirements before the application uses it. It reduces the risk of malformed data, invalid business operations, and excessive resource consumption. OWASP's Proactive Control C3 distinguishes validation from the additional defenses needed when using that data: - Use parameterized queries for SQL and context-aware output encoding to prevent cross-site scripting (XSS). - Check authorization separately: a valid account identifier does not mean the caller may access that account.
- Category
- OWASP API
- Version / scope
- OWASP Cheat Sheet Series; commit 7af0ef1b745f1a38ce905c00c5a592d5b3a515a9
- Affected / relevant technologies
- Web applications / APIs
- Evidence
- Documentation: pinned-source excerpt checked. Execution: not tested. Editorial: curated reference.
Defensive analysis and explicitly authorized assessment only. This website performs no scans, exploitation, model calls or infrastructure changes. Indicators below are investigation opportunities, not proof of compromise or guaranteed detectors.
Mechanism and prerequisites
Match the design and deployment assumptions in the cited revision. Use authorized review evidence; do not send production secrets to test systems.
Potential impact
This is preventive engineering guidance, not a new Top 10 risk, a CVE or proof of an exploitable deployment.
Versioned source scope
This record contains normalized, sometimes shortened source excerpts with editorial safety context. Markup and executable example blocks are omitted. Source-field verification does not establish device testing, a working detector or local applicability.
Publisher: OWASP. Release: OWASP Cheat Sheet Series; commit 7af0ef1b745f1a38ce905c00c5a592d5b3a515a9. Source checked: 2026-11-18.
Source object: OWASP Cheat Sheet: Input Validation Cheat Sheet.
Attribution and source terms (OWASP contributors · CC BY-SA 4.0)Detection and investigation
- Publisher review topics: Input Validation Strategies; Implementing Input Validation; Parse Safely, Then Validate; Validate Structured Data; Validating Free-form Unicode Text; Validating Rich User Content; File Upload Validation; Email Address Validation
Preserve source timestamps, asset identity and collection context. Correlate independent evidence before attributing malicious intent. In OT, review passive evidence with the process owner; do not induce failures, replay commands or write to controllers to test a hypothesis.
Mitigation and response
- Validate both syntax (the expected type and format) and semantics (whether the value makes sense for the operation). For example, a booking needs valid dates and an end date after its start date. CWE-20 describes these checks, including consistency between related fields. Define rules for each field: | Input | Rules to enforce | | --- | --- | | Fixed choices | Exact membership in the allowed set, including values submitted from drop-down menus | | Numbers and dates | Expected type, accepted format, and minimum and maximum values | | Strings | Length limits and the characters or structure required by the field | | Objects | Allowed fields, required fields, and rules for missing or null values | | Arrays | Minimum and maximum item counts and validation of every item, including nested objects |
- Apply request size limits before buffering or parsing input, and configure parser limits such as maximum nesting depth. JSON explicitly supports implementation limits on size, depth, and numbers. A schema check after parsing cannot protect a parser that has already exhausted resources. Use a maintained parser for the expected format, handle parsing failures, and validate the resulting values before business processing or storage. Configure parsers for untrusted input; see XML External Entity Prevention and Deserialization. Converting text to an integer only establishes a type: it does not establish an acceptable quantity. Decode according to the protocol before checking field rules. Validate the representation that will actually be used, and avoid decoding it again downstream; CWE-20 explains how inconsistent decoding can invalidate earlier checks.
Apply changes through the asset owner's approved change and recovery process. Documentation review is separate from successful testing or verified production protection.
Related technical context
No protocol-specific mapping is asserted for this entry.
Related security reading
Continue directly to another reference. Editorial reading connections do not assert official CWE/CAPEC/ATT&CK/OWASP equivalence or mappings.
Authoritative sources and attribution
Identifiers and source titles belong to OWASP, MITRE, the CVE Program, CISA, NIST or the cited vendor. Source excerpts are attributed and adapted under the linked publisher license; editorial context is separate. This is not an official framework mirror. Review baseline: 2026-11-18. Live documents can change; check exact current applicability.
- Publisher reference: OWASP Cheat Sheet: Input Validation Cheat Sheet — source accessed 2026-11-18
- cheatsheets/Input_Validation_Cheat_Sheet.md — source accessed 2026-11-18
Source review supports bounded reference text. It is not execution evidence, a completeness claim, a CVSS assessment, a compliance certification or verification of production security.
