[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7BWNKFJT67M37MP31Y5A2Q8":3,"skill-same:01M7BWNKFJT67M37MP31Y5A2Q8":47},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":29,"ownerHtmlUrl":30,"ownerBlogUrl":6,"ownerDescription":31,"updatedAt":32,"install":33,"resources":46},"01M7BWNKFJT67M37MP31Y5A2Q8","anti-reversing-techniques",null,"Understand anti-reversing, obfuscation, and protection techniques encountered during software analysis. Use when analyzing protected binaries, bypassing anti-debugging for authorized analysis, or understanding software protection mechanisms.","YYC-Cube\u002FYYC3-Knowledge-Base","YYC-Cube","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F235006543?v=4","01M79J2PH4SWD2X0825X6PN748","yyc3","01M79J2PHVK3F6ZBYT8K2SCZCW",1,"MIT","https:\u002F\u002Fgithub.com\u002FYYC-Cube\u002FYYC3-Knowledge-Base\u002Fblob\u002Fmain\u002FYYC3-Plugin-插件协议\u002FYYC3-Plugin-插件协议-plugins-claude\u002Freverse-engineering\u002Fskills\u002Fanti-reversing-techniques\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: anti-reversing-techniques\ndescription: Understand anti-reversing, obfuscation, and protection techniques encountered during software analysis. Use when analyzing protected binaries, bypassing anti-debugging for authorized analysis, or understanding software protection mechanisms.\n---\n\n> **AUTHORIZED USE ONLY**: This skill contains dual-use security techniques. Before proceeding with any bypass or analysis:\n>\n> 1. **Verify authorization**: Confirm you have explicit written permission from the software owner, or are operating within a legitimate security context (CTF, authorized pentest, malware analysis, security research)\n> 2. **Document scope**: Ensure your activities fall within the defined scope of your authorization\n> 3. **Legal compliance**: Understand that unauthorized bypassing of software protection may violate laws (CFAA, DMCA anti-circumvention, etc.)\n>\n> **Legitimate use cases**: Malware analysis, authorized penetration testing, CTF competitions, academic security research, analyzing software you own\u002Fhave rights to\n\n# Anti-Reversing Techniques\n\nUnderstanding protection mechanisms encountered during authorized software analysis, security research, and malware analysis. This knowledge helps analysts bypass protections to complete legitimate analysis tasks.\n\n## Anti-Debugging Techniques\n\n### Windows Anti-Debugging\n\n#### API-Based Detection\n\n```c\n\u002F\u002F IsDebuggerPresent\nif (IsDebuggerPresent()) {\n    exit(1);\n}\n\n\u002F\u002F CheckRemoteDebuggerPresent\nBOOL debugged = FALSE;\nCheckRemoteDebuggerPresent(GetCurrentProcess(), &debugged);\nif (debugged) exit(1);\n\n\u002F\u002F NtQueryInformationProcess\ntypedef NTSTATUS (NTAPI *pNtQueryInformationProcess)(\n    HANDLE, PROCESSINFOCLASS, PVOID, ULONG, PULONG);\n\nDWORD debugPort = 0;\nNtQueryInformationProcess(\n    GetCurrentProcess(),\n    ProcessDebugPort,        \u002F\u002F 7\n    &debugPort,\n    sizeof(debugPort),\n    NULL\n);\nif (debugPort != 0) exit(1);\n\n\u002F\u002F Debug flags\nDWORD debugFlags = 0;\nNtQueryInformationProcess(\n    GetCurrentProcess(),\n    ProcessDebugFlags,       \u002F\u002F 0x1F\n    &debugFlags,\n    sizeof(debugFlags),\n    NULL\n);\nif (debugFlags == 0) exit(1);  \u002F\u002F 0 means being debugged\n```\n\n**Bypass Approaches:**\n\n```python\n# x64dbg: ScyllaHide plugin\n# Patches common anti-debug checks\n\n# Manual patching in debugger:\n# - Set IsDebuggerPresent return to 0\n# - Patch PEB.BeingDebugged to 0\n# - Hook NtQueryInformationProcess\n\n# IDAPython: Patch checks\nida_bytes.patch_byte(check_addr, 0x90)  # NOP\n```\n\n#### PEB-Based Detection\n\n```c\n\u002F\u002F Direct PEB access\n#ifdef _WIN64\n    PPEB peb = (PPEB)__readgsqword(0x60);\n#else\n    PPEB peb = (PPEB)__readfsdword(0x30);\n#endif\n\n\u002F\u002F BeingDebugged flag\nif (peb->BeingDebugged) exit(1);\n\n\u002F\u002F NtGlobalFlag\n\u002F\u002F Debugged: 0x70 (FLG_HEAP_ENABLE_TAIL_CHECK |\n\u002F\u002F                 FLG_HEAP_ENABLE_FREE_CHECK |\n\u002F\u002F                 FLG_HEAP_VALIDATE_PARAMETERS)\nif (peb->NtGlobalFlag & 0x70) exit(1);\n\n\u002F\u002F Heap flags\nPDWORD heapFlags = (PDWORD)((PBYTE)peb->ProcessHeap + 0x70);\nif (*heapFlags & 0x50000062) exit(1);\n```\n\n**Bypass Approaches:**\n\n```assembly\n; In debugger, modify PEB directly\n; x64dbg: dump at gs:[60] (x64) or fs:[30] (x86)\n; Set BeingDebugged (offset 2) to 0\n; Clear NtGlobalFlag (offset 0xBC for x64)\n```\n\n#### Timing-Based Detection\n\n```c\n\u002F\u002F RDTSC timing\nuint64_t start = __rdtsc();\n\u002F\u002F ... some code ...\nuint64_t end = __rdtsc();\nif ((end - start) > THRESHOLD) exit(1);\n\n\u002F\u002F QueryPerformanceCounter\nLARGE_INTEGER start, end, freq;\nQueryPerformanceFrequency(&freq);\nQueryPerformanceCounter(&start);\n\u002F\u002F ... code ...\nQueryPerformanceCounter(&end);\ndouble elapsed = (double)(end.QuadPart - start.QuadPart) \u002F freq.QuadPart;\nif (elapsed > 0.1) exit(1);  \u002F\u002F Too slow = debugger\n\n\u002F\u002F GetTickCount\nDWORD start = GetTickCount();\n\u002F\u002F ... code ...\nif (GetTickCount() - start > 1000) exit(1);\n```\n\n**Bypass Approaches:**\n\n```\n- Use hardware breakpoints instead of software\n- Patch timing checks\n- Use VM with controlled time\n- Hook timing APIs to return consistent values\n```\n\n#### Exception-Based Detection\n\n```c\n\u002F\u002F SEH-based detection\n__try {\n    __asm { int 3 }  \u002F\u002F Software breakpoint\n}\n__except(EXCEPTION_EXECUTE_HANDLER) {\n    \u002F\u002F Normal execution: exception caught\n    return;\n}\n\u002F\u002F Debugger ate the exception\nexit(1);\n\n\u002F\u002F VEH-based detection\nLONG CALLBACK VectoredHandler(PEXCEPTION_POINTERS ep) {\n    if (ep->ExceptionRecord->ExceptionCode == EXCEPTION_BREAKPOINT) {\n        ep->ContextRecord->Rip++;  \u002F\u002F Skip INT3\n        return EXCEPTION_CONTINUE_EXECUTION;\n    }\n    return EXCEPTION_CONTINUE_SEARCH;\n}\n```\n\n### Linux Anti-Debugging\n\n```c\n\u002F\u002F ptrace self-trace\nif (ptrace(PTRACE_TRACEME, 0, NULL, NULL) == -1) {\n    \u002F\u002F Already being traced\n    exit(1);\n}\n\n\u002F\u002F \u002Fproc\u002Fself\u002Fstatus\nFILE *f = fopen(\"\u002Fproc\u002Fself\u002Fstatus\", \"r\");\nchar line[256];\nwhile (fgets(line, sizeof(line), f)) {\n    if (strncmp(line, \"TracerPid:\", 10) == 0) {\n        int tracer_pid = atoi(line + 10);\n        if (tracer_pid != 0) exit(1);\n    }\n}\n\n\u002F\u002F Parent process check\nif (getppid() != 1 && strcmp(get_process_name(getppid()), \"bash\") != 0) {\n    \u002F\u002F Unusual parent (might be debugger)\n}\n```\n\n**Bypass Approaches:**\n\n```bash\n# LD_PRELOAD to hook ptrace\n# Compile: gcc -shared -fPIC -o hook.so hook.c\nlong ptrace(int request, ...) {\n    return 0;  \u002F\u002F Always succeed\n}\n\n# Usage\nLD_PRELOAD=.\u002Fhook.so .\u002Ftarget\n```\n\n## Anti-VM Detection\n\n### Hardware Fingerprinting\n\n```c\n\u002F\u002F CPUID-based detection\nint cpuid_info[4];\n__cpuid(cpuid_info, 1);\n\u002F\u002F Check hypervisor bit (bit 31 of ECX)\nif (cpuid_info[2] & (1 \u003C\u003C 31)) {\n    \u002F\u002F Running in hypervisor\n}\n\n\u002F\u002F CPUID brand string\n__cpuid(cpuid_info, 0x40000000);\nchar vendor[13] = {0};\nmemcpy(vendor, &cpuid_info[1], 12);\n\u002F\u002F \"VMwareVMware\", \"Microsoft Hv\", \"KVMKVMKVM\", \"VBoxVBoxVBox\"\n\n\u002F\u002F MAC address prefix\n\u002F\u002F VMware: 00:0C:29, 00:50:56\n\u002F\u002F VirtualBox: 08:00:27\n\u002F\u002F Hyper-V: 00:15:5D\n```\n\n### Registry\u002FFile Detection\n\n```c\n\u002F\u002F Windows registry keys\n\u002F\u002F HKLM\\SOFTWARE\\VMware, Inc.\\VMware Tools\n\u002F\u002F HKLM\\SOFTWARE\\Oracle\\VirtualBox Guest Additions\n\u002F\u002F HKLM\\HARDWARE\\ACPI\\DSDT\\VBOX__\n\n\u002F\u002F Files\n\u002F\u002F C:\\Windows\\System32\\drivers\\vmmouse.sys\n\u002F\u002F C:\\Windows\\System32\\drivers\\vmhgfs.sys\n\u002F\u002F C:\\Windows\\System32\\drivers\\VBoxMouse.sys\n\n\u002F\u002F Processes\n\u002F\u002F vmtoolsd.exe, vmwaretray.exe\n\u002F\u002F VBoxService.exe, VBoxTray.exe\n```\n\n### Timing-Based VM Detection\n\n```c\n\u002F\u002F VM exits cause timing anomalies\nuint64_t start = __rdtsc();\n__cpuid(cpuid_info, 0);  \u002F\u002F Causes VM exit\nuint64_t end = __rdtsc();\nif ((end - start) > 500) {\n    \u002F\u002F Likely in VM (CPUID takes longer)\n}\n```\n\n**Bypass Approaches:**\n\n```\n- Use bare-metal analysis environment\n- Harden VM (remove guest tools, change MAC)\n- Patch detection code\n- Use specialized analysis VMs (FLARE-VM)\n```\n\n## Code Obfuscation\n\n### Control Flow Obfuscation\n\n#### Control Flow Flattening\n\n```c\n\u002F\u002F Original\nif (cond) {\n    func_a();\n} else {\n    func_b();\n}\nfunc_c();\n\n\u002F\u002F Flattened\nint state = 0;\nwhile (1) {\n    switch (state) {\n        case 0:\n            state = cond ? 1 : 2;\n            break;\n        case 1:\n            func_a();\n            state = 3;\n            break;\n        case 2:\n            func_b();\n            state = 3;\n            break;\n        case 3:\n            func_c();\n            return;\n    }\n}\n```\n\n**Analysis Approach:**\n\n- Identify state variable\n- Map state transitions\n- Reconstruct original flow\n- Tools: D-810 (IDA), SATURN\n\n#### Opaque Predicates\n\n```c\n\u002F\u002F Always true, but complex to analyze\nint x = rand();\nif ((x * x) >= 0) {  \u002F\u002F Always true\n    real_code();\n} else {\n    junk_code();  \u002F\u002F Dead code\n}\n\n\u002F\u002F Always false\nif ((x * (x + 1)) % 2 == 1) {  \u002F\u002F Product of consecutive = even\n    junk_code();\n}\n```\n\n**Analysis Approach:**\n\n- Identify constant expressions\n- Symbolic execution to prove predicates\n- Pattern matching for known opaque predicates\n\n### Data Obfuscation\n\n#### String Encryption\n\n```c\n\u002F\u002F XOR encryption\nchar decrypt_string(char *enc, int len, char key) {\n    char *dec = malloc(len + 1);\n    for (int i = 0; i \u003C len; i++) {\n        dec[i] = enc[i] ^ key;\n    }\n    dec[len] = 0;\n    return dec;\n}\n\n\u002F\u002F Stack strings\nchar url[20];\nurl[0] = 'h'; url[1] = 't'; url[2] = 't'; url[3] = 'p';\nurl[4] = ':'; url[5] = '\u002F'; url[6] = '\u002F';\n\u002F\u002F ...\n```\n\n**Analysis Approach:**\n\n```python\n# FLOSS for automatic string deobfuscation\nfloss malware.exe\n\n# IDAPython string decryption\ndef decrypt_xor(ea, length, key):\n    result = \"\"\n    for i in range(length):\n        byte = ida_bytes.get_byte(ea + i)\n        result += chr(byte ^ key)\n    return result\n```\n\n#### API Obfuscation\n\n```c\n\u002F\u002F Dynamic API resolution\ntypedef HANDLE (WINAPI *pCreateFileW)(LPCWSTR, DWORD, DWORD,\n    LPSECURITY_ATTRIBUTES, DWORD, DWORD, HANDLE);\n\nHMODULE kernel32 = LoadLibraryA(\"kernel32.dll\");\npCreateFileW myCreateFile = (pCreateFileW)GetProcAddress(\n    kernel32, \"CreateFileW\");\n\n\u002F\u002F API hashing\nDWORD hash_api(char *name) {\n    DWORD hash = 0;\n    while (*name) {\n        hash = ((hash >> 13) | (hash \u003C\u003C 19)) + *name++;\n    }\n    return hash;\n}\n\u002F\u002F Resolve by hash comparison instead of string\n```\n\n**Analysis Approach:**\n\n- Identify hash algorithm\n- Build hash database of known APIs\n- Use HashDB plugin for IDA\n- Dynamic analysis to resolve at runtime\n\n### Instruction-Level Obfuscation\n\n#### Dead Code Insertion\n\n```asm\n; Original\nmov eax, 1\n\n; With dead code\npush ebx           ; Dead\nmov eax, 1\npop ebx            ; Dead\nxor ecx, ecx       ; Dead\nadd ecx, ecx       ; Dead\n```\n\n#### Instruction Substitution\n\n```asm\n; Original: xor eax, eax (set to 0)\n; Substitutions:\nsub eax, eax\nmov eax, 0\nand eax, 0\nlea eax, [0]\n\n; Original: mov eax, 1\n; Substitutions:\nxor eax, eax\ninc eax\n\npush 1\npop eax\n```\n\n## Packing and Encryption\n\n### Common Packers\n\n```\nUPX          - Open source, easy to unpack\nThemida      - Commercial, VM-based protection\nVMProtect    - Commercial, code virtualization\nASPack       - Compression packer\nPECompact    - Compression packer\nEnigma       - Commercial protector\n```\n\n### Unpacking Methodology\n\n```\n1. Identify packer (DIE, Exeinfo PE, PEiD)\n\n2. Static unpacking (if known packer):\n   - UPX: upx -d packed.exe\n   - Use existing unpackers\n\n3. Dynamic unpacking:\n   a. Find Original Entry Point (OEP)\n   b. Set breakpoint on OEP\n   c. Dump memory when OEP reached\n   d. Fix import table (Scylla, ImpREC)\n\n4. OEP finding techniques:\n   - Hardware breakpoint on stack (ESP trick)\n   - Break on common API calls (GetCommandLineA)\n   - Trace and look for typical entry patterns\n```\n\n### Manual Unpacking Example\n\n```\n1. Load packed binary in x64dbg\n2. Note entry point (packer stub)\n3. Use ESP trick:\n   - Run to entry\n   - Set hardware breakpoint on [ESP]\n   - Run until breakpoint hits (after PUSHAD\u002FPOPAD)\n4. Look for JMP to OEP\n5. At OEP, use Scylla to:\n   - Dump process\n   - Find imports (IAT autosearch)\n   - Fix dump\n```\n\n## Virtualization-Based Protection\n\n### Code Virtualization\n\n```\nOriginal x86 code is converted to custom bytecode\ninterpreted by embedded VM at runtime.\n\nOriginal:     VM Protected:\nmov eax, 1    push vm_context\nadd eax, 2    call vm_entry\n              ; VM interprets bytecode\n              ; equivalent to original\n```\n\n### Analysis Approaches\n\n```\n1. Identify VM components:\n   - VM entry (dispatcher)\n   - Handler table\n   - Bytecode location\n   - Virtual registers\u002Fstack\n\n2. Trace execution:\n   - Log handler calls\n   - Map bytecode to operations\n   - Understand instruction set\n\n3. Lifting\u002Fdevirtualization:\n   - Map VM instructions back to native\n   - Tools: VMAttack, SATURN, NoVmp\n\n4. Symbolic execution:\n   - Analyze VM semantically\n   - angr, Triton\n```\n\n## Bypass Strategies Summary\n\n### General Principles\n\n1. **Understand the protection**: Identify what technique is used\n2. **Find the check**: Locate protection code in binary\n3. **Patch or hook**: Modify check to always pass\n4. **Use appropriate tools**: ScyllaHide, x64dbg plugins\n5. **Document findings**: Keep notes on bypassed protections\n\n### Tool Recommendations\n\n```\nAnti-debug bypass:    ScyllaHide, TitanHide\nUnpacking:           x64dbg + Scylla, OllyDumpEx\nDeobfuscation:       D-810, SATURN, miasm\nVM analysis:         VMAttack, NoVmp, manual tracing\nString decryption:   FLOSS, custom scripts\nSymbolic execution:  angr, Triton\n```\n\n### Ethical Considerations\n\nThis knowledge should only be used for:\n\n- Authorized security research\n- Malware analysis (defensive)\n- CTF competitions\n- Understanding protections for legitimate purposes\n- Educational purposes\n\nNever use to bypass protections for:\n\n- Software piracy\n- Unauthorized access\n- Malicious purposes\n","> **AUTHORIZED USE ONLY**: This skill contains dual-use security techniques. Before proceeding with any bypass or analysis:\n>\n> 1. **Verify authorization**: Confirm you have explicit written permission from the software owner, or are operating within a legitimate security context (CTF, authorized pentest, malware analysis, security research)\n> 2. **Document scope**: Ensure your activities fall within the defined scope of your authorization\n> 3. **Legal compliance**: Understand that unauthorized bypassing of software protection may violate laws (CFAA, DMCA anti-circumvention, etc.)\n>\n> **Legitimate use cases**: Malware analysis, authorized penetration testing, CTF competitions, academic security research, analyzing software you own\u002Fhave rights to\n\n# Anti-Reversing Techniques\n\nUnderstanding protection mechanisms encountered during authorized software analysis, security research, and malware analysis. This knowledge helps analysts bypass protections to complete legitimate analysis tasks.\n\n## Anti-Debugging Techniques\n\n### Windows Anti-Debugging\n\n#### API-Based Detection\n\n```c\n\u002F\u002F IsDebuggerPresent\nif (IsDebuggerPresent()) {\n    exit(1);\n}\n\n\u002F\u002F CheckRemoteDebuggerPresent\nBOOL debugged = FALSE;\nCheckRemoteDebuggerPresent(GetCurrentProcess(), &debugged);\nif (debugged) exit(1);\n\n\u002F\u002F NtQueryInformationProcess\ntypedef NTSTATUS (NTAPI *pNtQueryInformationProcess)(\n    HANDLE, PROCESSINFOCLASS, PVOID, ULONG, PULONG);\n\nDWORD debugPort = 0;\nNtQueryInformationProcess(\n    GetCurrentProcess(),\n    ProcessDebugPort,        \u002F\u002F 7\n    &debugPort,\n    sizeof(debugPort),\n    NULL\n);\nif (debugPort != 0) exit(1);\n\n\u002F\u002F Debug flags\nDWORD debugFlags = 0;\nNtQueryInformationProcess(\n    GetCurrentProcess(),\n    ProcessDebugFlags,       \u002F\u002F 0x1F\n    &debugFlags,\n    sizeof(debugFlags),\n    NULL\n);\nif (debugFlags == 0) exit(1);  \u002F\u002F 0 means being debugged\n```\n\n**Bypass Approaches:**\n\n```python\n# x64dbg: ScyllaHide plugin\n# Patches common anti-debug checks\n\n# Manual patching in debugger:\n# - Set IsDebuggerPresent return to 0\n# - Patch PEB.BeingDebugged to 0\n# - Hook NtQueryInformationProcess\n\n# IDAPython: Patch checks\nida_bytes.patch_byte(check_addr, 0x90)  # NOP\n```\n\n#### PEB-Based Detection\n\n```c\n\u002F\u002F Direct PEB access\n#ifdef _WIN64\n    PPEB peb = (PPEB)__readgsqword(0x60);\n#else\n    PPEB peb = (PPEB)__readfsdword(0x30);\n#endif\n\n\u002F\u002F BeingDebugged flag\nif (peb->BeingDebugged) exit(1);\n\n\u002F\u002F NtGlobalFlag\n\u002F\u002F Debugged: 0x70 (FLG_HEAP_ENABLE_TAIL_CHECK |\n\u002F\u002F                 FLG_HEAP_ENABLE_FREE_CHECK |\n\u002F\u002F                 FLG_HEAP_VALIDATE_PARAMETERS)\nif (peb->NtGlobalFlag & 0x70) exit(1);\n\n\u002F\u002F Heap flags\nPDWORD heapFlags = (PDWORD)((PBYTE)peb->ProcessHeap + 0x70);\nif (*heapFlags & 0x50000062) exit(1);\n```\n\n**Bypass Approaches:**\n\n```assembly\n; In debugger, modify PEB directly\n; x64dbg: dump at gs:[60] (x64) or fs:[30] (x86)\n; Set BeingDebugged (offset 2) to 0\n; Clear NtGlobalFlag (offset 0xBC for x64)\n```\n\n#### Timing-Based Detection\n\n```c\n\u002F\u002F RDTSC timing\nuint64_t start = __rdtsc();\n\u002F\u002F ... some code ...\nuint64_t end = __rdtsc();\nif ((end - start) > THRESHOLD) exit(1);\n\n\u002F\u002F QueryPerformanceCounter\nLARGE_INTEGER start, end, freq;\nQueryPerformanceFrequency(&freq);\nQueryPerformanceCounter(&start);\n\u002F\u002F ... code ...\nQueryPerformanceCounter(&end);\ndouble elapsed = (double)(end.QuadPart - start.QuadPart) \u002F freq.QuadPart;\nif (elapsed > 0.1) exit(1);  \u002F\u002F Too slow = debugger\n\n\u002F\u002F GetTickCount\nDWORD start = GetTickCount();\n\u002F\u002F ... code ...\nif (GetTickCount() - start > 1000) exit(1);\n```\n\n**Bypass Approaches:**\n\n```\n- Use hardware breakpoints instead of software\n- Patch timing checks\n- Use VM with controlled time\n- Hook timing APIs to return consistent values\n```\n\n#### Exception-Based Detection\n\n```c\n\u002F\u002F SEH-based detection\n__try {\n    __asm { int 3 }  \u002F\u002F Software breakpoint\n}\n__except(EXCEPTION_EXECUTE_HANDLER) {\n    \u002F\u002F Normal execution: exception caught\n    return;\n}\n\u002F\u002F Debugger ate the exception\nexit(1);\n\n\u002F\u002F VEH-based detection\nLONG CALLBACK VectoredHandler(PEXCEPTION_POINTERS ep) {\n    if (ep->ExceptionRecord->ExceptionCode == EXCEPTION_BREAKPOINT) {\n        ep->ContextRecord->Rip++;  \u002F\u002F Skip INT3\n        return EXCEPTION_CONTINUE_EXECUTION;\n    }\n    return EXCEPTION_CONTINUE_SEARCH;\n}\n```\n\n### Linux Anti-Debugging\n\n```c\n\u002F\u002F ptrace self-trace\nif (ptrace(PTRACE_TRACEME, 0, NULL, NULL) == -1) {\n    \u002F\u002F Already being traced\n    exit(1);\n}\n\n\u002F\u002F \u002Fproc\u002Fself\u002Fstatus\nFILE *f = fopen(\"\u002Fproc\u002Fself\u002Fstatus\", \"r\");\nchar line[256];\nwhile (fgets(line, sizeof(line), f)) {\n    if (strncmp(line, \"TracerPid:\", 10) == 0) {\n        int tracer_pid = atoi(line + 10);\n        if (tracer_pid != 0) exit(1);\n    }\n}\n\n\u002F\u002F Parent process check\nif (getppid() != 1 && strcmp(get_process_name(getppid()), \"bash\") != 0) {\n    \u002F\u002F Unusual parent (might be debugger)\n}\n```\n\n**Bypass Approaches:**\n\n```bash\n# LD_PRELOAD to hook ptrace\n# Compile: gcc -shared -fPIC -o hook.so hook.c\nlong ptrace(int request, ...) {\n    return 0;  \u002F\u002F Always succeed\n}\n\n# Usage\nLD_PRELOAD=.\u002Fhook.so .\u002Ftarget\n```\n\n## Anti-VM Detection\n\n### Hardware Fingerprinting\n\n```c\n\u002F\u002F CPUID-based detection\nint cpuid_info[4];\n__cpuid(cpuid_info, 1);\n\u002F\u002F Check hypervisor bit (bit 31 of ECX)\nif (cpuid_info[2] & (1 \u003C\u003C 31)) {\n    \u002F\u002F Running in hypervisor\n}\n\n\u002F\u002F CPUID brand string\n__cpuid(cpuid_info, 0x40000000);\nchar vendor[13] = {0};\nmemcpy(vendor, &cpuid_info[1], 12);\n\u002F\u002F \"VMwareVMware\", \"Microsoft Hv\", \"KVMKVMKVM\", \"VBoxVBoxVBox\"\n\n\u002F\u002F MAC address prefix\n\u002F\u002F VMware: 00:0C:29, 00:50:56\n\u002F\u002F VirtualBox: 08:00:27\n\u002F\u002F Hyper-V: 00:15:5D\n```\n\n### Registry\u002FFile Detection\n\n```c\n\u002F\u002F Windows registry keys\n\u002F\u002F HKLM\\SOFTWARE\\VMware, Inc.\\VMware Tools\n\u002F\u002F HKLM\\SOFTWARE\\Oracle\\VirtualBox Guest Additions\n\u002F\u002F HKLM\\HARDWARE\\ACPI\\DSDT\\VBOX__\n\n\u002F\u002F Files\n\u002F\u002F C:\\Windows\\System32\\drivers\\vmmouse.sys\n\u002F\u002F C:\\Windows\\System32\\drivers\\vmhgfs.sys\n\u002F\u002F C:\\Windows\\System32\\drivers\\VBoxMouse.sys\n\n\u002F\u002F Processes\n\u002F\u002F vmtoolsd.exe, vmwaretray.exe\n\u002F\u002F VBoxService.exe, VBoxTray.exe\n```\n\n### Timing-Based VM Detection\n\n```c\n\u002F\u002F VM exits cause timing anomalies\nuint64_t start = __rdtsc();\n__cpuid(cpuid_info, 0);  \u002F\u002F Causes VM exit\nuint64_t end = __rdtsc();\nif ((end - start) > 500) {\n    \u002F\u002F Likely in VM (CPUID takes longer)\n}\n```\n\n**Bypass Approaches:**\n\n```\n- Use bare-metal analysis environment\n- Harden VM (remove guest tools, change MAC)\n- Patch detection code\n- Use specialized analysis VMs (FLARE-VM)\n```\n\n## Code Obfuscation\n\n### Control Flow Obfuscation\n\n#### Control Flow Flattening\n\n```c\n\u002F\u002F Original\nif (cond) {\n    func_a();\n} else {\n    func_b();\n}\nfunc_c();\n\n\u002F\u002F Flattened\nint state = 0;\nwhile (1) {\n    switch (state) {\n        case 0:\n            state = cond ? 1 : 2;\n            break;\n        case 1:\n            func_a();\n            state = 3;\n            break;\n        case 2:\n            func_b();\n            state = 3;\n            break;\n        case 3:\n            func_c();\n            return;\n    }\n}\n```\n\n**Analysis Approach:**\n\n- Identify state variable\n- Map state transitions\n- Reconstruct original flow\n- Tools: D-810 (IDA), SATURN\n\n#### Opaque Predicates\n\n```c\n\u002F\u002F Always true, but complex to analyze\nint x = rand();\nif ((x * x) >= 0) {  \u002F\u002F Always true\n    real_code();\n} else {\n    junk_code();  \u002F\u002F Dead code\n}\n\n\u002F\u002F Always false\nif ((x * (x + 1)) % 2 == 1) {  \u002F\u002F Product of consecutive = even\n    junk_code();\n}\n```\n\n**Analysis Approach:**\n\n- Identify constant expressions\n- Symbolic execution to prove predicates\n- Pattern matching for known opaque predicates\n\n### Data Obfuscation\n\n#### String Encryption\n\n```c\n\u002F\u002F XOR encryption\nchar decrypt_string(char *enc, int len, char key) {\n    char *dec = malloc(len + 1);\n    for (int i = 0; i \u003C len; i++) {\n        dec[i] = enc[i] ^ key;\n    }\n    dec[len] = 0;\n    return dec;\n}\n\n\u002F\u002F Stack strings\nchar url[20];\nurl[0] = 'h'; url[1] = 't'; url[2] = 't'; url[3] = 'p';\nurl[4] = ':'; url[5] = '\u002F'; url[6] = '\u002F';\n\u002F\u002F ...\n```\n\n**Analysis Approach:**\n\n```python\n# FLOSS for automatic string deobfuscation\nfloss malware.exe\n\n# IDAPython string decryption\ndef decrypt_xor(ea, length, key):\n    result = \"\"\n    for i in range(length):\n        byte = ida_bytes.get_byte(ea + i)\n        result += chr(byte ^ key)\n    return result\n```\n\n#### API Obfuscation\n\n```c\n\u002F\u002F Dynamic API resolution\ntypedef HANDLE (WINAPI *pCreateFileW)(LPCWSTR, DWORD, DWORD,\n    LPSECURITY_ATTRIBUTES, DWORD, DWORD, HANDLE);\n\nHMODULE kernel32 = LoadLibraryA(\"kernel32.dll\");\npCreateFileW myCreateFile = (pCreateFileW)GetProcAddress(\n    kernel32, \"CreateFileW\");\n\n\u002F\u002F API hashing\nDWORD hash_api(char *name) {\n    DWORD hash = 0;\n    while (*name) {\n        hash = ((hash >> 13) | (hash \u003C\u003C 19)) + *name++;\n    }\n    return hash;\n}\n\u002F\u002F Resolve by hash comparison instead of string\n```\n\n**Analysis Approach:**\n\n- Identify hash algorithm\n- Build hash database of known APIs\n- Use HashDB plugin for IDA\n- Dynamic analysis to resolve at runtime\n\n### Instruction-Level Obfuscation\n\n#### Dead Code Insertion\n\n```asm\n; Original\nmov eax, 1\n\n; With dead code\npush ebx           ; Dead\nmov eax, 1\npop ebx            ; Dead\nxor ecx, ecx       ; Dead\nadd ecx, ecx       ; Dead\n```\n\n#### Instruction Substitution\n\n```asm\n; Original: xor eax, eax (set to 0)\n; Substitutions:\nsub eax, eax\nmov eax, 0\nand eax, 0\nlea eax, [0]\n\n; Original: mov eax, 1\n; Substitutions:\nxor eax, eax\ninc eax\n\npush 1\npop eax\n```\n\n## Packing and Encryption\n\n### Common Packers\n\n```\nUPX          - Open source, easy to unpack\nThemida      - Commercial, VM-based protection\nVMProtect    - Commercial, code virtualization\nASPack       - Compression packer\nPECompact    - Compression packer\nEnigma       - Commercial protector\n```\n\n### Unpacking Methodology\n\n```\n1. Identify packer (DIE, Exeinfo PE, PEiD)\n\n2. Static unpacking (if known packer):\n   - UPX: upx -d packed.exe\n   - Use existing unpackers\n\n3. Dynamic unpacking:\n   a. Find Original Entry Point (OEP)\n   b. Set breakpoint on OEP\n   c. Dump memory when OEP reached\n   d. Fix import table (Scylla, ImpREC)\n\n4. OEP finding techniques:\n   - Hardware breakpoint on stack (ESP trick)\n   - Break on common API calls (GetCommandLineA)\n   - Trace and look for typical entry patterns\n```\n\n### Manual Unpacking Example\n\n```\n1. Load packed binary in x64dbg\n2. Note entry point (packer stub)\n3. Use ESP trick:\n   - Run to entry\n   - Set hardware breakpoint on [ESP]\n   - Run until breakpoint hits (after PUSHAD\u002FPOPAD)\n4. Look for JMP to OEP\n5. At OEP, use Scylla to:\n   - Dump process\n   - Find imports (IAT autosearch)\n   - Fix dump\n```\n\n## Virtualization-Based Protection\n\n### Code Virtualization\n\n```\nOriginal x86 code is converted to custom bytecode\ninterpreted by embedded VM at runtime.\n\nOriginal:     VM Protected:\nmov eax, 1    push vm_context\nadd eax, 2    call vm_entry\n              ; VM interprets bytecode\n              ; equivalent to original\n```\n\n### Analysis Approaches\n\n```\n1. Identify VM components:\n   - VM entry (dispatcher)\n   - Handler table\n   - Bytecode location\n   - Virtual registers\u002Fstack\n\n2. Trace execution:\n   - Log handler calls\n   - Map bytecode to operations\n   - Understand instruction set\n\n3. Lifting\u002Fdevirtualization:\n   - Map VM instructions back to native\n   - Tools: VMAttack, SATURN, NoVmp\n\n4. Symbolic execution:\n   - Analyze VM semantically\n   - angr, Triton\n```\n\n## Bypass Strategies Summary\n\n### General Principles\n\n1. **Understand the protection**: Identify what technique is used\n2. **Find the check**: Locate protection code in binary\n3. **Patch or hook**: Modify check to always pass\n4. **Use appropriate tools**: ScyllaHide, x64dbg plugins\n5. **Document findings**: Keep notes on bypassed protections\n\n### Tool Recommendations\n\n```\nAnti-debug bypass:    ScyllaHide, TitanHide\nUnpacking:           x64dbg + Scylla, OllyDumpEx\nDeobfuscation:       D-810, SATURN, miasm\nVM analysis:         VMAttack, NoVmp, manual tracing\nString decryption:   FLOSS, custom scripts\nSymbolic execution:  angr, Triton\n```\n\n### Ethical Considerations\n\nThis knowledge should only be used for:\n\n- Authorized security research\n- Malware analysis (defensive)\n- CTF competitions\n- Understanding protections for legitimate purposes\n- Educational purposes\n\nNever use to bypass protections for:\n\n- Software piracy\n- Unauthorized access\n- Malicious purposes\n",{"name":5,"description":7},"main","87afe6ce96220accf50a345dea46784c8c9f210e","YYC3-Plugin-插件协议\u002FYYC3-Plugin-插件协议-plugins-claude\u002Freverse-engineering\u002Fskills\u002Fanti-reversing-techniques",0,"https:\u002F\u002Fgithub.com\u002FYYC-Cube\u002FYYC3-Knowledge-Base","https:\u002F\u002Fkb.yyc3.top\u002F","https:\u002F\u002Fgithub.com\u002FYYC-Cube","万象归元于云枢 | 深栈智启新纪元","2026-11-10 10:37:32",{"source":8,"skillName":5,"commands":34,"prompt":44,"zipAvailable":45},[35,38,41],{"tool":36,"command":37},"npx","npx skills add YYC-Cube\u002FYYC3-Knowledge-Base --skill anti-reversing-techniques",{"tool":39,"command":40},"bunx","bunx skills add YYC-Cube\u002FYYC3-Knowledge-Base --skill anti-reversing-techniques",{"tool":42,"command":43},"pnpm","pnpm dlx skills add YYC-Cube\u002FYYC3-Knowledge-Base --skill anti-reversing-techniques","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FYYC-Cube\u002FYYC3-Knowledge-Base\u002Fblob\u002Fmain\u002FYYC3-Plugin-插件协议\u002FYYC3-Plugin-插件协议-plugins-claude\u002Freverse-engineering\u002Fskills\u002Fanti-reversing-techniques\u002FSKILL.md",true,[],[48,55,62,69,76,83],{"skillNo":49,"name":50,"nameZh":6,"description":51,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":52,"categories":53,"keywords":54,"publishedAt":19},"01M7CTDWHERCXPQCP0K03A86AS","vercel-sandbox","Run agent-browser + Chrome inside Vercel Sandbox microVMs for browser automation from any Vercel-deployed app. Use when the user needs browser automation in a Vercel app (Next.js, SvelteKit, Nuxt, Remix, Astro, etc.), wants to run headless Chrome without binary size limits, needs persistent browser sessions across commands, or wants ephemeral isolated browser environments. Triggers include \"Vercel Sandbox browser\", \"microVM Chrome\", \"agent-browser in sandbox\", \"browser automation on Vercel\", or any task requiring Chrome in a Vercel Sandbox.","https:\u002F\u002Fgithub.com\u002FYYC-Cube\u002FYYC3-Knowledge-Base\u002Fblob\u002Fmain\u002FYYC3-WebSpec-Web标准\u002FYYC3-WebSpec-Web标准-standards\u002Fbrowser-agent\u002Fskills\u002Fvercel-sandbox\u002FSKILL.md",[],[],{"skillNo":56,"name":57,"nameZh":6,"description":58,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":59,"categories":60,"keywords":61,"publishedAt":19},"01M7CTD8D2BNJY54S65M47HEJA","slack","Interact with Slack workspaces using browser automation. Use when the user needs to check unread channels, navigate Slack, send messages, extract data, find information, search conversations, or automate any Slack task. Triggers include \"check my Slack\", \"what channels have unreads\", \"send a message to\", \"search Slack for\", \"extract from Slack\", \"find who said\", or any task requiring programmatic Slack interaction.","https:\u002F\u002Fgithub.com\u002FYYC-Cube\u002FYYC3-Knowledge-Base\u002Fblob\u002Fmain\u002FYYC3-WebSpec-Web标准\u002FYYC3-WebSpec-Web标准-standards\u002Fbrowser-agent\u002Fskills\u002Fslack\u002FSKILL.md",[],[],{"skillNo":63,"name":64,"nameZh":6,"description":65,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":66,"categories":67,"keywords":68,"publishedAt":19},"01M7CTCSSB8ZP3Q58C3YZDZK1W","electron","Automate Electron desktop apps (VS Code, Slack, Discord, Figma, Notion, Spotify, etc.) using agent-browser via Chrome DevTools Protocol. Use when the user needs to interact with an Electron app, automate a desktop app, connect to a running app, control a native app, or test an Electron application. Triggers include \"automate Slack app\", \"control VS Code\", \"interact with Discord app\", \"test this Electron app\", \"connect to desktop app\", or any task requiring automation of a native Electron application.","https:\u002F\u002Fgithub.com\u002FYYC-Cube\u002FYYC3-Knowledge-Base\u002Fblob\u002Fmain\u002FYYC3-WebSpec-Web标准\u002FYYC3-WebSpec-Web标准-standards\u002Fbrowser-agent\u002Fskills\u002Felectron\u002FSKILL.md",[],[],{"skillNo":70,"name":71,"nameZh":6,"description":72,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":19},"01M7CTCBJY76688V4DCZGWFHGQ","dogfood","Systematically explore and test a web application to find bugs, UX issues, and other problems. Use when asked to \"dogfood\", \"QA\", \"exploratory test\", \"find issues\", \"bug hunt\", \"test this app\u002Fsite\u002Fplatform\", or review the quality of a web application. Produces a structured report with full reproduction evidence -- step-by-step screenshots, repro videos, and detailed repro steps for every issue -- so findings can be handed directly to the responsible teams.","https:\u002F\u002Fgithub.com\u002FYYC-Cube\u002FYYC3-Knowledge-Base\u002Fblob\u002Fmain\u002FYYC3-WebSpec-Web标准\u002FYYC3-WebSpec-Web标准-standards\u002Fbrowser-agent\u002Fskills\u002Fdogfood\u002FSKILL.md",[],[],{"skillNo":77,"name":78,"nameZh":6,"description":79,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":80,"categories":81,"keywords":82,"publishedAt":19},"01M7CTC4H0FFGVEAQR9PA4GA1A","agent-browser","Browser automation CLI for AI agents. Use when the user needs to interact with websites, including navigating pages, filling forms, clicking buttons, taking screenshots, extracting data, testing web apps, or automating any browser task. Triggers include requests to \"open a website\", \"fill out a form\", \"click a button\", \"take a screenshot\", \"scrape data from a page\", \"test this web app\", \"login to a site\", \"automate browser actions\", or any task requiring programmatic web interaction.","https:\u002F\u002Fgithub.com\u002FYYC-Cube\u002FYYC3-Knowledge-Base\u002Fblob\u002Fmain\u002FYYC3-WebSpec-Web标准\u002FYYC3-WebSpec-Web标准-standards\u002Fbrowser-agent\u002Fskills\u002Fagent-browser\u002FSKILL.md",[],[],{"skillNo":84,"name":85,"nameZh":6,"description":86,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":87,"categories":88,"keywords":89,"publishedAt":19},"01M7CTBKVFYBG78FDSABSDJTTQ","shadcn","Manages shadcn components and projects — adding, searching, fixing, debugging, styling, and composing UI, including chat interfaces. Provides project context, component docs, and usage examples. Applies when working with shadcn\u002Fui, component registries, presets, --preset codes, or any project with a components.json file. Also triggers for \"shadcn init\", \"create an app with --preset\", \"switch to --preset\", and for building a design system or applying a DESIGN.md or brand spec to shadcn\u002Fui.","https:\u002F\u002Fgithub.com\u002FYYC-Cube\u002FYYC3-Knowledge-Base\u002Fblob\u002Fmain\u002FYYC3-UI-界面组件\u002FYYC3-UI-界面组件-ui\u002Fskills\u002Fshadcn\u002FSKILL.md",[],[]]