Data Validation & Encoding (VEJ)
Toby इनपुट सत्यापन, आउटपुट सत्यापन, सैनिटाइजेशन या आउटपुट एन्कोडिंग कोड या रूटीन पर नियंत्रण रखता है, जिससे उन्हें बायपास किया जा सकता है
Unlike other cards in this suit, this Data Validation & Encoding J (VEJ) relates to an attacker being able to change the executing code. This may be due to inadequate source code control, deployment controls or server protection, but is more often a standard feature of client-side code.
Scenario: Toby’s Control Over Validation and Encoding
Picture a scenario where Toby gains control over crucial aspects of the system’s security - specifically, input validation, output validation, and output encoding routines. This allows him to manipulate these processes:
- Control Over Input Validation: Toby can manipulate or bypass checks on data entering the system.
- Influence on Output Validation: He has the ability to alter or disable validation of data before it's presented or used.
- Manipulation of Output Encoding Routines: Toby can modify how data is encoded before it’s sent to users or other systems, potentially disabling vital security measures.
Example
Toby exploits his control by disabling certain input validation checks on a form that accepts user data. For instance, he allows special characters or script inputs that are usually blocked. This enables him to insert malicious scripts or commands, which are then executed by the system or other users, leading to vulnerabilities like Cross-Site Scripting (XSS) or command injections.
Threat Modeling
STRIDE
Toby is modifying or disabling the code/routines that enforce validation/encoding — that’s an integrity attack which alters the system processes or data so that malicious input is accepted. In STRIDE, that maps directly to Tampering, but the consequences of that tampering (XSS, RCE, auth bypass) may map to other STRIDE categories such as Elevation of Privilege or Information Disclosure, so treat those as secondary impacts.
What can go wrong?
Such control over validation and encoding routines can lead to a wide array of security issues, including data corruption, unauthorized access, and execution of harmful scripts.
Validation and encoding are sometimes undertaken in client applications or external sources that interact with the system. This is a bad practice, as external sources are usually more vulnerable to attacks, can be spoofed and are generally less accountable for malicious behavior. An attacker can try to bypass these routines using non-controlled unexpected behavior:
- Modifying/deleting code
- Generating unexpected handcrafted requests
- Use an automated exploring tool (web crawler) to get information about the file structure and then try to access well known resource locations
- Abusing an ill-defined zone of trust
- Modifying data between the client application and the server (e.g. Trojan, modification in transit)
- XSS
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?
In general, all validation and encoding routines should be on the server-side using robust, tested and protected routines.
- Implement strict access controls and monitoring to prevent unauthorized changes to validation and encoding routines.
- Regularly review and audit these processes to ensure they haven't been tampered with.
- Establish robust checks and balances within the development and deployment processes to detect any unauthorized modifications.
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: 2.2.2,3.1.1,3.4.3,3.4.6,3.4.7,3.5.3,3.5.4,3.5.5,3.5.6,3.5.7,3.6.1,3.7.5
CAPEC: 77,87,202,207,271,446,554
CAPEC™ Map
| Code | Title | ASVS |
|---|---|---|
| 77 | Manipulating User-Controlled Variables | 2.2.2,3.5.7 |
| 87 | Forceful Browsing | 2.2.2,3.1.1,3.7.5 |
| 201 | Serialized Data External Linking | 1.5.1,2.2.2 |
| 202 | Create Malicious Client | 2.2.2,3.1.1,3.7.5 |
| 207 | Removing Important Client Functionality | 2.2.2,3.1.1,3.4.3,3.4.7,3.5.7,3.6.1,3.7.5 |
| 271 | Schema Poisoning | 1.5.1,2.2.2 |
| 446 | Malicious Logic Insertion into Product via Inclusion of Third-Party Component | 3.4.3,3.4.6,3.4.7,3.5.3,3.5.4,3.5.5,3.5.6,3.5.7,3.6.1 |
| 554 | Functionality Bypass | 2.2.2,3.1.1,3.7.5 |