Wednesday, August 23, 2017

RawCopy sending output on TCP securely

Fixed a few bugs in the TcpSend option of RawCopy, and thought it would be a good opportunity to explain how it can be used to send output securely.

The implementation of the TcpSend option is very basic. It merely open a tcp socket and send the data on the wire to the destination. Obviously this is not secure because the data is sent unencrypted in plaintext. Now there are a few options available for using that feature in a secure way. The following examples are all based on the assumption that you have a ssh server endpoint available. This way we can transfer the files securely through a SSH tunnel.



In all examples we use local port 6666 and remote port 7777 at the tunnel endpoints. That is, we use port 6666 on the RawCopy part and port 7777 on the remote netcat (or similar) part. For RawCopy we will thus use a command like this;


The remote netcat command would then be something like this;
nc -l -p 7777 >logfile.bin

For the creation of the encrypted tunnel:

Putty

Configure a regular ssh connection and specify local and remote destination in the tunnel options like this;

Now there's not yet any listening end, so open netcat inside the putty shell to receive the file from rawcopy;


Plink

This is the command line equivalent of putty that. Logic is still the same. Create the tunnel by plink command like this;


And use netcat in the shell as with putty.

OpenSSH

We will use the ssh client of Microsoft's Win32-OpenSSH, which is a fork of OpenSSH. This time we will nest all commands together in one command so that it could be suited for scripting. In short we will add the remote netcat command into the ssh command like this;


That would be much better with automation.

2 comments:


  1. This is a brilliant blog! I'm very happy with the comments!..
    original post here

    ReplyDelete
  2. Excellent to be visiting your blog again, it has been months for me. Rightly, this article that I've been served for therefore long. I want this article to finish my assignment within the faculty, and it has the same topic together with your article. Thanks for the ton of valuable help, nice share. BinaryToday

    ReplyDelete