보안/분석
[노트] ProbeForRead
NineKY
2009. 8. 31. 10:37
The ProbeForRead routine checks that a user-mode buffer
actually resides in the user portion of the address space, and is correctly
aligned.
즉, 파라메터로 전달된 유저모드 버퍼 주소 가 사용자 주소 공간안에 포함되어 있는지 여부를 확인하는 함수이다.
VOID ProbeForRead( IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment );
- Address
- Specifies the beginning of the user-mode buffer.
- Length
- Specifies the length, in bytes, of the user-mode buffer.
- Alignment
- Specifies the required alignment, in bytes, of the beginning of the user-mode buffer.
이 함수는 유저모드 주소 공간 영역(Address)을 벗어날 경우 STATUS_ACCESS_VIOLATION exception 을 발생시키고,
Alignment 파라메터 에 정의된 것과 다른 Alignment 를 보일 경우에는 STATUS_DATATYPE_MISALIGNMENT 예외를 발생시킨다.
따라서 드라이버 내에서 호출을 할 경우 반드시 try ~ catch 를 이용해야 한다.
MSDN 에는 다음과 같은 보안 관련 커멘트도 있다.
a malicious application could have another thread deleting, substituting, or
changing the protection of user address ranges at any time (even after or during
a call to ProbeForRead or ProbeForWrite).
위 커멘트에 따르면 악성 프로그램에 의해서 이용될 수 있는데, 타 Thread 의 제거, 대체, 또는 사용자 메모리 영역의 Protection 을 변경하려고 할 때 메모리 Exception 을 피하려고 이용되는 것으로 생각된다.
그러나, 간단히 웹 검색해 본 결과 직접적인 사례 또는 예제 코드를 확인할 수는 없었다.