Files
LLM_Engineering_OLD/week1/community-contributions/xss_vulnerable_example.html
gulsahdemiryurek 1ed52bfb81 Add files via upload
2025-07-10 15:56:40 +03:00

24 lines
653 B
HTML

<!-- xss_vulnerable.html -->
<!DOCTYPE html>
<html>
<head>
<title>XSS Vulnerability Example</title>
</head>
<body>
<h1>Leave a Comment</h1>
<form method="GET">
<input type="text" name="comment" placeholder="Enter your comment" />
<input type="submit" value="Submit" />
</form>
<h2>Your Comment:</h2>
<p>
<!-- Vulnerable: User input is printed directly without sanitization -->
<!-- Example attack: ?comment=<script>alert('xss')</script> -->
<script>
const params = new URLSearchParams(window.location.search);
document.write(params.get("comment"));
</script>
</p>
</body>
</html>