XSS Question 08-10-2017, 06:20 AM
#1
Hey so i want to ask a question about XSS. I get XSS and the basic concept of it:
www.website.com/search.php?q=<script>alert(1)</script> <------ Okay, this injects javascript and brings up a alert box saying "1"
But my question is:
I was looking at this thing online and i saw this:
Now, by looking at that HTML, how can you understand WHY it is vulnerable to XSS? what makes this HTML vulnerable compared to a secure one?
OR is it with the php (For example in the code above 'search.php' that would tell you?)
If that makes sense, i want to know HOW and WHY it works, not how to do it.
www.website.com/search.php?q=<script>alert(1)</script> <------ Okay, this injects javascript and brings up a alert box saying "1"
But my question is:
I was looking at this thing online and i saw this:
Code:
$ Let's say this is how a simple, unsecured search function looks like:
content of index.html
<html>
<head>
<title>Google</title>
</head>
<body>
<form method="get" action="search.php">
Google:
<input type="text" name="search" size="20" />
<input type="submit" class="button" value="Submit" />
</form>
</body>
</html>Now, by looking at that HTML, how can you understand WHY it is vulnerable to XSS? what makes this HTML vulnerable compared to a secure one?
OR is it with the php (For example in the code above 'search.php' that would tell you?)
If that makes sense, i want to know HOW and WHY it works, not how to do it.

![[+]](https://sinister.li/images/modern/collapse_collapsed.png)










![[Image: 9H83e18.png]](https://i.imgur.com/9H83e18.png)