I'm trying to exploit a XSS Reflected vulnerability on DVWA, in order to steal cookies. Currently I managed to craft the following payload into an HTTP request that will redirect the victim to load and execute a php file
The following payload, if entered on search box will load a php file.
Therefore, I would like to embed this payload on a malicious page (that the victim will access). This is what the malicious page looks like.
When this malicious page is loaded by the user, a php file should be loaded in order to steal the cookie from the victim and then write it to a file. This is not happening despite of the fact that the payload is successfully echoed back to the victim's browser. I check this by printing the HTTP response and I looked for my payload. Here's a proof of concept. So despite of the payload was successfully delivered to the victim's browser the php file was not loaded.
This exploit will work if I load
cookie.php manually on browser or if I feed it to the search box directly on the vulnerable webserver, but this is cheating. So my first question is: Why php file is not loading if payload was successfully echoed back?
My second question is: suppose that I want to make this in a real lab scenario where I have two machines on the same virtual network.
192.168.56.102 is running web server and has the cookie grabber. Will the malicious page work if I only change the IP addresses? I mean...instead of localhost on port 81 change it to IP on port 81?
I kinda know that this probably would not work because if I do this:
It will not have a cookie assigned to it because this "question" is not addressed to my browser session but is instead to the server's IP.
Clearly, you can see that I'm almost there (and maybe a little lost) but I really can use some feedback on this. What do you think about it?