SlideShare a Scribd company logo
Web Application Hacking 101




Common Web Attacks and Defenses
Agenda
     •      Introduction
     •      Application Attacks Overview
     •      Attack Methodologies
     •      Demonstration Platform Details
     •      Demo of Common Vulnerabilities
            Cross-site Scripting               Directory Traversal
            SQL Injection                      Verbose Error Messages
            Price Fixing (Parameter Tampering) Information Disclosure
     • Review
     • Questions



9/17/2009                      www.0x90.org email: txs@0x90.org         2
Introduction
     • txs@0x90.org
        – Active member of 0x90.org “Digital Think Tank” and “Source of
          Proper Internet Villainy” (www.0x90.org)
        – Founding member of the GhettoHackers, GHI
          (www.ghettohackers.net)
        – Professional security consultant to the U.S. Government,
          Financial Institutions, Fortune 500 Companies, and anyone
          willing to pay cash.
        – Primary focus is application penetration testing and analysis. In
          other words I break stuff.
        – Presented at major industry conferences, taught security
          courses, and has been involved in the security community for
          nearly a decade contributing to many prominent mailing lists
          and open source security projects.



9/17/2009                    www.0x90.org email: txs@0x90.org                 3
Application Attacks Overview
     • Application security measures are often implemented
       at the network level
            – This will not work effectively as network ACLs cannot protect
              against the use of valid connections
            – Network security cannot generally provide adequate protection
              at the application level
            – Network implemented application controls may introduce
              significant impact on performance
     • Applications are the next generation attack point
            – Information about application attacks is more readily available
            – Protections against application attacks are not as robust or
              mature as network security
            – Tools for testing applications are becoming more readily
              available



9/17/2009                       www.0x90.org email: txs@0x90.org                4
Application Attacks Overview
     • Applications are targeted because they are the
       access point for data, products, resources, and
       money
            – Even with conventional network defenses, many applications
              can be attacked
            – Security controls around applications can be bypassed, which
              allows attackers to:
               • Modify information
               • Steal products
               • Credit money to accounts
            – In some cases the attack may grant access to other portions of
              the application or to the environment
            – The attack may not even involve theft
               • If the attacker understands the system being attacked, it is
                 possible that they will be able to merely “borrow” resources



9/17/2009                        www.0x90.org email: txs@0x90.org               5
Attack Methodology

     • Discover
     • Target
     • Attack




9/17/2009         www.0x90.org email: txs@0x90.org   6
Attack Methodology: Discover
     • Examine the environment
            – Identify what types and version of applications are running
              (banners/headers)
            – Identify what ports are open for communication to the server
              and the application
            – Examine extensions: foo.jhtml, foo.shtml - will often reveal
              the application server engine (weblogic, coldfusion, tomcat,
              etc.)
     • Generate and examine errors
            – Submit ridiculous input and monitor response (fuzzing)
            – Database errors are extremely helpful
     • Look for information left behind from development
            – Sample code or snippets


9/17/2009                       www.0x90.org email: txs@0x90.org             7
Attack Methodology: Discover
     • Look for configuration errors:
            – Use a sniffer to examine traffic
            – Review client software
            – Use network scanning and probing tools
     • Look for environment errors:
            – Identify ways to circumvent application security
              controls
            – Reveal program data flow and logic flow
            – Reveal critical systems that are easier to attack than
              the original target


9/17/2009                    www.0x90.org email: txs@0x90.org          8
Attack Methodology: Discover
     • Use a debug proxy to intercept client-server
       communications
            – Observe application traffic and modify components of
              application traffic independently of the client
            – Look for hidden fields and notes embedded in the source
            – Developers tend to make assumptions about the integrity of
              “client” generated data, like headers and other data that is
              supposedly concealed from the user -- abuse these assumptions
     • Include a regular expression engine to make on the fly
       replacements
     • Use an existing tool or a write a new one
            – HTTP: @Stake/Symantec WebProxy, Paros, 0x90.org Sake



9/17/2009                      www.0x90.org email: txs@0x90.org               9
Attack Methodology: Target
     •      Login Mechanism
     •      Session Management
     •      Input Fields
     •      Unprotected Interfaces
     •      Application Related Infrastructure
     •      Application Related Networks



9/17/2009                www.0x90.org email: txs@0x90.org   10
Attack Methodology: Attack
       Ok enough of this chit-chat. Show me how
                  to break something!




9/17/2009           www.0x90.org email: txs@0x90.org   11
Demonstration Platform Details
     • “Microsoft .Net PetShop 3.0” is Microsoft’s
       implementation of a .NET sample application.
            – Original application can be found at :
              http://msdn.microsoft.com/library/default.asp?url=/library/en
              -us/dnbda/html/psimp.asp?frame=true
     • Does not out of the box have these vulnerabilities
            – Added for demonstration purposes
     • Vulnerabilities based on common web application issues
       found in production environments.
     • Platform built on Windows 2000 Server, IIS 5.0 and SQL
       Server 2000



9/17/2009                      www.0x90.org email: txs@0x90.org               12
Vulnerability Details
     •      What it is and what does it do
     •      Vulnerability identification
     •      Execution of the vulnerability
     •      Review of faulty application code
     •      Possible mitigation techniques




9/17/2009                www.0x90.org email: txs@0x90.org   13
Common Vulnerabilities
                 Verbose Error Messages
     • What it is and what does it do
            – Presenting the end user with verbose error messages
              including potentially sensitive information
            – Utilized to further other attacks against the system
     • Vulnerability identification
            – No special technique required
            – Review all error messages in detail
     • Execution of the vulnerability
            – May directly result in an attack vector presenting
              itself for exploit
            – May leak information that can be used in
              conjunction with other attack vectors


9/17/2009                    www.0x90.org email: txs@0x90.org        14
Common Vulnerabilities
                Verbose Error Messages
     • Review of faulty application code
            – Configuration error allowing the web service
              to be available for requests
            – Error presents detailed information
     • Possible mitigation techniques
            – Modify the resulting page to have a limited
              error message
            – Configure the server so this functionality is
              not available or remove it all together

9/17/2009                  www.0x90.org email: txs@0x90.org   15
Verbose Error Messages
                Demonstration




9/17/2009         www.0x90.org email: txs@0x90.org   16
Verbose Error Messages
                Demonstration




9/17/2009         www.0x90.org email: txs@0x90.org   17
Common Vulnerabilities
                  Information Disclosure
     • What it is and what does it do
            – Default functionality leaks information
            – Allows an attacker to gain knowledge about the
              target environment
            – May leak sensitive data
     • Vulnerability identification
            – Subtle differences in information displayed in the
              browser
            – Comments left in production code
            – Application functionality that does not require
              authentication


9/17/2009                    www.0x90.org email: txs@0x90.org      18
Common Vulnerabilities
                   Information Disclosure
     • Execution of the vulnerability
            – Varies dependant upon the type of information disclosure
            – May be an error scenario
            – May be standard functionality available without authentication
     • Review of faulty application code
            – Commonly a configuration error
            – May be extra information in comments or in presented data
     • Possible mitigation techniques
            – Require authentication on all requests
            – Verify presented data can not be used in other attacks




9/17/2009                       www.0x90.org email: txs@0x90.org               19
Information Disclosure
                Demonstration




9/17/2009        www.0x90.org email: txs@0x90.org   20
Common Vulnerabilities
                   Directory Traversal
     • What it is and what does it do
            – Allow the attacker to download or gain access to
              files outside of the normal web directory structure
     • Vulnerability identification
            – Manipulation of parameters with .. And / or 
              characters in an attempt to bypass normal directory
              structures
     • Execution of the vulnerability
            – Modify the parameters within the URL
            – Alternatively intercept the request and modify
              hidden fields or modify the content of the HTTP
              POST


9/17/2009                    www.0x90.org email: txs@0x90.org       21
Common Vulnerabilities
                     Directory Traversal
     • Review of faulty application code
            – string path = "c:PetStore.review"+itemId; using
              (StreamReader sr = new StreamReader(path))
            – Lack of input validation
            – File access granted where not specifically required
     • Possible mitigation techniques
            –   Validate all input
            –   Utilize a lower privileged account
            –   Only grant permissions on specifically required files
            –   Use “Mappath” method to safely generate a file path

9/17/2009                     www.0x90.org email: txs@0x90.org          22
Directory Traversal
               Demonstration




9/17/2009       www.0x90.org email: txs@0x90.org   23
Common Vulnerabilities
                     Price Fixing
     • What it is and what does it do
            – Commonly referred to as parameter manipulation
              attacks
            – Allows the attacker to modify values that are then
              utilized by the application in an unchecked fashion
     • Vulnerability identification
            – Modification of parameters in a logical fashion in an
              attempt to verify the validation and authorization
              routines of the application server
     • Execution of the vulnerability
            – If possible modify in the URL directly
            – Alternatively utilize an http(s) intercepting proxy


9/17/2009                    www.0x90.org email: txs@0x90.org         24
Common Vulnerabilities
                     Price Fixing
     • Review of faulty application code
            – decimal price =
              decimal.Parse(Request["UnitPrice"]);
              myCart.Add(itemId,price);
            – Data stored client side utilized directly in the
              application business logic
            – No verification of pricing (parameter) against server
              side data
     • Possible mitigation techniques
            – Do not store sensitive information client side
               • If you must, encrypt and sign the data
            – Do not trust client data
               • Verify that user supplied data has not been tampered with


9/17/2009                      www.0x90.org email: txs@0x90.org              25
Price Fixing - Demonstration




9/17/2009            www.0x90.org email: txs@0x90.org   26
Common Vulnerabilities
                Cross Site Scripting (XSS)
     • What it is and what does it do
            – XSS is the injection of code or script into a web page
              that is then displayed to a third party executing the
              script in the context of their web browser.
     • Vulnerability identification
            – Look for anywhere were client supplied data is
              redisplayed to the end user and not properly input
              validated or output encoded.
     • Execution of the vulnerability
            – Inject some simple script and see if the resulting
              page contains your data.


9/17/2009                    www.0x90.org email: txs@0x90.org          27
Common Vulnerabilities
                 Cross Site Scripting (XSS)
     • Review of faulty application code
            – Search Results for "<%=Request["keywords"]%>“
            – Lack of input validation and output encoding
     • Possible mitigation techniques
        – Input validation and output encoding
           • The original code htmlEncodes suspicious values
             on output
           • Validate all input against a known set of approved
             characters
        – Defense in depth:
           • Truncate all input fields to a max reasonable
             length
           • Out-of the box .Net bans ‘<‘

9/17/2009                      www.0x90.org email: txs@0x90.org   28
Cross Site Scripting
              Demonstration




9/17/2009       www.0x90.org email: txs@0x90.org   29
Common Vulnerabilities
                    SQL Injection
     • What it is and what does it do
            – SQL Injection is a vulnerability allowing an attacker
              to submit SQL statements of their choosing that are
              then processed by the application.
     • Vulnerability identification
            – Typical identification techniques include submitting
              characters such as ‘, “, or – characters into an input
              field. Based on the resulting errors and/or data, SQL
              Injection points may be identified.
     • Execution of the vulnerability
            – Longer cycle of execution. Based on resulting error
              pages and/or data the entire database schema and
              stored data may be compromised.

9/17/2009                    www.0x90.org email: txs@0x90.org          30
Common Vulnerabilities
                   SQL Injection
     • Review of faulty application code
            – string sql = "SELECT Item.ItemId, Item.Attr1,
              Inventory.Qty, Item.ListPrice, Product.Name,
              Product.Descn FROM Item INNER JOIN
              Inventory ON Item.ItemId = Inventory.ItemId
              INNER JOIN Product ON Item.ProductId =
              Product.ProductId WHERE Item.ItemId =
              '"+itemId+"';";
            – Lack of input validation
            – Dynamically concatenated SQL statements


9/17/2009                 www.0x90.org email: txs@0x90.org    31
Common Vulnerabilities
                    SQL Injection
     • Possible mitigation techniques
            – Input Validation
               • The original code htmlEncodes suspicious values such as ’
               • Input validation: itemId should not contain anything but A-Z,0-9
                 and not be longer than 15 characters. Use white-list based input
                 filtering.
            – Prepared statements
               • Arguments are added to the statement after it is parsed for
                 validation
               • Limited privileges: Create a “browse” identity with only
                 select privileges on the products tables




9/17/2009                        www.0x90.org email: txs@0x90.org                   32
SQL Injection Demonstration




9/17/2009            www.0x90.org email: txs@0x90.org   33
Review - Attacks
     •      Cross-site Scripting
     •      SQL Injection
     •      Price Fixing (aka Parameter Tampering)
     •      Directory Traversal
     •      Verbose Error Messages
     •      Information Disclosure



9/17/2009               www.0x90.org email: txs@0x90.org   34
Review - Defenses
     • Input validation
     • Output sanitation and encoding
     • Least privilege accounts and account
       permissions
     • Limit error message information
     • Require authentication and authorization
       for all requests
     • Harden the web application removing
       extraneous content

9/17/2009          www.0x90.org email: txs@0x90.org   35
9/17/2009   www.0x90.org email: txs@0x90.org   36

More Related Content

PPT
Scanning web vulnerabilities
PPT
Protecting web aplications with machine learning and security fabric
PPTX
WEB APPLICATION SECURITY
PDF
Cyber attacks 101
PPTX
WEB APPLICATION SECURITY
PPTX
Penetration Testing
PPTX
Penetration testing dont just leave it to chance
PDF
How we breach small and medium enterprises (SMEs)
Scanning web vulnerabilities
Protecting web aplications with machine learning and security fabric
WEB APPLICATION SECURITY
Cyber attacks 101
WEB APPLICATION SECURITY
Penetration Testing
Penetration testing dont just leave it to chance
How we breach small and medium enterprises (SMEs)

What's hot (16)

PPTX
A new web application vulnerability assessment framework
PPTX
Mobile platform security models
PDF
Ccsit cyberlympics 2017 workshop 3 - presentation
PDF
OWASP Top Ten in Practice
PPTX
The bare minimum that you should know about web application security testing ...
PDF
Do You Write Secure Code? by Erez Metula
PPTX
Network penetration testing
PDF
APEC TEL 58: Social Media Security
PPTX
Outpost24 webinar - Understanding the 7 deadly web application attack vectors
PPTX
Detection of webshells in compromised perimeter assets using ML algorithms
PPTX
Cryptography and Network security # Lecture 3
PPTX
Ethical Hacking
PPTX
Owasp security testing methodlogies –part2
PPT
Security Compliance Web Application Risk Management
PPTX
Applying the nist framework to transportation systems mod 1 nhi instructor de...
PDF
OWASP Top 10 Project
A new web application vulnerability assessment framework
Mobile platform security models
Ccsit cyberlympics 2017 workshop 3 - presentation
OWASP Top Ten in Practice
The bare minimum that you should know about web application security testing ...
Do You Write Secure Code? by Erez Metula
Network penetration testing
APEC TEL 58: Social Media Security
Outpost24 webinar - Understanding the 7 deadly web application attack vectors
Detection of webshells in compromised perimeter assets using ML algorithms
Cryptography and Network security # Lecture 3
Ethical Hacking
Owasp security testing methodlogies –part2
Security Compliance Web Application Risk Management
Applying the nist framework to transportation systems mod 1 nhi instructor de...
OWASP Top 10 Project

Similar to CarolinaCon 2005 Web Application Hacking 101 (20)

PPT
CyberCrime in the Cloud and How to defend Yourself
PDF
Secure coding guidelines
PPTX
Application Explosion How to Manage Productivity vs Security
PDF
Web App Security Presentation by Ryan Holland - 05-31-2017
PDF
Brief Tour about Android Security
PPT
Avoiding Application Attacks: A Guide to Preventing the OWASP Top 10 from Hap...
PPT
30ITSecurityThreatsVulnerabilitiesandCountermeasuresV1.ppt
PDF
Layer7-WebServices-Hacking-and-Hardening.pdf
PDF
Solvay secure application layer v2015 seba
PPTX
Advanced Persistent Threats (APTs) - Information Security Management
PPT
Software security (vulnerabilities) and physical security
PPT
Software Security (Vulnerabilities) And Physical Security
PPTX
Owasp top 10 2017
PDF
Managing and Securing Web 2.0
PPTX
CSS 17: NYC - Protecting your Web Applications
PDF
Threat_Modelling.pdf
PPTX
Burp Suite is a powerful and widely-used tool
PDF
Protecting Against Web App Attacks
PPT
DEVSECOPS_the_beginning.ppt
PPTX
VAPT_FINAL SLIDES.pptx
CyberCrime in the Cloud and How to defend Yourself
Secure coding guidelines
Application Explosion How to Manage Productivity vs Security
Web App Security Presentation by Ryan Holland - 05-31-2017
Brief Tour about Android Security
Avoiding Application Attacks: A Guide to Preventing the OWASP Top 10 from Hap...
30ITSecurityThreatsVulnerabilitiesandCountermeasuresV1.ppt
Layer7-WebServices-Hacking-and-Hardening.pdf
Solvay secure application layer v2015 seba
Advanced Persistent Threats (APTs) - Information Security Management
Software security (vulnerabilities) and physical security
Software Security (Vulnerabilities) And Physical Security
Owasp top 10 2017
Managing and Securing Web 2.0
CSS 17: NYC - Protecting your Web Applications
Threat_Modelling.pdf
Burp Suite is a powerful and widely-used tool
Protecting Against Web App Attacks
DEVSECOPS_the_beginning.ppt
VAPT_FINAL SLIDES.pptx

More from Tyler Shields (20)

PDF
The New Mobile Landscape - OWASP Ireland
PPTX
Defending Behind the Mobile Device
PDF
Avoiding the Pandora Pitfall
PPTX
Social and Mobile and Cloud - OH MY!
PPTX
Social Media Basics: Security Loopholes with Twitter & Other Social Media
PDF
United Security Summit 2011 - Using the Mobile Top 10 as a Guide to Assessing...
PDF
Shmoocon 2010 - The Monkey Steals the Berries
PDF
Survey of Rootkit Technologies and Their Impact on Digital Forensics
PDF
Source Boston 2009 - Anti-Debugging A Developers Viewpoint
PDF
Source Boston 2010 - The Monkey Steals the Berries Part Deux
PDF
Software Developers Forum 2010 - The Monkey Steals the Berries
PDF
Raleigh ISSA 2010 - The Monkey Steals the Berries
PDF
Static Detection of Application Backdoors
PDF
Blackhat Europe 2009 - Detecting Certified Pre Owned Software
PDF
Anti-Debugging - A Developers View
PDF
Praetorian Veracode Webinar - Mobile Privacy
PDF
Owasp Ireland - The State of Software Security
PDF
More Apps More Problems
PDF
Dirty Little Secret - Mobile Applications Invading Your Privacy
PDF
IT Hot Topics - Mobile Security Threats at Every Layer
The New Mobile Landscape - OWASP Ireland
Defending Behind the Mobile Device
Avoiding the Pandora Pitfall
Social and Mobile and Cloud - OH MY!
Social Media Basics: Security Loopholes with Twitter & Other Social Media
United Security Summit 2011 - Using the Mobile Top 10 as a Guide to Assessing...
Shmoocon 2010 - The Monkey Steals the Berries
Survey of Rootkit Technologies and Their Impact on Digital Forensics
Source Boston 2009 - Anti-Debugging A Developers Viewpoint
Source Boston 2010 - The Monkey Steals the Berries Part Deux
Software Developers Forum 2010 - The Monkey Steals the Berries
Raleigh ISSA 2010 - The Monkey Steals the Berries
Static Detection of Application Backdoors
Blackhat Europe 2009 - Detecting Certified Pre Owned Software
Anti-Debugging - A Developers View
Praetorian Veracode Webinar - Mobile Privacy
Owasp Ireland - The State of Software Security
More Apps More Problems
Dirty Little Secret - Mobile Applications Invading Your Privacy
IT Hot Topics - Mobile Security Threats at Every Layer

Recently uploaded (20)

PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Electronic commerce courselecture one. Pdf
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Encapsulation theory and applications.pdf
PPTX
A Presentation on Artificial Intelligence
PDF
Machine learning based COVID-19 study performance prediction
PPTX
Spectroscopy.pptx food analysis technology
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Empathic Computing: Creating Shared Understanding
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Chapter 3 Spatial Domain Image Processing.pdf
Programs and apps: productivity, graphics, security and other tools
Encapsulation_ Review paper, used for researhc scholars
The Rise and Fall of 3GPP – Time for a Sabbatical?
Diabetes mellitus diagnosis method based random forest with bat algorithm
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
20250228 LYD VKU AI Blended-Learning.pptx
Electronic commerce courselecture one. Pdf
“AI and Expert System Decision Support & Business Intelligence Systems”
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
gpt5_lecture_notes_comprehensive_20250812015547.pdf
Dropbox Q2 2025 Financial Results & Investor Presentation
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Encapsulation theory and applications.pdf
A Presentation on Artificial Intelligence
Machine learning based COVID-19 study performance prediction
Spectroscopy.pptx food analysis technology
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Empathic Computing: Creating Shared Understanding
Unlocking AI with Model Context Protocol (MCP)
Chapter 3 Spatial Domain Image Processing.pdf

CarolinaCon 2005 Web Application Hacking 101

  • 1. Web Application Hacking 101 Common Web Attacks and Defenses
  • 2. Agenda • Introduction • Application Attacks Overview • Attack Methodologies • Demonstration Platform Details • Demo of Common Vulnerabilities Cross-site Scripting Directory Traversal SQL Injection Verbose Error Messages Price Fixing (Parameter Tampering) Information Disclosure • Review • Questions 9/17/2009 www.0x90.org email: txs@0x90.org 2
  • 3. Introduction • txs@0x90.org – Active member of 0x90.org “Digital Think Tank” and “Source of Proper Internet Villainy” (www.0x90.org) – Founding member of the GhettoHackers, GHI (www.ghettohackers.net) – Professional security consultant to the U.S. Government, Financial Institutions, Fortune 500 Companies, and anyone willing to pay cash. – Primary focus is application penetration testing and analysis. In other words I break stuff. – Presented at major industry conferences, taught security courses, and has been involved in the security community for nearly a decade contributing to many prominent mailing lists and open source security projects. 9/17/2009 www.0x90.org email: txs@0x90.org 3
  • 4. Application Attacks Overview • Application security measures are often implemented at the network level – This will not work effectively as network ACLs cannot protect against the use of valid connections – Network security cannot generally provide adequate protection at the application level – Network implemented application controls may introduce significant impact on performance • Applications are the next generation attack point – Information about application attacks is more readily available – Protections against application attacks are not as robust or mature as network security – Tools for testing applications are becoming more readily available 9/17/2009 www.0x90.org email: txs@0x90.org 4
  • 5. Application Attacks Overview • Applications are targeted because they are the access point for data, products, resources, and money – Even with conventional network defenses, many applications can be attacked – Security controls around applications can be bypassed, which allows attackers to: • Modify information • Steal products • Credit money to accounts – In some cases the attack may grant access to other portions of the application or to the environment – The attack may not even involve theft • If the attacker understands the system being attacked, it is possible that they will be able to merely “borrow” resources 9/17/2009 www.0x90.org email: txs@0x90.org 5
  • 6. Attack Methodology • Discover • Target • Attack 9/17/2009 www.0x90.org email: txs@0x90.org 6
  • 7. Attack Methodology: Discover • Examine the environment – Identify what types and version of applications are running (banners/headers) – Identify what ports are open for communication to the server and the application – Examine extensions: foo.jhtml, foo.shtml - will often reveal the application server engine (weblogic, coldfusion, tomcat, etc.) • Generate and examine errors – Submit ridiculous input and monitor response (fuzzing) – Database errors are extremely helpful • Look for information left behind from development – Sample code or snippets 9/17/2009 www.0x90.org email: txs@0x90.org 7
  • 8. Attack Methodology: Discover • Look for configuration errors: – Use a sniffer to examine traffic – Review client software – Use network scanning and probing tools • Look for environment errors: – Identify ways to circumvent application security controls – Reveal program data flow and logic flow – Reveal critical systems that are easier to attack than the original target 9/17/2009 www.0x90.org email: txs@0x90.org 8
  • 9. Attack Methodology: Discover • Use a debug proxy to intercept client-server communications – Observe application traffic and modify components of application traffic independently of the client – Look for hidden fields and notes embedded in the source – Developers tend to make assumptions about the integrity of “client” generated data, like headers and other data that is supposedly concealed from the user -- abuse these assumptions • Include a regular expression engine to make on the fly replacements • Use an existing tool or a write a new one – HTTP: @Stake/Symantec WebProxy, Paros, 0x90.org Sake 9/17/2009 www.0x90.org email: txs@0x90.org 9
  • 10. Attack Methodology: Target • Login Mechanism • Session Management • Input Fields • Unprotected Interfaces • Application Related Infrastructure • Application Related Networks 9/17/2009 www.0x90.org email: txs@0x90.org 10
  • 11. Attack Methodology: Attack Ok enough of this chit-chat. Show me how to break something! 9/17/2009 www.0x90.org email: txs@0x90.org 11
  • 12. Demonstration Platform Details • “Microsoft .Net PetShop 3.0” is Microsoft’s implementation of a .NET sample application. – Original application can be found at : http://msdn.microsoft.com/library/default.asp?url=/library/en -us/dnbda/html/psimp.asp?frame=true • Does not out of the box have these vulnerabilities – Added for demonstration purposes • Vulnerabilities based on common web application issues found in production environments. • Platform built on Windows 2000 Server, IIS 5.0 and SQL Server 2000 9/17/2009 www.0x90.org email: txs@0x90.org 12
  • 13. Vulnerability Details • What it is and what does it do • Vulnerability identification • Execution of the vulnerability • Review of faulty application code • Possible mitigation techniques 9/17/2009 www.0x90.org email: txs@0x90.org 13
  • 14. Common Vulnerabilities Verbose Error Messages • What it is and what does it do – Presenting the end user with verbose error messages including potentially sensitive information – Utilized to further other attacks against the system • Vulnerability identification – No special technique required – Review all error messages in detail • Execution of the vulnerability – May directly result in an attack vector presenting itself for exploit – May leak information that can be used in conjunction with other attack vectors 9/17/2009 www.0x90.org email: txs@0x90.org 14
  • 15. Common Vulnerabilities Verbose Error Messages • Review of faulty application code – Configuration error allowing the web service to be available for requests – Error presents detailed information • Possible mitigation techniques – Modify the resulting page to have a limited error message – Configure the server so this functionality is not available or remove it all together 9/17/2009 www.0x90.org email: txs@0x90.org 15
  • 16. Verbose Error Messages Demonstration 9/17/2009 www.0x90.org email: txs@0x90.org 16
  • 17. Verbose Error Messages Demonstration 9/17/2009 www.0x90.org email: txs@0x90.org 17
  • 18. Common Vulnerabilities Information Disclosure • What it is and what does it do – Default functionality leaks information – Allows an attacker to gain knowledge about the target environment – May leak sensitive data • Vulnerability identification – Subtle differences in information displayed in the browser – Comments left in production code – Application functionality that does not require authentication 9/17/2009 www.0x90.org email: txs@0x90.org 18
  • 19. Common Vulnerabilities Information Disclosure • Execution of the vulnerability – Varies dependant upon the type of information disclosure – May be an error scenario – May be standard functionality available without authentication • Review of faulty application code – Commonly a configuration error – May be extra information in comments or in presented data • Possible mitigation techniques – Require authentication on all requests – Verify presented data can not be used in other attacks 9/17/2009 www.0x90.org email: txs@0x90.org 19
  • 20. Information Disclosure Demonstration 9/17/2009 www.0x90.org email: txs@0x90.org 20
  • 21. Common Vulnerabilities Directory Traversal • What it is and what does it do – Allow the attacker to download or gain access to files outside of the normal web directory structure • Vulnerability identification – Manipulation of parameters with .. And / or characters in an attempt to bypass normal directory structures • Execution of the vulnerability – Modify the parameters within the URL – Alternatively intercept the request and modify hidden fields or modify the content of the HTTP POST 9/17/2009 www.0x90.org email: txs@0x90.org 21
  • 22. Common Vulnerabilities Directory Traversal • Review of faulty application code – string path = "c:PetStore.review"+itemId; using (StreamReader sr = new StreamReader(path)) – Lack of input validation – File access granted where not specifically required • Possible mitigation techniques – Validate all input – Utilize a lower privileged account – Only grant permissions on specifically required files – Use “Mappath” method to safely generate a file path 9/17/2009 www.0x90.org email: txs@0x90.org 22
  • 23. Directory Traversal Demonstration 9/17/2009 www.0x90.org email: txs@0x90.org 23
  • 24. Common Vulnerabilities Price Fixing • What it is and what does it do – Commonly referred to as parameter manipulation attacks – Allows the attacker to modify values that are then utilized by the application in an unchecked fashion • Vulnerability identification – Modification of parameters in a logical fashion in an attempt to verify the validation and authorization routines of the application server • Execution of the vulnerability – If possible modify in the URL directly – Alternatively utilize an http(s) intercepting proxy 9/17/2009 www.0x90.org email: txs@0x90.org 24
  • 25. Common Vulnerabilities Price Fixing • Review of faulty application code – decimal price = decimal.Parse(Request["UnitPrice"]); myCart.Add(itemId,price); – Data stored client side utilized directly in the application business logic – No verification of pricing (parameter) against server side data • Possible mitigation techniques – Do not store sensitive information client side • If you must, encrypt and sign the data – Do not trust client data • Verify that user supplied data has not been tampered with 9/17/2009 www.0x90.org email: txs@0x90.org 25
  • 26. Price Fixing - Demonstration 9/17/2009 www.0x90.org email: txs@0x90.org 26
  • 27. Common Vulnerabilities Cross Site Scripting (XSS) • What it is and what does it do – XSS is the injection of code or script into a web page that is then displayed to a third party executing the script in the context of their web browser. • Vulnerability identification – Look for anywhere were client supplied data is redisplayed to the end user and not properly input validated or output encoded. • Execution of the vulnerability – Inject some simple script and see if the resulting page contains your data. 9/17/2009 www.0x90.org email: txs@0x90.org 27
  • 28. Common Vulnerabilities Cross Site Scripting (XSS) • Review of faulty application code – Search Results for "<%=Request["keywords"]%>“ – Lack of input validation and output encoding • Possible mitigation techniques – Input validation and output encoding • The original code htmlEncodes suspicious values on output • Validate all input against a known set of approved characters – Defense in depth: • Truncate all input fields to a max reasonable length • Out-of the box .Net bans ‘<‘ 9/17/2009 www.0x90.org email: txs@0x90.org 28
  • 29. Cross Site Scripting Demonstration 9/17/2009 www.0x90.org email: txs@0x90.org 29
  • 30. Common Vulnerabilities SQL Injection • What it is and what does it do – SQL Injection is a vulnerability allowing an attacker to submit SQL statements of their choosing that are then processed by the application. • Vulnerability identification – Typical identification techniques include submitting characters such as ‘, “, or – characters into an input field. Based on the resulting errors and/or data, SQL Injection points may be identified. • Execution of the vulnerability – Longer cycle of execution. Based on resulting error pages and/or data the entire database schema and stored data may be compromised. 9/17/2009 www.0x90.org email: txs@0x90.org 30
  • 31. Common Vulnerabilities SQL Injection • Review of faulty application code – string sql = "SELECT Item.ItemId, Item.Attr1, Inventory.Qty, Item.ListPrice, Product.Name, Product.Descn FROM Item INNER JOIN Inventory ON Item.ItemId = Inventory.ItemId INNER JOIN Product ON Item.ProductId = Product.ProductId WHERE Item.ItemId = '"+itemId+"';"; – Lack of input validation – Dynamically concatenated SQL statements 9/17/2009 www.0x90.org email: txs@0x90.org 31
  • 32. Common Vulnerabilities SQL Injection • Possible mitigation techniques – Input Validation • The original code htmlEncodes suspicious values such as ’ • Input validation: itemId should not contain anything but A-Z,0-9 and not be longer than 15 characters. Use white-list based input filtering. – Prepared statements • Arguments are added to the statement after it is parsed for validation • Limited privileges: Create a “browse” identity with only select privileges on the products tables 9/17/2009 www.0x90.org email: txs@0x90.org 32
  • 33. SQL Injection Demonstration 9/17/2009 www.0x90.org email: txs@0x90.org 33
  • 34. Review - Attacks • Cross-site Scripting • SQL Injection • Price Fixing (aka Parameter Tampering) • Directory Traversal • Verbose Error Messages • Information Disclosure 9/17/2009 www.0x90.org email: txs@0x90.org 34
  • 35. Review - Defenses • Input validation • Output sanitation and encoding • Least privilege accounts and account permissions • Limit error message information • Require authentication and authorization for all requests • Harden the web application removing extraneous content 9/17/2009 www.0x90.org email: txs@0x90.org 35
  • 36. 9/17/2009 www.0x90.org email: txs@0x90.org 36