SIGBIN
GTFOBins → Sigma & Wazuh Rules
一条命令。零依赖。即时生成检测规则。
## 描述
一个独立工具。克隆最新的 GTFOBins 数据,使用内置的 YAML 解析器解析每一种二进制文件滥用技术,并生成带有匹配真实攻击者基础设施的 regex 模式的、可直接部署的检测规则。
## 功能说明
| 步骤 | 描述 |
|---|---|
| Clone | `git clone --depth 1` 拉取最新的 [GTFOBins](https://github.com/GTFOBins/GTFOBins.github.io) |
| Parse | 内置 YAML 解析器读取每个二进制文件,展平 `contexts: {sudo, suid, unprivileged}` |
| Generate Sigma | 独立的 Sigma YAML 规则,带有 ATT&CK 标签 + 内嵌的 Wazuh mapping |
| Generate Wazuh | 独立的 Wazuh XML 规则 + 合并的 `gtfobins_wazuh_rules.xml` |
| Cleanup | 移除克隆的仓库 — 仅保留输出文件 |
## 使用方法
```
./dedsec_sigbin # clone → Sigma + Wazuh (regex default)
./dedsec_sigbin --literal # clone → Sigma + Wazuh (literal placeholders)
./dedsec_sigbin --sigma-only # clone → Sigma only
./dedsec_sigbin --wazuh-only # clone → Wazuh only
```
默认情况下,文档占位符(`attacker.com`、`/path/to/input-file`、`12345`)会被替换为 regex 通配符(`\S+`、`\d+`),以便规则可以匹配真实的 IP、域名、路径和端口。使用 `--literal` 可保留原始的 GTFOBins 字符串。
## 输出
```
gtfobins_wazuh_rules.xml # combined Wazuh rules (drop-in ready)
sigma_rules/ # individual Sigma YAML rules
├── bash_reverse_shell.yml
├── vim_shell.yml
├── find_sudo.yml
└── ...
wazuh_rules/ # individual Wazuh XML rules
├── bash_reverse_shell.xml
├── vim_shell.xml
└── ...
```
### Sigma Rule(包含内嵌的 Wazuh mapping)
```
title: Reverse Shell via bash
id: 13a40b1f-d0ed-576d-b1f3-c2b15a3ea760
status: experimental
description: Detects bash establishing a reverse shell to an attacker-controlled host.
references:
- https://gtfobins.github.io/gtfobins/bash/
tags:
- attack.t1059.004
- attack.execution
- attack.command_and_control
logsource:
category: process_creation
product: linux
detection:
selection:
Image|endswith: /bash
CommandLine|re: bash\ -c\ 'exec\ bash\ -i\ &>/dev/tcp/\S+/\d+\ <\&1'
condition: selection
level: high
wazuh:
purpose: wazuh_custom_rule
rule_id: 100100
level: 15
if_sid: 530
decoder: command
match: bash
regex: /bash$
```
### Wazuh Rule
```
530
bash
/bash$.*(?:bash\ \-c\ 'exec\ bash\ \-i\ \>/dev/tcp/\S+/\d+\ \<\&1')
GTFOBins: Reverse Shell via bash
T1059.004
https://gtfobins.github.io/gtfobins/bash/
reverse_shell,command_and_control,gtfobins,
```
## Regex 模式(默认)
占位符会被替换为通配符,以便规则匹配真实的攻击者基础设施:
| 占位符 | Regex | 匹配内容 |
|---|---|---|
| `attacker.com` | `\S+` | `10.0.0.1`, `evil.c2.io` |
| `http://attacker.com` | `https?://\S+` | `https://cdn.bad.co` |
| `/path/to/input-file` | `\S+` | `/etc/shadow` |
| `12345`, `4444`, `1337` | `\d+` | 任意端口 |
**`--literal`(在生产环境中不会触发):**
```
CommandLine|contains: bash -c '...attacker.com/12345...'
```
**默认(捕获真实攻击):**
```
CommandLine|re: bash\ -c\ '...\S+/\d+...'
```
## 部署到 Wazuh
```
cp gtfobins_wazuh_rules.xml /var/ossec/etc/rules/
systemctl restart wazuh-manager
```
规则使用 `
530`(命令执行 decoder)。
## ATT&CK 覆盖范围
| 技术 | 等级 | 描述 |
|---|---|---|
| **T1059.004** — Unix Shell | 12–15 | 通过被滥用的二进制文件生成 Shell |
| **T1548.001** — SUID | 12 | SUID 权限提升 |
| **T1548.003** — Sudo | 12 | Sudo 权限提升 |
| **T1574** — Library Load | 12 | 共享库注入 |
| **T1005** — File Read | 10 | 未授权的文件访问 |
| **T1048** — Exfiltration | 10 | 文件上传/数据外发 |
| **T1105** — Ingress Transfer | 10 | 远程文件下载 |
| **T1564** — File Write | 10 | 未授权的文件写入 |
### Wazuh 严重性等级
| 等级 | 含义 | 技术 |
|---|---|---|
| **15** | 最高 — 远程访问 | reverse-shell, bind-shell |
| **14** | 高 — 非交互式远程 | non-interactive-reverse-shell |
| **12** | 高 — 权限提升 | shell, command, sudo, suid, library-load, capabilities |
| **10** | 中 — 数据访问 | file-read, file-write, file-upload, file-download |
## 工作原理
```
┌──────────────┐ ┌──────────┐ ┌──────────────────────────┐
│ GTFOBins │ │ sigbin │ │ sigma_rules/ │
│ upstream │ ──▶ │ │ ──▶ │ wazuh_rules/ │
│ (408+ bins) │ │ clone │ │ gtfobins_wazuh_rules.xml│
│ │ │ +parse │ │ │
│ │ │ +gen │ │ │
└──────────────┘ └──────────┘ └──────────────────────────┘
```
1. **Clone** — `git clone --depth 1` 拉取最新的 GTFOBins YAML 数据
2. **Parse** — 内置 YAML 解析器读取 `contexts: {sudo, suid, unprivileged}` 结构
3. **Generate** — 为每个二进制文件+技术生成 Sigma YAML (`CommandLine|re`) 和 Wazuh XML
4. **Cleanup** — 移除克隆的仓库,仅保留输出文件
### 安装说明
```
git clone https://github.com/0xbitx/DEDSEC_SIGBIN.git
cd DEDSEC_SIGBIN
chmod +x dedsec_sigbin
./dedsec_sigbin
```
### 测试环境
* Kali Linux
* Parrot OS
* Ubuntu