HelixCipher/defense-evasion

GitHub: HelixCipher/defense-evasion

基于 MITRE ATT&CK 框架的防御规避技术教育参考,涵盖攻击手法讲解与配套检测策略。

Stars: 0 | Forks: 0

# 防御规避 这是一份教育参考资料,记录了 [MITRE ATT&CK](https://attack.mitre.org/) 框架内的防御规避技术。本项目涵盖了目录伪装、文件系统操纵、痕迹隐藏及检测策略,专为在授权的网络安全培训环境中使用而设计。









## 目录 - [1. 通过 Unicode 混淆隐藏目录](defense_evasion.md#1-hidden-directories-via-unicode-obfuscation) - [2. 分数斜杠目录伪装](defense_evasion.md#2-fractional-slash-directory-masquerading) - [其他基于 Unicode 的伪装](defense_evasion.md#additional-unicode-based-masquerading) - [通过 Inode 强制删除目录](defense_evasion.md#force-removing-a-directory-by-inode) - [3. 高级视觉伪装(从右至左覆盖)](defense_evasion.md#3-advanced-visual-masquerading-right-to-left-override) - [4. 时间戳篡改(Timestomping)](defense_evasion.md#4-timestamp-manipulation-timestomping) - [5. 备用数据流(NTFS 专有)](defense_evasion.md#5-alternate-data-streams-ntfs-specific) - [6. 清除日志与命令历史记录](defense_evasion.md#6-log-clearing-and-command-history-removal) - [7. 沙箱规避与环境感知](defense_evasion.md#7-sandbox-evasion-and-environment-awareness) - [8. 通过文件监控与指数级复制实现持久化](defense_evasion.md#8-persistence-via-file-monitoring-and-exponential-replication) - [9. 同形异义字攻击(Unicode 字符替换)](defense_evasion.md#9-homoglyph-attack-unicode-character-substitution) - [通过 Python 进行程序化检测](defense_evasion.md#programmatic-detection-via-python) - [通过 Linux Auditd 进行检测](defense_evasion.md#detection-via-linux-auditd) - [通过 YARA 进行检测](defense_evasion.md#detection-via-yara) - [10. 网络层规避:IDN 同形异义词攻击](defense_evasion.md#10-network-layer-evasion-idn-homograph-attacks) - [Punycode 转换](defense_evasion.md#punycode-translation) - [通过 DNS/代理日志进行检测(SIEM 逻辑)](defense_evasion.md#detection-via-dnsproxy-logs-siem-logic) - [程序化检测与标准化](defense_evasion.md#programmatic-detection-and-normalization-python) - [浏览器缓解措施与攻击者绕过](defense_evasion.md#browser-mitigations-and-attacker-bypasses) - [11. 通过文件描述符隐藏文件(影子文件)](defense_evasion.md#11-file-concealment-via-file-descriptors-shadow-files) - [演示](defense_evasion.md#demonstration) - [影子文件工具](defense_evasion.md#shadow-file-tool) - [12. 在 RAM 中执行(无文件执行)](defense_evasion.md#12-execution-in-ram-fileless-execution) - [技术 1:`memfd_create`(内核级)](defense_evasion.md#technique-1-memfd_create-kernel-level) - [技术 2:共享内存(`/dev/shm`)](defense_evasion.md#technique-2-shared-memory-devshm) - [`quiet toram` 启动参数](defense_evasion.md#the-quiet-toram-boot-parameters) - [13. 通过 BPFtrace 监控系统调用](defense_evasion.md#13-system-call-monitoring-via-bpftrace) - [14. Bash Profile 操纵(Shell 配置劫持)](defense_evasion.md#14-bash-profile-manipulation-shell-configuration-hijacking) - [演示:通过 Bashrc 注入进行命令过滤](defense_evasion.md#demonstration-command-filtering-via-bashrc-injection) - [技术说明:避免无限递归](defense_evasion.md#technical-note-avoiding-infinite-recursion) - [防御意义](defense_evasion.md#defensive-implications) - [附录:项目结构](defense_evasion.md#appendix-project-structure) - [附录:MITRE ATT&CK 技术索引](defense_evasion.md#appendix-mitre-attack-technique-index) ## 项目结构 ``` defense-evasion/ ├── README.md # This document ├── DISCLAIMER.md # Legal disclaimer and liability waiver ├── ATTRIBUTION.md # Creative Commons attribution requirements ├── LICENSE # CC BY 4.0 license ├── defense_evasion.md # Full educational reference ├── assets/ │ └── images/ # Screenshots referenced throughout └── tools/ ├── stealth/ │ └── shadow_file.py # File hiding tool using file descriptors └── watcher/ └── watch_commands.sh # BPFtrace command monitoring script ``` ## 工具 ### `shadow_file.py` 一款文件隐藏工具,利用 Linux 文件描述符保留机制将文件临时从文件系统中隐藏。具有五种运行模式: | 模式 | 命令 | 描述 | |---|---|---| | **Shadow** | `sudo ./shadow_file.py shadow [filename]` | 解除文件链接,并通过后台进程保持数据块处于打开状态 | | **Hunt** | `sudo ./shadow_file.py hunt [pid]` | 检查特定 PID 的文件描述符以查找影子文件 | | **Restore** | `sudo ./shadow_file.py restore [pid] [dest]` | 从文件描述符恢复保留的文件数据到磁盘 | | **Kill** | `sudo ./shadow_file.py kill [pid]` | 终止持有进程,释放 inode 以便进行垃圾回收 | | **Search** | `sudo ./shadow_file.py search` | 扫描所有系统进程以查找影子文件描述符 | ### `watch_commands.sh` 一个 BPFtrace 单行命令,可实时监控 `execve` 系统调用,捕获系统内的每一个二进制执行事件: ``` sudo ./tools/watcher/watch_commands.sh ``` 此钩子无论历史文件如何操纵,都会在内核级别拦截命令执行。 ## 技术参考 | # | 技术 | MITRE ID | 章节 | |---|---|---|---| | 1 | 通过 Unicode 混淆隐藏目录 | T1564.001 | [前往](defense_evasion.md#1-hidden-directories-via-unicode-obfuscation) | | 2 | 分数斜杠目录伪装 | T1036 | [前往](defense_evasion.md#2-fractional-slash-directory-masquerading) | | 3 | 高级视觉伪装(RTLO) | T1036.008 | [前往](defense_evasion.md#3-advanced-visual-masquerading-right-to-left-override) | | 4 | 时间戳篡改(Timestomping) | T1070.006 | [前往](defense_evasion.md#4-timestamp-manipulation-timestomping) | | 5 | 备用数据流(NTFS 专有) | T1564.004 | [前往](defense_evasion.md#5-alternate-data-streams-ntfs-specific) | | 6 | 清除日志与命令历史记录 | T1070 | [前往](defense_evasion.md#6-log-clearing-and-command-history-removal) | | 7 | 沙箱规避与环境感知 | T1497 | [前往](defense_evasion.md#7-sandbox-evasion-and-environment-awareness) | | 8 | 通过文件监控与指数级复制实现持久化 | TA0003 | [前往](defense_evasion.md#8-persistence-via-file-monitoring-and-exponential-replication) | | 9 | 同形异义字攻击(Unicode 字符替换) | T1036.008 | [前往](defense_evasion.md#9-homoglyph-attack-unicode-character-substitution) | | 10 | 网络层规避:IDN 同形异义词攻击 | T1071 | [前往](defense_evasion.md#10-network-layer-evasion-idn-homograph-attacks) | | 11 | 通过文件描述符隐藏文件(影子文件) | T1564.001 | [前往](defense_evasion.md#11-file-concealment-via-file-descriptors-shadow-files) | | 12 | 在 RAM 中执行(无文件执行) | T1059 | [前往](defense_evasion.md#12-execution-in-ram-fileless-execution) | | 13 | 通过 BPFtrace 监控系统调用 | T1059.004 | [前往](defense_evasion.md#13-system-call-monitoring-via-bpftrace) | | 14 | Bash Profile 操纵(Shell 配置劫持) | T1546.004 | [前往](defense_evasion.md#14-bash-profile-manipulation-shell-configuration-hijacking) | ## 参考资料 - [MITRE ATT&CK 框架](https://attack.mitre.org/) - [MITRE ATT&CK - 防御规避](https://attack.mitre.org/tactics/TA0005/) - [Linux man pages](https://man7.org/linux/man-pages/) ## 署名与许可 本仓库采用 **知识共享署名 4.0 国际许可协议 (CC BY 4.0)** 进行许可。 ### 署名要求 对本项目的任何再分发、镜像或衍生使用,必须注明源仓库出处: 1. **作者姓名:** `HelixCipher` 2. **源链接:** [https://github.com/HelixCipher/defense-evasion](https://github.com/HelixCipher/defense-evasion) 3. **更新日志:** 明确说明是否对原始项目结构进行了修改。 #### 参考块示例 ## 使用条款 在克隆此仓库之前,请阅读 [DISCLAIMER.md](./DISCLAIMER.md) 以了解完整的法律框架、免责声明以及系统合规性定义。 ## 法律与道德声明 本仓库仅供教育目的使用。请以负责任且合法的方式使用该工具。请勿用于促成非法活动。
标签:AMSI绕过, Cloudflare, DNS 反向解析, DNS 解析, MITRE ATT&CK, 威胁检测, 子域名变形, 安全教育, 应用安全, 私有化部署, 网络安全, 逆向工具, 防御加固, 防御规避, 隐私保护