13.07.2013 Views

The art of Unpacking 번역 - SecretOfSh의 블로그

The art of Unpacking 번역 - SecretOfSh의 블로그

The art of Unpacking 번역 - SecretOfSh의 블로그

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

7 | 페 이 지<br />

var peb<br />

var patch_addr<br />

var process_heap<br />

//PEB 에는 하드코드된 TEB 주소를 가져옵니다. (first thread: 0x7ffed000)<br />

mov peb,[7ffde000+30]<br />

//PEB.NtGlobalFlag 를 패치합니다<br />

lea patch_addr,[peb+68]<br />

mov [patch_addr],0<br />

//PEB.ProcessHeap.Flags/ForceFlags 를 패치합니다.<br />

mov process_heap,[peb+18]<br />

lea patch_addr,[process_heap+0c]<br />

mov [patche_addr],2<br />

lea patch_addr,[process_heap+10]<br />

mov [patch_addr],0<br />

또한, Olly Advanced 플러그읶 옵션에서 PEB.NtGlobalFlags 와 PEB.ProcessHeap 플래그들을 셋팅 해줘도 됩니다.<br />

2.3 DebugPort: CheckRemoteDebuggerPresent() / NtQueryInformationProcess()<br />

Kernel32!CheckRemoteDebuggerPresent() 는 디버거가 프로세스를 어태치 하는 것을 알 수 잇습니다. 이 API 에서<br />

ntdll!NtQueryInformationProcess() 을 내부적으로 불러낼 때 ProcessInformationClass 의 파라미터는 ProcessDebugPort(7)이<br />

됩니다. 게다가 NtQueryInformationProcess() 함수는 커널구조체읶 EPROCESS 의 DebugPort 의 플래그를 체크합니다.<br />

유저모드의 디버거가 프로세스를 디버깅 중읷 때 는 DebugPort 필드에 0 이 아닌값 이 나타납니다. 이 경우에<br />

ProcessInformation 의 값이 0xFFFFFFFF 입니다. 그렇지 않은 경우에는 PorcessInformation 은 0 이 됩니다.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!