본문 바로가기

자료

루트킷 프로세스 숨기기(Hiding the Rootkit Process -2)

728x90

 

블로그 인기글

● 메이플스토리 신규 룬패치/자동해제 프로그램 [링크 이동]

● 메이플스토리 거짓말탐지기 알림 프로그램 [링크 이동]

C#에서 TensorFlow 사용하는법 [링크 이동]


  • PIDB (Process ID Bruteforce) 방법을 사용하는 HPD

이 방법은 BlackLight에서 처음 사용되었으며 매우 효과적이면서도 단순한 것으로 밝혀졌습니다. 여기서는 0부터 0x41DC까지 ​​프로세스 id를 통해 열거 한 후 OpenProcess 함수를 호출하여 해당 프로세스가 존재하는지 확인합니다. 그런 다음이 검색된 프로세스 목록을 표준 열거 함수 (예 : Process32First, EnumProcesses 함수)를 사용하여 얻은 일반 프로세스 목록과 비교합니다.

테스트 중에 서버 시스템의 일부 프로세스 ID가 매직 넘버 0x41DC 이상인 것으로 확인되었습니다. 따라서 효율성을 높이기 위해 최신 운영 체제에서 실행 가능한 모든 프로세스를 처리하기 위해 매직 넘버가 두 배가됩니다.

다음은 PIDB 메서드를 구현하는 샘플 코드입니다.

 for(int i=0; i < 0x83B8; i+=4)
 {
   //These are system idle and system processes
   if( i == 0 || i==4 )
   {
   	 continue;
   }

   hprocess = OpenProcess
  	 (PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, i);

   if( hprocess == NULL  )
   {
	
	if( GetLastError() != ERROR_INVALID_PARAMETER)
	{
	// If the error code is other than 
	// ERROR_INVALID_PARAMETER that means this
	// process exists but we are not able to open.
		
	//check if this process is already discovered
	//using standard API functions.

	if( IsHiddenProcess(i) )
	{
		printf("\n Hidden process found %d", i);
	}
	}

	continue;
	}

	dwExitCode = 0;
	GetExitCodeProcess(hprocess, &dwExitCode);

	// check if this is active process...
	// only active process will return error 
	// code as ERROR_NO_MORE_ITEMS

	if( dwExitCode == ERROR_NO_MORE_ITEMS )  
	{
	  //check if this process is already discovered
	  if( IsHiddenProcess(i) )
	  {
		printf("\n Hidden process found %d", i);
	  }
	}
	CloseHandle(hprocess);
 }

이것은 매우 효과적인 방법이지만 루트킷은 OpenProcess 또는 기본 버전 NTOpenProcess 함수를 후킹 한 다음 ERROR_INVALID_PARAMETER로 오류 코드와 함께 NULL을 반환하여이 기술을 쉽게 무력화 할 수 있습니다. 이러한 속임수를 방어하기 위해 안티-루트킷 소프트웨어는 "Direct NT System Call Implemenation을 사용한 숨겨진 프로세스 감지"에 표시된대로 직접 시스템 호출 방법을 사용하여 NtOpenProcess를 호출 할 수 있습니다.


 

728x90