Miscellaneous File Transfer Methods
File Transfer with Netcat and Ncat
NCat is the NMap updated and maintained verison of the original Netcat (not maintained anymore)
Target Machine
If the compromised machine is using Ncat, we'll need to specify --recv-only
to close the connection once the file transfer is finished.
Attack machine
By utilizing Ncat on our attacking host, we can opt for --send-only
rather than -q
. The --send-only
flag, when used in both connect and listen modes, prompts Ncat to terminate once its input is exhausted. Typically, Ncat would continue running until the network connection is closed, as the remote side may transmit additional data. However, with --send-only
, there is no need to anticipate further incoming information.
Attack Host - Sending File as Input to Netcat
Target - Connect to Netcat to Receive the File
Target - Connecting to Netcat Using /dev/tcp to Receive the File
PowerShell Session File Transfer
We already talk about doing file transfers with PowerShell, but there may be scenarios where HTTP, HTTPS, or SMB are unavailable. If that's the case, we can use PowerShell Remoting, aka WinRM, to perform file transfer operations.
PowerShell Remoting allows us to execute scripts or commands on a remote computer using PowerShell sessions. Administrators commonly use PowerShell Remoting to manage remote computers in a network, and we can also use it for file transfer operations. By default, enabling PowerShell remoting creates both an HTTP and an HTTPS listener. The listeners run on default ports TCP/5985 for HTTP and TCP/5986 for HTTPS.
To create a PowerShell Remoting session on a remote computer, we will need administrative access, be a member of the Remote Management Users
group, or have explicit permissions for PowerShell Remoting in the session configuration.
From DC01 - Confirm WinRM port TCP 5985 is Open on DATABASE01.
Create a PowerShell Remoting Session to DATABASE01
Copy samplefile.txt from our Localhost to the DATABASE01 Session
Copy DATABASE.txt from DATABASE01 Session to our Localhost
RDP
Mounting a Linux Folder Using rdesktop
Mounting a Linux Folder Using xfreerdp
Windows
Native mstsc.exe remote desktop client can be used
Last updated