php reverse shell connection refused(111)

I’m noob here and trying to complete starting point machines.
when I try to trigger reverse shell that I uploaded it say
"WARNING: Failed to daemonise. This is quite common and not fatal.
Connection refused (111)

I tried most of methods that I found on internet but no luck yet.
Hope you’ll help.

1 Like

have you checked the IP in the code of the reverse shell?
have you a listening server prepared to receive the connection from your reverse shell?

1 Like

yep. I add correct IP address and port before upload the shell.php. I think I have a problem in listening port.

nc -lvnp [port]

Everytime it gives me no respond. netcat sys “listening to port” but gives me no respond.

Maybe someone overwrote your shell. Try to give uniq name.
Run listener, than open shell script.

I tried that too. I think the error is in netcat listening step. Is there any way to check that the ‘nc’ listening service is working fine…?
Thanks

You need to be sure your netcat listener is active on the same port as specified by your reverse shell before you ‘activate’ your shell

a3n3a I did that too dude. But I don’t know what is wrong. ‘nc’ gives me no respond. I think that the reverse shell is working correctly. Bcoz when I call the shell using ‘curl’ it gives me ‘connection refused’ message.

It is also possible that a firewall rule is blocking the port, this might help.

I was getting the same Connection Refused(111) problem for the Oopsie machine. Looking at this post, I tried opening that port. I still was getting the same error. In the walkthrough, the order shown is first run the curl command and then nc -lvnp 1234, but to make it work, it needs to run first netcat in shell and then curl in another. Now, it works fine.

Though the error was the same before and after ufw command, port still needs to be open.

I hope you can fix it this way.

EDIT:
I should have read better, but in the same discussion, SalahEo solves it with a much better explanation but in my case I still needed to open the listening port.

Run nc as sudo solved it for me.

$ sudo nc -lvvp [PORT]

same problem, nothing helped.
Throught a script:
Listening on 0.0.0.0 4444
WARNING: Failed to daemonise. This is quite common and not fatal.
Connection refused (111)

Throught a nc:
sudo nc -lvnp 4444
Listening on 0.0.0.0 4444

It just stop working… firewall is disabled

I had the same issue, I resolved it by making the listening port in my reverse shell php code, the port my nc -lvpn code was calling. So, the two numbers you change should be the $ip and $port, the $ip should be your given IP (the IP your machine is given in this instance) and the $port should be whatever port nc -lvpn is listening on.