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/readelf.md
View on GitHub# readelf
- **Category**: Reverse Engineering / Binary & Library Analysis
- **Risk Level**: 🟢 Low
---
## 描述
显示 ELF(可执行与可链接格式)文件的详细信息。与 `objdump` 不同,readelf 是 ELF 专用的,且不使用 BFD 库,因此在检查异常或格式异常的 ELF 二进制文件时更为可靠。
## 安装
```bash
apt install binutils
```
## 参数说明
| 参数 | 说明 |
|-----------|-------------|
| `-a` | 打印所有可用信息(头部、节区、段、符号、重定位、注释) |
| `-h` | ELF 文件头(架构、入口点、类型) |
| `-l` | 程序头(段布局、GNU_STACK、GNU_RELRO 权限) |
| `-S` | 节区头(所有节区及其地址和标志) |
| `-s` | 符号表(导出/导入符号) |
| `-d` | 动态段(库依赖、RUNPATH、RELRO、标志) |
| `-r` | 重定位条目 |
| `-n` | 注释段(ABI 信息、构建 ID) |
| `-W` | 宽输出(不截断) |
| `--dyn-syms` | 专门显示动态符号表 |
## 常用命令
```bash
# 二进制文件的完整安全评估
readelf -a /usr/bin/target | grep -E "STACK|RELRO|Type:|Machine:|Class:"
# 检查可执行栈(RWE = 可利用)
readelf -l /usr/bin/target | grep GNU_STACK
# 检查 RELRO 状态(Partial = GOT 可写)
readelf -d /usr/bin/target | grep -E "RELRO|BIND_NOW"
# 库依赖关系(比 ldd 更安全)
readelf -d /usr/bin/target | grep NEEDED
# 检查二进制文件是否位置无关(PIE)
readelf -h /usr/bin/target | grep Type:
# 检查 RUNPATH / RPATH(库劫持向量)
readelf -d /usr/bin/target | grep -E "RPATH|RUNPATH"
# 列出所有符号
readelf -s /usr/bin/target
```
## 注意事项
1. `readelf -l | grep GNU_STACK` 显示 `E`(执行)权限意味着栈可执行——这是最强的利用指标之一。
2. 若 `readelf -d | grep BIND_NOW` 不存在 → 启用了延迟绑定 → GOT 条目在首次调用时解析,这在某些条件下可被利用。
3. 在 ELF 头 `Type:` 中显示 `DYN (Position-Independent Executable file)` 表示启用了 PIE(更难使用固定地址进行利用)。
4. 对不受信任的二进制文件使用 `readelf` 代替 `ldd`——`readelf` 解析文件时不执行它。
---
## 官方参考
- [readelf(1) — Linux manual page](https://man7.org/linux/man-pages/man1/readelf.1.html)
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 |