The ๐๐๐ซ๐ข๐ฉ๐ญ๐ข๐ง๐ part indicates, obviously, scripting, so we can think about what kind of scripting we know exist in Web Apps: HTML & JavaScript being the 2 most common.
Secondly, XSS is part of the INJECTION bug class (see @owasp's Top 10)
So, we now know XSS consists of injecting scripts in websites.
Types of XSS:
1. Reflected 2. Stored 3. DOM-based
They can also be Blind too (you don't see the reflection)
As this thread is aimed at beginners, I will focus on the first 2 as they're easier to understand at first
Let's find out more:
XSS solely depends on reflection of user input(or other inputs) meaning you input something, and it reflects on the page/source code OR somewhere else on the back-end (in which case it's Blind XSS)
User input is carried mostly by parameters in a request
Let's differentiate Reflected and Stored XSS:
Reflected - most common XSS type, happens when loading a URL with a vulnerable parameter that reflects on the page based on its value
Stored - happens in data that's stored on the page/server, such as username, comment, posts, etc.
Similar to SQL Injection, you achieve XSS by injecting scripts, and them reflecting onto the page and getting executed in the browser.
A basic XSS payload looks like this: <script>alert(1)</script>
This calls the <script> tag, and executes alert(), which will pop up an alert box
1๏ธโฃ Reflected XSS
As mentioned before, this XSS is delivered via a URL and executes upon loading the page.
The XSS payload is delivered through a vulnerable parameter that we were able to inject valid HTML scripts that reflect successfully.
Again, this type of XSS is called stored because the payload gets stored on the page indefinitely (or until we change/delete it), and anytime someone accesses the page, it will execute.
In order to know what which user role can do, you have to know your target well.
If documentations are available, make full use of them, if not, use the app as much as you can from the perspective of each user role (have a different account for each role)
Anywhere you see user input is reflected in the response (not limited to what you see on the page, it could be in source code/HTTP response only), note the location/parameter down, that's a potential attack vector.