반응형

분석을 하다보니,

실행시킬 프로그램에서 CreateProcess를 통해 프로세스가 실행 되는 구간이 발생한다.

그럴땐, 어떻게 분석해야 할지 난감해진다.

 

전체적으로 어떤 과정을 통해 실행되는지 확인을 하고 싶은데,

해당 Process는 접근 하기엔 이미 메모리에 다 올라간 상태이며 분석이 어렵게 된다.

따라서, 그런 과정일 경우 분석하는 방법을 소개 하겠다.

 

프로그램이 실행 되는 그림은 다음과 같다.

 

 

이럴 경우 CreateProcess 함수의 6번째 인자에 집중할 필요가 있다.

CreateProcess 함수의 6번째 인자는 CreationFlags 로써, 아래의 Flags를 갖는다.

 

(참조 : http://msdn.microsoft.com/en-us/library/windows/desktop/ms684863(v=vs.85).aspx)

 Constant/value  Description
 
CREATE_DEFAULT_ERROR_MODE
0x04000000
 

The new process does not inherit the error mode of the calling process. Instead, the new process gets the default error mode.

This feature is particularly useful for multithreaded shell applications that run with hard errors disabled.

The default behavior is for the new process to inherit the error mode of the caller. Setting this flag changes that default behavior.

 
CREATE_NEW_CONSOLE
0x00000010
 

The new process has a new console, instead of inheriting its parent's console (the default). For more information, see Creation of a Console.

This flag cannot be used with DETACHED_PROCESS.

 
CREATE_NO_WINDOW
0x08000000
 

The process is a console application that is being run without a console window. Therefore, the console handle for the application is not set.

This flag is ignored if the application is not a console application, or if it is used with either CREATE_NEW_CONSOLE or DETACHED_PROCESS.

 
CREATE_PROTECTED_PROCESS
0x00040000
 

The process is to be run as a protected process. The system restricts access to protected processes and the threads of protected processes. For more information on how processes can interact with protected processes, see Process Security and Access Rights.

To activate a protected process, the binary must have a special signature. This signature is provided by Microsoft but not currently available for non-Microsoft binaries. There are currently four protected processes: media foundation, audio engine, Windows error reporting, and system. Components that load into these binaries must also be signed. Multimedia companies can leverage the first two protected processes. For more information, see Overview of the Protected Media Path.

Windows Server 2003 and Windows XP:  This value is not supported.
 
CREATE_SUSPENDED
0x00000004
 

The primary thread of the new process is created in a suspended state, and does not run until the ResumeThread function is called.

 

제일 마지막에 보이는가?

CREATE_SUSPENDED

감을 잡은 사람이 있을 것이다. 해당 옵션으로 CreateProcess를 할 경우 이 녀석은 PID를 가진 얼음과 같이 얼어버린 상태가 된다.

 

따라서, CreatePrcess 함수를 호출하는 인자에서 6번째 인자를 "4"로 변경하고 분석을 하게 되면 프로그램이 시작하는 단계에서 부터 분석이 가능하게 되므로 아주 유용하게 사용할 수 있는 내용이다.

 

특히나, 대회, 악성코드 분석할때 많이 사용 될 것으로 보인다.

더 좋은 방법이 있다면 같이 공유하길 바라며, 이 글을 마친다.

 

반응형
반응형

요즘 악성 파일들이 자주 날라오네요.

분석한 김에 정리한 내용을 올립니다.

 

 

 

doc 파일이라고 보이지만, 파일을 선택해 보면 exe 파일 임을 확인 할 수 있다.

 

해당 파일을 분석 해보면, 랜덤한 문자열을 생성한다.

srand() 이용

 

00401A3F  |.  50            PUSH EAX                                 ; /seed
00401A40  |.  FF15 00714000 CALL DWORD PTR DS:[<&MSVCRT.srand>]      ; \srand

 

랜덤한 문자열을 기반으로 2차 연산 과정을 걸쳐 실행파일 생성

 

 

 

해당 파일을 CreateProcessW를 이용하여 실행 이후 프로그램 종료.

 

gz2gh.exe 파일의 경우는 레지스트리의 "Software\Microsoft\Windows\CurrentVersion\Run\Google_Update"

추가하여 실행시 구동하게 한다.

 

 

외부 C&C 서버로 접속

 

war.geekgalaxy.com

revjj.syshell.org

 

해당 URL은 방화벽으로 차단하는 것이 좋을 것 같다.

(접속 로그를 확인하여, 감염 유무를 모니터링 하는 것도 하나의 방법이다.)

서버에서 kernel.dll 파일을 전송 받음.

 

 

ps ;

서버를 끊어버려서 kernel.dll 파일은 못 구했네요.

해당 파일을 분석 하고 싶은데 ㅎㅎㅎ 실망에선 좀 힘들고..어디 안전하게 받으신 분 있다면 연락주세요.^^/

 

 

 

 

 

 

반응형
반응형
반응형

'프로그래밍 > 안드로이드' 카테고리의 다른 글

Android Emulator  (0) 2013.04.01
반응형

 

 

지인의 소개로 자리 하나를 잡은 일정..@.@
마지막 시간이라니..>.<


반응형

+ Recent posts