xss-100908063522-phpapp02

31
Cross Site Scripting (XSS) by Amit Tyagi

Upload: garland-neal

Post on 04-Oct-2015

214 views

Category:

Documents


0 download

DESCRIPTION

asdfdfsds

TRANSCRIPT

XSS

Cross Site Scripting (XSS)by Amit TyagiWhat is XSSCross Site ScriptingXSS is a vulnerability which when present in websites or web applications, allows malicious users (Hackers) to insert their client side code (normally JavaScript) in those web pages. When this malicious code along with the original webpage gets displayed in the web client (browsers like IE, Mozilla etc), allows Hackers to gain greater access of that page.

XSS (-ve) effects stealing other users cookies stealing their private information performing actions on behalf of other users redirecting to other websitesShowing ads in hidden IFRAMES and pop-ups How XSS worksWeb server gets data from web client (POST, GET, COOKIES etc) with the request. So a malicious User can include client side code snippets (JavaScript) into the data. For example : Amitalert (this site has been hacked) ;

XSS input

Note: This image has been created using Firebug and this XSS hole is not present in google.comXSS contd.Lets assume Web server performs no validation or filtration on this data.Now web server either saves this data + XSS code to some persistent storage (like database) or print this data back in the HTML.When this XSS code, comes from server along with HTML into the web client (Browser) and executes as servers own code, it gets access whole HTML document, page URL, cookies etc.

XSS ServerHackers Browserhttp request with XSS JavaScriptHackers Browserhttp response with XSS JavaScriptXSS output

Note: This image has been created using Firebug and this XSS hole is not present in google.comXSS vectors

Type of XSS attacksNon-persistentPersistentDOM Based

Non-persistentWhen XSS code only gets displayed in the next page to the same user and not gets saved into persistent storage like database. This type of attack is less vulnerable, because Hacker can see only their own cookies and can make modifications in their own current opened pages. The risk with these kinds of XSS holes is that it opens way for Cross Site Request Forgery CSRF. CSRF allows a hacker to place some links

Example : same as given previously to explain XSS

CSRFCross-site request forgery is a type of malicious exploit of a website whereby unauthorized commands are transmitted from a user that the website trusts. This can be done by placing some hidden links in some bad website.

for example :