I need to find a XSS and propose a solution in the following code:
<form action="#" method="post"> <input type="hidden" name="id" value="<?=$id?>"><br> <textarea name="body"><?=$text?></textarea><br> <input type="submit" value="Send"><br> </form><br>
This is part of a message board. The submit will store the message in a database and then there is another function which reads this DB and copy the content of the register without sanitize it, so whatever I put in $text will be executed, hence vulnerable to XSS. I have added prior to that this line
$text = htmlspecialchars($text);, but it's not escaping the string, so then again the script it's getting executed.
Also, the $id is vulnerable as well, isn't it? How could I exploit it? Because I've been trying but no luck.