Windbg 에서 IAT 확인하는 방법
!chkimg 와 같은 명령으로 후킹여부를 체크할 때 IAT는 체크되지 않기 때문에 따로 체크해야 합니다.
1. !dh <모듈이 로딩된 주소>명령을 이용해 대상 모듈의 PE를 파싱합니다.
!dh WINWORD
혹은
!dh 30000000
(30000000 은 WINWORD.exe의 ImageBase임. lm 등의 명령으로 확인)
2. 출력된 정보 중 Import Address Table 의 주소(Offset)와 사이즈를 확인합니다.
0:000> !dh 30000000
File Type: EXECUTABLE IMAGE
FILE HEADER VALUES
14C machine (i386)
4 number of sections
... 중간생략
OPTIONAL HEADER VALUES
10B magic #
7.10 linker version
A70800 size of code
114E00 size of initialized data
21400 size of uninitialized data
19A0 address of entry point
1000 base of code
----- new -----
30000000 image base
... 중간생략
0 DLL characteristics
2DFC24 [ 95] address [size] of Export Directory
A6E364 [ 8C] address [size] of Import Directory
B4B000 [ 5E7C0] address [size] of Resource Directory
0 [ 0] address [size] of Exception Directory
B79400 [ 1A38] address [size] of Security Directory
0 [ 0] address [size] of Base Relocation Directory
A71724 [ 38] address [size] of Debug Directory
0 [ 0] address [size] of Description Directory
0 [ 0] address [size] of Special Directory
58A210 [ 18] address [size] of Thread Storage Directory
0 [ 0] address [size] of Load Configuration Directory
0 [ 0] address [size] of Bound Import Directory
1000 [ 9A0] address [size] of Import Address Table Directory
A6C604 [ A0] address [size] of Delay Import Directory
0 [ 0] address [size] of COR20 Header Directory
0 [ 0] address [size] of Reserved Directory
IAT의 Offset은 1000, 사이즈는 9A0 라는 것을 확인했습니다.
3. dps 명령을 이용해 확인된 IAT의 내용을 출력해봅니다.
0:000> dps 30000000+1000 L9A0/4
30001000 77f56c17 advapi32!RegCloseKey
30001004 77f656e7 advapi32!LookupAccountSidW
30001008 77f572f5 advapi32!GetTokenInformation
3000100c 77f5797b advapi32!OpenProcessToken
30001010 77f56fef advapi32!RegQueryValueExW
30001014 77f56a9f advapi32!RegOpenKeyExW
30001018 77f57842 advapi32!RegOpenKeyExA
3000101c 77f5efb8 advapi32!RegOpenKeyA
30001020 77f57aab advapi32!RegQueryValueExA