A low-to-medium interaction SSH Honeypot with features to capture terminal activity and upload to asciinema.org
A SSH honeypot with rich features written in Go
You may find the pre-build packages for various platform on the release tab. If you find the platform you need is not on the list, you can follow the building procedure in the next section.
GO111MODULE=auto
:
go get -u github.com/mkishere/sshsyrup
cd ~/go/src/github.com/mkishere/sshsyrup
dep ensure
go build -ldflags "-s -w" -o sshsyrup ./cmd/syrup
go build -ldflags "-s -w" -o createfs ./cmd/createfs
GO111MODULE=on
:Currently building executable with GO111MODULE=on
is a bit tricky in Go 1.11 with module, here is how to do it if you want to leave module on:
git clone https://github.com/mkishere/sshsyrup/
go build -ldflags "-s -w" -o sshsyrup ./cmd/syrup
go build -ldflags "-s -w" -o createfs ./cmd/createfs
server:
addr: 0.0.0.0 # Host IP
port: 22 # Port listen to
allowRandomUser: false # Allow random user
speed: 0 # Connection max speed in kb/s
processDelay: 0 # Artifical delay after server returns responses in ms
timeout: 0 # Connection timeout, 0 for none
Prepare the virtual filesystem image by downloading the filesystem.zip from master branch or create your own by running
./createfs -p / -o filesystem.zip
Since we’ll need to read every file from the directory, it will take some time to load.
For Windows, since there are no user/group information, the file/directory owner will always be root.
Alternatively, you can create your own image file by using zip
in Linux (or any compatible zip utility file that is capable preserving uid/gid, symbolic links and timestamps in zip file). After all the image created is a standard zip file. Theoretically you can zip your entire filesystem into a zip file and hosted in Syrup, but remember to exclude sensitive files like /etc/passwd
Prepare user and passwd file
Put passwd and group file in the same directory as config.json. The format of both files are the same as their real-life counterpart in /etc, except that passwd also stores the password in the second field of each line, and asterisk(*) in password field can be used to denote matching any password.
ssh-keygen -t rsa
./sshsyrup
A Docker image based on the latest build:
docker pull mkishere/sshsyrup
By default the internal sshsyrup listens on 22.
docker run -d mkishere/sshsyrup
The following example shows how you can customize stuff while running Syrup in container:
docker run -d -p 9999:22 \
-v /path/to/vfs/image.zip:/filesystem.zip \
-v /path/to/config.yaml:/config.yaml \
-v /path/to/logfiles:/logs \
-v /path/to/group:/group \
-v /path/to/passwd:/passwd \
-v /path/to/private_key:/id_rsa \
-v /path/to/commands.txt:/commands.txt \
-v /path/to/command_output:/cmdOutput \
mkishere/sshsyrup
But you may want to map to port 22 to make your honeypot easier to find.
If you want to see what happens (logs) in the Docker instance, get the instance id (docker ps
) and then
run docker logs -f YOUR_INSTANCE_ID
.
Check out config.yaml
By default Syrup will create a logging file in logs/ directory with file name activity.log in JSON format.
Please note that Syrup will no longer append dates to log files. Use a proper log rotation tool (e.g. logrotate) to do the work.
Also, each terminal session (the shell) will be logged into a separate file under logs/sessions in asciinema v2 format.
Syrup comes with a framework that helps to implement command easier. By implementing the Command interface you can create your own command and being executed by intruders connecting to your honeypot. For more details refer to the wiki.
If your command prints static output every time, you can put the output in cmdOutput/, and Syrup will print that when client type the command in terminal.
Feel free to submit feature request/bug report via the GitHub issue tracker.
For submitting PR, do the following steps:
It is advised that creating an issue to discuss the matter in advance if your change is large :)