XSS Flashcards
What are the 3 types of XSS?
Reflected
Stored
Dom-based
What is reflected XSS?
When an application recieves data in a HTTP request and includes that data within the immediate response in an unsafe way
What is stored XSS?
When an application recieves data from an untrusted source and includes that data within its later response in an unsafe way
What is Dom-base xss?
When an application contains some client-side Javascript that processes data from an untrusted source in an unsafe way, usually by writting the data back into the dom
What is XSS used for?
- impersonate as the victim user
- carry out any actions the user is able to perform
- read any data the user is able to access
- capture the users login creds
- perform virtual defacement of the web site
- inject trojan functionalities into the web site
How can XSS vulnerabilites be prevented?
- Filter/ sanatise input on arrival
- encode data on output
- use appropriate response headers
- content security policy
What areas of a web app do you test for reflected XSS?
- every entry point for data
How do you test for reflected XSS?
1) submit random alphanumeric values into each entry point - to determine if the value is reflected in the response.
2) determine the reflection context - what is the location of the reflected value? Is it quoted within a javascript string?
3) test a candidate payload that will trigger Javascript execution if it is reflected unmodified within the response
4) test alternative payloads - if it was blocked or modified then try different payloads
5) test the attack in a browser - if one works in burp try it on the webpage.
What is a simple Javascript to use in a reflected XSS attack that would trigger a visible pop-up?
‘alert(document.domain)’
What carrying out a stored XSS where are some areas that could be poteitnally vulnerable?
- comments section
- user nicknames in a chat room
- contact detials on a customer order
If vulnerable to storded XSS where might you recieve data from untrusted sources?
- a wemail application displaying messages recieved over SMTP
- a marketing application displaying social media posts
- a network monitoring application displaying packet dats from network traffic.
What string could you input to test if a webapp is vulnerable to stored XSs?
alert(1) or <><img></img>.src=1.onerror.=.alert(1)>
What is a Content Security Policy
A browser mechanism that aims to mitigate the impact of cross-site scripting and some other vulnerabilities.
When testing or a stored XSS vulnerabilitry what entry points might you test?
- parameters or other data within the URL query string and message body
- the URL file path
HTTP request headers that might not be exploitable - any out-of-band routes via which an atacker can deliver data into the application.
How does a content security policy work?
If an app that employs a CSP contains XXS-like behaviour, then the CSP might hinder or preventexploitation of the vulnerability.
Often the CSP can be circumvented (worked around) to enable exploitation of the underlying vulnerability