Data Validation & Encoding (VE3)

DATA VALIDATION & ENCODING
3

Robert può immettere dati dannosi perché non viene controllato il formato del protocollo consentito, o sono accettati duplicati, o non viene verificata la struttura, o non vengono convalidati i singoli elementi dei dati coerentemente con il formato, il tipo, l'intervallo, la lunghezza desiderati e con una lista di caratteri o formati consentiti

How to play?

This card relates to generic input validation. See Data Validation & Sanitization 4 for the similar additional context-specific checks.

Scenario: Robert’s Clever Exploits

Imagine a scenario where Robert, an astute attacker, manipulates your system by inputting malicious data. He takes advantage of the system's failure in several critical areas:

  1. Unchecked Protocol Formats: The system doesn't verify if the data conforms to the expected protocol format.
  2. Acceptance of Duplicates: The system allows duplicate data entries, which it should normally reject.
  3. Unverified Structure: There's no check to ensure the overall structure of the data is consistent.
  4. Inadequate Data Element Validation: The system fails to validate individual data elements for format, type, range, length, or against a whitelist of allowed characters or formats.

Example

Robert attacks by submitting a form on your website. He intentionally uses an unexpected data format, like entering alphabetic characters where only numbers are expected. The system, not checking the format or range, accepts this input, leading to potential processing errors or more severe security vulnerabilities, such as injection attacks.

Threat Modeling

STRIDE

The primary STRIDE category for “being able to input malicious data due to missing protocol/structure/element validation” is Tampering with possible secondary impacts into Information Disclosure, DoS, or Elevation of Privilege depending on how the malformed data is exploited.

What can go wrong?

These oversights can result in significant security breaches, data corruption, and may compromise the integrity and reliability of the entire system.

A lack of input validation is often the root cause of many security issues. Since the validation needs to be context specific, generic sanitisation routines will not suffice.

For more things that can go wrong, see the Common Attack Patterns related to this card in the table below.

What are we going to do about it?

The developer needs to understand how data are formatted/composed, why the data is being sent, what it is used for and the meaning of the values.

  1. Rigorously validate all data inputs, fields and parameters for their format, type, range, length, and against a comprehensive whitelist.
  2. Regularly update and refine these validation rules to stay ahead of sophisticated attack techniques.
  3. Only the permitted inputs (field/parameter names) must be allowed.
  4. All the mandatory inputs must be enforced.

For detailed advice on how to mitigate threats related to the card, see the ASVS and OWASP Developer Guide requirements in the table below.

Mappings

STRIDE: Tampering

OWASP ASVS: 1.5.3,5.1.1,5.1.2,5.1.3,13.2.1,14.1.2,14.4.1

CAPEC: 28,33,39,48,64,105,126,130,152,153,165,220,231,261,272,586

OWASP DevGuide: CEC5,CEC8,SSV2,SSV6,SSV7,SSV8,SSV9,SSV10,LF3,LF4,LF5,FV7,FV8

OWASP AppSensor: RE7,RE8,AE4,AE5,AE6,AE7,IE2,IE3,CIE1,CIE3,CIE4,HT1,HT2,HT3

SAFECode: 3,16,24,35

ASVS (4.0.3) Cheat Sheet Series Index

Attacks

SQL Injection

Cross-Site Scripting (XSS)

Command Injection

Directory Traversal Attack

File Upload Vulnerabilities

OWASP Cornucopia

OWASP Cornucopia is a mechanism in the form of a card game to assist software development teams identify security requirements in Agile, conventional and formal development processes. It is language, platform and technology-agnostic, and is free to use. OWASP Cornucopia is licensed under the Creative Commons Attribution-ShareAlike 4.0 license, so you can copy, distribute and transmit the work, and you can adapt it, and use it commercially, but all provided that you attribute the work and if you alter, transform, or build upon this work, you may distribute the resulting work only under the same or similar licence to this one.

© 2012-2025 OWASP Foundation. The Open Worldwide Application Security Project (OWASP) is a nonprofit foundation that works to improve the security of software.