Transferring Files to Windows
Transferring files to Linux is usually pretty easy. We can use netcat
, wget
, or curl
, which most systems have as default. But windows does not have these tools.
FTP
Most windows machines have a ftp-client included. But we can't use it interactively since that most likely would kill our shell. So we have get around that. We can however run commands from a file. So what we want to do is to echo out the commands into a textfile. And then use that as our input to the ftp-client. Let me demonstrate.
On the compromised machine we echo out the following commands into a file
Then run this command to connect to the ftp
Of course you need to have a ftp-server configured with the user asshat and the password to mysecretpassword.
TFTP
Works by default on:
Windows XP
Windows 2003
A TFTP client is installed by default on windows machines up to Windows XP and Windows 2003. What is good about TFTP is that you can use it non-interactively. Which means less risk of losing your shell.
Kali has a TFTP server build in. You can server up some files with it like this
Now you can put stuff in /srv/tftp
and it will be served. Remember that TFTP used UDP. So if you run netstat
it will not show it as listening.
You can see it running like this
So now you can upload and download whatever from the windows-machine like this
If you like to test that the tftp-server is working you can test it from Linux, I don't think it has a non-interactive way.
I usually put all files I want to make available in /srv/tftp
If you want to make sure that the file was uploaded correct you can check in the syslog. Grep for the IP like this:
grep 192.168.1.101 /var/log/syslog
VBScript
Here is a good script to make a wget-clone in VB.
If it doesn't work try piping it through unix2dos before copying it.
You then execute the script like this:
PowerShell
This is how we can download a file using PowerShell. Remember since we only have a non-interactive shell we cannot start PowerShell.exe, because our shell can't handle that. But we can get around that by creaing a PowerShell-script and then executing the script:
Now we invoke it with this crazy syntax:
Debug.exe
This is a crazy technique that works on windows 32 bit machines. Basically the idea is to use the debug.exe
program. It is used to inspect binaries, like a debugger. But it can also rebuild them from hex. So the idea is that we take a binaries, like netcat
. And then disassemble it into hex, paste it into a file on the compromised machine, and then assemble it with debug.exe
.
Debug.exe
can only assemble 64 kb. So we need to use files smaller than that. We can use upx to compress it even more. So let's do that:
Now it only weights 29 kb. Perfect. So now let's disassemble it:
Now we just copy-past the text into our windows-shell. And it will automatically create a file called nc.exe
Last updated