π― TL;DR:
Typed <script>alert(1)</script> in a search box β clicked "Search" β π₯ JavaScript executed right in the browser.
Why? No sanitization, no encoding. Just pure DOM injection. Let's break it down π
πΈ Live Proof:


π§ What's This Lab About?
This PortSwigger lab is a classic example of Reflected Cross-Site Scripting (XSS) in its rawest form β where the app reflects your input directly into the HTML page without encoding or filtering.
π Step-by-Step Walkthrough:
β 1. Loaded the Lab
- Lab title: Reflected XSS into HTML context with nothing encoded
- Simple blog-style page with a search bar
β 2. Entered This Payload:
<script>alert(1)</script>Typed it directly into the search input box (not the URL bar)
β 3. Clicked "Search"
The payload was reflected back into the page's HTML π
β 4. Boom π£ β Alert Triggered
Browser treated the input as real JS and executed the alert. Congrats, you just popped an XSS! π
π₯ Why It Worked
- App didn't sanitize or encode input
- The HTML response inserted this:
<p>You searched for: <script>alert(1)</script></p><script>was parsed + executed as JS by the browser
Result? β Your script ran exactly as written π
π§ͺ Real-World Damage Potential:
This vulnerability might look basic, but it can lead to:
- Credential theft
- Session hijacking
- Full account takeover
- Self-replicating JS worms πͺ±
It's the kind of bug that bug bounty hunters dream about.
π How to Fix It:
- Escape all dynamic input reflected in HTML using proper libraries
- Sanitize any user input with tools like DOMPurify
- Implement Content Security Policy (CSP)
- Avoid using
.innerHTMLwhen.innerTextor.textContentwill do
β Final Thoughts
Sometimes the simplest payloads expose the biggest flaws.
This lab shows exactly why understanding basic XSS can give you an edge in CTFs, bug bounties, and even real-world pentests. Never overlook the classics π₯

π£ Follow Me β Let's Build Together π§ β‘
I'm building RootPwn to help others learn, grow, and pwn the web ethically.
π YouTube (Video Tutorials): https://www.youtube.com/@RootPwn
πΈ Instagram (Reels + Carousels): https://www.instagram.com/rootpwned/
βοΈ Medium (Walkthroughs): https://medium.com/@RootPwned
π» GitHub (Tools + Scripts): https://github.com/sumanth192
π¦ Twitter/X (Threads + Payloads): https://x.com/RootPwned
πΌ LinkedIn (Professional content): https://www.linkedin.com/in/rootpwned/
#XSS #ReflectedXSS #BugBounty #WebSecurity #EthicalHacking #PortSwigger #OWASPTop10 #CEH #RootPwn #CTF #TryHackMe #HackTheBox #JavaScriptInjection #CyberSecurity #SearchBoxHack