AntiDebugSeeker插件,发现我多年的一个问题

admin 2024年4月28日10:54:22评论2 views字数 4887阅读16分17秒阅读模式

这是IDA的插件,是2023年的获奖插件,网上有报导。

插件的介绍为:一个自动提取恶意软件使用的反调试技术并在IDA Pro中显示的程序,基于静态分析和PE文件的静态分析,通过双击插件用户中显示的结果可以快速跳转到检测到的模式接口。

插件很强大,能获奖就说明问题了,不用我这个小白多费口舌。

插件工作后的效果是这样的:也能发现调试函数。

AntiDebugSeeker插件,发现我多年的一个问题

写这个文章一方面是推荐给大家,一方面是说件事,它发现了我多年来的一个使用反调试代码的误区,对我而言,收获很大。且听一一道来:

插件由三个文件组成,很简捷:

AntiDebugSeeker.py:主文件;

anti_debug.config:配置文件,各种触发阀值;

anti_debug_techniques_descriptions.json:描述内容;

在这三个文件中,我发现anti_debug.config是个好东西,里面对现在市面上流行的常用的触发条件都罗列了出来,下面贴出来:

###Anti_Debug_API###

[Debugger check]

CheckRemoteDebuggerPresent

DebugActiveProcess

DebugBreak

DbgSetDebugFilterState

DbgUiDebugActiveProcess

IsDebuggerPresent

NtDebugActiveProcess

NtQueryObject

NtSetDebugFilterState

NtSystemDebugControl

OutputDebugStringA

OutputDebugStringW

[Process Check]

CreateToolhelp32Snapshot

GetWindowThreadProcessId

NtQueryInformationProcess

NtSetInformationProcess

Process32First

Process32Next

Process32FirstW

Process32NextW

[Memory Manipulation]

MapViewOfFile

UnmapViewOfFile

VirtualAlloc

VirtualAllocEx

VirtualProtect

VirtualProtectEx

NtAllocateVirtualMemory

[Write Data OnTheMemory]

WriteProcessMemory

NtWriteVirtualMemory

[MemoryRead,ProcessInspection]

NtQueryVirtualMemory

ReadProcessMemory

Toolhelp32ReadProcessMemory

[Window Name Check]

EnumThreadWindows

EnumWindows

FindWindowA

FindWindowExA

FindWindowExW

FindWindowW

GetForegroundWindow

GetWindow

GetWindowTextW

NtUserBuildHwndList

NtUserFindWindowEx

NtUserGetForegroundWindow

NtUserQueryWindow

[Mutual Exclusion]

CreateMutexA

CreateMutexW

OpenMutexA

OpenMutexW

[Analysis Environment Check]

DeviceIoControl

GetAdaptersAddresses

GetAdaptersInfo

GetComputerNameA

GetComputerNameW

GetSystemInfo

GetUserNameA

GetUserNameW

NtQuerySystemInformation

SetupDiEnumDeviceInfo

SetupDiGetClassDevsA

SetupDiGetDeviceRegistryPropertyA

SetupDiGetDeviceRegistryPropertyW

[Time Check]

GetLocalTime

GetSystemTime

GetTickCount

GetTickCount64

NtDelayExecution

NtQueryPerformanceCounter

NtQuerySystemTime

NtWaitForSingleObject

QueryPerformanceCounter

SetTimer

SleepEx

sleep

timeGetTime

timeSetEvent

WaitForSingleObject

WaitForSingleObjectEx

[Thread Manipulation]

CreateThread

GetThreadContext

SetThreadContext

SuspendThread

[Thread Execute]

NtResumeThread

ResumeThread

[Thread Injection]

CreateRemoteThread

[Thread Hide Check]

NtCreateThreadEx

NtSetInformationThread

[Hardware Breakpoint Check]

NtGetContextThread

NtSetContextThread

[User Interaction Check]

BlockInput

CountClipboardFormats

GenerateConsoleCtrlEvent

GetCursorInfo

GetCursorPos

NtUserBlockInput

SwitchDesktop

[Check Invalid Close->Exception]

CloseHandle

NtClose

[Exception Handling Check]

RaiseException

SetUnhandledExceptionFilter

UnhandledExceptionFilter

###Anti_Debug_Technique###

default_search_range=80

[HeapTailMarker]

ABABABAB

[KernelDebuggerMarker]

7FFE02D4

[DbgBreakPoint_RET]

DbgBreakPoint

C3h

[DbgUiRemoteBreakin_Debugger_Terminate]

DbgUiRemoteBreakin

TerminateProcess

[PMCCheck_RDPMC]

rdpmc

[TimingCheck_RDTSC]

rdtsc

[SkipPrefixes_INT1]

F3h

64h

F1h

[INT2D_interrupt_check]

fs:0

2Dh

search_range=30

[INT3_interrupt_check]

fs:0

3

search_range=30

[EXCEPTION_BREAKPOINT]

fs:0

3

80000003h

[ICE_interrupt_check]

fs:0

icebp

[DBG_PRINTEXCEPTION_C]

40010006h

[TrapFlag_SingleStepException]

pushfd

100h

popfd

[BeingDebugged_check]

fs:30h

eax+2

search_range=15

[NtGlobalFlag_check]

fs:30h

68h

70h

[NtGlobalFlag_check_2]

BCh

70h

[HeapFlags]

fs:30h

18h

40h

[HeapForceFlags]

fs:30h

18h

44h

[Combination_of_HEAP_Flags]

40000060h

[Combination_of_HEAP_Flags_2]

40000062h

[ReadHeapFlags]

RtlCreateQueryDebugBuffer

RtlQueryProcessHeapInformation

[ReadHeapFlags_2]

RtlCreateQueryDebugBuffer

RtlQueryProcessDebugInformation

[DebugPrivileges_Check]

1FFFFFh

OpenProcess

[Opened_Exclusively_Check]

80000000h

CreateFile

search_range=20

[EXCEPTION_INVALID_HANDLE_1]

CloseHandle

0C0000008h

[EXCEPTION_INVALID_HANDLE_2]

NtClose

0C0000008h

[Memory_EXECUTE_READWRITE_1]

40h

3000h

VirtualAlloc

search_range=15

[Memory_EXECUTE_READWRITE_2]

40h

VirtualProtect

search_range=20

[Memory_Region_Tracking]

VirtualAlloc

GetWriteWatch

search_range=250

[Check_BreakPoint_Memory_1]

Toolhelp32ReadProcessMemory

0CCh

[Check_BreakPoint_Memory_2]

0CCh

40h

VirtualProtect

[Software_Breakpoints_Check]

NtQueryVirtualMemory

100h

0E0h

search_range=300

[Hardware_Breakpoints_Check]

10010h

GetCurrentThread

GetThreadContext

[Enumerate_Running_Processes]

CreateToolhelp32Snapshot

Process32First

Process32Next

search_range=250

[ThreadHideFromDebugger]

NtSetInformationThread

11h

[NtQueryInformationProcess_PDPort]

NtQueryInformationProcess

7

0FFFFFFFFh

[NtQueryInformationProcess_PDFlags]

NtQueryInformationProcess

1Fh

[NtQueryInformationProcess_PDObjectHandle]

NtQueryInformationProcess

1Eh

[NtQuerySystemInformation_KD_Check]

NtQuerySystemInformation

23h

这分别代表什么意思,可以结合AntiDebugSeeker.py来理解,自己看吧。

我为什么说它是个好东西呢,因为它发现了我的一个问题,

因为在比较重要的软件中,有时会在源码里加入一些反调试的片断,如这样的:

AntiDebugSeeker插件,发现我多年的一个问题

对照anti_debug.config中的就为:

AntiDebugSeeker插件,发现我多年的一个问题

这三行代码就为:

    mov eax,fs:[30h]     

    mov     eax, [eax + 68h]

    AND     eax, $70 

这是对NtGlobal的标志位进行检测;

在配置文件的红框的下面又列出了一个NtGlobal的标志位检测

AntiDebugSeeker插件,发现我多年的一个问题

这里的偏移不是68h而是BCh了,怎么回事?

在网上搜索了一翻,大部分都是68h的偏移这样,最后在官网上找到了说明,如下:

AntiDebugSeeker插件,发现我多年的一个问题

原来是32位和64位的区别,噢了,原来这么多年我一直用的反调试代码都是在32位下的,没有64位的,那就意味着在64位下运行的防护都是失效的,这可是很严重的问题了。

好了,这篇文章到这里结束,下面我会对照这个清单来检验我多年来一直使用的这些代码。

能在这个日子里有这么大的收获,特分享给大家,共同庆祝伟大的祖国繁荣昌盛!

原文始发于微信公众号(MicroPest):AntiDebugSeeker插件,发现我多年的一个问题

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2024年4月28日10:54:22
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   AntiDebugSeeker插件,发现我多年的一个问题https://cn-sec.com/archives/2080574.html

发表评论

匿名网友 填写信息