SlideShare a Scribd company logo
Top Ten Web Attacks

        Saumil Shah
        Net-Square
  BlackHat Asia 2002, Singapore
TodayÕs battleground Ð the Web

¥ Web sites and web applications rapidly
  growing.
¥ Complex business applications are now
  delivered over the web (HTTP).
¥ Increased Òweb hackingÓ activity.
¥ Worms on the web.
¥ How much damage can be done?
¥ Firewalls?
Typical Web Application set-up


                    HTTP             Firewall                 SQL
                   request                                  Database
                  (cleartext
                   or SSL)                      Web app

                                                Web app
                                                              DB
Web                                Web
Client                            Server        Web app
                                                              DB
                                                Web app

         HTTP reply
          (HTML,
         Javascript,           ¥Apache      Plugins:      Database
          VBscript,            ¥IIS         ¥Perl         connection:
            etc)               ¥Netscape    ¥C/C++        ¥ADO,
                                etcÉ        ¥JSP, etc     ¥ODBC, etc.
Traditional HackingÉLimitations

¥ Modern network architectures are getting
  more robust and secure.
¥ Firewalls being used in almost all network
  roll-outs.
¥ OS vendors learning from past mistakes (?)
  and coming out with patches rapidly.
¥ Increased maturity in coding practices.
Utility of Firewalls

¥ Hacks on OS
  network services
  prevented by
  firewalls.                       Web app

                                   Web app
                                             DB
                           Web
                          Server   Web app
                                             DB
         wu-ftpd                   Web app

                X
         Sun RPC
                X
         NT ipc$
                   X
Utility of Firewalls

¥ Internal back-end
  application servers
  are on a non-
  routable IP network.              Web app
  (private addresses)               Web app
                                              DB
                            Web
                           Server   Web app
                                              DB
                                    Web app


                                    X
Utility of Firewalls

¥ Outbound access
  restricted. Why
  would a web server
  telnet out?                     Web app

                                  Web app
                                            DB
                          Web
                         Server   Web app
                                            DB
                                  Web app


                       X
Futility of Firewalls

¥ E-commerce / Web hacking is unfettered.
¥ Web traffic is the most commonly allowed of
  protocols through Internet firewalls.
¥ Why fight the wall when youÕve got an open
  door?
¥ HTTP is perceived as ÒfriendlyÓ traffic.
¥ Content/Application based attacks are still
  perceived as rare.
The Web HackerÕs Toolbox

Essentially, all a web hacker needs is É

¥ a web browser,
¥ an Internet connection,
¥ É and a clear mind.
Classifying Web Hacks

Web Hacks fall under the following categories:
¥ URL Interpretation attacks
¥ Input Validation attacks
¥ SQL Injection attacks
¥ Impersonation attacks
¥ Buffer Overflow attacks
Firewalls cannot preventÉ




Web                         Web
Client                     Server

¥ URL Interpretation
  Attacks.
                       web server
                       mis-
                       configuration
Firewalls cannot preventÉ




                                      Web app

                                      Web app
Web                       Web
Client                   Server       Web app

                                      Web app

¥ Input Validation
  attacks.
                     URL              poor
                     Interpretation   checking
                     attacks          of user
                                      inputs
Firewalls cannot preventÉ




                                     Web app

                                     Web app
                                                    DB
Web                      Web
Client                  Server       Web app
                                                    DB
                                     Web app

¥ SQL Query
  Poisoning
                    URL              Input        Extend SQL
                    Interpretation   Validation   statements
                    attacks          attacks
Firewalls cannot preventÉ


         Reverse-
         engineering
         HTTP cookies.
                                          Web app

                                          Web app
                                                         DB
Web                           Web
Client                       Server       Web app
                                                         DB
                                          Web app

¥ HTTP session
  hijacking.
¥ Impersonation.         URL              Input        SQL query
                         Interpretation   Validation   poisoning
                         attacks          attacks
Why is Web Hacking so deadly?

¥ Ports 80 and 443 are usually allowed
  through firewalls.
¥ A single URL works its way into may
  components.
¥ And in most cases, the only defense is
  Òsecure codingÓ.
The URL as a cruise missile

http: // 10.0.0.1 / catalogue / display.asp ? pg = 1 & product = 7




                             Web app

                             Web app
                                           DB
                    Web
                   Server    Web app
                                           DB
                             Web app
Web Hacks - net effects

Web Hacks cause three types of effects:

¥ Extra information disclosure. (paths, etc.)
¥ Source code and arbitrary file content
  disclosure.
¥ Extra data disclosure (e.g. return all rows)
¥ Arbitrary command execution.
The Web HackerÕs Toolbox

Some desired accessories would be É

¥   a port scanner,
¥   netcat,
¥   vulnerability checker (e.g. whisker),
¥   OpenSSL, É etc.
Hacking over SSL

¥ SSL Myth: ÒStrong 128 bit crypto stops
  hackers dead in their tracksÓ
¥ Using netcat and OpenSSL, it is possible to
  create a simple two-line SSL Proxy!
¥ Listen on port 80 on a host and redirect
  requests to port 443 on a remote host
  through SSL.
               web          nc           SSL
               client                    web
                          openssl       server
The Top 10 Web Hacking Techniques

1.   URL Misinterpretation
2.   Directory Browsing
3.   Retrieving Ònon-webÓ Files
4.   Reverse Proxying
5.   Java Decompilation
The Top 10 Web Hacking Techniques

6. Source Code Disclosure
7. Input Validation
8. SQL Query Poisoning
9. Session Hijacking
10. Buffer Overflows
1. URL Misinterpretation

¥ The web server fails to parse the URL
  properly.
¥ e.g. the Unicode / Superfluous decode
  attack.
¥ Mismatched resource mappings in the
  configuration.
¥ e.g. +.htr, .JSP, Java remote command
  execution, etc.
1. URL Misinterpretation

Countermeasures:
¥ Usually require a vendor supplied fix.
¥ Thorough inspection of the web server
  configuration and bindings.
2. Directory Browsing

¥ Ability to retrieve complete directory listing
  within directories on the web server.
¥ Usually happens when the default document
  is missing.
¥ Not-so-strict Web server configuration.
2. Directory Browsing

Countermeasures:
¥ Web server configuration lock-down.
¥ Disable serving of directory listings.
¥ Sometimes the error may require a vendor
  supplied fix.
3. Retrieving Ònon-webÓ Files

¥ ÒNon-webÓ files can be:
  ¥   Archive files (.zip, .tar.gz, etc)
  ¥   Backup files (.bak, ~, etc)
  ¥   Header / Include files (.inc, .asa, etc)
  ¥   Text files (readme.txt, etc)
¥ Can be retrieved with some guess work.
¥ e.g. if there is a directory called /reports/,
  look for Òreports.zipÓ.
3. Retrieving Ònon-webÓ Files

Countermeasures:
¥ Eliminate careless presence of such files.
¥ Disable serving certain file types by creating
  a resource mapping.
¥ Strict change control measures.
4. Reverse Proxying

¥ Web proxy servers may work both ways!
¥ Typically meant to allow users from within a
  network to access external web sites.
¥ May end up proxying HTTP requests from
  the outside world to the internal network.
¥ e.g. Compaq Insight Manager
¥ Usually happens when the front end web
  server proxies requests to back end app
  servers.
4. Reverse Proxying

Countermeasures:
¥ Check the web server proxy configuration
  thoroughly.
¥ Be careful when creating URL mappings to
  internal servers.
5. Java Decompilation

¥ Java Bytecode can be decompiled quite
  effectively.
¥ May disclose sensitive information such as
  passwords, application paths, etc.
¥ May also disclose application logic Ð such as
  generation of session IDs, encryption, etc.
¥ Java Archive files (.jar files) may contain files
  other than bytecode, such as configuration
  files.
5. Java Decompilation

Countermeasures:
¥ Java bytecode obfuscation.
¥ Elimination of sensitive configuration
  information within bytecode.
¥ Elimination of unnecessary files within .jar
  files.
6. Source Code Disclosure

¥ Ability to retrieve application files in an
  unparsed manner.
¥ Attackers can recover the source code of the
  web application itself.
¥ The code can then be used to find further
  loopholes / trophies.
¥ May be caused my many ways:
  ¥ Misconfiguration or vendor errors
  ¥ Poor application design, etc.
6. Source Code Disclosure

Countermeasures:
¥ Vendor supplied fixes.
¥ Locking down the web server configuration.
¥ Secure coding practices.
7. Input Validation

¥ Root cause of most web hacks.
¥ All inputs received should be validated:
  ¥   data types
  ¥   data ranges (e.g. -ve or fractional numbers)
  ¥   buffer sizes and bounds
  ¥   metacharacters
¥ Tampering with hidden fields.
¥ Bypassing client side checking (e.g.
  javascript).
7. Input Validation

Countermeasures:
¥ These are the worst to deal with!
¥ There is no other countermeasure but proper
  coding practices.
8. SQL Query Poisoning

¥ Parameters from the URL or input fields get
  used in SQL queries.
¥ An instance of Input Validation attacks.
¥ Data can be altered to extend the SQL
  query.
  ¥ e.g. http://server/query.asp?item=3+OR+1=1
¥ Execution of stored procedures.
¥ May even lead to back-end database server
  compromise.
8. SQL Query Poisoning

Countermeasures:
¥ Again, no easy fix.
¥ Thorough source code review.
¥ Following the principle of least privilege for
  the database application.
¥ Elimination of unnecessary database users
  and stored procedures.
9. Session Hijacking

¥ HTTP is inherently a ÒstatelessÓ protocol.
¥ Many web applications are stateful.
¥ Poor mechanisms of state tracking.
  ¥ Hidden fields carrying a session ID
  ¥ Client side cookies
  ¥ É with no server side session tracking.
¥ Reverse engineering of the session ID leads
  to access of other usersÕ data.
9. Session Hijacking

Countermeasures:
¥ Use server side session ID tracking.
¥ Match connections with time stamps, IP
  addresses, etc.
¥ Cryptographically generated session IDs.
  ¥ hard to sequence.
¥ Use web application server session
  management APIs when possible.
10. Buffer Overflows

¥ Poor bounds checking.
¥ Web server HTTP requests.
  ¥ e.g. ASP buffer overflow, .printer, etc.
¥ Application Input fields.
  ¥ e.g. ColdFusion DoS, etc.
¥ Can cause:
  ¥ Denial of service (crashing the app / service)
  ¥ Remote command execution (shellcode)
10. Buffer Overflows

Countermeasures:
¥ Vendor supplied fixes.
¥ Bounds checking within applications.
¥ Source code reviews.
¥ Buffer overflow testing.
Hacking Web enabled Devices

¥ Network equipment, printers, etc. becoming
  Òweb enabledÓ.
¥ e.g. Cisco IOS HTTP hack, HP
  WebJetAdmin hack, etc.
¥ May leak sensitive information about a
  network.
¥ May allow proxying of web attacks.
Beating the IDS

¥ ÒSecure HackingÓ Ð hacking over SSL.
¥ Many ways of writing the same URL.
  ¥ Defeats signature based pattern matching.
¥ Spurious parameters.
¥ Intentionally generating false positives.
Closing Thoughts

¥ Far harder to secure web sites and web
  applications.
¥ Need to create a heightened levels of
  security awareness.
¥ Use of formal software engineering methods
  for developing web applications.
¥ Use of secure coding practices.
¥ Thorough application testing.
Closing Thoughts

¥ ÒThere is no patch for carelessnessÓ.
¥ Web Hacking: Attacks and Defense
  Saumil Shah, Shreeraj Shah, Stuart McClure
  Addison Wesley Ð 2002.
Thank you!

saumil@net-square.com

   http://www.net-square.com/
         +91 98254 31192

More Related Content

PDF
Why Load Testing from the Cloud Doesn't Work
Compuware APM
 
PPTX
Technical Cyber Defense Strategies Explained!
Microsoft TechNet - Belgium and Luxembourg
 
PDF
[Infosecworld 08 Orlando] CSRF: The Biggest Little Vulnerability on the Web
Shreeraj Shah
 
PDF
Building Living Web Applications with HTML5 WebSockets
Peter Moskovits
 
PDF
Accessing Native APIs from Touch
Sencha
 
PDF
Extending JMS to Web Devices over HTML5 WebSockets - JavaOne 2011
Peter Moskovits
 
PDF
Real Life WebSocket Case Studies and Demos
Peter Moskovits
 
PDF
Adversity: Good for software
James Wickett
 
Why Load Testing from the Cloud Doesn't Work
Compuware APM
 
Technical Cyber Defense Strategies Explained!
Microsoft TechNet - Belgium and Luxembourg
 
[Infosecworld 08 Orlando] CSRF: The Biggest Little Vulnerability on the Web
Shreeraj Shah
 
Building Living Web Applications with HTML5 WebSockets
Peter Moskovits
 
Accessing Native APIs from Touch
Sencha
 
Extending JMS to Web Devices over HTML5 WebSockets - JavaOne 2011
Peter Moskovits
 
Real Life WebSocket Case Studies and Demos
Peter Moskovits
 
Adversity: Good for software
James Wickett
 

What's hot (15)

PDF
API Reliability Guide
Nick DeNardis
 
PDF
2018 JavaLand Deconstructing and Evolving REST Security
David Blevins
 
PDF
Application DoS In Microservice Architectures
Scott Behrens
 
PPTX
The Fundamentals of HTML5
DataLeader.io
 
PPTX
vFabric - Ideal Platform for SaaS Apps
VMware vFabric
 
PDF
SproutCore GTUG
sproutit
 
PPTX
Working with Data and Web Services in Microsoft Silverlight 2
goodfriday
 
PDF
WEBSITE HOSTING FOR PNG ORGANISATIONS
webhostingguy
 
PDF
Dave Carroll Application Services Salesforce
deimos
 
PDF
Ajax World Fall08
rajivmordani
 
PDF
ION Mumbai - Richard Lamb: Why DNSSEC?
Deploy360 Programme (Internet Society)
 
PDF
Sail Fin Webinar Overview
Eduardo Pelegri-Llopart
 
PDF
BeamAuth - Two-Factor Web Authentication with a Bookmark
Ben Adida
 
PPTX
Protecting Online Identities - MIX09
Jorgen Thelin
 
PDF
Performance Testing and Instrumenting the KGB SMS Service for the Super Bowl
natematias
 
API Reliability Guide
Nick DeNardis
 
2018 JavaLand Deconstructing and Evolving REST Security
David Blevins
 
Application DoS In Microservice Architectures
Scott Behrens
 
The Fundamentals of HTML5
DataLeader.io
 
vFabric - Ideal Platform for SaaS Apps
VMware vFabric
 
SproutCore GTUG
sproutit
 
Working with Data and Web Services in Microsoft Silverlight 2
goodfriday
 
WEBSITE HOSTING FOR PNG ORGANISATIONS
webhostingguy
 
Dave Carroll Application Services Salesforce
deimos
 
Ajax World Fall08
rajivmordani
 
ION Mumbai - Richard Lamb: Why DNSSEC?
Deploy360 Programme (Internet Society)
 
Sail Fin Webinar Overview
Eduardo Pelegri-Llopart
 
BeamAuth - Two-Factor Web Authentication with a Bookmark
Ben Adida
 
Protecting Online Identities - MIX09
Jorgen Thelin
 
Performance Testing and Instrumenting the KGB SMS Service for the Super Bowl
natematias
 
Ad

Viewers also liked (14)

PDF
Owasp top 10 2013 - rc1
Ajay Ohri
 
PPT
Web Attacks - Top threats - 2010
Shreeraj Shah
 
PPTX
Web Application Vulnerabilities
Preetish Panda
 
PPTX
Anatomy Web Attack
Kelly Speiser
 
PDF
Behind The Scenes Of Web Attacks
Maurizio Abbà
 
PPT
Web attacks
husnara mohammad
 
PPTX
Lesson 6 web based attacks
Frank Victory
 
PPT
Trends in Web Attacks
IWMW
 
PPTX
Presentation on Web Attacks
Vivek Sinha Anurag
 
PPTX
Web application attack Presentation
Khoa Nguyen
 
PPTX
Hacking Web: Attacks & Tips
Iván Sanz de Castro
 
PPTX
Web application attacks
hruth
 
PPTX
Hacking & its types
Sai Sakoji
 
Owasp top 10 2013 - rc1
Ajay Ohri
 
Web Attacks - Top threats - 2010
Shreeraj Shah
 
Web Application Vulnerabilities
Preetish Panda
 
Anatomy Web Attack
Kelly Speiser
 
Behind The Scenes Of Web Attacks
Maurizio Abbà
 
Web attacks
husnara mohammad
 
Lesson 6 web based attacks
Frank Victory
 
Trends in Web Attacks
IWMW
 
Presentation on Web Attacks
Vivek Sinha Anurag
 
Web application attack Presentation
Khoa Nguyen
 
Hacking Web: Attacks & Tips
Iván Sanz de Castro
 
Web application attacks
hruth
 
Hacking & its types
Sai Sakoji
 
Ad

Similar to Top Ten Web Attacks (20)

PDF
Web Application Security with PHP
jikbal
 
PPTX
SecTor '09 - When Web 2.0 Attacks!
Rafal Los
 
PPT
Why You Need A Web Application Firewall
Port80 Software
 
PDF
Is the Web at Risk?
Carlos Serrao
 
PDF
Amish Umesh - Future Of Web App Testing - ClubHack2007
ClubHack
 
PPTX
Web application
Eve_Srithong
 
PDF
Hacking intranet websites
shehab najjar
 
PPTX
Itp web application development
Shibu S R
 
PPTX
Ethical hacking Chapter 10 - Exploiting Web Servers - Eric Vanderburg
Eric Vanderburg
 
PDF
375 378
Editor IJARCET
 
PDF
Minor Mistakes In Web Portals
msobiegraj
 
PPTX
Fundamental of Webserver Hacking, Web Applications and Database Attacks
UK Defence Cyber School
 
PPT
Web Application Security
Abdul Wahid
 
PPT
gofortution
gofortution
 
PPTX
LECTURE-DEC-6_web-application-attacks (1).pptx
JhonFrancisDuarte
 
KEY
Introduction to web security @ confess 2012
jakobkorherr
 
PDF
CNIT 129S: 10: Attacking Back-End Components
Sam Bowne
 
PDF
Are you fighting_new_threats_with_old_weapons
Bhargav Modi
 
PDF
Xfocus xcon 2008_aks_oknock
ownerkhan
 
PDF
cyber security-ethical hacking web servers.pdf
jayaprasanna10
 
Web Application Security with PHP
jikbal
 
SecTor '09 - When Web 2.0 Attacks!
Rafal Los
 
Why You Need A Web Application Firewall
Port80 Software
 
Is the Web at Risk?
Carlos Serrao
 
Amish Umesh - Future Of Web App Testing - ClubHack2007
ClubHack
 
Web application
Eve_Srithong
 
Hacking intranet websites
shehab najjar
 
Itp web application development
Shibu S R
 
Ethical hacking Chapter 10 - Exploiting Web Servers - Eric Vanderburg
Eric Vanderburg
 
Minor Mistakes In Web Portals
msobiegraj
 
Fundamental of Webserver Hacking, Web Applications and Database Attacks
UK Defence Cyber School
 
Web Application Security
Abdul Wahid
 
gofortution
gofortution
 
LECTURE-DEC-6_web-application-attacks (1).pptx
JhonFrancisDuarte
 
Introduction to web security @ confess 2012
jakobkorherr
 
CNIT 129S: 10: Attacking Back-End Components
Sam Bowne
 
Are you fighting_new_threats_with_old_weapons
Bhargav Modi
 
Xfocus xcon 2008_aks_oknock
ownerkhan
 
cyber security-ethical hacking web servers.pdf
jayaprasanna10
 

More from Ajay Ohri (20)

PDF
Introduction to R ajay Ohri
Ajay Ohri
 
PPTX
Introduction to R
Ajay Ohri
 
PDF
Social Media and Fake News in the 2016 Election
Ajay Ohri
 
PDF
Pyspark
Ajay Ohri
 
PDF
Download Python for R Users pdf for free
Ajay Ohri
 
PDF
Install spark on_windows10
Ajay Ohri
 
DOCX
Ajay ohri Resume
Ajay Ohri
 
PDF
Statistics for data scientists
Ajay Ohri
 
PPTX
National seminar on emergence of internet of things (io t) trends and challe...
Ajay Ohri
 
PDF
Tools and techniques for data science
Ajay Ohri
 
PPTX
How Big Data ,Cloud Computing ,Data Science can help business
Ajay Ohri
 
PDF
Training in Analytics and Data Science
Ajay Ohri
 
PDF
Tradecraft
Ajay Ohri
 
PDF
Software Testing for Data Scientists
Ajay Ohri
 
PDF
Craps
Ajay Ohri
 
PDF
A Data Science Tutorial in Python
Ajay Ohri
 
PDF
How does cryptography work? by Jeroen Ooms
Ajay Ohri
 
PDF
Using R for Social Media and Sports Analytics
Ajay Ohri
 
PDF
Kush stats alpha
Ajay Ohri
 
PPTX
Analyze this
Ajay Ohri
 
Introduction to R ajay Ohri
Ajay Ohri
 
Introduction to R
Ajay Ohri
 
Social Media and Fake News in the 2016 Election
Ajay Ohri
 
Pyspark
Ajay Ohri
 
Download Python for R Users pdf for free
Ajay Ohri
 
Install spark on_windows10
Ajay Ohri
 
Ajay ohri Resume
Ajay Ohri
 
Statistics for data scientists
Ajay Ohri
 
National seminar on emergence of internet of things (io t) trends and challe...
Ajay Ohri
 
Tools and techniques for data science
Ajay Ohri
 
How Big Data ,Cloud Computing ,Data Science can help business
Ajay Ohri
 
Training in Analytics and Data Science
Ajay Ohri
 
Tradecraft
Ajay Ohri
 
Software Testing for Data Scientists
Ajay Ohri
 
Craps
Ajay Ohri
 
A Data Science Tutorial in Python
Ajay Ohri
 
How does cryptography work? by Jeroen Ooms
Ajay Ohri
 
Using R for Social Media and Sports Analytics
Ajay Ohri
 
Kush stats alpha
Ajay Ohri
 
Analyze this
Ajay Ohri
 

Top Ten Web Attacks

  • 1. Top Ten Web Attacks Saumil Shah Net-Square BlackHat Asia 2002, Singapore
  • 2. TodayÕs battleground Ð the Web ¥ Web sites and web applications rapidly growing. ¥ Complex business applications are now delivered over the web (HTTP). ¥ Increased Òweb hackingÓ activity. ¥ Worms on the web. ¥ How much damage can be done? ¥ Firewalls?
  • 3. Typical Web Application set-up HTTP Firewall SQL request Database (cleartext or SSL) Web app Web app DB Web Web Client Server Web app DB Web app HTTP reply (HTML, Javascript, ¥Apache Plugins: Database VBscript, ¥IIS ¥Perl connection: etc) ¥Netscape ¥C/C++ ¥ADO, etcÉ ¥JSP, etc ¥ODBC, etc.
  • 4. Traditional HackingÉLimitations ¥ Modern network architectures are getting more robust and secure. ¥ Firewalls being used in almost all network roll-outs. ¥ OS vendors learning from past mistakes (?) and coming out with patches rapidly. ¥ Increased maturity in coding practices.
  • 5. Utility of Firewalls ¥ Hacks on OS network services prevented by firewalls. Web app Web app DB Web Server Web app DB wu-ftpd Web app X Sun RPC X NT ipc$ X
  • 6. Utility of Firewalls ¥ Internal back-end application servers are on a non- routable IP network. Web app (private addresses) Web app DB Web Server Web app DB Web app X
  • 7. Utility of Firewalls ¥ Outbound access restricted. Why would a web server telnet out? Web app Web app DB Web Server Web app DB Web app X
  • 8. Futility of Firewalls ¥ E-commerce / Web hacking is unfettered. ¥ Web traffic is the most commonly allowed of protocols through Internet firewalls. ¥ Why fight the wall when youÕve got an open door? ¥ HTTP is perceived as ÒfriendlyÓ traffic. ¥ Content/Application based attacks are still perceived as rare.
  • 9. The Web HackerÕs Toolbox Essentially, all a web hacker needs is É ¥ a web browser, ¥ an Internet connection, ¥ É and a clear mind.
  • 10. Classifying Web Hacks Web Hacks fall under the following categories: ¥ URL Interpretation attacks ¥ Input Validation attacks ¥ SQL Injection attacks ¥ Impersonation attacks ¥ Buffer Overflow attacks
  • 11. Firewalls cannot preventÉ Web Web Client Server ¥ URL Interpretation Attacks. web server mis- configuration
  • 12. Firewalls cannot preventÉ Web app Web app Web Web Client Server Web app Web app ¥ Input Validation attacks. URL poor Interpretation checking attacks of user inputs
  • 13. Firewalls cannot preventÉ Web app Web app DB Web Web Client Server Web app DB Web app ¥ SQL Query Poisoning URL Input Extend SQL Interpretation Validation statements attacks attacks
  • 14. Firewalls cannot preventÉ Reverse- engineering HTTP cookies. Web app Web app DB Web Web Client Server Web app DB Web app ¥ HTTP session hijacking. ¥ Impersonation. URL Input SQL query Interpretation Validation poisoning attacks attacks
  • 15. Why is Web Hacking so deadly? ¥ Ports 80 and 443 are usually allowed through firewalls. ¥ A single URL works its way into may components. ¥ And in most cases, the only defense is Òsecure codingÓ.
  • 16. The URL as a cruise missile http: // 10.0.0.1 / catalogue / display.asp ? pg = 1 & product = 7 Web app Web app DB Web Server Web app DB Web app
  • 17. Web Hacks - net effects Web Hacks cause three types of effects: ¥ Extra information disclosure. (paths, etc.) ¥ Source code and arbitrary file content disclosure. ¥ Extra data disclosure (e.g. return all rows) ¥ Arbitrary command execution.
  • 18. The Web HackerÕs Toolbox Some desired accessories would be É ¥ a port scanner, ¥ netcat, ¥ vulnerability checker (e.g. whisker), ¥ OpenSSL, É etc.
  • 19. Hacking over SSL ¥ SSL Myth: ÒStrong 128 bit crypto stops hackers dead in their tracksÓ ¥ Using netcat and OpenSSL, it is possible to create a simple two-line SSL Proxy! ¥ Listen on port 80 on a host and redirect requests to port 443 on a remote host through SSL. web nc SSL client web openssl server
  • 20. The Top 10 Web Hacking Techniques 1. URL Misinterpretation 2. Directory Browsing 3. Retrieving Ònon-webÓ Files 4. Reverse Proxying 5. Java Decompilation
  • 21. The Top 10 Web Hacking Techniques 6. Source Code Disclosure 7. Input Validation 8. SQL Query Poisoning 9. Session Hijacking 10. Buffer Overflows
  • 22. 1. URL Misinterpretation ¥ The web server fails to parse the URL properly. ¥ e.g. the Unicode / Superfluous decode attack. ¥ Mismatched resource mappings in the configuration. ¥ e.g. +.htr, .JSP, Java remote command execution, etc.
  • 23. 1. URL Misinterpretation Countermeasures: ¥ Usually require a vendor supplied fix. ¥ Thorough inspection of the web server configuration and bindings.
  • 24. 2. Directory Browsing ¥ Ability to retrieve complete directory listing within directories on the web server. ¥ Usually happens when the default document is missing. ¥ Not-so-strict Web server configuration.
  • 25. 2. Directory Browsing Countermeasures: ¥ Web server configuration lock-down. ¥ Disable serving of directory listings. ¥ Sometimes the error may require a vendor supplied fix.
  • 26. 3. Retrieving Ònon-webÓ Files ¥ ÒNon-webÓ files can be: ¥ Archive files (.zip, .tar.gz, etc) ¥ Backup files (.bak, ~, etc) ¥ Header / Include files (.inc, .asa, etc) ¥ Text files (readme.txt, etc) ¥ Can be retrieved with some guess work. ¥ e.g. if there is a directory called /reports/, look for Òreports.zipÓ.
  • 27. 3. Retrieving Ònon-webÓ Files Countermeasures: ¥ Eliminate careless presence of such files. ¥ Disable serving certain file types by creating a resource mapping. ¥ Strict change control measures.
  • 28. 4. Reverse Proxying ¥ Web proxy servers may work both ways! ¥ Typically meant to allow users from within a network to access external web sites. ¥ May end up proxying HTTP requests from the outside world to the internal network. ¥ e.g. Compaq Insight Manager ¥ Usually happens when the front end web server proxies requests to back end app servers.
  • 29. 4. Reverse Proxying Countermeasures: ¥ Check the web server proxy configuration thoroughly. ¥ Be careful when creating URL mappings to internal servers.
  • 30. 5. Java Decompilation ¥ Java Bytecode can be decompiled quite effectively. ¥ May disclose sensitive information such as passwords, application paths, etc. ¥ May also disclose application logic Ð such as generation of session IDs, encryption, etc. ¥ Java Archive files (.jar files) may contain files other than bytecode, such as configuration files.
  • 31. 5. Java Decompilation Countermeasures: ¥ Java bytecode obfuscation. ¥ Elimination of sensitive configuration information within bytecode. ¥ Elimination of unnecessary files within .jar files.
  • 32. 6. Source Code Disclosure ¥ Ability to retrieve application files in an unparsed manner. ¥ Attackers can recover the source code of the web application itself. ¥ The code can then be used to find further loopholes / trophies. ¥ May be caused my many ways: ¥ Misconfiguration or vendor errors ¥ Poor application design, etc.
  • 33. 6. Source Code Disclosure Countermeasures: ¥ Vendor supplied fixes. ¥ Locking down the web server configuration. ¥ Secure coding practices.
  • 34. 7. Input Validation ¥ Root cause of most web hacks. ¥ All inputs received should be validated: ¥ data types ¥ data ranges (e.g. -ve or fractional numbers) ¥ buffer sizes and bounds ¥ metacharacters ¥ Tampering with hidden fields. ¥ Bypassing client side checking (e.g. javascript).
  • 35. 7. Input Validation Countermeasures: ¥ These are the worst to deal with! ¥ There is no other countermeasure but proper coding practices.
  • 36. 8. SQL Query Poisoning ¥ Parameters from the URL or input fields get used in SQL queries. ¥ An instance of Input Validation attacks. ¥ Data can be altered to extend the SQL query. ¥ e.g. http://server/query.asp?item=3+OR+1=1 ¥ Execution of stored procedures. ¥ May even lead to back-end database server compromise.
  • 37. 8. SQL Query Poisoning Countermeasures: ¥ Again, no easy fix. ¥ Thorough source code review. ¥ Following the principle of least privilege for the database application. ¥ Elimination of unnecessary database users and stored procedures.
  • 38. 9. Session Hijacking ¥ HTTP is inherently a ÒstatelessÓ protocol. ¥ Many web applications are stateful. ¥ Poor mechanisms of state tracking. ¥ Hidden fields carrying a session ID ¥ Client side cookies ¥ É with no server side session tracking. ¥ Reverse engineering of the session ID leads to access of other usersÕ data.
  • 39. 9. Session Hijacking Countermeasures: ¥ Use server side session ID tracking. ¥ Match connections with time stamps, IP addresses, etc. ¥ Cryptographically generated session IDs. ¥ hard to sequence. ¥ Use web application server session management APIs when possible.
  • 40. 10. Buffer Overflows ¥ Poor bounds checking. ¥ Web server HTTP requests. ¥ e.g. ASP buffer overflow, .printer, etc. ¥ Application Input fields. ¥ e.g. ColdFusion DoS, etc. ¥ Can cause: ¥ Denial of service (crashing the app / service) ¥ Remote command execution (shellcode)
  • 41. 10. Buffer Overflows Countermeasures: ¥ Vendor supplied fixes. ¥ Bounds checking within applications. ¥ Source code reviews. ¥ Buffer overflow testing.
  • 42. Hacking Web enabled Devices ¥ Network equipment, printers, etc. becoming Òweb enabledÓ. ¥ e.g. Cisco IOS HTTP hack, HP WebJetAdmin hack, etc. ¥ May leak sensitive information about a network. ¥ May allow proxying of web attacks.
  • 43. Beating the IDS ¥ ÒSecure HackingÓ Ð hacking over SSL. ¥ Many ways of writing the same URL. ¥ Defeats signature based pattern matching. ¥ Spurious parameters. ¥ Intentionally generating false positives.
  • 44. Closing Thoughts ¥ Far harder to secure web sites and web applications. ¥ Need to create a heightened levels of security awareness. ¥ Use of formal software engineering methods for developing web applications. ¥ Use of secure coding practices. ¥ Thorough application testing.
  • 45. Closing Thoughts ¥ ÒThere is no patch for carelessnessÓ. ¥ Web Hacking: Attacks and Defense Saumil Shah, Shreeraj Shah, Stuart McClure Addison Wesley Ð 2002.
  • 46. Thank you! [email protected] http://www.net-square.com/ +91 98254 31192