Windbg로 리모트 디버깅을 하거나 LiveKD를 사용하여 로칼 커널 디버깅을 할때에 간단하게 커널 후커, 또는 룻킷(RootKit)이 설치 되었는지 확인하는 방법이 있다. 물론 이런 작업은 IceSword와 같은 툴을 사용하면 간단히 해결되지만, 나름대로 이 방법도 사용해야 할 경우가 있다.
바로 !chkimg 명령어를 사용하는 것이다. -d 옵션을 사용하여 요약된 출력을 볼 수 있다.
-d
Causes the debugger to display a summary of all mismatched areas while the scan is occurring. For a description of this summary text, see the Comments section.
예를 들어 서비스테이블를 후킹하는 보안 프로그램이 깔려 있을 경우 다음과 같은 명령을 통해서 커널에 어떠한 변조를 가했는지 확인할 수 있다.
kd> !chkimg -lo 50 -d !nt
804e26ec-804e26ef 4 bytes - nt!KiServiceTable+44
[ 9d 7d 56 80:f8 13 2d 81 ]
804e270c-804e270f 4 bytes - nt!KiServiceTable+64 (+0x20)
[ 49 6b 56 80:b6 fd 48 f9 ]
804e273c-804e273f 4 bytes - nt!KiServiceTable+94 (+0x30)
[ 48 0d 57 80:8a 00 49 f9 ]
804e274c-804e274f 4 bytes - nt!KiServiceTable+a4 (+0x10)
[ 61 e7 56 80:d8 4c 49 f9 ]
804e2764-804e276b 8 bytes - nt!KiServiceTable+bc (+0x18)
[ 14 d3 5a 80 1a 04 58 80:20 19 2d 81 a8 18 2d 81 ]
804e277c-804e277f 4 bytes - nt!KiServiceTable+d4 (+0x18)
[ c5 b1 57 80:c8 16 2d 81 ]
804e27a4-804e27a7 4 bytes - nt!KiServiceTable+fc (+0x28)
[ 78 0f 59 80:da 51 49 f9 ]
804e27ac-804e27af 4 bytes - nt!KiServiceTable+104 (+0x08)
[ fa e9 58 80:84 51 49 f9 ]
804e2878-804e287b 4 bytes - nt!KiServiceTable+1d0 (+0xcc)
[ e3 0c 57 80:80 fc 48 f9 ]
804e2884-804e2887 4 bytes - nt!KiServiceTable+1dc (+0x0c)
[ fb 7a 56 80:ac 4e 49 f9 ]
804e2978-804e297b 4 bytes - nt!KiServiceTable+2d0 (+0xf4)
[ 2e 6f 58 80:70 14 2d 81 ]
804e2990-804e2993 4 bytes - nt!KiServiceTable+2e8 (+0x18)
[ 8e e4 57 80:08 13 2d 81 ]
804e29a8-804e29ab 4 bytes - nt!KiServiceTable+300 (+0x18)
[ 3d cd 64 80:00 1b 2d 81 ]
804e29fc-804e29ff 4 bytes - nt!KiServiceTable+354 (+0x54)
[ 43 c1 62 80:60 15 2d 81 ]
804e2a30-804e2a33 4 bytes - nt!KiServiceTable+388 (+0x34)
[ 5b c4 64 80:88 1a 2d 81 ]
804e2a38-804e2a3f 8 bytes - nt!KiServiceTable+390 (+0x08)
[ 05 bd 56 80 36 57 57 80:b8 17 2d 81 d8 15 2d 81 ]
804e2a84-804e2a87 4 bytes - nt!KiServiceTable+3dc (+0x4c)
[ 1d 4c 57 80:24 50 49 f9 ]
804e2a9c-804e2aa3 8 bytes - nt!KiServiceTable+3f4 (+0x18)
[ 19 dd 62 80 1e f8 5d 80:40 17 2d 81 e8 14 2d 81 ]
804e2aac-804e2ab3 8 bytes - nt!KiServiceTable+404 (+0x10)
[ 2b 2c 58 80 de a8 57 80:f0 12 49 f9 50 16 2d 81 ]
804e2afc-804e2aff 4 bytes - nt!KiServiceTable+454 (+0x50)
[ e0 e5 57 80:22 10 49 f9 ]
결과 출력물에서는 단지 KiServiceTable에 대한 offset만 나와 있지만, 커널 코드 디스어셈블리등을 해보면 간단히 어떠한 함수들인지 확인할 수 있다.
Trackback Address :: http://bugtruck.tistory.com/trackback/62

