SlideShare a Scribd company logo
Input Validation
Eoin Keary
CTO BCC Risk Advisory
www.bccriskadvisory.com
www.edgescan.com
Where are we going?
Don’t ever trust user input
Where possible, use whitelist validation
Perform input validation at earliest possible stage
Layers of defense
Use in-built validator routines
Data Validation
Input that is not directly entered by the user is typically less prone to
validation
Attacks discussed in this section apply to external input from any client-side
source
Standard form input control
Read-only HTML form controls (drop down lists, radio buttons,
hidden fields, etc)
HTTP Cookie Values
HTTP Headers
Embedded URL parameters (e.g., in the GET request)
Data Validation
Known Bad
Known Good
Exact
Match
 Data Validation is
typically done using
one of three basic
approaches
 All input must be properly
validated on the server
(not the client) to ensure
that malicious data is not
accepted and processed
by the application
Data is validated against a list of explicit known values
Application footprint or “application attack surface” defined
Provides the strongest level of protection against malicious data
Often not feasible when a large number of possible good values are
expected
May require code modification any time input values are changed or
updated
Exact Match Validation
Example: Acceptable input is yes or no
if ($input eq“yes” or $input eq “no”)
Exact Match Validation Example
Validates the variable gender against 2 known values (.NET)
static bool validateGender(String gender)
{
if (gender.equals(“Female“))
return true;
else if (gender.equals(“Male“))
return true;
else
return false; //attack SOUND THE ALARM! BEEP BEEP!
}
Exact Match Validation Example
Validates the variable gender against 2 known values (Java)
static boolean validateGender (String
gender) {
if (gender.equals (“Female“))
return true;
else if (gender.equals (“Male“))
return true;
else
return false; //attack
}
Known Good Validation
Often called "white list" validation
Data is validated against a list of allowable characters and patterns
Typically implemented using regular expressions to match known good data patterns
Data type cast/convert functions can be used to verify data conforms to a certain
data type (i.e. Int32)
Expected input character values must be clearly defined for each input variable
Care must be taken if complex regular expressions are used
A common mistake is to forget to anchor the expression with ^ and $
Regular Expression Syntax
Symbol Match
^ Beginning of input string
$ End of input string
* Zero or more occurrences of previous character, short for {0,}
+ One or more occurrences of previous character, short for {1,}
? Zero or one occurrences of previous character, short for {0,1}
{n,m} At least n and at most m occurrences of previous character
. Any single character, except ‘n’
[xyz] A character set (i.e. any one of the enclosed characters)
[^xyz] A negative character set (i.e. any character except the enclosed)
[a-z] A range of characters
Regular Expression Syntax - shortcuts
Symbol Match
d Any digit, short for [0-9]
D A non-digit, short for [^0-9]
s A whitespace character, short for [ tnx0brf]
S A non-whitespace character, for short for [^s]
w A word character, short for [a-zA-Z_0-9]
W A non-word character [^w]
S+ Several non-whitespace characters
Example 1
Validating SSN entry
if ($input=~/^[0-9]{9}$/)
Example 2
Validating entry of a last name
if ($input=~/^[A-Za-z][-.'0-9A-Za-z]{1,256}$/)
Example 3
Validating SSN entry (Short cut)
if ($input=~/^d{9}$/)
Examples 123-56-3454
Regular Expressions - Templates
Field Expression Format Samples Description
Name ^[a-zA-Z-'s]{1,40}$ John Doe Validates a name. Allows up to 40 uppercase and lowercase characters and a few special
characters that are common to some names. You can modify this list.
Social Security
Number
^d{3}-d{2}-d{4}$ 111-11-1111 Validates the format, type, and length of the supplied input field. The input must consist of 3
numeric characters followed by a dash, then 2 numeric characters followed by a dash, and
then 4 numeric characters.
Phone Number ^[01]?[- .]?(([2-9]d{2})|[2-
9]d{2})[- .]?d{3}[- .]?d{4}$
(425) 555-0123 Validates a U.S. phone number. It must consist of 3 numeric characters, optionally enclosed in
parentheses, followed by a set of 3 numeric characters and then a set of 4 numeric
characters.
E-mail ^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-
]+@[a-zA-Z0-9-]+(?:.[a-zA-Z0-9-
]+)*$
someone@exampl
e.com
Validates an e-mail address. (per the HTML5 specification
http://www.w3.org/TR/html5/forms.html#valid-e-mail-address).
URL ^(ht|f)tp(s?)://[0-9a-zA-Z]([-
.w]*[0-9a-zA-Z])*(:(0-
9)*)*(/?)([a-zA-Z0-9-
.?,'/+&%$#_]*)?$
http://www.micros
oft.com
Validates a URL
ZIP Code ^(d{5}-d{4}|d{5}|d{9})$|^([a-
zA-Z]d[a-zA-Z] d[a-zA-Z]d)$
12345 Validates a U.S. ZIP Code. The code must consist of 5 or 9 numeric characters.
Password (?!^[0-9]*$)(?!^[a-zA-Z]*$)^([a-
zA-Z0-9]{8,10})$
Validates a strong password. It must be between 8 and 10 characters, contain at least one
digit and one alphabetic character, and must not contain special characters.
Non- negative
integer
^d+$ 0 Validates that the field contains an integer greater than zero.
Currency (non-
negative)
^d+(.dd)?$ 1 Validates a positive currency amount. If there is a decimal point, it requires 2 numeric
characters after the decimal point. For example, 3.00 is valid but 3.1 is not.
Currency
(positive or
negative)
^(-)?d+(.dd)?$ 1.2 Validates for a positive or negative currency amount. If there is a decimal point, it requires 2
numeric characters after the decimal point.
Regular Expressions
Regular Expressions is a term used to refer to a pattern-matching technology
for processing text
Although there is no standards body governing the regular expression
language, Perl 5, by virtue of its popularity, has set the standard for regular
expression syntax
A Regular Expression itself is a string that represents a pattern, encoded
using the regular expression language and syntax
Regular Expression - Zend
$validator = new Zend_Validate_Regex(array('pattern' => '/^Test/');
$validator->isValid("Test"); // returns true
$validator->isValid("Testing"); // returns true
$validator->isValid("Pest"); // returns false
Data Validation Techniques
Validates against a regular expression representing the proper expected data format
(10 alphanumeric characters) (.NET)
using System.Text.RegularExpressions;
static bool validateUserFormat(String userName) {
bool isValid = false; //Fail by default
// Verify that the UserName is 1-10 character alphanumeric
isValid = Regex.IsMatch(userName, @"^[A-Za-z0-9]{10}$");
return isValid;
}
Regular Expressions - assertions
Assert a string is 8 or more characters:
(?=.{8,})
Assert a string contains at least 1 lowercase letter (zero or more characters followed by
a lowercase character):
(?=.*[a-z])
Assert a string contains at least 1 uppercase letter (zero or more characters followed by
an uppercase character):
(?=.*[A-Z])
Assert a string contains at least 1 digit:
(?=.*[d])
So if you want to match a string at least 6 characters long, with at least one lower case
and at least one uppercase letter you could use something like:
^.*(?=.{6,})(?=.*[a-z])(?=.*[A-Z]).*$
Known Good Validation Example
Validates against a regular expression representing the proper expected data
format (10 alphanumeric characters) (Java)
import java.util.regex.*;
static boolean validateUserFormat(String userName){
boolean isValid = false; //Fail by default
try{
// Verify that the UserName is 10 character alphanumeric
if (Pattern.matches(“^[A-Za-z0-9]{10}$”, userName))
isValid=true;
} catch(PatternSyntaxException e) {
System.out.println(e.getDescription());
}
return isValid;
}
Known Good Example
$validator = new Zend_Validate_Alnum();
if ($validator->isValid('Abcd12')) {
// value contains only allowed chars
} else {
// false
}
Known Good Example - Chains
// Create a validator chain and add validators to it
$validatorChain = new Zend_Validate();
$validatorChain->addValidator(
new Zend_Validate_StringLength(array('min' => 6, 'max' => 12)))
->addValidator(new Zend_Validate_Alnum());
// Validate the username
if ($validatorChain->isValid($username)) {
// username passed validation
} else {
// username failed validation; print reasons or whatever…..
foreach ($validatorChain->getMessages() as $message) {
echo "$messagen";
}
Often called "BlackList" validation
Data is validated against a list of characters that are deemed to be dangerous
or unacceptable
Useful for preventing specific characters from being accepted by the
application
Provides the weakest method of validation against malicious data
Susceptible to bypass using various forms of character encoding
Known Bad Validation
Example: Validating entry into generic text field
if ($input !~/[rtn><();+&%’”*|]/)
Known Bad Validation Example
Validates against a regular expression of known bad input strings (.Net)
using System.Text.RegularExpressions;
static boolean checkMessage(string messageText){
bool isValid = false; //Fail by default
// Verify input doesn’t contain any < , >
isValid = !Regex.IsMatch(messageText, @"[><]");
return isValid;
}
Known Bad Validation Example
Validates against a regular expression of known bad input strings (Java)
import java.util.regex.*;
static boolean checkMessage (string messageText) {
boolean isValid = false; //Fail by default
try {
Pattern P = Pattern.compile (“<|>”,
Pattern.CASE_INSENSITIVE | Pattern.MULTILINE);
Matcher M = p.matcher(messageText);
if (!M.find())
isValid = true;
} catch(Exception e) {
System.out.println(e.toString());
}
return isValid;
}
Bounds Checking
All external input must
also be properly validated
to ensure that excessively
large input is rejected
Length checking: A maximum length check should be
performed on all incoming application data.
Careful about name length! Lokelani
Keihanaikukauakahihuliheekahaunaele is a real
person!
Input that exceeds the
appropriate length or size
limits must be rejected
and not processed by the
application
Size checking: A maximum size check should be
performed on all incoming data files
The following code reads a String from a file.
Because it uses the readLine() method, it will read an unbounded amount of input until
a <newline> (n) charter is read.
InputStream Input = inputfileFile.getInputStream(Entry);
Reader inpReader = new InputStreamReader(Input);
BufferedReader br = new BufferedReader(inpReader);
String line = br.readLine();
This could be taken advantage of and cause an OutOfMemoryException or to consume a
large amount of memory which shall affect performance and initiate costly garbage
collection routines.
Bounds Checking – Example
Unbounded Reading of a file
Bounds checking
$validator = new Zend_Validate_StringLength(array('max' => 6));
$validator->isValid("Test"); // returns true
$validator->isValid("Testing"); // returns false
Bounds checking – File size
$upload = new Zend_File_Transfer();
// Limit the size of all files to be uploaded to 40000 bytes
$upload->addValidator('FilesSize', false, 40000);
// Limit the size of all files to be uploaded to maximum 4MB and mimimum 10kB
$upload->addValidator('FilesSize', false, array('min' => '10kB', 'max' => '4MB'));
.NET Validator Controls:
RequiredFieldValidator, CompareValidator, RangeValidator,
RegularExpressionValidator, CustomValidator, ValidateRequest
Jakarta Commons Validator:
required, mask, range, maxLength, minLength, datatype, date,
creditCard, email, regularExpression
Native Validation Controls
Many development platforms have native validator controls, such as Jakarta and .NET
Escaping vs. Rejecting
When validating data, one can either reject data failing to meet validation
requirements or attempt to “clean” or escape dangerous characters
Failed validation attempts should always reject the data to minimise the risk
that sanitisation routines will be ineffective or can be bypassed
Error messages displayed when rejecting data should specify the proper
format for the user to enter appropriate data
Error messages should not redisplay the input the user has entered
The Problem with Escaping
--- Snip ---
page_template = request.queryString("page")
replace(page_template , "/", "")
replace(page_template, "..", "")
getFile(page_template)
--- End Snip ---
http://www.example.com/content/default.jsp?page=info.htm
 Page_template = info.htm <- First Pass
 Page_template = info.htm <- Second Pass
http://www.example.com/content/default.jsp?page=../web.xml
 Page_template = .. web.xml <- First Pass
 Page_template = web.xml <- Second Pass
http://www.example.com/content/default.jsp?page=....//web.xml
 Page_template = ....web.xml <- First Pass
 Page_template = ..web.xml <- Second Pass
Input Based Attacks
Malicious user input can be used to launch a variety of attacks against an application. These
attacks include, but are not limited to:
Parameter
Manipulation
 Cookie poisoning
 Hidden field manipulation
Content
injection
 SQL
 HTTP Response Splitting
 Operating system calls
 Command insertion
 XPath
Cross site
scripting
 …
Buffer
overflows
 Format string attacks
Parameter Manipulation
Applications typically pass parameters that determine what the user can do
or see
Unauthorised access to application data can be obtained by manipulating
parameter values, if record-level authorisation checks are not performed
within the application code
Many applications tend to pass sensitive parameters back and forth rather
than using server session variables to store the information
Very common to see this in
HTTP cookies
“hidden” HTML form fields
Parameter Manipulation
Database record index numbers are often passed as page parameters to
view a specific record
If there is a relatively small range of possible index values, sequential
parameter values can by cycled to view other records
Even-non sequential indexing can be attacked within a small range of
potential values
Manipulating parameter values can be trivial when other obvious valid
Values exist:
Username=joe (change to username=mary)
Privilege=user (change to privilege=admin)
Price=100.00 (change to price=1.00)
Testing for Parameter Manipulation
Identify areas in the application where records appear to be displayed based
on input parameters
Attempt to access records using other known valid parameter values
For parameter values that seem to fall within a variable range, cycle through
the range to search for other valid records
Identify all data being passed in hidden fields. Attempt to determine:
What the data is being used for
Whether use of a hidden field seems appropriate
Defenses Against Parameter
Manipulation
Data that should not be altered should never be passed to the client
Always perform validation on the server
Use the most restrictive input validation method possible
Use Exact Match Validation to verify that parameters values are
appropriate for the specific transaction or user’s permission level
In situations where a query or hash table lookup is required, Known Good
Validation should be used to validate the parameter before performing
the lookup
Retrieve the information from the client once, validate it and keep it on the
server associated with that user’s session
Summary
Don’t ever trust user input
Where possible, use whitelist validation
Perform input validation at earliest possible stage
Layers of defense
Use in-built validator routines

More Related Content

What's hot

Sql injection
Sql injectionSql injection
Sql injection
Nitish Kumar
 
Sql injection
Sql injectionSql injection
Sql injection
Pallavi Biswas
 
Sql injections - with example
Sql injections - with exampleSql injections - with example
Sql injections - with example
Prateek Chauhan
 
Virus and its CounterMeasures -- Pruthvi Monarch
Virus and its CounterMeasures                         -- Pruthvi Monarch Virus and its CounterMeasures                         -- Pruthvi Monarch
Virus and its CounterMeasures -- Pruthvi Monarch
Pruthvi Monarch
 
Secure coding in C#
Secure coding in C#Secure coding in C#
Secure coding in C#
Siddharth Bezalwar
 
Security testing
Security testingSecurity testing
Security testing
Tabăra de Testare
 
Sql Injection - Vulnerability and Security
Sql Injection - Vulnerability and SecuritySql Injection - Vulnerability and Security
Sql Injection - Vulnerability and Security
Sandip Chaudhari
 
Secure Coding - Web Application Security Vulnerabilities and Best Practices
Secure Coding - Web Application Security Vulnerabilities and Best PracticesSecure Coding - Web Application Security Vulnerabilities and Best Practices
Secure Coding - Web Application Security Vulnerabilities and Best Practices
Websecurify
 
SQL Injection
SQL Injection SQL Injection
SQL Injection
Adhoura Academy
 
OWASP Secure Coding
OWASP Secure CodingOWASP Secure Coding
OWASP Secure Coding
bilcorry
 
Application security
Application securityApplication security
Application security
Hagar Alaa el-din
 
SQL Injections - A Powerpoint Presentation
SQL Injections - A Powerpoint PresentationSQL Injections - A Powerpoint Presentation
SQL Injections - A Powerpoint Presentation
Rapid Purple
 
Whatis SQL Injection.pptx
Whatis SQL Injection.pptxWhatis SQL Injection.pptx
Whatis SQL Injection.pptx
Simplilearn
 
Secure coding practices
Secure coding practicesSecure coding practices
Secure coding practices
Mohammed Danish Amber
 
SQL INJECTION
SQL INJECTIONSQL INJECTION
SQL INJECTION
Anoop T
 
Web Application Penetration Testing
Web Application Penetration Testing Web Application Penetration Testing
Web Application Penetration Testing
Priyanka Aash
 
Secure Code Review 101
Secure Code Review 101Secure Code Review 101
Secure Code Review 101
Narudom Roongsiriwong, CISSP
 
Web Application Security 101
Web Application Security 101Web Application Security 101
Web Application Security 101
Cybersecurity Education and Research Centre
 
Vulnerability assessment and penetration testing
Vulnerability assessment and penetration testingVulnerability assessment and penetration testing
Vulnerability assessment and penetration testing
Abu Sadat Mohammed Yasin
 
Web security
Web securityWeb security
Web security
Padam Banthia
 

What's hot (20)

Sql injection
Sql injectionSql injection
Sql injection
 
Sql injection
Sql injectionSql injection
Sql injection
 
Sql injections - with example
Sql injections - with exampleSql injections - with example
Sql injections - with example
 
Virus and its CounterMeasures -- Pruthvi Monarch
Virus and its CounterMeasures                         -- Pruthvi Monarch Virus and its CounterMeasures                         -- Pruthvi Monarch
Virus and its CounterMeasures -- Pruthvi Monarch
 
Secure coding in C#
Secure coding in C#Secure coding in C#
Secure coding in C#
 
Security testing
Security testingSecurity testing
Security testing
 
Sql Injection - Vulnerability and Security
Sql Injection - Vulnerability and SecuritySql Injection - Vulnerability and Security
Sql Injection - Vulnerability and Security
 
Secure Coding - Web Application Security Vulnerabilities and Best Practices
Secure Coding - Web Application Security Vulnerabilities and Best PracticesSecure Coding - Web Application Security Vulnerabilities and Best Practices
Secure Coding - Web Application Security Vulnerabilities and Best Practices
 
SQL Injection
SQL Injection SQL Injection
SQL Injection
 
OWASP Secure Coding
OWASP Secure CodingOWASP Secure Coding
OWASP Secure Coding
 
Application security
Application securityApplication security
Application security
 
SQL Injections - A Powerpoint Presentation
SQL Injections - A Powerpoint PresentationSQL Injections - A Powerpoint Presentation
SQL Injections - A Powerpoint Presentation
 
Whatis SQL Injection.pptx
Whatis SQL Injection.pptxWhatis SQL Injection.pptx
Whatis SQL Injection.pptx
 
Secure coding practices
Secure coding practicesSecure coding practices
Secure coding practices
 
SQL INJECTION
SQL INJECTIONSQL INJECTION
SQL INJECTION
 
Web Application Penetration Testing
Web Application Penetration Testing Web Application Penetration Testing
Web Application Penetration Testing
 
Secure Code Review 101
Secure Code Review 101Secure Code Review 101
Secure Code Review 101
 
Web Application Security 101
Web Application Security 101Web Application Security 101
Web Application Security 101
 
Vulnerability assessment and penetration testing
Vulnerability assessment and penetration testingVulnerability assessment and penetration testing
Vulnerability assessment and penetration testing
 
Web security
Web securityWeb security
Web security
 

Viewers also liked

Form Validation
Form ValidationForm Validation
Form Validation
Graeme Smith
 
Web forms and server side scripting
Web forms and server side scriptingWeb forms and server side scripting
Web forms and server side scripting
sawsan slii
 
Form Validation in JavaScript
Form Validation in JavaScriptForm Validation in JavaScript
Form Validation in JavaScript
Ravi Bhadauria
 
1 - Designing A Site
1 - Designing A Site1 - Designing A Site
1 - Designing A Site
Graeme Smith
 
Flex security
Flex securityFlex security
Flex security
chengalva
 
Javascript validation assignment
Javascript validation assignmentJavascript validation assignment
Javascript validation assignment
H K
 
JavaScript
JavaScriptJavaScript
JavaScript
Bharti Gupta
 
Business Interfaces using Virtual Objects, Visual-Force Forms and JavaScript
Business Interfaces using Virtual Objects, Visual-Force Forms and JavaScriptBusiness Interfaces using Virtual Objects, Visual-Force Forms and JavaScript
Business Interfaces using Virtual Objects, Visual-Force Forms and JavaScript
Salesforce Developers
 
HTML5
HTML5HTML5
HTML5 Mullet: Forms & Input Validation
HTML5 Mullet: Forms & Input ValidationHTML5 Mullet: Forms & Input Validation
HTML5 Mullet: Forms & Input Validation
Todd Anglin
 
Authentication Protocols
Authentication ProtocolsAuthentication Protocols
Authentication Protocols
Trinity Dwarka
 
Javascript validating form
Javascript validating formJavascript validating form
Javascript validating form
Jesus Obenita Jr.
 
Validation rule, validation text and input masks
Validation rule, validation text and input masksValidation rule, validation text and input masks
Validation rule, validation text and input masks
fizahPhd
 
Ch3 server controls
Ch3 server controlsCh3 server controls
Ch3 server controls
Madhuri Kavade
 
HTML5 JavaScript APIs
HTML5 JavaScript APIsHTML5 JavaScript APIs
HTML5 JavaScript APIs
Remy Sharp
 
8 Authentication Security Protocols
8 Authentication Security Protocols8 Authentication Security Protocols
8 Authentication Security Protocols
guestfbf635
 
Java script ppt
Java script pptJava script ppt
Javascript Best Practices
Javascript Best PracticesJavascript Best Practices
Javascript Best Practices
Christian Heilmann
 
Slideshare.Com Powerpoint
Slideshare.Com PowerpointSlideshare.Com Powerpoint
Slideshare.Com Powerpoint
guested929b
 
TEDx Manchester: AI & The Future of Work
TEDx Manchester: AI & The Future of WorkTEDx Manchester: AI & The Future of Work
TEDx Manchester: AI & The Future of Work
Volker Hirsch
 

Viewers also liked (20)

Form Validation
Form ValidationForm Validation
Form Validation
 
Web forms and server side scripting
Web forms and server side scriptingWeb forms and server side scripting
Web forms and server side scripting
 
Form Validation in JavaScript
Form Validation in JavaScriptForm Validation in JavaScript
Form Validation in JavaScript
 
1 - Designing A Site
1 - Designing A Site1 - Designing A Site
1 - Designing A Site
 
Flex security
Flex securityFlex security
Flex security
 
Javascript validation assignment
Javascript validation assignmentJavascript validation assignment
Javascript validation assignment
 
JavaScript
JavaScriptJavaScript
JavaScript
 
Business Interfaces using Virtual Objects, Visual-Force Forms and JavaScript
Business Interfaces using Virtual Objects, Visual-Force Forms and JavaScriptBusiness Interfaces using Virtual Objects, Visual-Force Forms and JavaScript
Business Interfaces using Virtual Objects, Visual-Force Forms and JavaScript
 
HTML5
HTML5HTML5
HTML5
 
HTML5 Mullet: Forms & Input Validation
HTML5 Mullet: Forms & Input ValidationHTML5 Mullet: Forms & Input Validation
HTML5 Mullet: Forms & Input Validation
 
Authentication Protocols
Authentication ProtocolsAuthentication Protocols
Authentication Protocols
 
Javascript validating form
Javascript validating formJavascript validating form
Javascript validating form
 
Validation rule, validation text and input masks
Validation rule, validation text and input masksValidation rule, validation text and input masks
Validation rule, validation text and input masks
 
Ch3 server controls
Ch3 server controlsCh3 server controls
Ch3 server controls
 
HTML5 JavaScript APIs
HTML5 JavaScript APIsHTML5 JavaScript APIs
HTML5 JavaScript APIs
 
8 Authentication Security Protocols
8 Authentication Security Protocols8 Authentication Security Protocols
8 Authentication Security Protocols
 
Java script ppt
Java script pptJava script ppt
Java script ppt
 
Javascript Best Practices
Javascript Best PracticesJavascript Best Practices
Javascript Best Practices
 
Slideshare.Com Powerpoint
Slideshare.Com PowerpointSlideshare.Com Powerpoint
Slideshare.Com Powerpoint
 
TEDx Manchester: AI & The Future of Work
TEDx Manchester: AI & The Future of WorkTEDx Manchester: AI & The Future of Work
TEDx Manchester: AI & The Future of Work
 

Similar to 02. input validation module v5

Secure Dot Net Programming
Secure Dot Net ProgrammingSecure Dot Net Programming
Secure Dot Net Programming
Adam Getchell
 
PHP Built-in String Validation Functions
PHP Built-in String Validation FunctionsPHP Built-in String Validation Functions
PHP Built-in String Validation Functions
Aung Khant
 
Php Security By Mugdha And Anish
Php Security By Mugdha And AnishPhp Security By Mugdha And Anish
Php Security By Mugdha And Anish
OSSCube
 
vb.net.pdf
vb.net.pdfvb.net.pdf
vb.net.pdf
VimalSangar1
 
Lecture7 pattern
Lecture7 patternLecture7 pattern
Lecture7 pattern
Châu Thanh Chương
 
TestFest - Respect\Validation 1.0
TestFest - Respect\Validation 1.0TestFest - Respect\Validation 1.0
TestFest - Respect\Validation 1.0
Henrique Moody
 
Form validation server side
Form validation server side Form validation server side
Form validation server side
Mudasir Syed
 
Unit testing zend framework apps
Unit testing zend framework appsUnit testing zend framework apps
Unit testing zend framework apps
Michelangelo van Dam
 
Leveraging Scala Macros for Better Validation
Leveraging Scala Macros for Better ValidationLeveraging Scala Macros for Better Validation
Leveraging Scala Macros for Better Validation
Tomer Gabel
 
Validation and input formatting
Validation and input formattingValidation and input formatting
Validation and input formatting
Neha Kaurav
 
Drupal7 dbtng
Drupal7  dbtngDrupal7  dbtng
Drupal7 dbtng
Nicolas Leroy
 
Linq 090701233237 Phpapp01
Linq 090701233237 Phpapp01Linq 090701233237 Phpapp01
Linq 090701233237 Phpapp01
google
 
Computational Problem Solving 004 (1).pptx (1).pdf
Computational Problem Solving 004 (1).pptx (1).pdfComputational Problem Solving 004 (1).pptx (1).pdf
Computational Problem Solving 004 (1).pptx (1).pdf
SadhikaPolamarasetti1
 
QA Lab: тестирование ПО. Станислав Шмидт: "Self-testing REST APIs with API Fi...
QA Lab: тестирование ПО. Станислав Шмидт: "Self-testing REST APIs with API Fi...QA Lab: тестирование ПО. Станислав Шмидт: "Self-testing REST APIs with API Fi...
QA Lab: тестирование ПО. Станислав Шмидт: "Self-testing REST APIs with API Fi...
GeeksLab Odessa
 
Email Validation
Email ValidationEmail Validation
Email Validation
Hashim Lokasher
 
Php Security3895
Php Security3895Php Security3895
Php Security3895
Aung Khant
 
API first with Swagger and Scala by Slava Schmidt
API first with Swagger and Scala by  Slava SchmidtAPI first with Swagger and Scala by  Slava Schmidt
API first with Swagger and Scala by Slava Schmidt
JavaDayUA
 
Php & my sql
Php & my sqlPhp & my sql
Php & my sql
Norhisyam Dasuki
 
Defending against Injections
Defending against InjectionsDefending against Injections
Defending against Injections
Blueinfy Solutions
 
Forms
FormsForms

Similar to 02. input validation module v5 (20)

Secure Dot Net Programming
Secure Dot Net ProgrammingSecure Dot Net Programming
Secure Dot Net Programming
 
PHP Built-in String Validation Functions
PHP Built-in String Validation FunctionsPHP Built-in String Validation Functions
PHP Built-in String Validation Functions
 
Php Security By Mugdha And Anish
Php Security By Mugdha And AnishPhp Security By Mugdha And Anish
Php Security By Mugdha And Anish
 
vb.net.pdf
vb.net.pdfvb.net.pdf
vb.net.pdf
 
Lecture7 pattern
Lecture7 patternLecture7 pattern
Lecture7 pattern
 
TestFest - Respect\Validation 1.0
TestFest - Respect\Validation 1.0TestFest - Respect\Validation 1.0
TestFest - Respect\Validation 1.0
 
Form validation server side
Form validation server side Form validation server side
Form validation server side
 
Unit testing zend framework apps
Unit testing zend framework appsUnit testing zend framework apps
Unit testing zend framework apps
 
Leveraging Scala Macros for Better Validation
Leveraging Scala Macros for Better ValidationLeveraging Scala Macros for Better Validation
Leveraging Scala Macros for Better Validation
 
Validation and input formatting
Validation and input formattingValidation and input formatting
Validation and input formatting
 
Drupal7 dbtng
Drupal7  dbtngDrupal7  dbtng
Drupal7 dbtng
 
Linq 090701233237 Phpapp01
Linq 090701233237 Phpapp01Linq 090701233237 Phpapp01
Linq 090701233237 Phpapp01
 
Computational Problem Solving 004 (1).pptx (1).pdf
Computational Problem Solving 004 (1).pptx (1).pdfComputational Problem Solving 004 (1).pptx (1).pdf
Computational Problem Solving 004 (1).pptx (1).pdf
 
QA Lab: тестирование ПО. Станислав Шмидт: "Self-testing REST APIs with API Fi...
QA Lab: тестирование ПО. Станислав Шмидт: "Self-testing REST APIs with API Fi...QA Lab: тестирование ПО. Станислав Шмидт: "Self-testing REST APIs with API Fi...
QA Lab: тестирование ПО. Станислав Шмидт: "Self-testing REST APIs with API Fi...
 
Email Validation
Email ValidationEmail Validation
Email Validation
 
Php Security3895
Php Security3895Php Security3895
Php Security3895
 
API first with Swagger and Scala by Slava Schmidt
API first with Swagger and Scala by  Slava SchmidtAPI first with Swagger and Scala by  Slava Schmidt
API first with Swagger and Scala by Slava Schmidt
 
Php & my sql
Php & my sqlPhp & my sql
Php & my sql
 
Defending against Injections
Defending against InjectionsDefending against Injections
Defending against Injections
 
Forms
FormsForms
Forms
 

More from Eoin Keary

IISF-March2023.pptx
IISF-March2023.pptxIISF-March2023.pptx
IISF-March2023.pptx
Eoin Keary
 
Validation of vulnerabilities.pdf
Validation of vulnerabilities.pdfValidation of vulnerabilities.pdf
Validation of vulnerabilities.pdf
Eoin Keary
 
Does a Hybrid model for vulnerability Management Make Sense.pdf
Does a Hybrid model for vulnerability Management Make Sense.pdfDoes a Hybrid model for vulnerability Management Make Sense.pdf
Does a Hybrid model for vulnerability Management Make Sense.pdf
Eoin Keary
 
Edgescan 2022 Vulnerability Statistics Report
Edgescan 2022 Vulnerability Statistics ReportEdgescan 2022 Vulnerability Statistics Report
Edgescan 2022 Vulnerability Statistics Report
Eoin Keary
 
Edgescan 2021 Vulnerability Stats Report
Edgescan 2021 Vulnerability Stats ReportEdgescan 2021 Vulnerability Stats Report
Edgescan 2021 Vulnerability Stats Report
Eoin Keary
 
One login enemy at the gates
One login enemy at the gatesOne login enemy at the gates
One login enemy at the gates
Eoin Keary
 
Edgescan vulnerability stats report 2020
Edgescan vulnerability stats report 2020Edgescan vulnerability stats report 2020
Edgescan vulnerability stats report 2020
Eoin Keary
 
edgescan vulnerability stats report (2018)
 edgescan vulnerability stats report (2018)  edgescan vulnerability stats report (2018)
edgescan vulnerability stats report (2018)
Eoin Keary
 
edgescan vulnerability stats report (2019)
edgescan vulnerability stats report (2019) edgescan vulnerability stats report (2019)
edgescan vulnerability stats report (2019)
Eoin Keary
 
Full stack vulnerability management at scale
Full stack vulnerability management at scaleFull stack vulnerability management at scale
Full stack vulnerability management at scale
Eoin Keary
 
Vulnerability Intelligence - Standing Still in a world full of change
Vulnerability Intelligence - Standing Still in a world full of changeVulnerability Intelligence - Standing Still in a world full of change
Vulnerability Intelligence - Standing Still in a world full of change
Eoin Keary
 
Edgescan vulnerability stats report 2019 - h-isac-2-2-2019
Edgescan   vulnerability stats report 2019 - h-isac-2-2-2019Edgescan   vulnerability stats report 2019 - h-isac-2-2-2019
Edgescan vulnerability stats report 2019 - h-isac-2-2-2019
Eoin Keary
 
Hide and seek - Attack Surface Management and continuous assessment.
Hide and seek - Attack Surface Management and continuous assessment.Hide and seek - Attack Surface Management and continuous assessment.
Hide and seek - Attack Surface Management and continuous assessment.
Eoin Keary
 
Online Gaming Cyber security and Threat Model
Online Gaming Cyber security and Threat ModelOnline Gaming Cyber security and Threat Model
Online Gaming Cyber security and Threat Model
Eoin Keary
 
Keeping the wolf from 1000 doors.
Keeping the wolf from 1000 doors.Keeping the wolf from 1000 doors.
Keeping the wolf from 1000 doors.
Eoin Keary
 
Security by the numbers
Security by the numbersSecurity by the numbers
Security by the numbers
Eoin Keary
 
Web security – everything we know is wrong cloud version
Web security – everything we know is wrong   cloud versionWeb security – everything we know is wrong   cloud version
Web security – everything we know is wrong cloud version
Eoin Keary
 
Cybersecurity by the numbers
Cybersecurity by the numbersCybersecurity by the numbers
Cybersecurity by the numbers
Eoin Keary
 
Ebu class edgescan-2017
Ebu class edgescan-2017Ebu class edgescan-2017
Ebu class edgescan-2017
Eoin Keary
 
Vulnerability management and threat detection by the numbers
Vulnerability management and threat detection by the numbersVulnerability management and threat detection by the numbers
Vulnerability management and threat detection by the numbers
Eoin Keary
 

More from Eoin Keary (20)

IISF-March2023.pptx
IISF-March2023.pptxIISF-March2023.pptx
IISF-March2023.pptx
 
Validation of vulnerabilities.pdf
Validation of vulnerabilities.pdfValidation of vulnerabilities.pdf
Validation of vulnerabilities.pdf
 
Does a Hybrid model for vulnerability Management Make Sense.pdf
Does a Hybrid model for vulnerability Management Make Sense.pdfDoes a Hybrid model for vulnerability Management Make Sense.pdf
Does a Hybrid model for vulnerability Management Make Sense.pdf
 
Edgescan 2022 Vulnerability Statistics Report
Edgescan 2022 Vulnerability Statistics ReportEdgescan 2022 Vulnerability Statistics Report
Edgescan 2022 Vulnerability Statistics Report
 
Edgescan 2021 Vulnerability Stats Report
Edgescan 2021 Vulnerability Stats ReportEdgescan 2021 Vulnerability Stats Report
Edgescan 2021 Vulnerability Stats Report
 
One login enemy at the gates
One login enemy at the gatesOne login enemy at the gates
One login enemy at the gates
 
Edgescan vulnerability stats report 2020
Edgescan vulnerability stats report 2020Edgescan vulnerability stats report 2020
Edgescan vulnerability stats report 2020
 
edgescan vulnerability stats report (2018)
 edgescan vulnerability stats report (2018)  edgescan vulnerability stats report (2018)
edgescan vulnerability stats report (2018)
 
edgescan vulnerability stats report (2019)
edgescan vulnerability stats report (2019) edgescan vulnerability stats report (2019)
edgescan vulnerability stats report (2019)
 
Full stack vulnerability management at scale
Full stack vulnerability management at scaleFull stack vulnerability management at scale
Full stack vulnerability management at scale
 
Vulnerability Intelligence - Standing Still in a world full of change
Vulnerability Intelligence - Standing Still in a world full of changeVulnerability Intelligence - Standing Still in a world full of change
Vulnerability Intelligence - Standing Still in a world full of change
 
Edgescan vulnerability stats report 2019 - h-isac-2-2-2019
Edgescan   vulnerability stats report 2019 - h-isac-2-2-2019Edgescan   vulnerability stats report 2019 - h-isac-2-2-2019
Edgescan vulnerability stats report 2019 - h-isac-2-2-2019
 
Hide and seek - Attack Surface Management and continuous assessment.
Hide and seek - Attack Surface Management and continuous assessment.Hide and seek - Attack Surface Management and continuous assessment.
Hide and seek - Attack Surface Management and continuous assessment.
 
Online Gaming Cyber security and Threat Model
Online Gaming Cyber security and Threat ModelOnline Gaming Cyber security and Threat Model
Online Gaming Cyber security and Threat Model
 
Keeping the wolf from 1000 doors.
Keeping the wolf from 1000 doors.Keeping the wolf from 1000 doors.
Keeping the wolf from 1000 doors.
 
Security by the numbers
Security by the numbersSecurity by the numbers
Security by the numbers
 
Web security – everything we know is wrong cloud version
Web security – everything we know is wrong   cloud versionWeb security – everything we know is wrong   cloud version
Web security – everything we know is wrong cloud version
 
Cybersecurity by the numbers
Cybersecurity by the numbersCybersecurity by the numbers
Cybersecurity by the numbers
 
Ebu class edgescan-2017
Ebu class edgescan-2017Ebu class edgescan-2017
Ebu class edgescan-2017
 
Vulnerability management and threat detection by the numbers
Vulnerability management and threat detection by the numbersVulnerability management and threat detection by the numbers
Vulnerability management and threat detection by the numbers
 

Recently uploaded

[HUN][hackersuli] Red Teaming alapok 2024
[HUN][hackersuli] Red Teaming alapok 2024[HUN][hackersuli] Red Teaming alapok 2024
[HUN][hackersuli] Red Teaming alapok 2024
hackersuli
 
怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样
怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样
怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样
rtunex8r
 
HijackLoader Evolution: Interactive Process Hollowing
HijackLoader Evolution: Interactive Process HollowingHijackLoader Evolution: Interactive Process Hollowing
HijackLoader Evolution: Interactive Process Hollowing
Donato Onofri
 
Should Repositories Participate in the Fediverse?
Should Repositories Participate in the Fediverse?Should Repositories Participate in the Fediverse?
Should Repositories Participate in the Fediverse?
Paul Walk
 
Design Thinking NETFLIX using all techniques.pptx
Design Thinking NETFLIX using all techniques.pptxDesign Thinking NETFLIX using all techniques.pptx
Design Thinking NETFLIX using all techniques.pptx
saathvikreddy2003
 
办理毕业证(NYU毕业证)纽约大学毕业证成绩单官方原版办理
办理毕业证(NYU毕业证)纽约大学毕业证成绩单官方原版办理办理毕业证(NYU毕业证)纽约大学毕业证成绩单官方原版办理
办理毕业证(NYU毕业证)纽约大学毕业证成绩单官方原版办理
uehowe
 
一比一原版(USYD毕业证)悉尼大学毕业证如何办理
一比一原版(USYD毕业证)悉尼大学毕业证如何办理一比一原版(USYD毕业证)悉尼大学毕业证如何办理
一比一原版(USYD毕业证)悉尼大学毕业证如何办理
k4ncd0z
 
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
xjq03c34
 
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
ysasp1
 
Gen Z and the marketplaces - let's translate their needs
Gen Z and the marketplaces - let's translate their needsGen Z and the marketplaces - let's translate their needs
Gen Z and the marketplaces - let's translate their needs
Laura Szabó
 
Ready to Unlock the Power of Blockchain!
Ready to Unlock the Power of Blockchain!Ready to Unlock the Power of Blockchain!
Ready to Unlock the Power of Blockchain!
Toptal Tech
 
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
fovkoyb
 
快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样
快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样
快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样
3a0sd7z3
 
留学挂科(UofM毕业证)明尼苏达大学毕业证成绩单复刻办理
留学挂科(UofM毕业证)明尼苏达大学毕业证成绩单复刻办理留学挂科(UofM毕业证)明尼苏达大学毕业证成绩单复刻办理
留学挂科(UofM毕业证)明尼苏达大学毕业证成绩单复刻办理
uehowe
 
Discover the benefits of outsourcing SEO to India
Discover the benefits of outsourcing SEO to IndiaDiscover the benefits of outsourcing SEO to India
Discover the benefits of outsourcing SEO to India
davidjhones387
 
不能毕业如何获得(USYD毕业证)悉尼大学毕业证成绩单一比一原版制作
不能毕业如何获得(USYD毕业证)悉尼大学毕业证成绩单一比一原版制作不能毕业如何获得(USYD毕业证)悉尼大学毕业证成绩单一比一原版制作
不能毕业如何获得(USYD毕业证)悉尼大学毕业证成绩单一比一原版制作
bseovas
 
快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
3a0sd7z3
 
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
uehowe
 
manuaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaal
manuaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaalmanuaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaal
manuaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaal
wolfsoftcompanyco
 

Recently uploaded (19)

[HUN][hackersuli] Red Teaming alapok 2024
[HUN][hackersuli] Red Teaming alapok 2024[HUN][hackersuli] Red Teaming alapok 2024
[HUN][hackersuli] Red Teaming alapok 2024
 
怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样
怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样
怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样
 
HijackLoader Evolution: Interactive Process Hollowing
HijackLoader Evolution: Interactive Process HollowingHijackLoader Evolution: Interactive Process Hollowing
HijackLoader Evolution: Interactive Process Hollowing
 
Should Repositories Participate in the Fediverse?
Should Repositories Participate in the Fediverse?Should Repositories Participate in the Fediverse?
Should Repositories Participate in the Fediverse?
 
Design Thinking NETFLIX using all techniques.pptx
Design Thinking NETFLIX using all techniques.pptxDesign Thinking NETFLIX using all techniques.pptx
Design Thinking NETFLIX using all techniques.pptx
 
办理毕业证(NYU毕业证)纽约大学毕业证成绩单官方原版办理
办理毕业证(NYU毕业证)纽约大学毕业证成绩单官方原版办理办理毕业证(NYU毕业证)纽约大学毕业证成绩单官方原版办理
办理毕业证(NYU毕业证)纽约大学毕业证成绩单官方原版办理
 
一比一原版(USYD毕业证)悉尼大学毕业证如何办理
一比一原版(USYD毕业证)悉尼大学毕业证如何办理一比一原版(USYD毕业证)悉尼大学毕业证如何办理
一比一原版(USYD毕业证)悉尼大学毕业证如何办理
 
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
 
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
 
Gen Z and the marketplaces - let's translate their needs
Gen Z and the marketplaces - let's translate their needsGen Z and the marketplaces - let's translate their needs
Gen Z and the marketplaces - let's translate their needs
 
Ready to Unlock the Power of Blockchain!
Ready to Unlock the Power of Blockchain!Ready to Unlock the Power of Blockchain!
Ready to Unlock the Power of Blockchain!
 
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
 
快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样
快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样
快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样
 
留学挂科(UofM毕业证)明尼苏达大学毕业证成绩单复刻办理
留学挂科(UofM毕业证)明尼苏达大学毕业证成绩单复刻办理留学挂科(UofM毕业证)明尼苏达大学毕业证成绩单复刻办理
留学挂科(UofM毕业证)明尼苏达大学毕业证成绩单复刻办理
 
Discover the benefits of outsourcing SEO to India
Discover the benefits of outsourcing SEO to IndiaDiscover the benefits of outsourcing SEO to India
Discover the benefits of outsourcing SEO to India
 
不能毕业如何获得(USYD毕业证)悉尼大学毕业证成绩单一比一原版制作
不能毕业如何获得(USYD毕业证)悉尼大学毕业证成绩单一比一原版制作不能毕业如何获得(USYD毕业证)悉尼大学毕业证成绩单一比一原版制作
不能毕业如何获得(USYD毕业证)悉尼大学毕业证成绩单一比一原版制作
 
快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
 
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
 
manuaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaal
manuaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaalmanuaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaal
manuaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaal
 

02. input validation module v5

  • 1. Input Validation Eoin Keary CTO BCC Risk Advisory www.bccriskadvisory.com www.edgescan.com
  • 2. Where are we going? Don’t ever trust user input Where possible, use whitelist validation Perform input validation at earliest possible stage Layers of defense Use in-built validator routines
  • 3. Data Validation Input that is not directly entered by the user is typically less prone to validation Attacks discussed in this section apply to external input from any client-side source Standard form input control Read-only HTML form controls (drop down lists, radio buttons, hidden fields, etc) HTTP Cookie Values HTTP Headers Embedded URL parameters (e.g., in the GET request)
  • 4. Data Validation Known Bad Known Good Exact Match  Data Validation is typically done using one of three basic approaches  All input must be properly validated on the server (not the client) to ensure that malicious data is not accepted and processed by the application
  • 5. Data is validated against a list of explicit known values Application footprint or “application attack surface” defined Provides the strongest level of protection against malicious data Often not feasible when a large number of possible good values are expected May require code modification any time input values are changed or updated Exact Match Validation Example: Acceptable input is yes or no if ($input eq“yes” or $input eq “no”)
  • 6. Exact Match Validation Example Validates the variable gender against 2 known values (.NET) static bool validateGender(String gender) { if (gender.equals(“Female“)) return true; else if (gender.equals(“Male“)) return true; else return false; //attack SOUND THE ALARM! BEEP BEEP! }
  • 7. Exact Match Validation Example Validates the variable gender against 2 known values (Java) static boolean validateGender (String gender) { if (gender.equals (“Female“)) return true; else if (gender.equals (“Male“)) return true; else return false; //attack }
  • 8. Known Good Validation Often called "white list" validation Data is validated against a list of allowable characters and patterns Typically implemented using regular expressions to match known good data patterns Data type cast/convert functions can be used to verify data conforms to a certain data type (i.e. Int32) Expected input character values must be clearly defined for each input variable Care must be taken if complex regular expressions are used A common mistake is to forget to anchor the expression with ^ and $
  • 9. Regular Expression Syntax Symbol Match ^ Beginning of input string $ End of input string * Zero or more occurrences of previous character, short for {0,} + One or more occurrences of previous character, short for {1,} ? Zero or one occurrences of previous character, short for {0,1} {n,m} At least n and at most m occurrences of previous character . Any single character, except ‘n’ [xyz] A character set (i.e. any one of the enclosed characters) [^xyz] A negative character set (i.e. any character except the enclosed) [a-z] A range of characters
  • 10. Regular Expression Syntax - shortcuts Symbol Match d Any digit, short for [0-9] D A non-digit, short for [^0-9] s A whitespace character, short for [ tnx0brf] S A non-whitespace character, for short for [^s] w A word character, short for [a-zA-Z_0-9] W A non-word character [^w] S+ Several non-whitespace characters
  • 11. Example 1 Validating SSN entry if ($input=~/^[0-9]{9}$/) Example 2 Validating entry of a last name if ($input=~/^[A-Za-z][-.'0-9A-Za-z]{1,256}$/) Example 3 Validating SSN entry (Short cut) if ($input=~/^d{9}$/) Examples 123-56-3454
  • 12. Regular Expressions - Templates Field Expression Format Samples Description Name ^[a-zA-Z-'s]{1,40}$ John Doe Validates a name. Allows up to 40 uppercase and lowercase characters and a few special characters that are common to some names. You can modify this list. Social Security Number ^d{3}-d{2}-d{4}$ 111-11-1111 Validates the format, type, and length of the supplied input field. The input must consist of 3 numeric characters followed by a dash, then 2 numeric characters followed by a dash, and then 4 numeric characters. Phone Number ^[01]?[- .]?(([2-9]d{2})|[2- 9]d{2})[- .]?d{3}[- .]?d{4}$ (425) 555-0123 Validates a U.S. phone number. It must consist of 3 numeric characters, optionally enclosed in parentheses, followed by a set of 3 numeric characters and then a set of 4 numeric characters. E-mail ^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~- ]+@[a-zA-Z0-9-]+(?:.[a-zA-Z0-9- ]+)*$ someone@exampl e.com Validates an e-mail address. (per the HTML5 specification http://www.w3.org/TR/html5/forms.html#valid-e-mail-address). URL ^(ht|f)tp(s?)://[0-9a-zA-Z]([- .w]*[0-9a-zA-Z])*(:(0- 9)*)*(/?)([a-zA-Z0-9- .?,'/+&amp;%$#_]*)?$ http://www.micros oft.com Validates a URL ZIP Code ^(d{5}-d{4}|d{5}|d{9})$|^([a- zA-Z]d[a-zA-Z] d[a-zA-Z]d)$ 12345 Validates a U.S. ZIP Code. The code must consist of 5 or 9 numeric characters. Password (?!^[0-9]*$)(?!^[a-zA-Z]*$)^([a- zA-Z0-9]{8,10})$ Validates a strong password. It must be between 8 and 10 characters, contain at least one digit and one alphabetic character, and must not contain special characters. Non- negative integer ^d+$ 0 Validates that the field contains an integer greater than zero. Currency (non- negative) ^d+(.dd)?$ 1 Validates a positive currency amount. If there is a decimal point, it requires 2 numeric characters after the decimal point. For example, 3.00 is valid but 3.1 is not. Currency (positive or negative) ^(-)?d+(.dd)?$ 1.2 Validates for a positive or negative currency amount. If there is a decimal point, it requires 2 numeric characters after the decimal point.
  • 13. Regular Expressions Regular Expressions is a term used to refer to a pattern-matching technology for processing text Although there is no standards body governing the regular expression language, Perl 5, by virtue of its popularity, has set the standard for regular expression syntax A Regular Expression itself is a string that represents a pattern, encoded using the regular expression language and syntax
  • 14. Regular Expression - Zend $validator = new Zend_Validate_Regex(array('pattern' => '/^Test/'); $validator->isValid("Test"); // returns true $validator->isValid("Testing"); // returns true $validator->isValid("Pest"); // returns false
  • 15. Data Validation Techniques Validates against a regular expression representing the proper expected data format (10 alphanumeric characters) (.NET) using System.Text.RegularExpressions; static bool validateUserFormat(String userName) { bool isValid = false; //Fail by default // Verify that the UserName is 1-10 character alphanumeric isValid = Regex.IsMatch(userName, @"^[A-Za-z0-9]{10}$"); return isValid; }
  • 16. Regular Expressions - assertions Assert a string is 8 or more characters: (?=.{8,}) Assert a string contains at least 1 lowercase letter (zero or more characters followed by a lowercase character): (?=.*[a-z]) Assert a string contains at least 1 uppercase letter (zero or more characters followed by an uppercase character): (?=.*[A-Z]) Assert a string contains at least 1 digit: (?=.*[d]) So if you want to match a string at least 6 characters long, with at least one lower case and at least one uppercase letter you could use something like: ^.*(?=.{6,})(?=.*[a-z])(?=.*[A-Z]).*$
  • 17. Known Good Validation Example Validates against a regular expression representing the proper expected data format (10 alphanumeric characters) (Java) import java.util.regex.*; static boolean validateUserFormat(String userName){ boolean isValid = false; //Fail by default try{ // Verify that the UserName is 10 character alphanumeric if (Pattern.matches(“^[A-Za-z0-9]{10}$”, userName)) isValid=true; } catch(PatternSyntaxException e) { System.out.println(e.getDescription()); } return isValid; }
  • 18. Known Good Example $validator = new Zend_Validate_Alnum(); if ($validator->isValid('Abcd12')) { // value contains only allowed chars } else { // false }
  • 19. Known Good Example - Chains // Create a validator chain and add validators to it $validatorChain = new Zend_Validate(); $validatorChain->addValidator( new Zend_Validate_StringLength(array('min' => 6, 'max' => 12))) ->addValidator(new Zend_Validate_Alnum()); // Validate the username if ($validatorChain->isValid($username)) { // username passed validation } else { // username failed validation; print reasons or whatever….. foreach ($validatorChain->getMessages() as $message) { echo "$messagen"; }
  • 20. Often called "BlackList" validation Data is validated against a list of characters that are deemed to be dangerous or unacceptable Useful for preventing specific characters from being accepted by the application Provides the weakest method of validation against malicious data Susceptible to bypass using various forms of character encoding Known Bad Validation Example: Validating entry into generic text field if ($input !~/[rtn><();+&%’”*|]/)
  • 21. Known Bad Validation Example Validates against a regular expression of known bad input strings (.Net) using System.Text.RegularExpressions; static boolean checkMessage(string messageText){ bool isValid = false; //Fail by default // Verify input doesn’t contain any < , > isValid = !Regex.IsMatch(messageText, @"[><]"); return isValid; }
  • 22. Known Bad Validation Example Validates against a regular expression of known bad input strings (Java) import java.util.regex.*; static boolean checkMessage (string messageText) { boolean isValid = false; //Fail by default try { Pattern P = Pattern.compile (“<|>”, Pattern.CASE_INSENSITIVE | Pattern.MULTILINE); Matcher M = p.matcher(messageText); if (!M.find()) isValid = true; } catch(Exception e) { System.out.println(e.toString()); } return isValid; }
  • 23. Bounds Checking All external input must also be properly validated to ensure that excessively large input is rejected Length checking: A maximum length check should be performed on all incoming application data. Careful about name length! Lokelani Keihanaikukauakahihuliheekahaunaele is a real person! Input that exceeds the appropriate length or size limits must be rejected and not processed by the application Size checking: A maximum size check should be performed on all incoming data files
  • 24. The following code reads a String from a file. Because it uses the readLine() method, it will read an unbounded amount of input until a <newline> (n) charter is read. InputStream Input = inputfileFile.getInputStream(Entry); Reader inpReader = new InputStreamReader(Input); BufferedReader br = new BufferedReader(inpReader); String line = br.readLine(); This could be taken advantage of and cause an OutOfMemoryException or to consume a large amount of memory which shall affect performance and initiate costly garbage collection routines. Bounds Checking – Example Unbounded Reading of a file
  • 25. Bounds checking $validator = new Zend_Validate_StringLength(array('max' => 6)); $validator->isValid("Test"); // returns true $validator->isValid("Testing"); // returns false
  • 26. Bounds checking – File size $upload = new Zend_File_Transfer(); // Limit the size of all files to be uploaded to 40000 bytes $upload->addValidator('FilesSize', false, 40000); // Limit the size of all files to be uploaded to maximum 4MB and mimimum 10kB $upload->addValidator('FilesSize', false, array('min' => '10kB', 'max' => '4MB'));
  • 27. .NET Validator Controls: RequiredFieldValidator, CompareValidator, RangeValidator, RegularExpressionValidator, CustomValidator, ValidateRequest Jakarta Commons Validator: required, mask, range, maxLength, minLength, datatype, date, creditCard, email, regularExpression Native Validation Controls Many development platforms have native validator controls, such as Jakarta and .NET
  • 28. Escaping vs. Rejecting When validating data, one can either reject data failing to meet validation requirements or attempt to “clean” or escape dangerous characters Failed validation attempts should always reject the data to minimise the risk that sanitisation routines will be ineffective or can be bypassed Error messages displayed when rejecting data should specify the proper format for the user to enter appropriate data Error messages should not redisplay the input the user has entered
  • 29. The Problem with Escaping --- Snip --- page_template = request.queryString("page") replace(page_template , "/", "") replace(page_template, "..", "") getFile(page_template) --- End Snip --- http://www.example.com/content/default.jsp?page=info.htm  Page_template = info.htm <- First Pass  Page_template = info.htm <- Second Pass http://www.example.com/content/default.jsp?page=../web.xml  Page_template = .. web.xml <- First Pass  Page_template = web.xml <- Second Pass http://www.example.com/content/default.jsp?page=....//web.xml  Page_template = ....web.xml <- First Pass  Page_template = ..web.xml <- Second Pass
  • 30. Input Based Attacks Malicious user input can be used to launch a variety of attacks against an application. These attacks include, but are not limited to: Parameter Manipulation  Cookie poisoning  Hidden field manipulation Content injection  SQL  HTTP Response Splitting  Operating system calls  Command insertion  XPath Cross site scripting  … Buffer overflows  Format string attacks
  • 31. Parameter Manipulation Applications typically pass parameters that determine what the user can do or see Unauthorised access to application data can be obtained by manipulating parameter values, if record-level authorisation checks are not performed within the application code Many applications tend to pass sensitive parameters back and forth rather than using server session variables to store the information Very common to see this in HTTP cookies “hidden” HTML form fields
  • 32. Parameter Manipulation Database record index numbers are often passed as page parameters to view a specific record If there is a relatively small range of possible index values, sequential parameter values can by cycled to view other records Even-non sequential indexing can be attacked within a small range of potential values Manipulating parameter values can be trivial when other obvious valid Values exist: Username=joe (change to username=mary) Privilege=user (change to privilege=admin) Price=100.00 (change to price=1.00)
  • 33. Testing for Parameter Manipulation Identify areas in the application where records appear to be displayed based on input parameters Attempt to access records using other known valid parameter values For parameter values that seem to fall within a variable range, cycle through the range to search for other valid records Identify all data being passed in hidden fields. Attempt to determine: What the data is being used for Whether use of a hidden field seems appropriate
  • 34. Defenses Against Parameter Manipulation Data that should not be altered should never be passed to the client Always perform validation on the server Use the most restrictive input validation method possible Use Exact Match Validation to verify that parameters values are appropriate for the specific transaction or user’s permission level In situations where a query or hash table lookup is required, Known Good Validation should be used to validate the parameter before performing the lookup Retrieve the information from the client once, validate it and keep it on the server associated with that user’s session
  • 35. Summary Don’t ever trust user input Where possible, use whitelist validation Perform input validation at earliest possible stage Layers of defense Use in-built validator routines

Editor's Notes

  1. 1
  2. ^ (Caret) Matches at the start of the string the regex pattern is applied to. $ (dollar) Matches at the end of the string the regex pattern is applied to.
  3. Set up a mask for certain types of fields
  4. It’s very difficult to list all known bad input – harder to protect against potential future problems.
  5. Strings – especially in C-based applications Numbers – negative numbers may have unintended consequences .NET Web.config <httpRuntime maxRequestLength="2048" /> C#   if (Upload.PostedFile.ContentLength < 1048576){… J2EE: struts-config.xml: <controller maxFileSize="2M" />