SlideShare a Scribd company logo
Hacking Web 2.0
Art and Science of Vulnerability Detection




                                      Shreeraj Shah
                                         Pune,India
Who am I?
                                                  http://shreeraj.blogspot.com
                                                  shreeraj@blueinfy.com
• Founder & Director
   – Blueinfy Solutions Pvt. Ltd. (Brief)
• Past experience
   – Net Square, Chase, IBM & Foundstone
• Interest
   – Web security research
• Published research
   – Articles / Papers – Securityfocus, O’erilly, DevX, InformIT etc.
   – Tools – wsScanner, scanweb2.0, AppMap, AppCodeScan,
     wsChess etc.
   – Advisories - .Net, Java servers etc.
• Books (Author)
   – Hacking Web Services (Thomson 2006)
   – Web Hacking (AWL 2003)
   – Web 2.0 Security (Work in progress)
Agenda
• Web 2.0 overview and security concerns
• Ajax Security – Attacks and Defense
  – Methods
  – Vectors
  – Defense
• Web Services – Attacks and Defense
  – Methodology
  – Assessment and Tools
  – Defense
Web 2.0 Trends
• 80% of companies are investing in Web
  Services as part of their Web 2.0 initiative
  (McKinsey2007 Global Survey)
• By the end of 2007, 30 percent of large
  companies will have some kind of Web 2.0-
  based business initiative up and running.
  (Gartner)
• 2008. Web Services or Service-Oriented
  Architecture (SOA) would surge ahead.
  (Gartner)
Web 2.0 – Ajax & Web Services
                                                    Documents

                                        News                      Emails
Browser
                                Weather                             Bank/Trade
     Ajax
                                                       Internet
  RIA (Flash)     Internet
                                                                           RSS feeds
HTML / JS / DOM

                             Web Services                                  Blog

                                  Local Application



                                 Database Authentication
Web 2.0 Layers

       Browser         Structures    Protocols    Server-Side

                                    JSON-RPC
  Ajax   Flash / RIA                              Services
                         XML          REST
HTML/CSS JavaScript                                SaaS
                        JSON         XML-RPC
 Widget     DOM                                  Open APIs
                                      SOAP


                               HTTP(S)
Technologies
  Internet            DMZ                              Trusted



                      SOAP, REST, XML-RPC, JSON etc.
Ajax
 RIA                                                             W
Client                                                           E
                               Scripted         Application      B
                 Web            Web              Servers
                                                                 S
                Server         Engine              And
               Static pages
                                                                 E
Web                          Dynamic pages      Integrated
              HTML,HTM etc.. ASP DHTML,                          R
Client                        PHP,CGI Etc..     Framework        V
                                                                 I

                                 X
                                                 ASP.NET with    C
                                                     .Net        E
                                                   J2EE App
                                                    Server
                                                                 S
                                                 Web Services
                                                     Etc..
                                 DB

                         Internal/Corporate
Web 2.0 Security
• Complex architecture and confusion with
  technologies
• Web 2.0 worms and viruses – Sammy,
  Yammaner & Spaceflash
• Ajax and JavaScripts – Client side attacks
  are on the rise
• Web Services attacks and exploitation
• Flash clients are running with risks
Ajax Security – Attacks & Defense

•   Basics
•   Structures and streams
•   Fingerprinting
•   Scanning and Enumeration
•   XSS and CSRF issues
•   Securing code base
Ajax basics
• Asynchronous JavaScript and XML

       HTML / CSS              Database / Resource

         JS / DOM             XML / Middleware / Text

   XMLHttpRequest (XHR)            Web Server



               Asynchronous
               over HTTP(S)
Ajax - Sample
function loadhtml()
{
    var http;
    if(window.XMLHttpRequest){
       http = new XMLHttpRequest();
    }else if (window.ActiveXObject){
             http=new ActiveXObject("Msxml2.XMLHTTP");
       if (! http){
             http=new ActiveXObject("Microsoft.XMLHTTP");
       }
    }
    http.open("GET", "main.html", true);
    http.onreadystatechange = function()
    {
             if (http.readyState == 4) {
                         var response = http.responseText;
                         document.getElementById('main').innerHTML = response;

    }
}
http.send(null);
}
Ajax & Data structures
•   Ajax is using various data streams
•   Developers are innovating this field
•   JavaScript can talk with back end sources
•   Mashups application can be leveraged
•   It is important to understand these streams
•   It has significant security impact
•   JSON, Array, JS-Object etc.
Cross-domain calls
• Browser security doesn’t support cross
  domain calls
• But cross domain callback with JavaScript
  is possible
• This can be lethal attack since cross
  domain information get executed on the
  current DOM context.
• Developers put proxy to bypass the SOP.
Ajax fingerprinting
• Determining Ajax calls
• Framework fingerprinting
• Running with what?
  – Atlas
  – GWT
  – Etc.
• Ajaxfinger a tool to achieve this
• Can help in assessment process
• RIA finger printing is possible
Ajax attack points
• Ajax components & Widgets
• Cross domain vulnerable browsers and
  callback implementations
• DOM manipulation calls and points
• Insecure eval()
• HTML tags
• Intranet nodes and internal resources
Ajax attack vectors
•   Entry point scanning and enumeration
•   Cross site scripting (XSS) attacks
•   Cross site Request Forgery (CSRF) issues
•   Client side code reverse engineering
•   Security control and validation bypassing
•   Local privacy information enumeration
•   Ajax framework exploitation – known bugs
Ajax Scanning
• Scanning Ajax components
• Retrieving all JS include files
    – Part of <SCRIPT SRC=….>
•   Identifying XHR calls
•   Grabbing function
•   Mapping function to DOM event
•   Scanning code for XSS – look for eval()
    and document.write()
Ajax serialization issues
• Ajax processing various information
  coming from server and third party
  sources. – XSS opportunities
  message = {
         from : "john@example.com",
         to : "jerry@victim.com",
         subject : "I am fine",
         body : "Long message here",
         showsubject :
  function(){document.write(this.subject)}
  };



                  XSS
Ajax serialization issues
• JSON issues
  {"bookmarks":[{"Link":"www.example.com","D
  esc":"Interesting link"}]}


• JS – Array manipulation
  new Array(“Laptop”, “Thinkpad”, “T60”,
  “Used”, “900$”, “It is great and I have
  used it for 2 years”)
Ajax and JS manipulation
• JavaScript exploitation – XSS
• Identifying DOM points like
  document.write()
• Eval() – another interesting point
• Attack APIs and tools for exploitation
• Lot can be done by an attacker from
  session hijacking to key loggers
Ajax and RSS injection
• RSS feeds are another entry point to the
  browser
• Injecting script to the RSS feeds and Ajax
  call may execute it.
• One click – Malformed linked injected into
  it and can lead to exploit “javascript:”
• Leveraging events – onClick, onMouse
  etc.
Ajax Crawling
• Crawling Ajax driven app – a challenge
• Resources are hidden in JavaScript
• Simple scanner will fail
• Crawling with actual DOM context
• Automated crawling with browser is
  required
• How?
Defending Ajax
• No business logic information on client
  side.
• Do not trust third party source – filter it out
• No direct cross domain call back
• Filtering at browser level before
  processing information
• Avoiding client side validation
Defending Ajax
• No secret in Ajax calls
• Proper data structure selection and
  frameworks
• Avoid client side validation
• Securing client side calls like eval() and
  document.write()
• HTML tags filtering before serving to end
  client
Web Services – Attacks & Defense

•   Methodology
•   Footprinting & Discovery
•   Profiling and Enumeration
•   Scanning and Fuzzing
•   Attack vectors
•   Scanning code for vulnerabilities
•   Defense by filtering
Methodology
                       Insecure Web Services
Blackbox                                                  Whitebox

   Footprinting & Discovery


   Enumeration & Profiling               Code / Config Scanning


    Vulnerability Detection



Defense                       Secure Coding
&
Countermeasure          Web Services Firewall


                        Secure Web Services
Footprinting and Discovery
• Objective: Discovering Web Services
  running on application domain.
• Methods
  – Primary discovery
    • Crawling and spidering
    • Script analysis and page scrubbing
    • Traffic analysis
  – Secondary discovery
    • Search engine queries
    • UDDI scanning
Primary Discovery
• Crawling the application and mapping file
  extensions and directory structures, like
  “.asmx”
• Page scrubbing – scanning for paths and
  resources in the pages, like atlas back end
  call to Web Services.
• Recording traffic while browsing and
  spidering, look for XML based traffic –
  leads to XML-RPC, REST, SOAP, JSON
  calls.
Primary Discovery - Demos
• Page scanning with grep – Look in
  JavaScripts for URLs, Paths etc.
• Crawling – Simple!
• Scanning for Atlas references –
  Framework creates stubs and proxy. –
  scanweb2.0/scanatlas
• Urlgrep can be used as well.
Secondary Discovery
• Searching UDDI server for Web Services
  running on particular domain.
  – Three tactics for it – business, services or
    tModel.
• Running queries against search engines
  like Google or MSN with extra directives
  like “inurl” or “filetype”
  – Look for “asmx”

• wsScanner – Discovery!
Enumerating and Profiling
• Scanning WSDL
  – Looking for Methods
  – Collecting In/Out parameters
  – Security implementations
  – Binding points
  – Method signature mapping
Scanning strategies
•   Manual invocation and response analysis.
•   Dynamic proxy creation and scanning.
•   Auto auditing for various vectors.
•   Fuzzing Web Services streams – XML or
    JSON
•   Response analysis is the key
    –   Look for fault code nodes
    –   Enumerating fault strings
    –   Dissecting XML message and finding bits
    –   Hidden error messages in JSON
Cross Site Scripting (XSS)
• XSS is possible through Web Services.
• It would be DOM based XSS via eval().
• JSON-RPC based stream coming in the
  browser and get injected into DOM.
• Source of stream can be of third party and
  Un-trusted.
• XML streams coming in the browser and
  can cause XSS via document.write call.
Injection Flaws
• Web Services methods are consuming
  parameters coming from end users.
• It is possible to inject malicious characters
  into the stream.
• It can break Web Services code and send
  faultsting back to an attacker
• Various injections possible – SQL and
  XPATH
Malicious File Execution
• Malicious command can be injected
  through the parameter.
• WS supports attachments as well and that
  can lead to uploading a file.
• This can give remote command execution
  capability to the attacker.
Insecure Direct Object Reference
• Injecting characters to break file system
  sequences.
• Faultcode spits out internal information if
  not protected.
• Customized error shows the file refernces.
• Access to internal file and full traversal to
  directories
• Inspecting methods and parameters in the
  profile stage can help.
Cross Site Request Forgery
• CSRF with XML streams
• XML-RPC or SOAP based request can be
  generated from browsers.
• Splitting form and XML injection is
  possible – interesting trick.
• If Content-Type is not validated on the
  server then it can cause a potential CSRF.
• XForms usage in browser can produce
  XML requests to attack CSRF.
Code Analysis for Web Services

• Scanning the code base.
• Identifying linkages.
• Method signatures and inputs.
• Looking for various patterns for SQL,
  LDAP, XPATH, File access etc.
• Checking validation on them.
• Code walking and tracing the base - Key
Code filtering with IHTTPModule

• Regular firewall will not work
• Content filtering on HTTP will not work
  either since it is SOAP over HTTP/HTTPS
• SOAP level filtering and monitoring would
  require
• ISAPI level filtering is essential
• SOAP content filtering through
  IHTTPModule
HTTP Stack for .Net
           HttpRuntime


      HttpApplicationFactory
                                 Web Application
                                 Firewall
                                 & IDS
         HttpApplication



                               IHttpModule




       HttpHandlerFactory


             Handler

148
IHTTPModule for Web Services Firewall

•   Code walkthrough – Events and Hooks
•   Loading the DLL
•   Setting up the rules
•   Up and running!
•   Demo.
Thanks!
• Questions?

  – shreeraj@blueinfy.com

More Related Content

What's hot (20)

PDF
HTML5 Top 10 Threats - Silent Attacks and Stealth Exploits
Shreeraj Shah
 
PPT
Web Services Hacking and Security
Blueinfy Solutions
 
PDF
Blackhat11 shreeraj reverse_engineering_browser
Shreeraj Shah
 
PPT
Advanced applications-architecture-threats
Blueinfy Solutions
 
PDF
Top 10 HTML5 Threats - Whitepaper
Shreeraj Shah
 
PPT
Web 2.0 Application Kung-Fu - Securing Ajax & Web Services
Shreeraj Shah
 
PPT
AppSec 2007 - .NET Web Services Hacking
Shreeraj Shah
 
PPTX
Working with Data and Web Services in Microsoft Silverlight 2
goodfriday
 
DOCX
Maya_Kamentcev_fullVersion_2016.docx
Maya Kamentcev
 
PPTX
SharePoint Data Anywhere and Everywhere by Chris Beckett - SPTechCon
SPTechCon
 
PPTX
A great api is hard to find
Dan Diephouse
 
PPT
Application fuzzing
Blueinfy Solutions
 
PDF
Open Source Identity Management
Radovan Semancik
 
PDF
Owasp top 10 vulnerabilities 2013
Vishrut Sharma
 
DOCX
santosh_resume
Santosh Murarkar
 
PDF
Bd conf sencha touch workshop
James Pearce
 
PPT
Web 2 0 Tools
ramesh kumar
 
PPT
Web 2.0
Himanshu Kumar Das
 
PDF
Don't Drop the SOAP: Real World Web Service Testing for Web Hackers
Tom Eston
 
PDF
REST in Practice
Guilherme Silveira
 
HTML5 Top 10 Threats - Silent Attacks and Stealth Exploits
Shreeraj Shah
 
Web Services Hacking and Security
Blueinfy Solutions
 
Blackhat11 shreeraj reverse_engineering_browser
Shreeraj Shah
 
Advanced applications-architecture-threats
Blueinfy Solutions
 
Top 10 HTML5 Threats - Whitepaper
Shreeraj Shah
 
Web 2.0 Application Kung-Fu - Securing Ajax & Web Services
Shreeraj Shah
 
AppSec 2007 - .NET Web Services Hacking
Shreeraj Shah
 
Working with Data and Web Services in Microsoft Silverlight 2
goodfriday
 
Maya_Kamentcev_fullVersion_2016.docx
Maya Kamentcev
 
SharePoint Data Anywhere and Everywhere by Chris Beckett - SPTechCon
SPTechCon
 
A great api is hard to find
Dan Diephouse
 
Application fuzzing
Blueinfy Solutions
 
Open Source Identity Management
Radovan Semancik
 
Owasp top 10 vulnerabilities 2013
Vishrut Sharma
 
santosh_resume
Santosh Murarkar
 
Bd conf sencha touch workshop
James Pearce
 
Web 2 0 Tools
ramesh kumar
 
Don't Drop the SOAP: Real World Web Service Testing for Web Hackers
Tom Eston
 
REST in Practice
Guilherme Silveira
 

Viewers also liked (19)

PPTX
Cyber security and Hacking
Parth Makadiya
 
PPTX
Cyberlaw by Mr. Pavan Duggal at ClubHack Infosec KeyNote @ Bangalore
ClubHack
 
PPT
Kunal - Introduction to backtrack - ClubHack2008
ClubHack
 
PDF
ClubHack Magazine Issue May 2012
ClubHack
 
PDF
Cybercrime, cyber war, infowar - what's this all about from an hacker's persp...
ClubHack
 
PPTX
Legal Nuances to the Cloud by Ritambhara Agrawal
ClubHack
 
PPTX
Digital Forensic Case Study
MyAssignmenthelp.com
 
PPT
Infrastructure Security by Sivamurthy Hiremath
ClubHack
 
PDF
Digital Forensic: Brief Intro & Research Challenge
Aung Thu Rha Hein
 
PPTX
Cyber security and ethical hacking 3
Shekh Md Mehedi Hasan
 
PPTX
Workshop on Cyber security
Shekh Md Mehedi Hasan
 
PDF
Digital Crime & Forensics - Report
prashant3535
 
PDF
India legal 31 october 2014
ClubHack
 
PPT
Cyber Forensic - Policing the Digital Domain
ppd1961
 
PPTX
Digital forensics
Roberto Ellis
 
PDF
Digital Evidence in Computer Forensic Investigations
Filip Maertens
 
PPTX
Computer forensics powerpoint presentation
Somya Johri
 
PPT
Cyber Crime and Security
Dipesh Waghela
 
PPTX
Cyber-crime PPT
Anshuman Tripathi
 
Cyber security and Hacking
Parth Makadiya
 
Cyberlaw by Mr. Pavan Duggal at ClubHack Infosec KeyNote @ Bangalore
ClubHack
 
Kunal - Introduction to backtrack - ClubHack2008
ClubHack
 
ClubHack Magazine Issue May 2012
ClubHack
 
Cybercrime, cyber war, infowar - what's this all about from an hacker's persp...
ClubHack
 
Legal Nuances to the Cloud by Ritambhara Agrawal
ClubHack
 
Digital Forensic Case Study
MyAssignmenthelp.com
 
Infrastructure Security by Sivamurthy Hiremath
ClubHack
 
Digital Forensic: Brief Intro & Research Challenge
Aung Thu Rha Hein
 
Cyber security and ethical hacking 3
Shekh Md Mehedi Hasan
 
Workshop on Cyber security
Shekh Md Mehedi Hasan
 
Digital Crime & Forensics - Report
prashant3535
 
India legal 31 october 2014
ClubHack
 
Cyber Forensic - Policing the Digital Domain
ppd1961
 
Digital forensics
Roberto Ellis
 
Digital Evidence in Computer Forensic Investigations
Filip Maertens
 
Computer forensics powerpoint presentation
Somya Johri
 
Cyber Crime and Security
Dipesh Waghela
 
Cyber-crime PPT
Anshuman Tripathi
 

Similar to Shreeraj - Hacking Web 2 0 - ClubHack2007 (20)

PDF
Shreeraj-Hacking_Web_2
guest66dc5f
 
PDF
Application Security Workshop
Priyanka Aash
 
PDF
Find me if you can – smart fuzzing and discovery! shreeraj shah
owaspindia
 
PDF
Polysource-IT Profile
Helen
 
PDF
Polysource-IT Profile
Helen
 
PDF
Polysource It Profile
elenarys
 
PDF
Poly Source It Profile
moseskhedi
 
PDF
Mike Taulty MIX10 Silverlight 4 Patterns Frameworks
ukdpe
 
PPTX
Uni Paa S Overview
Arik
 
PDF
Тестирование производительности Ajax приложений с помощью JMeter
automated-testing.info
 
PPT
java web services - soap and rest services
VasantPrasad
 
PDF
Cross platform mobile web apps
James Pearce
 
PPT
Ajax Ppt 1
JayaPrakash.m
 
PPTX
6 weeks 6 months live project summer industrial training in cmc limited 2012
CMC Limited
 
PDF
A Snapshot of the Mobile HTML5 Revolution
James Pearce
 
PDF
Building Cross Platform Mobile Web Apps
James Pearce
 
PDF
Modern Architectures with Spring and JavaScript
martinlippert
 
PDF
Rest - Representational State Transfer (EMC BRDC Internal Tech talk)
Rodrigo Senra
 
PDF
HTML5 and the dawn of rich mobile web applications pt 1
James Pearce
 
PPTX
Designing for SharePoint Provider Hosted Apps
Roy Kim
 
Shreeraj-Hacking_Web_2
guest66dc5f
 
Application Security Workshop
Priyanka Aash
 
Find me if you can – smart fuzzing and discovery! shreeraj shah
owaspindia
 
Polysource-IT Profile
Helen
 
Polysource-IT Profile
Helen
 
Polysource It Profile
elenarys
 
Poly Source It Profile
moseskhedi
 
Mike Taulty MIX10 Silverlight 4 Patterns Frameworks
ukdpe
 
Uni Paa S Overview
Arik
 
Тестирование производительности Ajax приложений с помощью JMeter
automated-testing.info
 
java web services - soap and rest services
VasantPrasad
 
Cross platform mobile web apps
James Pearce
 
Ajax Ppt 1
JayaPrakash.m
 
6 weeks 6 months live project summer industrial training in cmc limited 2012
CMC Limited
 
A Snapshot of the Mobile HTML5 Revolution
James Pearce
 
Building Cross Platform Mobile Web Apps
James Pearce
 
Modern Architectures with Spring and JavaScript
martinlippert
 
Rest - Representational State Transfer (EMC BRDC Internal Tech talk)
Rodrigo Senra
 
HTML5 and the dawn of rich mobile web applications pt 1
James Pearce
 
Designing for SharePoint Provider Hosted Apps
Roy Kim
 

More from ClubHack (20)

PPT
Cyber Insurance
ClubHack
 
PPTX
Summarising Snowden and Snowden as internal threat
ClubHack
 
PPTX
Fatcat Automatic Web SQL Injector by Sandeep Kamble
ClubHack
 
PDF
The Difference Between the Reality and Feeling of Security by Thomas Kurian
ClubHack
 
PDF
Stand Close to Me & You're pwned! Owning Smart Phones using NFC by Aditya Gup...
ClubHack
 
PPTX
Smart Grid Security by Falgun Rathod
ClubHack
 
PDF
Hybrid Analyzer for Web Application Security (HAWAS) by Lavakumar Kuppan
ClubHack
 
PPTX
Hacking and Securing iOS Applications by Satish Bomisstty
ClubHack
 
PPTX
Critical Infrastructure Security by Subodh Belgi
ClubHack
 
PPTX
Content Type Attack Dark Hole in the Secure Environment by Raman Gupta
ClubHack
 
PDF
XSS Shell by Vandan Joshi
ClubHack
 
PDF
Clubhack Magazine Issue February 2012
ClubHack
 
PDF
ClubHack Magazine issue 26 March 2012
ClubHack
 
PDF
ClubHack Magazine issue April 2012
ClubHack
 
PDF
ClubHack Magazine – December 2011
ClubHack
 
PDF
One link Facebook (Anand Pandey)
ClubHack
 
PDF
Scenatio based hacking - enterprise wireless security (Vivek Ramachandran)
ClubHack
 
PDF
Pentesting Mobile Applications (Prashant Verma)
ClubHack
 
PDF
Mere Paas Teensy Hai (Nikhil Mittal)
ClubHack
 
PDF
How Android Based Phone Helped Me Win American Idol (Elad Shapira)
ClubHack
 
Cyber Insurance
ClubHack
 
Summarising Snowden and Snowden as internal threat
ClubHack
 
Fatcat Automatic Web SQL Injector by Sandeep Kamble
ClubHack
 
The Difference Between the Reality and Feeling of Security by Thomas Kurian
ClubHack
 
Stand Close to Me & You're pwned! Owning Smart Phones using NFC by Aditya Gup...
ClubHack
 
Smart Grid Security by Falgun Rathod
ClubHack
 
Hybrid Analyzer for Web Application Security (HAWAS) by Lavakumar Kuppan
ClubHack
 
Hacking and Securing iOS Applications by Satish Bomisstty
ClubHack
 
Critical Infrastructure Security by Subodh Belgi
ClubHack
 
Content Type Attack Dark Hole in the Secure Environment by Raman Gupta
ClubHack
 
XSS Shell by Vandan Joshi
ClubHack
 
Clubhack Magazine Issue February 2012
ClubHack
 
ClubHack Magazine issue 26 March 2012
ClubHack
 
ClubHack Magazine issue April 2012
ClubHack
 
ClubHack Magazine – December 2011
ClubHack
 
One link Facebook (Anand Pandey)
ClubHack
 
Scenatio based hacking - enterprise wireless security (Vivek Ramachandran)
ClubHack
 
Pentesting Mobile Applications (Prashant Verma)
ClubHack
 
Mere Paas Teensy Hai (Nikhil Mittal)
ClubHack
 
How Android Based Phone Helped Me Win American Idol (Elad Shapira)
ClubHack
 

Recently uploaded (20)

PDF
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
PDF
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
PDF
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PDF
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
PPTX
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
PDF
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
PDF
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PDF
July Patch Tuesday
Ivanti
 
PDF
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
PDF
Blockchain Transactions Explained For Everyone
CIFDAQ
 
PDF
Log-Based Anomaly Detection: Enhancing System Reliability with Machine Learning
Mohammed BEKKOUCHE
 
PDF
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
PDF
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
PDF
Complete JavaScript Notes: From Basics to Advanced Concepts.pdf
haydendavispro
 
PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
PPTX
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
HubSpot Main Hub: A Unified Growth Platform
Jaswinder Singh
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
July Patch Tuesday
Ivanti
 
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
Blockchain Transactions Explained For Everyone
CIFDAQ
 
Log-Based Anomaly Detection: Enhancing System Reliability with Machine Learning
Mohammed BEKKOUCHE
 
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
Complete JavaScript Notes: From Basics to Advanced Concepts.pdf
haydendavispro
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 

Shreeraj - Hacking Web 2 0 - ClubHack2007

  • 1. Hacking Web 2.0 Art and Science of Vulnerability Detection Shreeraj Shah Pune,India
  • 2. Who am I? http://shreeraj.blogspot.com [email protected] • Founder & Director – Blueinfy Solutions Pvt. Ltd. (Brief) • Past experience – Net Square, Chase, IBM & Foundstone • Interest – Web security research • Published research – Articles / Papers – Securityfocus, O’erilly, DevX, InformIT etc. – Tools – wsScanner, scanweb2.0, AppMap, AppCodeScan, wsChess etc. – Advisories - .Net, Java servers etc. • Books (Author) – Hacking Web Services (Thomson 2006) – Web Hacking (AWL 2003) – Web 2.0 Security (Work in progress)
  • 3. Agenda • Web 2.0 overview and security concerns • Ajax Security – Attacks and Defense – Methods – Vectors – Defense • Web Services – Attacks and Defense – Methodology – Assessment and Tools – Defense
  • 4. Web 2.0 Trends • 80% of companies are investing in Web Services as part of their Web 2.0 initiative (McKinsey2007 Global Survey) • By the end of 2007, 30 percent of large companies will have some kind of Web 2.0- based business initiative up and running. (Gartner) • 2008. Web Services or Service-Oriented Architecture (SOA) would surge ahead. (Gartner)
  • 5. Web 2.0 – Ajax & Web Services Documents News Emails Browser Weather Bank/Trade Ajax Internet RIA (Flash) Internet RSS feeds HTML / JS / DOM Web Services Blog Local Application Database Authentication
  • 6. Web 2.0 Layers Browser Structures Protocols Server-Side JSON-RPC Ajax Flash / RIA Services XML REST HTML/CSS JavaScript SaaS JSON XML-RPC Widget DOM Open APIs SOAP HTTP(S)
  • 7. Technologies Internet DMZ Trusted SOAP, REST, XML-RPC, JSON etc. Ajax RIA W Client E Scripted Application B Web Web Servers S Server Engine And Static pages E Web Dynamic pages Integrated HTML,HTM etc.. ASP DHTML, R Client PHP,CGI Etc.. Framework V I X ASP.NET with C .Net E J2EE App Server S Web Services Etc.. DB Internal/Corporate
  • 8. Web 2.0 Security • Complex architecture and confusion with technologies • Web 2.0 worms and viruses – Sammy, Yammaner & Spaceflash • Ajax and JavaScripts – Client side attacks are on the rise • Web Services attacks and exploitation • Flash clients are running with risks
  • 9. Ajax Security – Attacks & Defense • Basics • Structures and streams • Fingerprinting • Scanning and Enumeration • XSS and CSRF issues • Securing code base
  • 10. Ajax basics • Asynchronous JavaScript and XML HTML / CSS Database / Resource JS / DOM XML / Middleware / Text XMLHttpRequest (XHR) Web Server Asynchronous over HTTP(S)
  • 11. Ajax - Sample function loadhtml() { var http; if(window.XMLHttpRequest){ http = new XMLHttpRequest(); }else if (window.ActiveXObject){ http=new ActiveXObject("Msxml2.XMLHTTP"); if (! http){ http=new ActiveXObject("Microsoft.XMLHTTP"); } } http.open("GET", "main.html", true); http.onreadystatechange = function() { if (http.readyState == 4) { var response = http.responseText; document.getElementById('main').innerHTML = response; } } http.send(null); }
  • 12. Ajax & Data structures • Ajax is using various data streams • Developers are innovating this field • JavaScript can talk with back end sources • Mashups application can be leveraged • It is important to understand these streams • It has significant security impact • JSON, Array, JS-Object etc.
  • 13. Cross-domain calls • Browser security doesn’t support cross domain calls • But cross domain callback with JavaScript is possible • This can be lethal attack since cross domain information get executed on the current DOM context. • Developers put proxy to bypass the SOP.
  • 14. Ajax fingerprinting • Determining Ajax calls • Framework fingerprinting • Running with what? – Atlas – GWT – Etc. • Ajaxfinger a tool to achieve this • Can help in assessment process • RIA finger printing is possible
  • 15. Ajax attack points • Ajax components & Widgets • Cross domain vulnerable browsers and callback implementations • DOM manipulation calls and points • Insecure eval() • HTML tags • Intranet nodes and internal resources
  • 16. Ajax attack vectors • Entry point scanning and enumeration • Cross site scripting (XSS) attacks • Cross site Request Forgery (CSRF) issues • Client side code reverse engineering • Security control and validation bypassing • Local privacy information enumeration • Ajax framework exploitation – known bugs
  • 17. Ajax Scanning • Scanning Ajax components • Retrieving all JS include files – Part of <SCRIPT SRC=….> • Identifying XHR calls • Grabbing function • Mapping function to DOM event • Scanning code for XSS – look for eval() and document.write()
  • 18. Ajax serialization issues • Ajax processing various information coming from server and third party sources. – XSS opportunities message = { from : "[email protected]", to : "[email protected]", subject : "I am fine", body : "Long message here", showsubject : function(){document.write(this.subject)} }; XSS
  • 19. Ajax serialization issues • JSON issues {"bookmarks":[{"Link":"www.example.com","D esc":"Interesting link"}]} • JS – Array manipulation new Array(“Laptop”, “Thinkpad”, “T60”, “Used”, “900$”, “It is great and I have used it for 2 years”)
  • 20. Ajax and JS manipulation • JavaScript exploitation – XSS • Identifying DOM points like document.write() • Eval() – another interesting point • Attack APIs and tools for exploitation • Lot can be done by an attacker from session hijacking to key loggers
  • 21. Ajax and RSS injection • RSS feeds are another entry point to the browser • Injecting script to the RSS feeds and Ajax call may execute it. • One click – Malformed linked injected into it and can lead to exploit “javascript:” • Leveraging events – onClick, onMouse etc.
  • 22. Ajax Crawling • Crawling Ajax driven app – a challenge • Resources are hidden in JavaScript • Simple scanner will fail • Crawling with actual DOM context • Automated crawling with browser is required • How?
  • 23. Defending Ajax • No business logic information on client side. • Do not trust third party source – filter it out • No direct cross domain call back • Filtering at browser level before processing information • Avoiding client side validation
  • 24. Defending Ajax • No secret in Ajax calls • Proper data structure selection and frameworks • Avoid client side validation • Securing client side calls like eval() and document.write() • HTML tags filtering before serving to end client
  • 25. Web Services – Attacks & Defense • Methodology • Footprinting & Discovery • Profiling and Enumeration • Scanning and Fuzzing • Attack vectors • Scanning code for vulnerabilities • Defense by filtering
  • 26. Methodology Insecure Web Services Blackbox Whitebox Footprinting & Discovery Enumeration & Profiling Code / Config Scanning Vulnerability Detection Defense Secure Coding & Countermeasure Web Services Firewall Secure Web Services
  • 27. Footprinting and Discovery • Objective: Discovering Web Services running on application domain. • Methods – Primary discovery • Crawling and spidering • Script analysis and page scrubbing • Traffic analysis – Secondary discovery • Search engine queries • UDDI scanning
  • 28. Primary Discovery • Crawling the application and mapping file extensions and directory structures, like “.asmx” • Page scrubbing – scanning for paths and resources in the pages, like atlas back end call to Web Services. • Recording traffic while browsing and spidering, look for XML based traffic – leads to XML-RPC, REST, SOAP, JSON calls.
  • 29. Primary Discovery - Demos • Page scanning with grep – Look in JavaScripts for URLs, Paths etc. • Crawling – Simple! • Scanning for Atlas references – Framework creates stubs and proxy. – scanweb2.0/scanatlas • Urlgrep can be used as well.
  • 30. Secondary Discovery • Searching UDDI server for Web Services running on particular domain. – Three tactics for it – business, services or tModel. • Running queries against search engines like Google or MSN with extra directives like “inurl” or “filetype” – Look for “asmx” • wsScanner – Discovery!
  • 31. Enumerating and Profiling • Scanning WSDL – Looking for Methods – Collecting In/Out parameters – Security implementations – Binding points – Method signature mapping
  • 32. Scanning strategies • Manual invocation and response analysis. • Dynamic proxy creation and scanning. • Auto auditing for various vectors. • Fuzzing Web Services streams – XML or JSON • Response analysis is the key – Look for fault code nodes – Enumerating fault strings – Dissecting XML message and finding bits – Hidden error messages in JSON
  • 33. Cross Site Scripting (XSS) • XSS is possible through Web Services. • It would be DOM based XSS via eval(). • JSON-RPC based stream coming in the browser and get injected into DOM. • Source of stream can be of third party and Un-trusted. • XML streams coming in the browser and can cause XSS via document.write call.
  • 34. Injection Flaws • Web Services methods are consuming parameters coming from end users. • It is possible to inject malicious characters into the stream. • It can break Web Services code and send faultsting back to an attacker • Various injections possible – SQL and XPATH
  • 35. Malicious File Execution • Malicious command can be injected through the parameter. • WS supports attachments as well and that can lead to uploading a file. • This can give remote command execution capability to the attacker.
  • 36. Insecure Direct Object Reference • Injecting characters to break file system sequences. • Faultcode spits out internal information if not protected. • Customized error shows the file refernces. • Access to internal file and full traversal to directories • Inspecting methods and parameters in the profile stage can help.
  • 37. Cross Site Request Forgery • CSRF with XML streams • XML-RPC or SOAP based request can be generated from browsers. • Splitting form and XML injection is possible – interesting trick. • If Content-Type is not validated on the server then it can cause a potential CSRF. • XForms usage in browser can produce XML requests to attack CSRF.
  • 38. Code Analysis for Web Services • Scanning the code base. • Identifying linkages. • Method signatures and inputs. • Looking for various patterns for SQL, LDAP, XPATH, File access etc. • Checking validation on them. • Code walking and tracing the base - Key
  • 39. Code filtering with IHTTPModule • Regular firewall will not work • Content filtering on HTTP will not work either since it is SOAP over HTTP/HTTPS • SOAP level filtering and monitoring would require • ISAPI level filtering is essential • SOAP content filtering through IHTTPModule
  • 40. HTTP Stack for .Net HttpRuntime HttpApplicationFactory Web Application Firewall & IDS HttpApplication IHttpModule HttpHandlerFactory Handler 148
  • 41. IHTTPModule for Web Services Firewall • Code walkthrough – Events and Hooks • Loading the DLL • Setting up the rules • Up and running! • Demo.