Vulnerable test sites to test your XSS skills: Hands-on AppSec

Understanding how cross-site scripting vulnerabilities are exploited is essential for developers and security testers. This guide highlights the top intentionally vulnerable websites and platforms where you can practice XSS attacks in a controlled environment, reinforcing secure coding habits and penetration testing skills.

Vulnerable test sites to test your XSS skills: Hands-on AppSec

Cross-site scripting (XSS) vulnerabilities remain a critical security risk for web applications. Understanding how to identify and mitigate these threats is essential for developers and security testers alike. One of the most effective ways to build pentesting chops and secure coding habits is by practicing in controlled environments that simulate real-world attack vectors. By testing XSS payloads on intentionally vulnerable sites, you can observe how XSS attacks work and legally hone your offensive skills (and defensive awareness) without asking for permission or causing any harm.

Why testing for XSS matters

XSS flaws allow malicious code to execute in a victim’s browser, enabling attackers to steal sensitive data, hijack sessions, or launch phishing attacks. These vulnerabilities often stem from insufficient input validation and improper sanitization of user-supplied content. Testing for XSS enhances your ability to detect these security vulnerabilities early, reinforcing best practices like secure parameter handling, proper encoding, and content security policy (CSP) enforcement. Using a vulnerability scanner can help identify these issues much faster in both client-side and server-side code.

To help sharpen your skills or test your tools, here’s a curated list of free platforms designed for practicing XSS exploitation and other common web attacks.

Vulnerable sites for learning XSS testing

The resources below fall into three main categories: XSS-specific challenges, more extensive security learning platforms, and vulnerable test environments that can be used both to hone your skills and to test your tools.

1. Google XSS Game

Google’s XSS Game is an interactive, browser-based training tool featuring six increasingly difficult challenges. Each level requires users to craft an XSS payload that triggers an alert in the user’s browser, demonstrating how attackers manipulate input fields, event handlers, and JavaScript execution. The game’s progressive difficulty makes it an excellent starting point for beginners who want a fun and engaging way to learn about XSS. The challenges also touch on CSS-based injection attacks and web browser security mechanisms.

2. alert(1) to win XSS Challenge

A well-known online challenge series dedicated entirely to XSS, alert(1) to win presents users with progressively complex tasks that require executing JavaScript payloads under restrictive conditions. Challenges include bypassing filtering mechanisms, injecting scripts via iframe-based techniques, and exploiting img src tags to execute malicious code. The challenge format encourages creative problem-solving and helps users understand how XSS payloads can be obfuscated to bypass security measures and evade XSS filters.

3. OWASP Juice Shop

An open-source web application intentionally designed to include numerous security vulnerabilities, OWASP Juice Shop is one of the most comprehensive platforms for learning web application security. Covering all types of XSS, from basic script injections to advanced DOM-based attacks, it provides real-world scenarios in a controlled environment. The platform runs on Node.js and supports penetration testing with client-side and server-side vulnerabilities. It also allows users to analyze how improperly sanitized source code can introduce risks.

4. HackThisSite

A community-driven platform offering a mix of web security challenges and real-world hacking simulations, HackThisSite includes missions where discovering and exploiting XSS vulnerabilities is a key objective. Many exercises involve bypassing JavaScript-based input restrictions, evading sanitization filters, and injecting scripts into insecure HTML code. The site encourages collaborative learning, with discussion forums where users can share insights and techniques (without providing outright solutions). It also highlights social engineering tactics that leverage XSS exploits.

5. PortSwigger Web Security Academy

Developed by the creators of Burp Suite, this online training platform provides a structured learning path with interactive labs covering various security topics, including over 30 XSS challenges. Users can practice injecting payloads, bypassing input filters, and understanding JavaScript code execution. The hands-on nature of the labs allows security professionals to test different attack vectors and defenses, making it a valuable resource for both beginners and experienced testers. The academy provides an XSS cheat sheet that helps users understand common payloads and their effects.

6. Damn Vulnerable Web Application (DVWA)

DVWA is a PHP-based vulnerable website specifically built to be insecure, providing an ideal environment for testing XSS, SQL injection, and other web vulnerabilities. The application offers multiple security levels, allowing users to start with unrestricted HTML code and JavaScript execution before progressing to more challenging settings with enhanced validation mechanisms. This progressive difficulty approach helps users understand how security measures impact attack success rates.

DVWA is not hosted online, so you need to deploy it in a test environment first, typically in a virtual machine (and never in a production environment because the app is, obviously, damn vulnerable).

7. bWAPP (Buggy Web Application)

bWAPP is another open-source, deliberately vulnerable web application designed for security training. Featuring over 100 vulnerabilities, it offers a deep dive into web security, including XSS, API security flaws, and cross-site request forgery. It allows users to test persistent XSS scenarios where injected scripts execute each time a user loads the web page. Its flexibility and breadth make it a great tool for both beginners and advanced security practitioners.

8. OWASP WebGoat

A structured, lesson-based training platform, WebGoat provides guided tutorials on a range of security vulnerabilities, including multiple XSS challenges. Users learn by injecting client-side scripts, bypassing validation mechanisms, and exploiting browser vulnerabilities. Unlike free-form testing platforms, WebGoat presents real-world security flaws with step-by-step instructions, making it particularly useful for those who prefer a structured learning experience. It also explores how XSS filters and security headers like CSP can help mitigate risks.

WebGoat is not hosted online, so you need to deploy it in a test environment first, typically in a virtual machine.

9. Acunetix VulnWeb

Provided by Acunetix by Invicti, VulnWeb is a collection of intentionally insecure web applications designed for testing security tools and manual exploitation. Unlike lab-based platforms, these live test sites simulate real-world applications, allowing users to practice finding and exploiting cross-site scripting vulnerabilities in realistic environments. Security researchers can analyze how modern defenses interact with various attack vectors and refine their testing skills accordingly. The platform also covers how malware can spread through XSS attacks.

Invicti also provides another set of vulnerable web applications for testing at TestInvicti.

Conclusion

Practicing XSS in safe environments equips developers and security professionals with hands-on experience in identifying and mitigating these security vulnerabilities. Understanding how attackers manipulate HTML tags, iframe injections, and HTTP request parameters helps reinforce secure coding techniques.

Regular engagement with these platforms not only enhances your penetration testing skills but also ensures you stay ahead of evolving attack vectors. Ethical hacking in a controlled environment fosters a proactive cybersecurity mindset to ensure that defensive strategies are effectively implemented, from CSP enforcement to API input validation.

With these resources, you can develop a stronger understanding of how cross-site scripting attacks work and how to protect applications against them. Happy ethical hacking!

Frequently asked questions about learning XSS

What is cross-site scripting (XSS)?

Cross-site scripting (XSS) is a security vulnerability that allows attackers to inject and execute malicious JavaScript code in a user’s browser. This can lead to session hijacking, phishing attacks, malware distribution, or data theft.

What are the different types of XSS?

There are three main kinds of XSS. Reflected (non-persistent) XSS happens when the script is directly included in an HTTP request and reflected back in the response, executing in the victim’s browser. Stored (persistent) XSS is when the malicious script is saved on the web server and executed when a user accesses the affected page. DOM-based XSS only runs in the user’s browser and allows the script to manipulate the Document Object Model of the open page without any server-side interaction.

Is it legal to practice XSS attacks?

Performing XSS and other cyberattacks, even if you’re just practicing, is only legal on intentionally vulnerable test environments or when you have the site owner’s permission. Attempting attacks against any live website or application without permission is illegal and may be a criminal act, depending on your jurisdiction.

How can developers defend against XSS?

The best way to prevent XSS attacks is to eliminate script injection vulnerabilities through input validation and sanitization, output encoding, and using XSS-safe libraries and application frameworks. Every web application should also run with carefully defined Content Security Policy (CSP) headers to set restrictions on permitted content and script sources.

How do I get started with XSS security testing?

Start by exploring gamified challenges created specifically for XSS, like Google’s XSS Game or alert(1) to win. Next, move on to broader security exercises with sites like HackThisSite and TryHackMe, and set up your own VMs with vulnerable environments like WebGoat and DVWA.

About the Author

Jesse Neubert

Data Scientist and Contributing Author