php-reverse-shell icon indicating copy to clipboard operation
php-reverse-shell copied to clipboard

Does the port need to be open?

Open Whip opened this issue 6 years ago • 4 comments

Hi. I'm trying this out on my own CentOS server. I used nmap to scan for open ports, I got this result:

Discovered open port 21/tcp on xxx.xx.xx.xxx
Discovered open port 143/tcp on xxx.xx.xx.xxx
Discovered open port 993/tcp on xxx.xx.xx.xxx
Discovered open port 110/tcp on xxx.xx.xx.xxx
Discovered open port 587/tcp on xxx.xx.xx.xxx
Discovered open port 995/tcp on xxx.xx.xx.xxx
Discovered open port 3306/tcp on xxx.xx.xx.xxx
Discovered open port 443/tcp on xxx.xx.xx.xxx
Discovered open port 25/tcp on xxx.xx.xx.xxx
Discovered open port 80/tcp on xxx.xx.xx.xxx
Discovered open port 465/tcp on xxx.xx.xx.xxx

Then I used netcat to listen to a port and modifed php file to communicate on that port and visited the url. Here's what I get for ports like 1234, 4444, etc.

WARNING: Failed to daemonise. This is quite common and not fatal.
Warning: fsockopen(): unable to connect to 198.46.87.211:4444 (Connection refused) in /home/xxxxxx/public_html/php-reverse-shell.php on line 100
Connection refused (111) 

And when I try an open port like 3306, I get this:

WARNING: Failed to daemonise. This is quite common and not fatal. Successfully opened reverse shell to 198.46.87.211:3306 ERROR: Shell connection terminated

But I'm not getting anything on netcat in either case. What am I doing wrong?

Whip avatar Jan 11 '19 07:01 Whip

you have to put IP of machine in which you start listener. It is just because of wrong IP. Thank you

ankit-kumar-jat avatar Jun 12 '20 04:06 ankit-kumar-jat

and you have to start listener first.

ankit-kumar-jat avatar Jun 12 '20 04:06 ankit-kumar-jat

im noob my friend can u tell me where i put the ip ?

ghost avatar Nov 23 '20 01:11 ghost

Line no. 49 in php-reverse-shell.php And you can change port in line no. 50

ankit-kumar-jat avatar Nov 23 '20 03:11 ankit-kumar-jat