Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
76 views
Input Validation Cheatsheet
Input Validation Cheatsheet
Uploaded by
Rizki Kurniawan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save Input Validation Cheatsheet For Later
Download
Save
Save Input Validation Cheatsheet For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
0 ratings
0% found this document useful (0 votes)
76 views
Input Validation Cheatsheet
Input Validation Cheatsheet
Uploaded by
Rizki Kurniawan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download now
Download
Save Input Validation Cheatsheet For Later
Carousel Previous
Carousel Next
Save
Save Input Validation Cheatsheet For Later
0%
0% found this document useful, undefined
0%
, undefined
Embed
Share
Print
Report
Download now
Download
You are on page 1
/ 9
Search
Fullscreen
972322, 6:36 AM Input Vatdation “OWASP Cheat Sheet Series Input Validation Cheat Sheet Introduction This article is focused on providing clear, simple, actionable guidance for providing Input Validation security functionality in your applications. Goals of Input Validation Input validation is performed to ensure only properly formed data is entering the workflow in an information system, preventing malformed data from persisting in the database and triggering malfunction of various downstream components. input validation should happen as early as possible in the data flow, preferably as soon as the data is received from the external party. Data from all potentially untrusted sources should be subject to input validation, including not only Internet-facing web clients but also backend feeds over extranets, from suppliers, partners, ‘vendors or regulators, each of which may be compromised on their own and start sending malformed deta. Input Validation shouldnot be used as the primary methad of preventing XSS, SQL Injection and other attacks which are covered in respective cheat sheets but can significantly contribute to reducing their impact if implemented properly. Input validation strategies Input validation should be applied on both syntactical and Semantic level. ‘Syntactic validation should enforce correct syntax of structured fields (e.g. SSN, date, currency symbol) ‘Semantic validation should enforce correctness of their values in the specific business context (eg. start date is before end date, price is within expected range). Itis always recommended to prevent attacks as early as possible in the processing of the user's (attackers) request. Input validation can be used to detect unauthorized input before it is processed by the application. Intps:ifcheatshectseries.owasp.orgicheatsheetsInput_Valdation_Cheat_Sheet.tm! 19972322, 6:36 AM Input Vatdation “OWASP Cheat Sheet Series Implementing input validation Input validation can be implemented using any programming technique that allows effective enforcement of syntactic and semantic comectness, for exemple: + Data type validators available natively in web application frameworks (such as Django Validators, Apache Commons Validators etc). + Validation against JSON Schema and XML Schema (XSO) for input in these formats. + Typeconversion (eg, Integer.parsetnt() in Java, int() in Python) with strict exception handing «Minimum and maximum value range check for numerical parameters and dates, minmum and maximum length check for strings. + Array of allowed values for small sets of string parameters (e.g. days of week). + Regular expressions for any other structured data cavering the whole input string (*.. .$) andnot using"any character’ wildcard (suchas . or \s) Allow list vs block list Itis a common mistake to use block lst validation in order totry to detect possibly dangerous characters and pattems lke the apostrophe * character thestring 1=1, or the "#example.org © user+subaddress#example.org ¢ usero[1Pv6:2081 :db8: 1] Intps:ifcheatshectseries.owasp.orgicheatsheetsInput_Valdation_Cheat_Sheet.tm! cr972322, 6:36 AM Input Vatdation “OWASP Cheat Sheet Series ©" "@example.org Properly parsing email addresses for validity with regular expressions is very complicated, although there are a number of publicly available documents on regex. The biggest caveat on this is that although the RFC defines a very flexible format for email addresses, most real world implementations (such as mail servers) use a far more restticted address format, meaning that they will reject addresses that are technically valid. Although they may be technically correct, these addresses are of little use if your application will not be able to actually send emails to them, ‘As such, the best way to validate email addresses is to perform some basic initial validation, and then pass the address to the mail server and catch the exception if it rejects it. This means that any the application can be confident that its mail server can send emails to any addresses it accepts. The initial validation could be as simple as: ‘+ The email address contains two parts, separated with an ® symbol + The email address does nct contain dangerous characters (such as backticks, single or double quctes, or null bytes). ‘Exactly which characters are dangerous will depend on how the address is going tobe used (echoed in page inserted into database, ete). «The domain part contains only letters, numbers, hyphens (- ) and periods (.). + The email address is areasonable length: + The local part (before the @) should be no more than 63 characters. + The total length should be no more than 254 characters. Semantic Validation ‘Semantic validation is about determining whether the email address is correct and legitimate. The most common way to do this is to send an email to the user, and require that they click a link in the email, or enter a code that has been sent to them. This provides a basic level of assurance that: + The email address is correct. + The application can successfully send emails to it. ‘+ Theuser has access to the mailbox. The links that are sent to users to prove ownership should contain a token that is: + Atleast 32 characters long. Intps:ifcheatshectseries.owasp.orgicheatsheetsInput_Valdation_Cheat_Sheet.tm! 79972322, 6:36 AM Input Vatdation “OWASP Cheat Sheet Series ‘+ Generated using a secure source of randomness. + Single use. + Time limited (¢.g, expiring after eight hours). After validating the ownership of the email address, the user should then be required to authenticate on the application through the usual mechanism. Disposable Email Addresses In some cases, users may not want to give their real email address when registering on the application, and will instead provide a disposable email address. These are publicly available addresses that do not require the user to authenticate, and are typically used to reduce the amount of spam received by users’ primary email addresses Blocking disposable email addresses is almost impossible, as there are a large number of websites offering these services, with new domains being created every day. There are a number of publicly available lists and commercial lists of known disposable domains, but these will always be incomplete If these lists are used to block the use of disposable email addresses then the user should be presented with a message explaining why they are blocked (although they are likely to simply search for another disposable provider rather than giving their legitimate address). Ifitis essential that disposable email addresses are blocked, then registrations should only be allowed from specifically-allowed email providers. However, if this includes public providers such as Google or Yahoo, users can simply register their own disposable address with them, ‘Sub-Addressing ‘Sub-addressing allows a user to specify a tag in the local part of the email address (before the & sign), which will be ignored by the mail server. For example, ifthat exanple.org domain supports sub-addressing, then the following email addresses are equivalent: © userBexample.org * usertsitettexemple.org + user+sitezeexample.org Many mail providers (such as Microsoft Exchange) donct support sub-addressing. The most notable provider who does is Gmail although there are many others that alsodo. Some users will se a different tag for each website they register on, so that if they start receiving spam tocne of the sub-addresses they can identify which website leaked or sold their email Intps:ifcheatshectseries.owasp.orgicheatsheetsInput_Valdation_Cheat_Sheet.tm! 89972322, 6:36 AM Input Vatdation “OWASP Cheat Sheet Series address. Because it could allow users to register muftiple aocounts with a singleemail address, some sites may wish to block sub-addressing by stripping out everything betweenthe + and @ signs. This is not generally recommended, as it suggests that the website owner is either unaware of sub- addressing or wishes to prevent users from identifying them when they leak or sellerail addresses. Additionally, it can be trivially bypassed by using disposable email addresses, or simply registering muttiple email accounts with a trusted provider Intps:ifcheatshectseries.owasp.orgicheatsheetsInput_Valdation_Cheat_Sheet.tm! 39
You might also like
Python Harvard RegularExpressions
PDF
No ratings yet
Python Harvard RegularExpressions
20 pages
Validation
PDF
No ratings yet
Validation
9 pages
Lab04 02
PDF
No ratings yet
Lab04 02
23 pages
Form Validation Techniques: Don Edlin, MRSC
PDF
No ratings yet
Form Validation Techniques: Don Edlin, MRSC
18 pages
Validation and Verification
PDF
No ratings yet
Validation and Verification
8 pages
File Upload Cheat Sheet
PDF
No ratings yet
File Upload Cheat Sheet
5 pages
Lesson 11 Valid A Tors
PDF
No ratings yet
Lesson 11 Valid A Tors
22 pages
REV-WORKSHEET-VALIDATION CHECKS (1)
PDF
No ratings yet
REV-WORKSHEET-VALIDATION CHECKS (1)
1 page
Secure Coding Best Practices Handbook Veracode Guide
PDF
No ratings yet
Secure Coding Best Practices Handbook Veracode Guide
16 pages
Tips For Data Validation - ATI
PDF
No ratings yet
Tips For Data Validation - ATI
7 pages
CS50P Notes
PDF
No ratings yet
CS50P Notes
1 page
Javascript Validation
PDF
No ratings yet
Javascript Validation
24 pages
AS_Level_IT_U1.5 (5)
PDF
No ratings yet
AS_Level_IT_U1.5 (5)
18 pages
Server Side Request Forgery Prevention Cheatsheet
PDF
No ratings yet
Server Side Request Forgery Prevention Cheatsheet
12 pages
05 HTML Form Validation
PDF
No ratings yet
05 HTML Form Validation
10 pages
Application Name:: Application Security Checklist V1.0
PDF
No ratings yet
Application Name:: Application Security Checklist V1.0
7 pages
Owasp Authentication Cheatsheet
PDF
No ratings yet
Owasp Authentication Cheatsheet
12 pages
Form Validation Using Javascript
PDF
No ratings yet
Form Validation Using Javascript
22 pages
Draw Arrows To Match The Definitions
PDF
No ratings yet
Draw Arrows To Match The Definitions
5 pages
Checking data ch7
PDF
No ratings yet
Checking data ch7
13 pages
Validation Test Data (1)
PDF
No ratings yet
Validation Test Data (1)
23 pages
Power Sharing
PDF
No ratings yet
Power Sharing
3 pages
Field Validation: Why & How: Fmug March 7, 2008
PDF
No ratings yet
Field Validation: Why & How: Fmug March 7, 2008
19 pages
JS Strings, Validation + Functions, RegExp, Modal, Lists
PDF
No ratings yet
JS Strings, Validation + Functions, RegExp, Modal, Lists
25 pages
Data Validation & Research
PDF
No ratings yet
Data Validation & Research
41 pages
Data Sorting Algorithm
PDF
No ratings yet
Data Sorting Algorithm
16 pages
php2 Print
PDF
No ratings yet
php2 Print
6 pages
Secure Coding Practices
PDF
No ratings yet
Secure Coding Practices
67 pages
Xss Filter Evasion Cheatsheet
PDF
No ratings yet
Xss Filter Evasion Cheatsheet
32 pages
10 Opt Verification & Validation
PDF
No ratings yet
10 Opt Verification & Validation
11 pages
Validation Controls
PDF
No ratings yet
Validation Controls
11 pages
Validating User Input With Validation Controls
PDF
No ratings yet
Validating User Input With Validation Controls
7 pages
Notes On Data Validation & Verification, Test Data
PDF
No ratings yet
Notes On Data Validation & Verification, Test Data
3 pages
Form Handling & Validation: Module IV Part II
PDF
No ratings yet
Form Handling & Validation: Module IV Part II
26 pages
Validation Controls in ASP
PDF
No ratings yet
Validation Controls in ASP
8 pages
Labactivity 13 Inputvalidationandexceptionhandling
PDF
No ratings yet
Labactivity 13 Inputvalidationandexceptionhandling
7 pages
Data Validation and Verification
PDF
100% (1)
Data Validation and Verification
18 pages
Chapter 11
PDF
No ratings yet
Chapter 11
16 pages
Data Validation and Verification
PDF
No ratings yet
Data Validation and Verification
29 pages
Web Form Validation - Best Practices and Tutorials
PDF
No ratings yet
Web Form Validation - Best Practices and Tutorials
23 pages
Unit-3.11 HTML Basics-HTML-Forms-val1
PDF
No ratings yet
Unit-3.11 HTML Basics-HTML-Forms-val1
33 pages
The Topes Format Editor and Parser
PDF
No ratings yet
The Topes Format Editor and Parser
19 pages
Developing Web Applications Using Microsoft Visual Studio 2008
PDF
No ratings yet
Developing Web Applications Using Microsoft Visual Studio 2008
21 pages
Validation and verification
PDF
No ratings yet
Validation and verification
3 pages
A039 - Exp 8 - Form Validation
PDF
No ratings yet
A039 - Exp 8 - Form Validation
21 pages
How To Create A Password Validation Form
PDF
No ratings yet
How To Create A Password Validation Form
8 pages
Validating User Input
PDF
No ratings yet
Validating User Input
22 pages
Checking the accuracy of data
PDF
No ratings yet
Checking the accuracy of data
7 pages
6-Security, Privacy and Data Integrity
PDF
No ratings yet
6-Security, Privacy and Data Integrity
5 pages
Experiment Title: Objective:: Server-Side Validation
PDF
No ratings yet
Experiment Title: Objective:: Server-Side Validation
2 pages
HTML Forms Validation
PDF
No ratings yet
HTML Forms Validation
15 pages
L05 Javascript2
PDF
No ratings yet
L05 Javascript2
39 pages
Lab 4 - Server Control Form Validation
PDF
No ratings yet
Lab 4 - Server Control Form Validation
15 pages
Python Skills Worksheet 4 Regular Expressions
PDF
No ratings yet
Python Skills Worksheet 4 Regular Expressions
4 pages
Validation and Verification
PDF
No ratings yet
Validation and Verification
11 pages
SQL Injection Prevention Cheatsheet
PDF
No ratings yet
SQL Injection Prevention Cheatsheet
14 pages
REST Security Cheatsheet
PDF
No ratings yet
REST Security Cheatsheet
9 pages
Pinning Cheat Sheet
PDF
No ratings yet
Pinning Cheat Sheet
8 pages
Ruby On Rails Cheatsheet
PDF
No ratings yet
Ruby On Rails Cheatsheet
13 pages
JSON Web Token Cheatsheet For Java
PDF
No ratings yet
JSON Web Token Cheatsheet For Java
14 pages
Xss Prevention
PDF
No ratings yet
Xss Prevention
10 pages
Password Storage Cheatsheet
PDF
No ratings yet
Password Storage Cheatsheet
7 pages
XML External Entity Prevention Cheatsheet
PDF
No ratings yet
XML External Entity Prevention Cheatsheet
18 pages
PHP Configuration Cheatsheet
PDF
No ratings yet
PHP Configuration Cheatsheet
3 pages
XML Security Cheatsheet
PDF
No ratings yet
XML Security Cheatsheet
22 pages
Virtual Patching Cheatsheet
PDF
No ratings yet
Virtual Patching Cheatsheet
10 pages
Third Party Javascript Management Cheatsheet
PDF
No ratings yet
Third Party Javascript Management Cheatsheet
11 pages
Threat Modeling Cheatsheet
PDF
No ratings yet
Threat Modeling Cheatsheet
12 pages
Transport Layer Protection Cheatsheet
PDF
No ratings yet
Transport Layer Protection Cheatsheet
9 pages
SAML Security Cheatsheet
PDF
No ratings yet
SAML Security Cheatsheet
6 pages
Session Management Cheatsheet
PDF
No ratings yet
Session Management Cheatsheet
20 pages
Nodejs Security Cheatsheet
PDF
No ratings yet
Nodejs Security Cheatsheet
18 pages
Injection Prevention Cheatsheet
PDF
No ratings yet
Injection Prevention Cheatsheet
11 pages
Secret Management Cheatsheet
PDF
100% (1)
Secret Management Cheatsheet
22 pages
Insecure Direct Object Reference
PDF
No ratings yet
Insecure Direct Object Reference
6 pages
Mass Assignment Cheatsheet
PDF
No ratings yet
Mass Assignment Cheatsheet
7 pages
Laravel Cheatsheet
PDF
No ratings yet
Laravel Cheatsheet
13 pages
Logging Vocabulary Cheatsheet
PDF
No ratings yet
Logging Vocabulary Cheatsheet
26 pages