Community研究與資料分析github.com

yaklang/code-obfuscation-deobfuscation

代碼混淆分析與反混淆實戰手冊。適用於逆向分析受垃圾代碼、不透明謂詞、自修改代碼、控制流平坦化、虛擬機保護或字串加密保護的二進制文件。

code-obfuscation-deobfuscation 是什麼?

這是一個專為逆向工程師和AI代理設計的綜合性代碼混淆分析與反混淆工具包。它涵蓋了從檢測垃圾代碼、不透明謂詞、自修改代碼到處理控制流平坦化、虛擬機保護和字串加密等常見混淆技術的完整工作流程。該技能支援多種平台(如 Windows、Linux、macOS),並提供自動化指令碼(如 Python、Yaklang)來簡化逆向分析過程。通過整合IDA Pro、Ghidra、x64dbg 等主流反彙編器,使用者可以高效地分析混淆代碼的結構與意圖。該技能的獨特之處在於它不僅提供靜態分析指南,還包含動態調試方法與符號執行策略,能夠有效處理現代惡意軟體中的複雜保護層。對於需要快速還原混淆邏輯的開發者而言,這是一個不可或缺的實用工具。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/yaklang/hack-skills/tree/main/skills/code-obfuscation-deobfuscation

Installed? Explore more 研究與資料分析 skills: affaan-m/uspto-database, affaan-m/scholar-evaluation, affaan-m/literature-review · View all 6 →

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

code-obfuscation-deobfuscation 是做什麼的?

代碼混淆分析與反混淆實戰手冊。適用於逆向分析受垃圾代碼、不透明謂詞、自修改代碼、控制流平坦化、虛擬機保護或字串加密保護的二進制文件。

概述

本技能提供了一套完整的代碼混淆檢測與反混淆指南,涵蓋了各種常見的混淆技術。無論您是資深逆向工程師還是剛入門的新手,都能從中找到實用的分析策略和自動化腳本範例。

支援的混淆類型

  • 垃圾代碼:插入無意義的指令以混淆控制流
  • 不透明謂詞:使用難以靜態評估的條件語句來增加分析難度
  • 自修改代碼:在運行時動態修改自身指令
  • 控制流平坦化:將原始控制流結構轉換為統一的調度器模式
  • 虛擬機保護:將原始代碼編譯為自定義字節碼,並通過解釋器執行
  • 字串加密:對敏感字串進行加密,運行時動態解密

使用方法

先決條件

安裝插件

pip install obfuscation-tools

基本工作流程

  1. 靜態分析:使用 static_analyzer.py 掃描二進制文件中的混淆模式

    python static_analyzer.py -i sample.exe -o report.json
    
  2. 動態調試:運行 dynamic_debugger.py 捕獲運行時行為

    python dynamic_debugger.py -i sample.exe -t 30
    
  3. 反混淆:基於分析結果執行 deobfuscator.py 進行代碼清理

    python deobfuscator.py -i report.json -o cleaned_sample.exe
    

進階技巧

處理虛擬機保護

需結合符號執行(如 angr)和污點分析:

import angr
proj = angr.Project('sample.exe')
cfg = proj.analyses.CFGFast()
#... 後續分析邏輯

控制流平坦化還原

使用模式匹配算法識別調度器並重建原始控制流:

pattern: dispatcher -> state_var -> switch_case

疑難排解

  • 問題:分析工具無響應:檢查是否為受保護的 .NET 二進制文件,需先脫殼
  • 問題:動態調試進程崩潰:啟用反反調試機制,使用 --anti-anti-debug 標誌

參考資源

授權

MIT License

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

yaklang/401-403-bypass-techniques

401/403 bypass playbook. Use when encountering access-denied responses on admin panels, API endpoints, or restricted paths. Covers path manipulation, HTTP method tampering, header injection, protocol downgrade, and automated bypass tools.

yaklang/active-directory-acl-abuse

Active Directory ACL abuse playbook. Use when exploiting misconfigured AD permissions including GenericAll, WriteDACL, DCSync rights, shadow credentials, LAPS reading, GPO abuse, and BloodHound-guided attack paths.

yaklang/active-directory-certificate-services

AD Certificate Services attack playbook. Use when targeting misconfigured AD CS for privilege escalation via ESC1-ESC13 template abuse, NTLM relay to enrollment, CA officer abuse, and certificate-based persistence.

yaklang/active-directory-kerberos-attacks

Kerberos attack playbook for Active Directory. Use when targeting AD authentication via AS-REP roasting, Kerberoasting, golden/silver/diamond tickets, delegation abuse, or pass-the-ticket attacks.

yaklang/ai-ml-security

AI/ML security playbook. Use when assessing model supply chain attacks (pickle RCE, poisoned weights), adversarial examples, model poisoning, model stealing, data privacy attacks (membership inference, model inversion), and autonomous agent security risks.

yaklang/android-pentesting-tricks

Android pentesting playbook. Use when testing Android applications for SSL pinning bypass, exported component abuse, WebView vulnerabilities, intent redirection, root detection bypass, tapjacking, and backup extraction during authorized mobile security assessments.

yaklang/anti-debugging-techniques

Anti-debugging detection and bypass playbook. Use when reversing protected binaries that detect debuggers via ptrace, PEB flags, timing checks, or signal/exception handlers on Linux and Windows.

yaklang/api-auth-and-jwt-abuse

API authentication and JWT abuse playbook. Use when testing bearer tokens, API keys, claim trust, header spoofing, rate limits, and API auth boundary weaknesses.

yaklang/api-authorization-and-bola

API authorization and BOLA testing playbook. Use when APIs expose object identifiers, nested resources, hidden writable fields, or weak function-level authorization.

yaklang/api-recon-and-docs

API reconnaissance and documentation review playbook. Use when discovering endpoints, schemas, versions, OpenAPI specs, hidden docs, and surface area for API testing.

yaklang/api-sec

Entry P1 category router for API security. Use when choosing between API recon, authorization, token abuse, and hidden-parameter workflows before any deeper API topic skill.

yaklang/arbitrary-write-to-rce

Arbitrary write to RCE playbook. Use when you have an arbitrary write primitive (from heap exploitation, format string, or OOB write) and need to convert it into code execution by targeting GOT, hooks, _IO_FILE vtable, exit_funcs, TLS_dtor_list, modprobe_path, .fini_array, or C++ vtables.

yaklang/authbypass-authentication-flaws

Authentication bypass testing playbook. Use when assessing login flows, password reset logic, account recovery, MFA bypass, token predictability, brute-force resistance, and session boundary flaws.

yaklang/auth-sec

Entry P1 category router for authentication and authorization. Use when testing login flows, sessions, object authorization, JWT, OAuth, CORS, CSRF, and enterprise SSO weaknesses before any deeper auth topic skill.

yaklang/binary-protection-bypass

Binary protection bypass playbook. Use when identifying and bypassing ASLR, PIE, NX/DEP, stack canary, RELRO, FORTIFY_SOURCE, CET, and MTE protections in ELF binaries to enable exploitation.

yaklang/browser-exploitation-v8

Browser and V8 exploitation playbook. Use when exploiting JavaScript engine vulnerabilities including JIT type confusion, incorrect bounds elimination, and V8 sandbox bypass to achieve renderer RCE and sandbox escape in Chrome/Chromium.

yaklang/business-logic-vuln

Entry P1 category router for business logic testing. Use when workflow abuse, race conditions, pricing flaws, or multi-step state attacks matter more than parser-level input injection.

yaklang/business-logic-vulnerabilities

Business logic vulnerability playbook. Use when reasoning about workflows, race conditions, price manipulation, coupon abuse, state machines, and multi-step authorization gaps.

yaklang/classical-cipher-analysis

Classical cipher analysis playbook. Use when encountering substitution ciphers, Vigenere, transposition, XOR, or encoded text in CTF challenges that requires frequency analysis, Kasiski examination, or known-plaintext cryptanalysis.

yaklang/clickjacking

Clickjacking playbook. Use when testing whether target pages can be framed, whether X-Frame-Options or CSP frame-ancestors are properly configured, and whether UI redress attacks can trigger sensitive actions.

相關技能