Nytro Posted April 25, 2015 Report Posted April 25, 2015 Contents1. NtGlobalFlag ...................................................................................................................... 52. Heap flags ........................................................................................................................... 83. The Heap ............................................................................................................................. 154. Thread Local Storage ................................................................................................... 195. Anti-Step-Over ................................................................................................................ 256. Hardware ............................................................................................................................. 29A. Hardware breakpoints ............................................................................................... 29B. Instruction Counting ............................................................................................... 30C. Interrupt 3 ................................................................................................................... 34D. Interrupt 0x2d ............................................................................................................ 35E. Interrupt 0x41 ............................................................................................................ 36F. MOV SS .............................................................................................................................. 377. APIs ...................................................................................................................................... 38A. Heap functions ............................................................................................................ 38B. Handles ............................................................................................................................ 41i. OpenProcess ............................................................................................................... 41ii. CloseHandle ............................................................................................................. 44iii. CreateFile ............................................................................................................. 48iv. LoadLibrary ............................................................................................................. 53v. ReadFile ...................................................................................................................... 55C. Execution Timing ........................................................................................................ 57D. Process-level............................................................................................................... 62i. CheckRemoteDebuggerPresent .............................................................................. 62ii. Parent Process ...................................................................................................... 63iii. CreateToolhelp32Snapshot .............................................................................. 65iv. DbgBreakPoint......................................................................................................... 79v. DbgPrint ...................................................................................................................... 80vi. DbgSetDebugFilterState ..................................................................................... 82vii. IsDebuggerPresent.............................................................................................. 83viii. NtQueryInformationProcess .......................................................................... 84ix. OutputDebugString ................................................................................................ 88x. RtlQueryProcessHeapInformation ..................................................................... 90xi. NtQueryVirtualMemory ......................................................................................... 91xii. RtlQueryProcessDebugInformation ............................................................... 92xiii. SwitchToThread .................................................................................................. 94xiv. Toolhelp32ReadProcessMemory........................................................................ 95xv. UnhandledExceptionFilter ................................................................................ 97xvi. VirtualProtect .................................................................................................... 98E. System-level ............................................................................................................... 100i. FindWindow ............................................................................................................... 100ii. NtQueryObject....................................................................................................... 102iii. NtQuerySystemInformation ............................................................................ 105iv. Selectors ............................................................................................................... 115F. User-interface .......................................................................................................... 118i. BlockInput ............................................................................................................... 118ii. FLD............................................................................................................................. 120iii. NtSetInformationThread................................................................................. 121iv. SuspendThread....................................................................................................... 122v. SwitchDesktop ......................................................................................................... 123G. Uncontrolled execution ......................................................................................... 124i. CreateProcess ......................................................................................................... 125ii. CreateThread ......................................................................................................... 130iii. DebugActiveProcess ......................................................................................... 131iv. Enum... .................................................................................................................... 134v. GenerateConsoleCtrlEvent................................................................................. 134vi. NtSetInformationProcess................................................................................. 136vii. NtSetLdtEntries ................................................................................................ 137viii. QueueUserAPC .................................................................................................... 138ix. RaiseException .................................................................................................... 139x. RtlProcessFlsData ................................................................................................ 141xi. WriteProcessMemory............................................................................................ 142xii. Intentional exceptions................................................................................. 143H. Conclusion ................................................................................................................... 146Download: http://pferrie.host22.com/papers/antidebug.pdf Quote