-
Notifications
You must be signed in to change notification settings - Fork 71
Piping code #74
Comments
What we could really do with is some tasty inotify stuff to log any file changes on the Honeypot and attribute in a log somewhere file changes that occurred during the session time period. Only problem is feeding these events to the HonSSH server is likely to require some agent or similar which could of course be detectable and potentially interesting to Mr Hacker. Having said that most of them run some automated payload retrieval and execution script so maybe they wouldn't notice it... |
Yes, its possible to install some type of monitoring software to do this. You are correct that the majority of the automated attacks never bother to look for monitoring agents or hidden kernel modules. The attackers that are looking for this type of software is the interesting ones. All of this is besides the point tho. The fact is that its possible to transfer files from a remote host to the honeypot, while using HonSSH as the proxy. It's probably possible to mitigate by setting |
If one is using docker, inotify could solve all the problems regarding honssh not being able to detect some file download mechanisms. AUFS storage driver: Starting with docker 1.10 the container id does not correspond to directory name anymore. But this one liner Using this combined with inotify would give everything needed to copy away modified and created files. Sure, this would not only include downloads but the more information the better ;) Example: I would be happy with that. It's IMHO better then not being able to catch the downloads + one can for example detect compromised binaries. Btrfs driver should also be kept in mind. Maybe just restricting that feature to aufs and btrfs would be enough for most installations. |
Using docker info the directory id can be retrieved without actually knowing the storage driver: Maybe using Combined one liner: |
@tnich would you mind having a look at https://github.com/bang-uin/honssh/commits/feature/fs_watch and telling me what you think about the inotify approach? |
The feature is now implemented for aufs, btrfs, overlay and overlay2 in this branch https://github.com/bang-uin/honssh/commits/feature/fs_watch Only IN_CREATE and IN_MODIFY are handled so created and modified files cannot be removed from the overlay directory. Also only files with size > 0 are copied to handle zeroing them out. Ideas are welcome! |
Btw, i suggest everyone to use overlay2 as it is damn fast 😄 |
@bang-uin You should make wiki pages for document your commits, how to use overlay2 and other things you could share 😉. |
These are just hints and infos for everyone who likes to test that branch. I'll create a wiki page if this branch gets at some point merged into the master. |
Discovered a "new" way in which an attacker can transfer files to the honeypot without HonSSH being able to detect or intercept the file.
This issue was only detected when the IDS started sending alerts about outbound SSH attacks.
The instance was not configured to send any email alerts, so i figured that someone had compromised the honeypot and downloaded some malware but, there was no entries in the downloads.log or any downloads directory in the sessions file structure. The only obvious thing was a EXEC session log, these are the entries that show the activity of the attacker
The only thing that raised a red flag was the size of the adv-log's, some of them were larger than 3 MB, after digging trough them i discovered the following strings
\xeaUPX!\xd8
UPX
\x7fELF\x01
ELF
Given the size of the adv-log's and the presence of these strings we can assume that the attacker used SSH to move binary files to the honeypot.
After a couple of tests i think i figured out how the attacker did this.
It's possible to pipe things from the local host into a SSH EXEC session.
echo "Test Test Test" | ssh -l derp 10.13.111.57 'cat - > /tmp/pipe_in_exec.txt'
This will pipe the output from the
echo
over SSH to/tmp/pipe_in_exec.txt
on10.13.111.57
. Given that this is possible, might it be that the attacker used a similar technique to transfer the file?Is this something that should be within the scope of HonSSH to catch/intercept/detect?
The text was updated successfully, but these errors were encountered: