It's been a while since i played with packing/unpacking tricks. So, i am going to choose some fancy tricks and try to explain them in detail.
The story begins when i was trying to analyze a security issue in an infamous application. I tried to attach ollydbg to the running process but the process immediately crashed. I quickly googled "anti-attach tricks" and found many useful links.
In the next few posts, i am going to explain those anti-attach tricks.
It would surely be better to understand how debuggers attach themselves to running processes in order to understand those tricks and perhaps innovate new ones.
The main idea behind attaching is that a debugger calls the "DebugActiveProcess" function which ends up with calling the "RtlCreateUserThread" function to create a new remote thread into the target process, with the "DbgUiRemoteBreakin" function as the new thread entry point.
Thread creation occurs in the "DbgUiIssueRemoteBreakin" function, which looks something like the highlighted line in the image below.
As far as i see, one way to prevent debuggers from attaching to a process is conducted by hooking the "DbgBreakUiRemoteBreakin" or "DbgBreakPoint" function.
I will write a simple executable to demonstrate that. It overwrites the first byte of the "DbgUiRemoteBreakin" function with 0xC3, opcode for retn, thus killing this kind of threads. Similarly, we can patch the "DbgBreakPoint" function.
'시스템 해킹' 카테고리의 다른 글
윈도우 시스템파일들. (0) | 2012.04.25 |
---|---|
CVE-2012-0056 Linux Kernel >=2.6.39 local root by zx2c4 works epicly (0) | 2012.01.24 |
Kernel Mode Driver Development Kit for MASM32 programmers (0) | 2011.12.15 |
Start Here: Disk Drive Terminology (0) | 2011.12.15 |
악성코드가 이용하는 Windows Registry 정보 (0) | 2011.11.18 |