>SECURING 0%

Web Security Lab

Intermediate
Lab Progress
1

XSS Vulnerability Detection

xss-detection

2

SQL Injection Basics

sql-injection

3

CSRF Protection

csrf-protection

4

Secure Authentication

secure-auth

5

Content Security Policy

csp-implementation

Overall Progress
0 / 5 completed
1XSS Vulnerability Detection
ACTIVE

Challenge Description

Learn to identify and exploit Cross-Site Scripting (XSS) vulnerabilities in web applications.

Example Vulnerable Code


// Vulnerable code:
function displayUserComment(comment) {
  document.getElementById('comments').innerHTML += comment;
}

// Secure code:
function displayUserComment(comment) {
  const sanitized = DOMPurify.sanitize(comment);
  document.getElementById('comments').innerHTML += sanitized;
}

Enter Flag to Complete Challenge