Category: Cross-Site Scripting (XSS)
Difficulty: Apprentice
Vulnerability: Reflected Cross-Site Scripting
Tools Used: Burp Suite, Web Browser
Primary Technique: JavaScript Injection
Payload Used:
Impact: Arbitrary JavaScript execution in the victim's browser
Author's Note :
This lab demonstrates a reflected Cross-Site Scripting (XSS) vulnerability in the search functionality of a web application. The application reflects user-supplied input directly into the HTML response without proper encoding or sanitisation.
By injecting a JavaScript payload into the search field, we can execute arbitrary JavaScript in the victim's browser. In this lab, I used a simple "alert()" payload to confirm successful exploitation.
Lab Description
This lab demonstrate reflected XSS vulnerability in search field. you can add script to make pop alerts.
Explore the Application's
At the top, there's a search box
The search functionality is the key here — it takes your input and displays it back on the page
The search box is a classic location for reflected XSS because it echoes your search term back to show you what you searched for.
Craft the XSS Payload
Since HTML is being rendered, you can inject a
<script>alert(1)</script>
<script>alert(1)</script>
alert() (JavaScript Function).
'1' (String Argument).
(Closing HTML Tag).
This will:
Create a script tag
Execute the JavaScript alert(1) function
Show a popup box with the number 1
At the top of the page, you'll see a green banner: "Congratulations, you solved the lab!"
Conclusion:
This lab helped me understand how reflected XSS occurs when user input is inserted into an HTML response without proper output encoding.
It also demonstrated how attackers can inject and execute JavaScript through vulnerable input fields. Proper output encoding and input handling are essential to prevent this type of vulnerability.