x-glacier/kali-pentest / kali-pentest-zh
kali-pentest-zh
Flagged通过 SSH 或 Docker 使用 Kali Linux CLI 工具执行授权渗透测试。 覆盖:信息收集、漏洞分析、嗅探与欺骗、Web/API 渗透、漏洞利用、密码攻击、无线、云原生安全、RFID/NFC、VoIP/ICS、逆向工程、取证分析、后渗透/C2、报告生成。
references/reverse-engineering/tools/ropper.md
View on GitHub# Ropper
- **Category**: Reverse Engineering / Exploit Development
- **Risk Level**: 🟡 Medium
---
## 描述
ropper 用于在二进制文件中搜索 ROP(Return-Oriented Programming)、JOP(Jump-Oriented Programming)和 SYS(syscall)gadget。支持 ELF、PE、Mach-O 和原始二进制格式,覆盖 x86、x86_64、ARM、MIPS 和 PowerPC 等多种架构。ropper 能够自动生成常见操作(如 execve、mprotect、virtualprotect)的 ROP 链。在绕过 DEP/NX 内存保护的漏洞利用开发中不可或缺。
## 安装
```bash
sudo apt install ropper
```
替代方式:
```bash
pip3 install ropper
```
## 参数说明
| 参数 | 说明 |
|------|------|
| `-f, --file <file>` | 要加载的文件 |
| `--search <pattern>` | 搜索 gadget |
| `--type <type>` | gadget 类型:`rop`、`jop`、`sys` 或 `all` |
| `--arch <arch>` | 已加载文件的架构 |
| `--inst-count <n>` | 指定 gadget 中的最大指令数(默认:6) |
| `--chain <generator>` | 生成 ROP 链(如 `execve`、`mprotect address=0x... size=0x...`、`virtualprotect address=0x...`) |
| `--nocolor` | 禁用彩色输出 |
| `-I <imagebase>` | 使用此镜像基地址查找 gadget |
| `--all` | 不移除重复的 gadget |
| `--badbytes <hex>` | 设置 gadget 中不应包含的字节 |
| `-i, --info` | 显示文件头信息(ELF/PE/Mach-O) |
| `-s, --sections` | 显示文件节信息 [ELF/PE/Mach-O] |
| `--opcode <hex>` | 搜索操作码(如 `ffe4` 或 `ffe?` 或 `ff??`) |
| `--string <str>` | 在所有数据段中查找字符串 |
| `--section <name>` | 打印该段的数据 |
| `--semantic <constraint>` | 基于约束条件语义搜索 gadget |
| `--instructions <instr>` | 按指令文本搜索(如 "jmp esp"、"pop eax; ret") |
## 常用命令
### 场景 1:基本 gadget 搜索
```bash
# 列出二进制文件中的所有 ROP gadget
ropper -f vulnerable_binary
# 列出最多 5 条指令的 gadget
ropper -f vulnerable_binary --inst-count 5
# 显示二进制文件信息(NX、ASLR 等)
ropper -f vulnerable_binary -i
```
### 场景 2:搜索特定 gadget
```bash
# 搜索包含 "pop rdi" 的 gadget
ropper -f vulnerable_binary --search "pop rdi"
# 搜索 syscall gadget
ropper -f vulnerable_binary --type sys
# 搜索 JOP gadget
ropper -f vulnerable_binary --type jop
# 搜索精确的操作码字节
ropper -f vulnerable_binary --opcode "5fc3"
```
### 场景 3:过滤坏字符
```bash
# 排除包含空字节和换行符的 gadget
ropper -f vulnerable_binary --badbytes 000a0d
# 搜索特定 gadget 同时过滤坏字节
ropper -f vulnerable_binary --search "pop rdi" --badbytes 000a0d
```
### 场景 4:自动生成 ROP 链
```bash
# 生成 execve("/bin/sh") ROP 链(Linux x86/x86_64)
ropper -f vulnerable_binary --chain execve
# 生成 mprotect ROP 链(指定地址和大小)
ropper -f vulnerable_binary --chain "mprotect address=0xdeadbeef size=0x10000"
# 生成 VirtualProtect ROP 链(Windows x86)
ropper -f vulnerable_binary --chain "virtualprotect address=0xdeadbeef"
```
### 场景 5:自定义基地址与架构
```bash
# 使用自定义镜像基地址分析
ropper -f shellcode.bin -I 0x08048000
# 为原始二进制文件指定架构
ropper -f firmware.bin --arch ARM
# 搜索所有类型的 gadget
ropper -f vulnerable_binary --type all
```
## 注意事项
1. 使用 `--inst-count` 限制 gadget 长度——较短的 gadget 更可靠且更容易链接。
2. 开发针对限制特定字节值的协议的漏洞利用时,始终使用 `--badbytes` 过滤(如 `00` 用于空终止字符串,`0a` 用于换行符)。
3. 自动链生成(`--chain`)需要二进制文件中有足够的 gadget——如果目标二进制文件太小,可使用更大的二进制文件或共享库(libc)。
4. ropper 支持交互模式——运行 `ropper --console`,在 shell 中使用 `file` 命令加载二进制文件。
5. 对于大型二进制文件,初始 gadget 枚举可能耗时较长——使用 `--section .text` 限制搜索范围。
---
## 官方参考
- [Ropper (GitHub)](https://github.com/sashs/Ropper)
- [ropper — Kali Tools](https://www.kali.org/tools/ropper/)
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |