This article explores Cross-site scripting (XSS) from Basic to Advanced, including real-world web application pen-testing perspective and practical examples of All PortSwigger labs.
So will start discussing it from the very beginning.
What is Cross-site scripting (XSS)?
Labs that we will solve
Type Of Cross-site scripting (XSS) we gonna learn! [In the next Articles]
- Reflected XSS (each of every lab with deep explanation and solutions).
- DOM XSS (each of every lab with deep explanations and solutions).
- Stored XSS (each of every lab with deep explanations and solutions).
- Exploiting cross-site scripting to steal cookies (BONUS).
- Exploiting cross-site scripting to capture passwords (BONUS).
- Exploiting XSS to perform CSRF (BONUS).
NOTE:- This type of XSS here we’ve mentioned, will teach you in the next articles step-by-step with full definition and explanation. So stay tuned 🙂
Reflected XSS into HTML context with nothing encoded
So, we are starting to solve the PortSwigger labs, and the first lab we have is ‘Reflected XSS into HTML context with nothing encoded’.
Take a look at the description of what to do in this lab for a better understanding.
Here you can clearly see that for solving the lab you’ve to contain a sample of reflected cross-site scripting vulnerability in the search functionality an attack that calls the
Let’s ‘Acess the lab’ and see what next to do.
So take a look, guys you can see as the lab description mentioned we’ve search functionality (search box) to attack or to perform the cross-site scripting (XSS).
If you guys know about basic HTML then before performing XSS payload for ‘Reflected XSS’ can check by putting a simple h1 tag that it is applicable or not.
<h1> #novaexperience </h1>
So, write it manually or you can copy from here and paste it into the (search box) and press the ‘ENTER’ button.
Seems, it’s applicable for ‘Reflected XSS’. Right?
To confirm it you can see the ‘view-source’ and find where the h1 tag we’ve pushed.
Here we go, it’s applicable for ‘Reflected XSS’ to solve this lab.
So it’s time to push the payload.
Simply copy it or type manually and paste it to (search box) and press the ‘ENTER’ button.
BOOM! Here we’ve successfully solved the lab.
#To a better understanding, you can again check the ‘view-source’ and see why it’s ‘Reflected’.
Thank you for reading, if this article (Cross-site scripting (XSS) from Basic to Advanced. Be ready for its other parts) really helps you then do share it with your mates.
And follow @masaudsec on Twitter.
Website security refers to protecting a website or web application from cyberattacks, unauthorized access, or other security threats.
Web application security means protecting a website from cyberattacks. These attacks may include vulnerabilities such as SQL injection, XSS, file inclusion, and others.
It is always a good practice to use an up-to-date browser with timely updates. Keep your browser plugins up-to-date, avoid malicious websites and links, and always enable 2-factor authentication while avoiding clickjacking.
Searching for someone’s social security number or credit card information on the dark web is illegal and unethical. It is important to always avoid such activities and protect yourself and others from cyber threats.