• Stars
    star
    219
  • Rank 181,133 (Top 4 %)
  • Language
    Rust
  • License
    Do What The F*ck ...
  • Created over 1 year ago
  • Updated 9 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

🧸 fully isolated honeypot ssh server using thrussh

pisshoff

A very simple SSH server using thrussh that exposes mocked versions of a bash shell, some commands and SSH subsystems to act as a honeypot for would-be crackers.

All actions undertaken on the connection by the client are recorded in JSON format in an audit log file.

What does the server expose?

Commands

  • echo
  • exit
  • ls
  • pwd
  • scp
  • uname
  • whoami

Subsystems

  • shell
  • sftp

How?

None of the commands or utilities shell out or otherwise interact with your operating system, you can essentially consider the honeypot "airgapped". Although for all intents and purposes it feels like you're connecting to an actual server, you're actually interacting with very simple partial reimplementations of common commands and utilities that don't do anything but return the expected output and write to an audit log.

Example

$ ssh [email protected]
bash-5.1$ pwd
/root
bash-5.1$ echo test
test
bash-5.1$ uname -a
Linux cd5079c0d642 5.15.49 #1 SMP PREEMPT Tue Sep 13 07:51:32 UTC 2022 x86_64 GNU/Linux
bash-5.1$ whoami
root
bash-5.1$ exit
$ echo test > test
$ scp test [email protected]:test
([email protected]) Password:
test                                                                                                      100%    5     0.1KB/s   00:00
$ cat audit.log | tail -n 2 | jq
{
  "connection_id": "464d87c9-e8fc-4d24-ab6f-34ee67b094f5",
  "ts": "2023-08-10T20:46:09.837165036Z",
  "peer_address": "127.0.0.1:31732",
  "host": "my-cool-honeypot.dev",
  "environment_variables": [
    ["LC_TERMINAL_VERSION", "4.5.20"],
    ["LANG", "en_GB.UTF-8"],
    ["LC_TERMINAL", "iTerm2"]
  ],
  "events": [
    {
      "start_offset": {
        "secs": 1,
        "nanos": 362803172
      },
      "action": {
        "type": "login-attempt",
        "credential-type": "public-key",
        "kind": "ssh-ed25519",
        "fingerprint": "AAAAC3NzaC1lZDI1NTE5AAAAIK3kwN10QmXsnt7jlZ7mYWXdwjfBmgK3fIp5rji"
      }
    },
    {
      "start_offset": {
        "secs": 7,
        "nanos": 85973767
      },
      "action": {
        "type": "login-attempt",
        "credential-type": "username-password",
        "username": "root",
        "password": "root"
      }
    },
    {
      "start_offset": {
        "secs": 7,
        "nanos": 190169895
      },
      "action": {
        "type": "shell-requested"
      }
    },
    {
      "start_offset": {
        "secs": 11,
        "nanos": 153124524
      },
      "action": {
        "type": "exec-command",
        "args": ["pwd"]
      }
    },
    {
      "start_offset": {
        "secs": 14,
        "nanos": 342192712
      },
      "action": {
        "type": "exec-command",
        "args": ["echo", "test"]
      }
    },
    {
      "start_offset": {
        "secs": 63,
        "nanos": 599852779
      },
      "action": {
        "type": "exec-command",
        "args": ["uname", "-a"]
      }
    },
    {
      "start_offset": {
        "secs": 67,
        "nanos": 368327325
      },
      "action": {
        "type": "exec-command",
        "args": ["whoami"]
      }
    },
    {
      "start_offset": {
        "secs": 166,
        "nanos": 208707438
      },
      "action": {
        "type": "exec-command",
        "args": ["exit"]
      }
    }
  ]
}
{
  "...": "...",
  "events": [
    "...",
    {
      "start_offset": {
        "secs": 4,
        "nanos": 196898172
      },
      "action": {
        "type": "subsystem-request",
        "name": "sftp"
      }
    },
    {
      "start_offset": {
        "secs": 4,
        "nanos": 404745407
      },
      "action": {
        "type": "write-file",
        "path": "test",
        "content": [116, 101, 115, 116, 10] // test
      }
    }
  ]
}

Running the server

From source

An example configuration is provided within the repository, running the server is as simple as building the binary using cargo build --release and calling ./pisshoff-server -c config.toml.

NixOS

Running pisshoff on NixOS is extremely simple, simply import the module into your flake.nix and use the provided service:

{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05";

    pisshoff = {
      url = "github:w4/pisshoff";
      inputs.nixpkgs = "nixpkgs";
    };
  };

  outputs = { nixpkgs, ... }: {
    nixosConfigurations.mySystem = nixpkgs.lib.nixosSystem {
      modules = [
        pisshoff.nixosModules.default
        {
          services.pisshoff = {
            enable = true;
            settings = {
              listen-address = "127.0.0.1:2233";
              access-probability = "0.2";
              audit-output-file = "/var/log/pisshoff/audit.jsonl";
            };
          };
        }
        ...
      ];
    };
  };
}

Docker

Running pisshoff in Docker is also simple:

$ docker run -d --name pisshoff ghcr.io/w4/pisshoff:master
$ docker exec -it pisshoff tail -f audit.jsonl

More Repositories

1

bin

🗑️ a paste bin.
Rust
395
star
2

chartered

✈️ a private, authenticated, permissioned cargo registry
Rust
129
star
3

gitlab-cargo-shim

🦀 Say goodbye to your Git dependencies, host a Cargo registry using the GitLab package repository
Rust
76
star
4

rgit

🏯 a gitweb interface written in rust
Rust
73
star
5

sonos.rs

🔈 Sonos controller library written in Rust
Rust
26
star
6

warpwallet-cracker

🔓 An extremely basic (and slow) POC for bruteforcing WarpWallet addresses
Java
6
star
7

shalom

🏠 wip home assistant tablet ui
Rust
5
star
8

stork

🐦 Scrapes a given source for all links without making a mess of your pots and pans
Rust
5
star
9

kpjs

🔒 Firefox addon POC for GPG signed JavaScript using Keybase
TypeScript
4
star
10

reaper

🎮 League of Legends mass summoner name checker.
Rust
3
star
11

serde_prometheus

📟 serde-based serializer for prometheus' text-based exposition format
Rust
3
star
12

sonos-cli

🔊 Simplistic, user- (and computer-) friendly command line interface for your Sonos speakers
Rust
3
star
13

shorty

🩳 single parameter s3 file uploader/url shortener
Rust
2
star
14

dave

🤖 A multipurpose robot written for any protocol supporting twisted.words
Python
2
star
15

dobble

🎶 scrobble using dobble from dbus dingus
Rust
2
star
16

nom-bytes

👹 take a nom of your bytes::Bytes
Rust
1
star
17

1p

✴️ user-friendly op (1password cli) frontend
Rust
1
star
18

dotfiles

⏺ ...nothing interesting really
Shell
1
star
19

memrise-answerer

❓ Answers Memrise questions automatically for you
JavaScript
1
star
20

twitter-undeleter

🗑 Code for the https://twitter.com/undeletebot bot.
Python
1
star
21

blocks.ls

🧱 blockchain explorer
Rust
1
star
22

mcinject

🧱 Perhaps the earliest (surviving) forayer into the dark arts that were bytecode manipulation-based Minecraft cheating clients (for fun and destruction) c. 2013
Java
1
star
23

titan-emu

🖥 An emulator for Marc Cleave's Homebrew TTL processor
Java
1
star
24

serde_bson

0️⃣1️⃣ like `bson` but faster
Rust
1
star
25

scoped-vec.rs

🔭 Scoped vectors for Rust, allowing child vectors to be read from and parents to be dropped when needed
Rust
1
star
26

xirc

🌉 Easy to configure XMPP↔IRC bridge.
Python
1
star
27

zpan

🎵 Radio DJ management panel with vBulletin integration, book time in to DJ, host events and take requests from your listeners.
PHP
1
star
28

yrs-kafka

✍️ Yrs synchronisation and persistence using RocksDB & Kafka
Rust
1
star
29

jogre

📆 wip jmap calendars/contacts server implementation
Rust
1
star
30

packfile

🪆 a simple library providing utilities to generate Git Packfiles in memory and send them to clients
Rust
1
star
31

syntect-cgit

🌈 syntect-based syntax highlighting for cgit
Rust
1
star
32

scrs

💿 A high performance, low maintanence SHOUTcast server.
Rust
1
star
33

fwloki

👽 logging martians since 2020
Rust
1
star
34

hkbi

📸 easy native homekit-blueiris integration
Go
1
star
35

tinfoil

💉 rust dependency injection
Rust
1
star