Data Validation & Encoding (VE8)

DATA VALIDATION & ENCODING
8

Oana puede eludir las rutinas de sanitización centralizadas ya que no se están utilizando de manera exhaustiva

How to play?

The key concept is that when centralized sanitization routines aren’t applied comprehensively to every input channel, attackers can bypass them and inject malicious payloads.

Scenario: Oana’s Sanitization Bypass

Picture a scenario where Oana, a skilled manipulator, finds a way to bypass the security of a system due to incomplete application of centralized sanitization routines. This vulnerability arises because:

  1. Incomplete Use of Sanitization: The system fails to apply sanitization routines comprehensively across all data inputs.

Example

Oana identifies that while primary user input fields on the website are well-sanitized, secondary inputs such as URL parameters or data inputs in less prominent forms are overlooked. She exploits this gap by injecting malicious code through these unsanitized channels. Since these inputs are not subjected to the usual sanitization process, her code bypasses the security measures, posing a threat to the system’s integrity.

Threat Modeling

STRIDE

Bypassing centralized sanitization routines because they are not applied everywhere — is a classic STRIDE: Tampering threat. Sanitization routines are meant to enforce integrity by ensuring data isn’t maliciously altered. If Oana can push malicious payloads through un-sanitized channels (e.g., overlooked URL parameters, hidden forms), she is modifying input data in a way the system was supposed to prevent.

What can go wrong?

This loophole can lead to significant security breaches, including Cross-Site Scripting (XSS) attacks, unauthorized access, and data compromise.

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?

Sanitization may be used to strip some inputs or outputs of certain unwanted characters. It is not a substitute for data validation and encoding, but may be used in combination (e.g. to remove leading/trailing whitespace from keyboard input). If sanitization is part of the validation and encoding processes, ensure that no relevant input/output is excluded, or can be bypassed by submitting data through a different input stream (e.g. GET instead of POST) or using a different app (e.g. mobile vs. desktop).

  1. Ensure that sanitization routines are uniformly applied to all forms of data input, including both primary and secondary sources.
  2. Regularly review and enhance sanitization protocols to cover all potential data entry points, ensuring no part of the system is left vulnerable.

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.1.1,1.1.2,1.2.3,1.3.1,1.3.2,1.3.3,1.3.4,1.3.5,1.3.6,1.3.7,1.3.8,1.3.9,1.3.10,1.3.11,1.3.12,16.5.1,16.5.2,16.5.3,16.5.4

CAPEC: 28,66,88,135,136,141,152,160,183,250,267,664,676

OWASP DevGuide: LF4,VSD2

SAFECode: 2,17

CAPEC™ Map

CodeTitleASVS
24Filter Failure through Buffer Overflow
28Fuzzing
66SQL Injection
88OS Command Injection
135Format String Injection
136LDAP Injection
141Cache Poisoning
152Inject Unexpected Items
160Exploit Script-Based APIs
183IMAP/SMTP Command Injection
250XML Injection
267Leverage Alternate Encoding
664Server Side Request Forgery
676NoSQL Injection

ASVS (5.0) Cheat Sheet Series Index

Attacks

Cross-Site Scripting (XSS)

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.