'Object Manager Filtering'에 해당되는 글 2건
윈도우즈 비스타 SP1에 새롭게 탑재될 Object Manager Filtering을 통해서 기본적으로 프로세스간의 상호 작용을 컨트롤 할 수 있다. 윈도우즈의 한 특징이 바로 한 프로세스가 다른 프로세스를 열거나(OpenProcess) 핸들을 복사해 올 수 있다는 것이다. 이러한 과정에서 비스타(Vista) 이전에는 권한만 있다면 아무러한 제약이 없었다. 하지만 비스타에 들어서는 아무리 권한이 많은 프로세스라도 다른 프로세스를 함부로 건드리지 못하도록 할 수 있게 되었다. 이 것은 "Object Manager Filtering"으로 구현되어 있으며, 현재 비스타(Vista) SP1 베타 시스템에 탑재되어 있다.
"Object Manager Filtering"은 원래 윈도우즈 모든 오브젝트들의 상호 작용을 컨트롤하기 위하여 설계 된 것으로 보인다. 하지만, 현재 SP1에서는 Process와 Thread Object에 대한 필터링만을 지원한다. 자세한 스펙은 Kernel Data and Filtering Support for Windows Server 2008 문서를 참조하면 된다. Windows Server 2008을 기준으로 작성된 문서이지만, Vista SP1에서도 그대로 적용 되는 것을 확인했다.
OB_PRE_CREATE_HANDLE_INFORMATION 문서를 읽어 보면 프로세스와 쓰레드에 대해서 어떠한 오퍼레이션을 제어할 수 있는 지를 알 수 있다.
다음은 프로세스에 대한 제어 가능한 DesiredAccess 목록이다. 프로세스나 쓰레드를 생성하거나 다른 프로세스의 가상 메모리에 쓰는 일 등을 막을 수 있다. 이는 곧 악성 프로그램들로 부터 사용자 프로세스가 보호 받을 수 있는 길이 열렸음을 의미한다. 아무리 스파이웨어에 감염 되어도 특정 프로세스는 변조되거나 종료 또는 잠시 멈춰지는 일을 당하지 않아도 되게 되었다.
-
Flag
Allowed operations
PROCESS_CREATE_PROCESS
Create a new child process of the process.
PROCESS_CREATE_THREAD
Create a new thread in the context of the process.
PROCESS_DUP_HANDLE
Duplicate handles to or from the context of the process, such as by calling the user-mode DuplicateHandle routine.
PROCESS_SET_QUOTA
Set the working set size for the process, such as by calling the user-mode SetProcessWorkingSetSize routine.
PROCESS_SET_INFORMATION
Modify process settings, such as by calling the user-mode SetPriorityClass routine.
PROCESS_SUSPEND_RESUME
Suspend or resume the process.
PROCESS_TERMINATE
Terminate the process, such as by calling the user-mode TerminateProcess routine..
PROCESS_VM_OPERATIONS
Modify the address space of the process, such as by calling the user-mode WriteProcessMemory and VirtualProtectEx routines.
PROCESS_VM_WRITE
Write to the address space of the process, such as by calling the user-mode WriteProcessMemory routine.
다음은 쓰레드에 대한 제어 가능한 DesiredAccess 목록이다. 역시 프로세스와 같은 정도의 보호를 받을 수 있다.
-
Flag
Allowed operations
THREAD_DIRECT_IMPERSONATION
Enable a server thread to impersonate one of its clients.
THREAD_IMPERSONATE
Impersonate the operating system's anonymous logon token, such as by calling the user-mode ImpersonateAnonymousToken routine.
THREAD_SET_CONTEXT
Modify the thread's execution context, such as by calling the user-mode SetThreadContext routine.
THREAD_SET_INFORMATION
Modify thread settings, such as by calling the user-mode SetThreadIdealProcessor routine. The operations that are permitted by this access right are a superset of those that are permitted by the THREAD_SET_LIMITED_INFORMATION access right.
THREAD_SET_LIMITED_INFORMATION
Modify a limited set of thread settings, such as by calling the user-mode SetThreadAffinityMask and SetThreadPriorityBoost routines.
THREAD_SET_THREAD_TOKEN
Modify properties of the thread's impersonation token, such as by calling the user-mode SetTokenInformation routine.
THREAD_SUSPEND_RESUME
Suspend or resume the thread, such as by calling the user-mode SuspendThread and ResumeThread routines.
THREAD_TERMINATE
Terminate the thread, such as by calling the user-mode TerminateThread routine.
이러한 오브젝트 보호 메카니즘을 통해서 윈도우즈 세계에서 활개를 치는 악성 코드들로 부터 사용자들이 자유로워질 수 있는 길이 열렸다. 하지만, 예전에도 그러했듯이 분명히 이러한 보호 장치를 우회하는 기법이 나올 것이고, 창과 방패의 전쟁은 계속 될 것이다.
'엔지니어링' 카테고리의 다른 글
| 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 |
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 |



Prev
Rss Feed