Object Manager Filter를 코딩하여 빌드한 후에 윈도우즈 비스타(Vista) SP1시스템에 올려 보면 대부분의 경우 ObRegisterCallbacks 함수가 STATUS_ACCESS_DENIED(0C0000022h)를 리턴하고 콜백을 등록하지 못하는 현상을 경험할 때가 있다.
이 경우는 바로 링커 옵션의 문제로서 Kernel Data and Filtering Support for Windows Server 2008
문서의 4장(Requirements and Constraints)에 보면 다음과 같이 링커의 옵션("/integritycheck")을 넣으라는 구절이 나온다.
-
All ISV kernel and user mode modules must be linked with the /integritycheck flag set at link time. This will cause the memory manager to enforce a signature check at load time for the referenced code. This link.exe setting is present in recent versions of the Microsoft Visual Studio® linker. If the ISV is using alternate tools to link or edit their produced binaries, this flag setting has the effect of setting (ON) IMAGE_DLLCHARACTERISTICS_FORCE_INTEGRITY (0x0800) in the image PE header OptionalHeader.DllCharacteristics field.
해당 옵션은 비스타에서 새롭게 도입된 옵션으로 보인다. 실제 커널 디버깅을 해 보면, 다음과 같이 _LDR_DATA_TABLE_ENTRY 구조체의 Flags에 0x20 플래그가 세팅 되어 있는 것을 발견할 수 있다. 이 플래그 세팅 여부는 MmVerifyCallbackFunction라는 커널의 함수에 의해서 체크가 이루어진다.
|
With /integritycheck flag unset |
With /integritycheck flag set |
|
kd> dt nt!_LDR_DATA_TABLE_ENTRY 83d20bf0 +0x000 InLoadOrderLinks : _LIST_ENTRY [ 0x81b2fbb0 - 0x83ccb3b0 ] +0x008 InMemoryOrderLinks : _LIST_ENTRY [ 0xffffffff - 0xffffffff ] +0x010 InInitializationOrderLinks : _LIST_ENTRY [ 0xc0d0003 - 0x0 ] +0x018 DllBase : 0x91ebb000 +0x01c EntryPoint : 0x91ebf005 +0x020 SizeOfImage : 0x7000 +0x024 FullDllName : _UNICODE_STRING "\??\C:\Windows\system32\drivers\TestDriver.sys" +0x02c BaseDllName : _UNICODE_STRING "TestDriver.sys" +0x034 Flags : 0x49104000 +0x038 LoadCount : 1 +0x03a TlsIndex : 0 +0x03c HashLinks : _LIST_ENTRY [ 0x0 - 0xf0dc ] +0x03c SectionPointer : (null) +0x040 CheckSum : 0xf0dc +0x044 TimeDateStamp : 0xa40 +0x044 LoadedImports : 0x00000a40 +0x048 EntryPointActivationContext : (null) +0x04c PatchInformation : 0x82da7bb9 +0x050 ForwarderLinks : _LIST_ENTRY [ 0x0 - 0x650054 ] +0x058 ServiceTagLinks : _LIST_ENTRY [ 0x740073 - 0x720044 ] +0x060 StaticLinks : _LIST_ENTRY [ 0x760069 - 0x720065 ] |
kd> dt nt!_LDR_DATA_TABLE_ENTRY 844de7e0 +0x000 InLoadOrderLinks : _LIST_ENTRY [ 0x81b61bb0 - 0x841820b0 ] +0x008 InMemoryOrderLinks : _LIST_ENTRY [ 0xffffffff - 0xffffffff ] +0x010 InInitializationOrderLinks : _LIST_ENTRY [ 0x630069 - 0x0 ] +0x018 DllBase : 0x922c7000 +0x01c EntryPoint : 0x922cc005 +0x020 SizeOfImage : 0x8000 +0x024 FullDllName : _UNICODE_STRING "\??\C:\Windows\system32\drivers\TestDriver.sys" +0x02c BaseDllName : _UNICODE_STRING "TestDriver.sys" +0x034 Flags : 0x49104020 +0x038 LoadCount : 1 +0x03a TlsIndex : 0x69 +0x03c HashLinks : _LIST_ENTRY [ 0x0 - 0x61e5 ] +0x03c SectionPointer : (null) +0x040 CheckSum : 0x61e5 +0x044 TimeDateStamp : 0x5c0073 +0x044 LoadedImports : 0x005c0073 +0x048 EntryPointActivationContext : (null) +0x04c PatchInformation : 0x82da7be9 +0x050 ForwarderLinks : _LIST_ENTRY [ 0x0 - 0x650054 ] +0x058 ServiceTagLinks : _LIST_ENTRY [ 0x740073 - 0x720044 ] +0x060 StaticLinks : _LIST_ENTRY [ 0x760069 - 0x720065 ] |
'엔지니어링' 카테고리의 다른 글
| Windows Vista x64 에디션의 드라이버 싸이닝 문제 (0) | 2008/03/17 |
|---|---|
| IRP_MJ_CLEANUP과 IRP_MJ_CLOSE의 차이점 (0) | 2008/03/12 |
| Windows Vista SP1의 Object Manager Filtering으로 할 수 있는 일 (0) | 2007/10/31 |
| Windows Vista SP1의 Object Manager Filtering (0) | 2007/10/30 |
| 윈도우즈 비스타(Vista) 커널 자료 구조 정리 사이트 (0) | 2007/10/29 |
| 인터넷 개인 정보 뒷조사 도구-말티고(Maltego) (0) | 2007/09/25 |



