KR101182346B1 - Apparatus and method for dynamic binary instrumentaion - Google Patents

Apparatus and method for dynamic binary instrumentaion Download PDF

Info

Publication number
KR101182346B1
KR101182346B1 KR1020100054642A KR20100054642A KR101182346B1 KR 101182346 B1 KR101182346 B1 KR 101182346B1 KR 1020100054642 A KR1020100054642 A KR 1020100054642A KR 20100054642 A KR20100054642 A KR 20100054642A KR 101182346 B1 KR101182346 B1 KR 101182346B1
Authority
KR
South Korea
Prior art keywords
analysis
dll
information
single step
analysis target
Prior art date
Application number
KR1020100054642A
Other languages
Korean (ko)
Other versions
KR20110134976A (en
Inventor
김태형
김인혁
김정한
임병홍
엄영익
Original Assignee
성균관대학교산학협력단
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 성균관대학교산학협력단 filed Critical 성균관대학교산학협력단
Priority to KR1020100054642A priority Critical patent/KR101182346B1/en
Publication of KR20110134976A publication Critical patent/KR20110134976A/en
Application granted granted Critical
Publication of KR101182346B1 publication Critical patent/KR101182346B1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/30098Register arrangements
    • G06F9/30105Register structure
    • G06F9/30109Register structure having multiple operands in a single register
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/30181Instruction operation extension or modification
    • G06F9/30185Instruction operation extension or modification according to one or more bits in the instruction, e.g. prefix, sub-opcode
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/38Concurrent instruction execution, e.g. pipeline, look ahead
    • G06F9/3836Instruction issuing, e.g. dynamic instruction scheduling or out of order instruction execution
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/38Concurrent instruction execution, e.g. pipeline, look ahead
    • G06F9/3836Instruction issuing, e.g. dynamic instruction scheduling or out of order instruction execution
    • G06F9/3838Dependency mechanisms, e.g. register scoreboarding
    • G06F9/384Register renaming
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45504Abstract machines for programme code execution, e.g. Java virtual machine [JVM], interpreters, emulators
    • G06F9/45516Runtime code conversion or optimisation
    • G06F9/4552Involving translation to a different instruction set architecture, e.g. just-in-time translation in a JVM

Abstract

본 발명에 따른 동적 코드 분석 시, 게스트 머신에서 동작하는 프로세스를 디버그 모드로 실행하여 상기 프로세스에 대해 적재된 DLL 정보를 획득하고, 프로세스의 시작 주소에 소프트웨어 브레이크 포인트를 설정하고, 프로세스에 대한 DLL의 정보가 모두 획득된 후 프로세스 실행 시 로딩되는 DLL의 정보와 획득한 DLL의 정보를 이용하여 API 호출 정보를 추출하고, 프로세스 실행에 따른 예외 발생 시 싱글 스텝 분석을 통한 명령어 분석을 수행한다.In dynamic code analysis in accordance with the present invention, a process running on a guest machine is executed in debug mode to obtain DLL information loaded for the process, to set a software breakpoint at the start address of the process, After all the information is obtained, API call information is extracted by using the DLL information loaded during process execution and the acquired DLL information, and command analysis is performed by single step analysis when an exception occurs according to process execution.

Description

동적 코드 분석 장치 및 방법{APPARATUS AND METHOD FOR DYNAMIC BINARY INSTRUMENTAION}Dynamic code analysis apparatus and method {APPARATUS AND METHOD FOR DYNAMIC BINARY INSTRUMENTAION}

본 발명은 코드 분석 장치에 관한 것으로, 더욱 상세하게는 가상 머신에서 동작하는 프로세스를 분석하는 동적 코드 분석 장치 및 방법에 관한 것이다.The present invention relates to a code analysis apparatus, and more particularly, to a dynamic code analysis apparatus and method for analyzing a process running in a virtual machine.

동적 코드 분석 기법은 메모리 관리, 스레드(thread) 버그 탐지, 힙/스택 오버런 탐지 및 프로그램 프로파일링(profiling) 등 다양한 목적으로 활용되고 있다. 이러한 코드 분석 기법은 목적 및 구현 방식에 따라 에뮬레이터, 프로세스 레벨 동적 코드 분석기 등 다양한 형태로 제공되고 있다.Dynamic code analysis techniques are used for a variety of purposes, including memory management, thread bug detection, heap / stack overrun detection, and program profiling. These code analysis techniques are available in various forms, including emulators and process-level dynamic code analyzers, depending on the purpose and implementation.

특히, 최근 들어 가상화 기술의 발전에 따라 이를 이용한 동적 코드 분석 기법이 활발히 연구되고 있다. 가상화 기술은, 한정된 물리적 자원을 하나의 서비스 혹은 여러 개의 서비스로 만들어 제공할 수 있는 중재자 역할을 수행하는 기술이다. 이와 같은, 가상화 기술은 서버, 데스크 탑, 운영 체제, 애플리케이션, 스토리지 및 네트워크 등 다양한 분야에서 기존의 복잡했던 환경을 단순화시켜 작업 처리의 분산 및 관리 수단의 통합을 가능하게 한다.In particular, recently, with the development of virtualization technology, dynamic code analysis techniques are actively being researched. Virtualization technology is a technology that acts as an arbiter that can provide limited physical resources as a service or multiple services. As such, virtualization technology simplifies existing complex environments in a variety of fields, including servers, desktops, operating systems, applications, storage, and networks, allowing for the integration of distributed processing and management tools.

이러한, 가상화 기술을 기반으로 하는 대표적인 동적 코드 분석 기법으로는 에뮬레이터를 사용하는 방식이 있다. 이러한, 에뮬레이터는 하드웨어와 독립적으로 소프트웨어를 통한 가상의 컴퓨터 시스템을 제공하며, 이를 통해서 코드 수정 없이 다른 운영체제를 실행할 수 있다. 하지만 실행 속도가 매우 느린 단점이 있어서 이를 활용하는 데에 한계가 있다.The representative dynamic code analysis technique based on the virtualization technology is an emulator. Such an emulator provides a virtual computer system through software independent of hardware, which allows other operating systems to run without code modification. However, there is a drawback in using it because it is very slow.

한편, 다른 동적 코드 분석 기법으로는 사용자 레벨에서 프로그램의 실행 과정을 모니터링하는 동적 코드 분석기가 존재한다. 일반적인 운영 체제에서 사용자 모드로 동작하는 프로그램의 경우, 범용 레지스터와 사용자 영역의 주소 공간으로의 접근만이 가능하며 나머지 자원을 사용하기 위해서는 시스템 콜을 통해 처리한다. 사용자 레벨의 동적 코드 분석기를 통한 모니터링에서는 사용자 컨텍스트(context)를 섀도우 레지스터와 메모리 영역을 통하여 관리하고, 시스템 콜 호출의 경우 리다이렉션(redirection)을 통해 커널에서 처리한다. 이를 통해 커널 내에서의 시스템 콜 처리를 제외한 응용 프로그램의 모든 코드를 동적으로 모니터링 할 수 있다.Another dynamic code analysis technique is a dynamic code analyzer that monitors the execution of a program at the user level. In the case of a program running in user mode in a general operating system, only access to general-purpose registers and user-space address space is possible, and system calls are used to use the remaining resources. In user level dynamic code analyzer monitoring, user contexts are managed through shadow registers and memory areas, and system call calls are handled by the kernel through redirection. This allows you to dynamically monitor all code in your application except for system call processing within the kernel.

이러한 동적 코드 분석기에는 Valgrind와 Pin이 있으며, Valgrind는 프로그램의 메모리 누수와 잘못된 메모리 접근 등을 탐지하는 오픈 소스 프로그램이고, Pin은 인텔에서 개발한 동적 코드 분석기로써 JIT 컴파일러 기반으로 동작한다.These dynamic code analyzers include Valgrind and Pin. Valgrind is an open source program that detects memory leaks and bad memory accesses. Pin is a dynamic code analyzer developed by Intel and runs on the JIT compiler.

그런데, 사용자 레벨 동적 코드 분석기를 이용한 코드의 분석은 에뮬레이터를 이용한 분석에 비해 빠르고 프로세스 별 추적이 용이하나, 코드 변환이 필요하여 디버깅 회피 기법에 노출되기 쉬운 단점이 있다.However, analysis of code using a user-level dynamic code analyzer is faster and easier to track by process than analysis using an emulator, but has a disadvantage of being easily exposed to debugging avoidance techniques due to code conversion.

따라서, 가상화 기술에 기반하여 메모리 추적, 시스템 콜 추적, 프로세스 제한적 추적 등과 더불어 실행 압축, 안티-디버깅 기술에 대해 효율적이면서도, 정확하고 상세한 동적 코드 분석을 수행할 수 있는 동적 코드 분석 장치 및 방법이 필요한 실정이다.Therefore, there is a need for a dynamic code analysis apparatus and method that can perform efficient, accurate and detailed dynamic code analysis of execution compression and anti-debugging techniques, along with memory tracing, system call tracing, and process-limited tracing based on virtualization technology. It is true.

본 발명은 상술한 문제점을 해결하기 위한 것으로서, 가상화 기술을 기반으로 게스트 머신에서 동작하는 프로세스가 실행하는 프로그램 코드를 분석하고, 프로세스가 로딩하는 DLL 정보 분석 및 API 호출 정보 추출을 수행하는 동적 코드 분석 장치 및 방법을 제공하고자 한다.The present invention is to solve the above-mentioned problems, based on the virtualization technology to analyze the program code executed by the process running on the guest machine, dynamic code analysis to perform DLL information analysis and API call information extraction process loading An apparatus and method are provided.

상술한 기술적 과제를 달성하기 위한 기술적 수단으로서, 본 발명의 일 측면에 따른 동적 코드 분석 장치는, 게스트 머신에서 동작하는 적어도 하나의 프로세스를 분석 대상 프로세스로 등록하는 호스트 머신; 상기 분석 대상 프로세스를 디버그 모드로 실행하여 DLL(Dynamic Link Library) 정보를 획득하고, 상기 획득한 DLL 정보를 이용하여 API(Application Programming Interface) 호출 정보를 추출하는 게스트 머신; 및 상기 호스트 머신을 통해 등록 요청되는 프로세스를 분석 대상 프로세스 목록에 추가하고, 상기 분석 대상 프로세스에서 발생되는 예외에 대해 싱글 스텝 분석처리를 수행하는 하이퍼바이저를 포함한다.As a technical means for achieving the above technical problem, a dynamic code analysis apparatus according to an aspect of the present invention, a host machine for registering at least one process operating in the guest machine as the analysis target process; A guest machine for executing the analysis target process in debug mode to obtain DLL (Dynamic Link Library) information, and extracting API (Application Programming Interface) call information using the obtained DLL information; And a hypervisor for adding a process requested to be registered through the host machine to a list of analysis target processes and performing a single step analysis process on exceptions generated in the analysis target process.

또한, 본 발명의 다른 측면에 따른 동적 코드 분석 방법은, 게스트 머신에서 동작하는 프로세스를 디버그 모드로 실행하여 상기 프로세스에 대해 적재된 DLL(Dynamic Link Library)의 정보를 획득하는 단계; 상기 프로세스의 시작 주소에 소프트웨어 브레이크 포인트를 설정하는 단계; 상기 프로세스에 대한 DLL의 정보가 모두 획득된 후, 상기 프로세스 실행 시 로딩되는 DLL의 정보와 상기 획득한 DLL의 정보를 이용하여 API(Application Programming Interface) 호출 정보를 추출하는 단계; 및 상기 프로세스 실행에 따른 예외 발생 시 싱글 스텝 분석을 통한 명령어 분석을 수행하는 단계를 포함한다.In addition, the dynamic code analysis method according to another aspect of the present invention, by executing a process running in the guest machine in the debug mode to obtain information of the loaded DLL (Dynamic Link Library) for the process; Setting a software breakpoint at a start address of the process; After all of the information on the DLL for the process is obtained, extracting API (Application Programming Interface) call information by using the information of the DLL loaded when the process is executed and the obtained DLL information; And performing command analysis through single step analysis when an exception occurs according to the execution of the process.

전술한 본 발명의 과제 해결 수단 중 어느 하나에 의하면, 분석 대상 프로세스가 로딩하는 DLL의 정보를 분석하여 API 호출 정보를 추출할 수 있어 더욱 정확하고 상세하게 해당 프로세스를 분석할 수 있다.According to any one of the problem solving means of the present invention described above, it is possible to extract the API call information by analyzing the information of the DLL to be loaded by the analysis target process can analyze the process more accurately and in detail.

그리고, 본 발명의 과제 해결 수단 중 어느 하나에 의하면, 분석 대상 프로세스들을 분석 시 실행 권한 상태를 구별하여 사용자 코드에 대한 싱글 스텝 분석을 수행함으로써 커널 코드 분석에 따른 명령어 실행 시간 지연을 방지할 수 있다.Further, according to any one of the problem solving means of the present invention, it is possible to prevent the instruction execution time delay caused by kernel code analysis by performing a single step analysis of the user code by distinguishing the execution authority state when analyzing the analysis target processes. .

도 1은 본 발명의 실시예에 따른 동적 코드 분석 장치의 구조를 나타내는 도면이다.
도 2 및 도 3은 본 발명의 실시예에 따른 동적 코드 분석 방법을 설명하기 위한 도면이다.
도 4는 본 발명의 실시예에 따른 API 호출 정보 추출을 통한 동적 코드 분석 방법을 설명하기 위한 순서도이다.
도 5는 본 발명의 실시예에 따른 예외 발생 시 동적 코드 분석 방법을 설명하기 위한 순서도이다.
도 6은 본 발명의 실시예에 따른 실행 권한 상태 변환 시 동적 코드 분석 방법을 설명하기 위한 순서도이다.
1 is a view showing the structure of a dynamic code analysis apparatus according to an embodiment of the present invention.
2 and 3 are diagrams for explaining a dynamic code analysis method according to an embodiment of the present invention.
4 is a flowchart illustrating a dynamic code analysis method through API call information extraction according to an embodiment of the present invention.
5 is a flowchart illustrating a dynamic code analysis method when an exception occurs according to an embodiment of the present invention.
6 is a flowchart illustrating a dynamic code analysis method when executing an execution permission state according to an embodiment of the present invention.

아래에서는 첨부한 도면을 참조하여 본 발명이 속하는 기술 분야에서 통상의 지식을 가진 자가 용이하게 실시할 수 있도록 본 발명의 실시예를 상세히 설명한다. 그러나 본 발명은 여러 가지 상이한 형태로 구현될 수 있으며 여기에서 설명하는 실시예에 한정되지 않는다. 그리고 도면에서 본 발명을 명확하게 설명하기 위해서 설명과 관계없는 부분은 생략하였으며, 명세서 전체를 통하여 유사한 부분에 대해서는 유사한 도면 부호를 붙였다.Hereinafter, embodiments of the present invention will be described in detail with reference to the accompanying drawings, which will be readily apparent to those skilled in the art. The present invention may, however, be embodied in many different forms and should not be construed as limited to the embodiments set forth herein. In the drawings, parts irrelevant to the description are omitted in order to clearly describe the present invention, and like reference numerals designate like parts throughout the specification.

명세서 전체에서, 어떤 부분이 어떤 구성요소를 "포함"한다고 할 때, 이는 특별히 반대되는 기재가 없는 한 다른 구성요소를 제외하는 것이 아니라 다른 구성요소를 더 포함할 수 있는 것을 의미한다.Throughout the specification, when a part is said to "include" a certain component, it means that it can further include other components, without excluding other components unless specifically stated otherwise.

도 1은 본 발명의 실시예에 따른 동적 코드 분석 장치의 구조를 나타내는 도면이다.1 is a view showing the structure of a dynamic code analysis apparatus according to an embodiment of the present invention.

이때, 본 발명의 실시예에 따른 동적 코드 분석 장치는 인텔 x86 프로세서에서 지원하는 Vt(Virtualization) 기술을 이용하여, Xen 기반으로 전가상화 기법을 구현한 경우를 나타내었다.In this case, the dynamic code analysis apparatus according to an embodiment of the present invention shows a case where a full virtualization technique is implemented based on Xen using Vt (Virtualization) technology supported by an Intel x86 processor.

먼저, 도 1에서 나타낸 바와 같이, 본 발명의 실시예에 따른 동적 코드 분석 장치(100)는 호스트 머신(10), 게스트 머신(20, 30), 하이퍼바이저(40) 및 물리 장치(50)를 포함한다.First, as shown in FIG. 1, the dynamic code analysis apparatus 100 according to an exemplary embodiment of the present invention may include the host machine 10, the guest machines 20 and 30, the hypervisor 40, and the physical device 50. Include.

호스트 머신(10)은 분석 제어 프로그램(11) 및 커널(12)을 포함하며, 본 발명의 실시예에 따른 분석 제어 프로그램(11)은 게스트 머신(20, 30)에서 동작하는 프로세스 중 분석 대상이 되는 특정 프로세스(이하, ‘분석 대상 프로세스’라고 함)의 명령어 단위 실행 과정을 모니터링하고 시스템 콜 호출 정보를 획득하며, 하이퍼바이저(40)를 통해 분석된 정보들을 저장하는 등 게스트 머신(20, 30)의 프로세스에 대한 분석을 제어한다.The host machine 10 includes an analysis control program 11 and a kernel 12. The analysis control program 11 according to an embodiment of the present invention is an analysis target during the process of operating in the guest machine (20, 30) Guest machines 20, 30, such as monitoring the execution of instruction units of a specific process (hereinafter referred to as 'analysis target process'), obtaining system call call information, and storing the analyzed information through the hypervisor 40. Control the analysis of the process.

이때, 분석 제어 프로그램(11)은 실행과 동시에 적어도 하나의 분석 대상 프로세스의 이름을 하이퍼바이저(40) 상에 존재하는 분석 대상 프로세스 목록에 추가한다.At this time, the analysis control program 11 adds the name of at least one analysis target process to the analysis target process list existing on the hypervisor 40 at the same time as it is executed.

게스트 머신(20, 30)은 분석 대상 프로세스(21), 윈도우즈(Windows) 운영 체제를 기반으로 동작하는 디버거 프로그램(22) 및, 리눅스 커널 또는 윈도우즈(23)을 포함한다. 이때, 본 발명의 실시예에 따른 디버거 프로그램(22)은 분석 대상 프로세스를 디버그 모드로 실행하여 모듈 적재 내역을 추적한다.The guest machines 20 and 30 include a process to be analyzed 21, a debugger program 22 that operates based on a Windows operating system, and a Linux kernel or Windows 23. At this time, the debugger program 22 according to the embodiment of the present invention runs the analysis target process in debug mode to track the module loading history.

하이퍼바이저(40)는 분석 처리 모듈(41) 및 예외 처리 핸들러(42, vmexit handler)를 포함한다.The hypervisor 40 includes an analysis processing module 41 and an exception handling handler 42 (vmexit handler).

이때, 본 발명의 실시예에 따른 분석 처리 모듈(41)은 게스트 머신(20, 30) 상에서 동작하는 프로세스 중 분석 제어 프로그램(10)을 통해 추가되는 특정 프로세스를 분석 대상 프로세스 목록에 추가한다. 그리고, 분석 처리 모듈(41)은 게스트 머신(20, 30)에서 동작하는 분석 대상 프로세스(21)에서 실행되는 프로그램 코드를 싱글 스텝 방식으로 분석한다.At this time, the analysis processing module 41 according to the embodiment of the present invention adds a specific process added through the analysis control program 10 among the processes operating on the guest machines 20 and 30 to the analysis target process list. The analysis processing module 41 analyzes the program code executed in the analysis target process 21 operating in the guest machines 20 and 30 in a single step method.

또한, 본 발명의 실시예에 따른 예외 처리 핸들러(42)는 게스트 머신(20, 30)에서 동작하는 특정 프로세스(즉, 분석 대상 프로세스)로부터 예외(exception)가 발생되면, 호스트 머신(10)의 분석 제어 프로그램(11)에 의해 예외 발생 사실을 전달받아, 발생된 예외의 종류에 따라 기설정된 예외 처리를 수행한다.In addition, the exception handling handler 42 according to the embodiment of the present invention may generate an exception from a specific process (that is, an analysis target process) operating in the guest machines 20 and 30. The exception occurrence is received by the analysis control program 11, and preset exception processing is performed according to the type of the exception.

물리 장치(50)는 CPU, 메모리, 디스크, 네트워크 인터페이스 등을 포함한다. 참고로, 본 발명의 실시예에 따른 CPU는 x86 프로세서일 수 있다.The physical device 50 includes a CPU, a memory, a disk, a network interface, and the like. For reference, the CPU according to the embodiment of the present invention may be an x86 processor.

한편, 본 발명의 실시예에 따른 동적 코드 분석 장치(100)는 게스트 머신에서 동작하는 분석 대상 프로세스가 로딩하는 DLL(Dynamic Link Library)을 추적하여 API(Application Programming Interface) 호출 정보를 추출한다.Meanwhile, the dynamic code analysis apparatus 100 according to an embodiment of the present invention extracts API (Application Programming Interface) call information by tracking a DLL (Dynamic Link Library) loaded by an analysis target process operating in a guest machine.

이하, 도 4를 참조하여 본 발명의 실시예에 따른 동적 코드 분석 장치(100)의 디버거 프로그램(22)을 이용한 API 정보 추출 방법에 대해서 설명하도록 한다.Hereinafter, a method of extracting API information using the debugger program 22 of the dynamic code analysis apparatus 100 according to an embodiment of the present invention will be described with reference to FIG. 4.

도 4는 본 발명의 실시예에 따른 API 호출 정보 추출을 통한 동적 코드 분석 방법을 설명하기 위한 순서도이다.4 is a flowchart illustrating a dynamic code analysis method through API call information extraction according to an embodiment of the present invention.

구체적으로, 도 4에서 나타낸 바와 같이, 디버거 프로그램(22)은 디버그 모드로 게스트 머신(20)의 프로세스를 실행 시킨다(S410). Specifically, as shown in FIG. 4, the debugger program 22 executes the process of the guest machine 20 in the debug mode (S410).

이에 따라, 디버그 모드로 실행되는 해당 프로세스에서 DLL을 로딩할 때마다 이벤트가 발생하며, 발생된 이벤트 정보가 디버거 프로그램(22)으로 전달된다. 이때, 디버거 프로그램(22)은 발생되는 해당 이벤트를 분석하여 DLL의 이름과 메모리 주소를 포함하는 DLL 정보를 획득하여 분석 제어 프로그램(11)으로 전달한다. 구체적으로, 디버거 프로그램(22)은 분석 대상이 되는 DLL 파일들을 읽기 처리를 하여 DLL 구성 정보를 획득하여, DLL 내부에서 각각의 API가 위치한 오프셋 값을 분석한다.Accordingly, an event occurs every time the DLL is loaded in the process running in debug mode, and the generated event information is transmitted to the debugger program 22. At this time, the debugger program 22 analyzes the generated event, obtains DLL information including the name and memory address of the DLL, and delivers the DLL information to the analysis control program 11. Specifically, the debugger program 22 reads DLL files to be analyzed to obtain DLL configuration information, and analyzes offset values in which respective APIs are located in the DLL.

참고로, 본 발명의 실시예에 따른 디버거 프로그램(22)은 DLL 로딩 정보를 획득한 후 디버그 모드를 종료함으로써, 다양한 Anti-debugging 기법에 노출되지 않도록 할 수 있다.For reference, the debugger program 22 according to the embodiment of the present invention may obtain the DLL loading information and then exit the debug mode so that the anti-debugging technique is not exposed.

다음으로, 디버거 프로그램(22)은 해당 프로세스의 시작 주소에 소프트웨어 브레이크 포인트를 설정한다(S420).Next, the debugger program 22 sets a software break point at the start address of the process (S420).

그런 다음, 디버거 프로그램(22)은 단계 (S410)에 의해 획득한 DLL 정보와, 이후 분석 대상 프로세스가 로딩하는 DLL 로딩 주소 값을 기반으로 분석 대상 프로세스에서 호출하는 API 정보를 추출한다(S430).Then, the debugger program 22 extracts API information called by the analysis target process based on the DLL information obtained by step S410 and the DLL loading address value loaded by the analysis target process (S430).

그런 다음, 모든 DLL 로딩이 완료된 후에 상기 시작 주소에 설정해 놓은 소프트웨어 브레이크 포인트로 인해 디버그 예외가 발생하면, 디버거 프로그램(22)은 소프트웨어 브레이크 포인트를 삭제하고 기존 명령어를 복구한다(S440). Then, if a debug exception occurs due to the software break point set at the start address after all the DLL loading is completed, the debugger program 22 deletes the software break point and recovers the existing instruction (S440).

참고로, DLL 정보 획득이 완료되면, 분석 제어 프로그램(11)은 상기 해당 프로세스를 분석 처리 모듈(40)의 분석 대상 프로세스 목록에 추가한다. 따라서, 상기 해당 프로세스(즉, 분석 대상 프로세스)는 예외 발생 시 싱글 스텝 방식으로 코드 분석된다.For reference, when the DLL information acquisition is completed, the analysis control program 11 adds the corresponding process to the analysis target process list of the analysis processing module 40. Therefore, the corresponding process (that is, the process to be analyzed) is code analyzed in a single step manner when an exception occurs.

이하, 도 2 및 도 5를 참조하여 본 발명의 실시예에 따른 동적 코드 분석 장치(100)의 예외 발생 시 동적 코드 분석 방법에 대해서 상세히 설명하도록 한다.Hereinafter, a dynamic code analysis method will be described in detail when an exception occurs in the dynamic code analysis apparatus 100 according to an embodiment of the present invention with reference to FIGS. 2 and 5.

도 2는 본 발명의 실시예에 따른 동적 코드 분석 방법을 설명하기 위한 도면이다.2 is a view for explaining a dynamic code analysis method according to an embodiment of the present invention.

그리고, 도 5는 본 발명의 실시예에 따른 예외 발생 시 동적 코드 분석 방법을 설명하기 위한 순서도이다.5 is a flowchart illustrating a dynamic code analysis method when an exception occurs according to an embodiment of the present invention.

본 발명의 실시예에 따른 동적 코드 분석 장치(100)에서 게스트 머신(20) 상에서 동작하는 프로세스에서 예외가 발생하면, 해당 예외에 대한 핸들러가 동작하여 해당 프로세스를 명령어 단위로 분석한다. 즉, 싱글 스텝 방식으로 프로세스의 동작을 분석하여 모니터링을 수행한다.When an exception occurs in a process running on the guest machine 20 in the dynamic code analysis apparatus 100 according to an embodiment of the present invention, a handler for the exception operates to analyze the process in units of instructions. In other words, monitoring is performed by analyzing the operation of the process in a single step method.

먼저, 도 2a에서 나타낸 바와 같이, 게스트 머신(20)에서 동작하는 프로세스는 윈도우의 컨텍스트 스위칭(context-switching) 과정을 통해 실행 권한을 획득하게 된다. 이때, 상기 컨텍스트 스위칭 과정에서 CR3 레지스터 값을 교체하는 명령어가 수행될 때, 게스트 머신(20)에서는 예외가 발생되어 하이퍼바이저(40)의 예외 처리 핸들러(42)가 동작한다.First, as shown in FIG. 2A, a process operating in the guest machine 20 obtains execution permission through a context-switching process of a window. At this time, when an instruction is performed to replace the CR3 register value in the context switching process, an exception occurs in the guest machine 20, and the exception handling handler 42 of the hypervisor 40 operates.

구체적으로, 도 5에서 나타낸 바와 같이, 윈도우(23)가 컨텍스트 스위칭(context-switching)에 따른 예외를 발생시킨 경우(S510), 예외 처리 핸들러(42)는 mov_to_cr() 함수를 호출한다(S520).Specifically, as shown in FIG. 5, when the window 23 generates an exception according to context-switching (S510), the exception handling handler 42 calls the mov_to_cr () function (S520). .

이때, 호출된 mov_to_cr() 함수는 따라 분석 처리 모듈(41)이 관리하는 분석 대상 프로그램 목록에 상기 예외가 발생된 해당 프로세스(즉, 분석 대상 프로세스)의 이름이 포함되었는지를 확인한다.At this time, the called mov_to_cr () function checks whether the name of the corresponding process (that is, the analysis target process) in which the exception occurred is included in the analysis target program list managed by the analysis processing module 41.

그런 후, 상기 예외가 발생된 해당 프로세스의 이름이 분석 대상 프로그램 목록에 포함된 경우, mov_to_cr() 함수는 게스트 머신(20)의 CPU eflags 레지스터의 트랩 플래그를 설정한다(S530).Then, when the name of the process in which the exception occurred is included in the analysis target program list, the mov_to_cr () function sets a trap flag of the CPU eflags register of the guest machine 20 (S530).

이때, eflags 레지스터에 트랩 플래그가 설정되면 해당 프로세스(즉, 분석 대상 프로세스)가 명령어를 수행할 때마다 디버그 예외가 발생된다. 그러면, 디버그 예외가 발생될 때마다, 분석 처리 모듈(41)이 발생된 예외(즉, 명령어 단위)에 대해 분석하는 싱글 스텝 분석을 수행한다.In this case, if a trap flag is set in the eflags register, a debug exception is generated whenever a corresponding process (ie, an analysis target process) executes an instruction. Then, whenever a debug exception occurs, the analysis processing module 41 performs a single step analysis of analyzing the generated exception (ie, instruction unit).

그리고, 예외 처리 핸들러(42)는 분석 처리 모듈(41)이 모든 명령어에 대해 싱글 스텝 분석을 완료한 후, 복귀 명령어(vmresume)를 수행하여 게스트 머신(20)의 컨텍스트가 수행되도록 실행 권한을 전환한다(S550).In addition, the exception handling handler 42 switches the execution authority so that the context processing of the guest machine 20 is performed by performing a return instruction (vmresume) after the analysis processing module 41 completes the single step analysis for all the instructions. (S550).

또한, 도 2b에서 나타낸 바와 같이, 게스트 머신(20)에서 동작하는 프로세스에서 디버그 예외 발생 시에도 하이퍼바이저(40)의 예외 처리 핸들러(42)가 동작하여 디버그 예외 처리(Handle debug exception)를 수행한다.In addition, as shown in FIG. 2B, the exception handling handler 42 of the hypervisor 40 operates even when a debug exception occurs in a process running in the guest machine 20 to perform a handle debug exception. .

참고로, 상기 도 4에서 설명한 바와 같이, DLL 정보 획득 및 API 호출 정보 추출이 완료된 프로세스(즉, 분석 대상 프로세스)에서 디버그 예외 발생 시 예외 처리 핸들러(42)가 동작한다.For reference, as described above with reference to FIG. 4, the exception handling handler 42 operates when a debug exception occurs in a process in which DLL information acquisition and API call information extraction are completed (that is, an analysis target process).

또한, 게스트 머신(20, 30)의 메모리의 내용 확인 및 메모리 변경 추적 시 디버그 예외가 발생되면 예외 처리 핸들러(42)가 동작한다.In addition, if a debug exception occurs when checking the contents of the memory of the guest machines 20 and 30 and tracking the memory change, the exception handling handler 42 operates.

구체적으로, 도 5에서 나타낸 바와 같이, 디버그 예외(debug exception)가 발생되면(S510), 예외 처리 핸들러(42)가 발생된 디버그 예외에 대한 정보를 분석 처리 모듈(41)로 전달한다.Specifically, as shown in FIG. 5, when a debug exception occurs (S510), the exception handling handler 42 transmits information on the debug exception that occurred to the analysis processing module 41.

그러면, 분석 처리 모듈(42)은 발생된 디버그 예외에 대한 싱글 스텝 분석을 수행하고, 그 결과를 분석 제어 프로그램(11)으로 전달하여 저장한다(S540). 이때, 분석 처리 모듈(42)은 디버그 예외가 발생된 명령어가 메모리 읽기/쓰기 명령어인 경우, 현재 메모리 값과 수정될 메모리 값을 분석한다. Then, the analysis processing module 42 performs a single step analysis on the generated debug exception, and transfers the result to the analysis control program 11 and stores the result (S540). At this time, the analysis processing module 42 analyzes the current memory value and the memory value to be modified when the instruction in which the debug exception is generated is a memory read / write instruction.

그런 다음, 예외 처리 핸들러(42)는 분석 처리 모듈(41)이 모든 명령어에 대해 싱글 스텝 분석을 완료한 후, 복귀 명령어(vmresume)를 수행하여 게스트 머신(20)의 컨텍스트가 수행되도록 실행 권한을 전환한다(S550).Then, the exception handling handler 42 executes a return instruction (vmresume) after the analysis processing module 41 completes the single step analysis for all the instructions so that the context of the guest machine 20 is executed. Switch (S550).

이하, 도 3 및 도 6을 참조하여 본 발명의 실시예에 따른 동적 코드 분석 장치(100)의 실행 권한 상태 변환 시 동적 코드 분석 방법에 대해서 상세히 설명하도록 한다.Hereinafter, a dynamic code analysis method will be described in detail when the execution authority state of the dynamic code analysis apparatus 100 according to the embodiment of the present invention is described with reference to FIGS. 3 and 6.

도 3은 본 발명의 실시예에 따른 동적 코드 분석 방법을 설명하기 위한 도면이다.3 is a view for explaining a dynamic code analysis method according to an embodiment of the present invention.

그리고, 도 6은 본 발명의 실시예에 따른 실행 권한 상태 변환 시 동적 코드 분석 방법을 설명하기 위한 순서도이다. 6 is a flowchart illustrating a dynamic code analysis method when executing an execution authority state according to an exemplary embodiment of the present invention.

먼저, 도 3에서 나타낸 바와 같이, 본 발명의 실시예에 따른 동적 코드 분석 장치(100)는 게스트 머신(20, 30)의 사용자 프로그램의 실행 과정에서 인터럽트나 에러가 발생하면 이에 대응하는 커널 코드가 핸들러로 동작하게 된다. 이 과정에서 커널 코드 세그먼트 정보를 담고 있는 GDT(Global Descriptor Table)에 접근하게 된다. 이때, 동적 코드 분석 장치(100)는 커널 코드 및 사용자 코드를 구분하여 사용자 코드에 대한 동적 코드 분석(즉, DLL 정보 획득, API 정보 추출 및 예외 발생에 대한 싱글 스텝 코드 분석 등)을 수행함으로써 명령어 실행 시간 지연을 방지할 수 있다.First, as shown in Figure 3, the dynamic code analysis apparatus 100 according to an embodiment of the present invention, if an interrupt or an error occurs during the execution of the user program of the guest machine (20, 30), the corresponding kernel code is It will act as a handler. This process accesses the Global Descriptor Table (GDT) that contains kernel code segment information. In this case, the dynamic code analysis apparatus 100 classifies the kernel code and the user code to perform dynamic code analysis (ie, single step code analysis for obtaining DLL information, API information extraction, and exception generation) for the user code. The execution time delay can be prevented.

구체적으로, 도 6에서 나타낸 바와 같이, 게스트 머신(20, 30)의 분석 대상 프로세스에 대한 실행 권한 상태 변환 이벤트가 발생되면(S610), 분석 처리 모듈(42)은 변환되는 실행 권한 상태에 따른 처리를 수행한다. Specifically, as shown in FIG. 6, when an execution authority state conversion event for the analysis target process of the guest machines 20 and 30 is generated (S610), the analysis processing module 42 processes according to the execution authority state to be converted. Perform

참고로, 메모리 보호 메커니즘에 따라 x86 프로세서에서 동작하는 사용자 프로그램은 CPL 3에서 동작하며 커널 코드는 CPL 0에서 동작하게 된다.Note that according to the memory protection mechanism, user programs running on x86 processors run on CPL 3 and kernel code runs on CPL 0.

이때, 단계 (S610)에서 커널 코드 동작이 발생하면, 분석 처리 모듈(42)이 게스트 머신(20)의 윈도우 상의 GDT의 커널 코드 세그먼트(참고로, 도 3에서는, ‘kernel code seg.’로 나타냄) 정보를 다른 저장 영역으로 이동시키고, 해당 엔트리를 초기화(예를 들어, ‘0’ 값으로 변경) 한다(S621).In this case, when the kernel code operation occurs in step S610, the analysis processing module 42 indicates the kernel code segment of the GDT on the window of the guest machine 20 (for reference, in FIG. 3, 'kernel code seg.'). ) Information is moved to another storage area, and the corresponding entry is initialized (for example, changed to a value of '0') (S621).

그러면, 사용자 모드에서 커널 모드로 전환되는 과정에서 GDT의 해당 엔트리가 잘못된 값을 갖고 있으므로 GPE(General Protection Error)가 발생하게 된다.Then, during the transition from the user mode to the kernel mode, a GPE (General Protection Error) occurs because the entry of the GDT has an incorrect value.

그런 다음, 예외 처리 핸들러(42)는 GPE 발생에 따라 싱글 스텝 분석 기능을 중지한다(S631).Then, the exception handling handler 42 stops the single step analysis function according to the generation of GPE (S631).

그런 후, 분석 처리 모듈(42)은 상기 이동시켰던 커널 코드 세그먼트 정보를 GDT에 복원시킨 후, 사용자 코드 세그먼트(참고로, 도 3에서는, ‘user code seg.’라고 나타냄) 정보를 다른 저장 영역으로 이동 시키고, 해당 엔트리를 초기화 한다(S641).Thereafter, the analysis processing module 42 restores the moved kernel code segment information to the GDT, and then transfers user code segment information (referred to as 'user code seg.' In FIG. 3) to another storage area. Move and initialize the entry (S641).

그런 다음, 예외 처리 핸들러(42)는 복귀 명령어(vmresume)를 수행하여 게스트 머신(20)을 다시 활성화 시킨다(S650). 이와 같이 함으로써, 게스트 머신(20)의 커널 코드가 정상적으로 수행된다.Then, the exception handling handler 42 activates the guest machine 20 again by performing a return command (vmresume) (S650). By doing this, the kernel code of the guest machine 20 is normally executed.

참고로, 게스트 머신(20)의 커널 코드가 모두 수행된 이후 IRET 명령어를 통해 사용자 프로그램으로 복귀하는 시점에서는 사전에 GDT에서 해당 엔트리 값을 초기화시켜 변경되어 있으므로, GPE가 발생하게 된다. For reference, when all the kernel codes of the guest machine 20 are executed, at the time of returning to the user program through the IRET command, the GDT is generated by initializing the corresponding entry value in the GDT in advance.

즉, 단계 (S610)에서 사용자 프로그램 복귀에 따른 GPE가 발생되면, 분석 처리 모듈(41)은 상기 이동시켰던 사용자 코드 세그먼트 정보를 GDT에 복원시킨 후, 커널 코드 세그먼트 정보를 다른 저장 영역으로 이동시킨 후 해당 엔트리를 초기화 한다(S622).That is, when the GPE according to the return of the user program occurs in step S610, the analysis processing module 41 restores the moved user code segment information to the GDT, and then moves the kernel code segment information to another storage area. Initialize the entry (S622).

그런 다음, 예외 처리 핸들러(42)는 사용자 코드를 분석하기 위해 싱글 스텝 분석 기능을 활성화한다(S632).Then, the exception handling handler 42 activates the single step analysis function to analyze the user code (S632).

그런 다음, 예외 처리 핸들러(42)는 복귀 명령어(vmresume)를 수행하여 게스트 머신(20)을 다시 활성화 시킨다(S650). 이와 같이 함으로써, 게스트 머신(20)의 사용자 코드가 정상적으로 수행되어 분석 처리 모듈(41)을 통해 싱글 스텝 분석을 수행한다.Then, the exception handling handler 42 activates the guest machine 20 again by performing a return command (vmresume) (S650). In this way, the user code of the guest machine 20 is normally executed to perform single step analysis via the analysis processing module 41.

이처럼, 본 발명의 실시예에 따른 동적 코드 분석 장치(100)에서는 게스트 머신(20, 30)의 실행권한 상태 변환 시점마다 GPE에 의한 예외가 발생하고, 발생된 예외에 대해 예외 처리 핸들러(42) 및 분석 처리 모듈(41)이 실행 권한 상태에 따른 예외 처리를 수행한다.As described above, in the dynamic code analysis apparatus 100 according to the exemplary embodiment of the present invention, an exception caused by the GPE occurs at every execution authority state transition time of the guest machines 20 and 30, and the exception handling handler 42 is applied to the generated exception. And the analysis processing module 41 performs exception processing according to the execution permission state.

본 발명의 실시예는 컴퓨터에 의해 실행되는 프로그램 모듈과 같은 컴퓨터에 의해 실행가능한 명령어를 포함하는 기록 매체의 형태로도 구현될 수 있다. 컴퓨터 판독 가능 매체는 컴퓨터에 의해 액세스될 수 있는 임의의 가용 매체일 수 있고, 휘발성 및 비휘발성 매체, 분리형 및 비분리형 매체를 모두 포함한다. 또한, 컴퓨터 판독가능 매체는 컴퓨터 저장 매체 및 통신 매체를 모두 포함할 수 있다. 컴퓨터 저장 매체는 컴퓨터 판독가능 명령어, 데이터 구조, 프로그램 모듈 또는 기타 데이터와 같은 정보의 저장을 위한 임의의 방법 또는 기술로 구현된 휘발성 및 비휘발성, 분리형 및 비분리형 매체를 모두 포함한다. 통신 매체는 전형적으로 컴퓨터 판독가능 명령어, 데이터 구조, 프로그램 모듈, 또는 반송파와 같은 변조된 데이터 신호의 기타 데이터, 또는 기타 전송 메커니즘을 포함하며, 임의의 정보 전달 매체를 포함한다.Embodiments of the invention may also be implemented in the form of a recording medium containing instructions executable by a computer, such as a program module executed by the computer. Computer readable media can be any available media that can be accessed by a computer and includes both volatile and nonvolatile media, removable and non-removable media. In addition, the computer-readable medium may include both computer storage media and communication media. Computer storage media includes both volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data. Communication media typically includes any information delivery media, including computer readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave, or other transport mechanism.

본 발명의 장치 및 방법은 특정 실시예와 관련하여 설명되었지만, 그것들의 구성 요소 또는 동작의 일부 또는 전부는 범용 하드웨어 아키텍쳐를 갖는 컴퓨터 시스템을 사용하여 구현될 수 있다.Although the apparatus and method of the present invention have been described in connection with specific embodiments, some or all of their components or operations may be implemented using a computer system having a general purpose hardware architecture.

전술한 본 발명의 설명은 예시를 위한 것이며, 본 발명이 속하는 기술분야의 통상의 지식을 가진 자는 본 발명의 기술적 사상이나 필수적인 특징을 변경하지 않고서 다른 구체적인 형태로 쉽게 변형이 가능하다는 것을 이해할 수 있을 것이다. 그러므로 이상에서 기술한 실시예들은 모든 면에서 예시적인 것이며 한정적이 아닌 것으로 이해해야만 한다. 예를 들어, 단일형으로 설명되어 있는 각 구성 요소는 분산되어 실시될 수도 있으며, 마찬가지로 분산된 것으로 설명되어 있는 구성 요소들도 결합된 형태로 실시될 수 있다.The foregoing description of the present invention is intended for illustration, and it will be understood by those skilled in the art that the present invention may be easily modified in other specific forms without changing the technical spirit or essential features of the present invention. will be. It is therefore to be understood that the above-described embodiments are illustrative in all aspects and not restrictive. For example, each component described as a single entity may be distributed and implemented, and components described as being distributed may also be implemented in a combined form.

본 발명의 범위는 상기 상세한 설명보다는 후술하는 특허청구범위에 의하여 나타내어지며, 특허청구범위의 의미 및 범위 그리고 그 균등 개념으로부터 도출되는 모든 변경 또는 변형된 형태가 본 발명의 범위에 포함되는 것으로 해석되어야 한다.The scope of the present invention is shown by the following claims rather than the above description, and all changes or modifications derived from the meaning and scope of the claims and their equivalents should be construed as being included in the scope of the present invention. do.

10: 호스트 머신 20, 30: 게스트 머신
11: 분석 제어 프로그램 21: 분석 대상 프로세스
22: 디버거 프로그램 40; 하이퍼바이저
41: 분석 처리 모듈 42: 예외 처리 핸들러
10: host machine 20, 30: guest machine
11: Analysis control program 21: Process to be analyzed
22: debugger program 40; Hypervisor
41: Analysis Processing Module 42: Exception Handling Handler

Claims (12)

동적 코드 분석 장치에 있어서,
게스트 머신에서 동작하는 적어도 하나의 프로세스를 분석 대상 프로세스로 등록하는 호스트 머신;
상기 분석 대상 프로세스를 디버그 모드로 실행하여 DLL(Dynamic Link Library) 정보를 획득하고, 상기 획득한 DLL 정보를 이용하여 API(Application Programming Interface) 호출 정보를 추출하는 게스트 머신; 및
상기 호스트 머신을 통해 등록 요청되는 프로세스를 분석 대상 프로세스 목록에 추가하고, 상기 분석 대상 프로세스에서 발생되는 예외에 대해 싱글 스텝 분석처리를 수행하는 하이퍼바이저를 포함하는 동적 코드 분석 장치.
In the dynamic code analysis device,
A host machine that registers at least one process running on the guest machine as an analysis target process;
A guest machine for executing the analysis target process in debug mode to obtain DLL (Dynamic Link Library) information, and extracting API (Application Programming Interface) call information using the obtained DLL information; And
And a hypervisor for adding a process requested to be registered through the host machine to a list of analysis target processes and performing a single step analysis process on exceptions generated in the analysis target process.
제 1 항에 있어서,
상기 하이퍼바이저는,
상기 분석 대상 프로세스에서 커널 코드 동작 발생에 따른 이벤트 발생 시 상기 싱글 스텝 분석을 중지하고, 사용자 프로그램으로의 복귀에 따른 이벤트 발생 시 상기 싱글 스텝 분석을 활성화하는 동적 코드 분석 장치.
The method of claim 1,
The hypervisor,
And stopping the single step analysis when an event occurs due to a kernel code operation occurring in the analysis target process and activating the single step analysis when an event occurs due to a return to a user program.
제 1 항에 있어서,
상기 하이퍼바이저는,
상기 분석 대상 프로그램에 대한 커널 코드 세그먼트 정보 및 사용자 코드 세그먼트 정보 중 적어도 하나를 변경하여 상기 분석 대상 프로그램의 실행 권한 상태 변환을 구별하는 동적 코드 분석 장치.
The method of claim 1,
The hypervisor,
And changing at least one of kernel code segment information and user code segment information of the analysis target program to distinguish execution permission state transition of the analysis target program.
제 1 항에 있어서,
상기 하이퍼바이저는,
상기 분석 대상 프로세스에서 예외 발생 시, eflags 레지스터의 트랩 플래그를 설정한 후 복귀 명령어를 수행하여 상기 싱글 스텝 분석을 수행하는 동적 코드 분석 장치.
The method of claim 1,
The hypervisor,
And performing an return instruction after setting a trap flag of an eflags register when an exception occurs in the analysis target process.
제 1 항에 있어서,
상기 게스트 머신은,
상기 DLL 로딩 시 발생되는 이벤트를 분석하여 상기 DLL의 이름과 메모리 주소를 포함하는 DLL 정보를 획득하고, 상기 DLL 정보로부터 각 API가 위치한 오프셋 값을 분석하는 동적 코드 분석 장치.
The method of claim 1,
The guest machine,
And analyzing the event generated when the DLL is loaded to obtain DLL information including the name and memory address of the DLL, and analyzing the offset value at which each API is located from the DLL information.
제 1 항에 있어서,
상기 게스트 머신은,
상기 DLL 로딩 정보를 모두 획득한 후 디버그 모드를 종료하는 동적 코드 분석 장치.
The method of claim 1,
The guest machine,
Dynamic code analysis device for exiting the debug mode after obtaining all the DLL loading information.
동적 코드 분석 장치가 동적으로 코드를 분석하는 방법에 있어서,
게스트 머신에서 동작하는 프로세스를 디버그 모드로 실행하여 상기 프로세스에 대해 적재된 DLL(Dynamic Link Library)의 정보를 획득하는 단계;
상기 프로세스의 시작 주소에 소프트웨어 브레이크 포인트를 설정하는 단계;
상기 프로세스에 대한 DLL의 정보가 모두 획득된 후, 상기 프로세스 실행 시 로딩되는 DLL의 정보와 상기 획득한 DLL의 정보를 이용하여 API(Application Programming Interface) 호출 정보를 추출하는 단계; 및
상기 프로세스 실행에 따른 예외 발생 시 싱글 스텝 분석을 통한 명령어 분석을 수행하는 단계를 포함하는 동적 코드 분석 방법.
In the method that the dynamic code analysis device dynamically analyzes the code,
Executing a process operating in a guest machine in debug mode to obtain information of a loaded Dynamic Link Library (DLL) for the process;
Setting a software breakpoint at a start address of the process;
After all of the information on the DLL for the process is obtained, extracting API (Application Programming Interface) call information by using the information of the DLL loaded when the process is executed and the obtained DLL information; And
And performing command analysis through single step analysis when an exception occurs according to the execution of the process.
제 7 항에 있어서,
상기 명령어 분석을 수행하는 단계는,
상기 프로세스에서 커널 코드 동작 발생에 따른 이벤트 발생 시 상기 싱글 스텝 분석을 중지하고, 사용자 프로그램으로의 복귀에 따른 이벤트 발생 시 상기 싱글 스텝 분석을 활성화는 동적 코드 분석 방법.
The method of claim 7, wherein
Performing the command analysis,
Stopping the single step analysis when an event occurs due to a kernel code operation in the process, and activating the single step analysis when an event occurs according to a return to a user program.
제 7 항에 있어서,
상기 API 호출 정보를 추출하는 단계 이후에,
상기 프로세스를 분석 대상 프로세스로 등록하는 단계를 더 포함하되,
상기 분석 대상 프로세스로 등록된 프로세스에 대해 상기 싱글 스텝 분석을 통한 명령어 분석을 수행하는 단계를 수행하는 동적 코드 분석 방법.
The method of claim 7, wherein
After extracting the API call information,
Registering the process as an analysis target process;
And performing a command analysis through the single step analysis on the process registered as the analysis target process.
제 7 항에 있어서,
상기 명령어 분석을 수행하는 단계는,
상기 예외 발생 시 상기 프로세스의 eflags 레지스터의 트랩 플래그를 설정한 후 복귀 명령어를 수행하여 상기 싱글 스텝 분석을 수행하는 동적 코드 분석 방법.
The method of claim 7, wherein
Performing the command analysis,
And performing a return instruction after setting a trap flag of the eflags register of the process when the exception occurs.
제 7 항에 있어서,
상기 API 호출 정보를 추출하는 단계는,
상기 디버그 모드에서 DLL 로딩 시 발생되는 이벤트를 분석하여 상기 DLL의 이름과 메모리 주소를 포함하는 DLL 정보를 획득하고, 상기 DLL 정보로부터 각 API가 위치한 오프셋 값을 분석하는 동적 코드 분석 방법.
The method of claim 7, wherein
Extracting the API call information,
And analyzing the event generated when the DLL is loaded in the debug mode to obtain DLL information including the name and memory address of the DLL, and analyzing the offset value at which each API is located from the DLL information.
제 7 항에 있어서,
상기 DLL의 정보를 획득하는 단계 이후에,
상기 프로세스에 대한 DLL의 정보가 모두 획득되면 상기 디버그 모드를 종료하는 단계를 더 포함하는 동적 코드 분석 방법.
The method of claim 7, wherein
After acquiring the information of the DLL,
And exiting the debug mode when all the information of the DLL for the process is obtained.
KR1020100054642A 2010-06-10 2010-06-10 Apparatus and method for dynamic binary instrumentaion KR101182346B1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
KR1020100054642A KR101182346B1 (en) 2010-06-10 2010-06-10 Apparatus and method for dynamic binary instrumentaion

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
KR1020100054642A KR101182346B1 (en) 2010-06-10 2010-06-10 Apparatus and method for dynamic binary instrumentaion

Publications (2)

Publication Number Publication Date
KR20110134976A KR20110134976A (en) 2011-12-16
KR101182346B1 true KR101182346B1 (en) 2012-09-20

Family

ID=45502027

Family Applications (1)

Application Number Title Priority Date Filing Date
KR1020100054642A KR101182346B1 (en) 2010-06-10 2010-06-10 Apparatus and method for dynamic binary instrumentaion

Country Status (1)

Country Link
KR (1) KR101182346B1 (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2004504662A (en) 2000-07-14 2004-02-12 ヴィースィーアイエス インコーポレイテッド Computer immune system and method for detecting unwanted code in a computer system
KR100938672B1 (en) 2007-11-20 2010-01-25 한국전자통신연구원 The method and apparatus for detecting dll inserted by malicious code

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2004504662A (en) 2000-07-14 2004-02-12 ヴィースィーアイエス インコーポレイテッド Computer immune system and method for detecting unwanted code in a computer system
KR100938672B1 (en) 2007-11-20 2010-01-25 한국전자통신연구원 The method and apparatus for detecting dll inserted by malicious code

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
Carsten Willems, et al, "Toward Automated Dynamic Malware Analysis Using CWSandbox," IEEE Security and Privacy, vol. 5, no. 2, pp. 32-39, March/April, 2007.

Also Published As

Publication number Publication date
KR20110134976A (en) 2011-12-16

Similar Documents

Publication Publication Date Title
Jeong et al. Razzer: Finding kernel race bugs through fuzzing
US9529614B2 (en) Automatically bridging the semantic gap in machine introspection
Fu et al. Space traveling across vm: Automatically bridging the semantic gap in virtual machine introspection via online kernel data redirection
Chow et al. Decoupling dynamic program analysis from execution in virtual environments
Henderson et al. Make it work, make it right, make it fast: building a platform-neutral whole-system dynamic binary analysis platform
Fattori et al. Dynamic and transparent analysis of commodity production systems
Deng et al. Spider: Stealthy binary program instrumentation and debugging via hardware virtualization
Wang et al. Isolating commodity hosted hypervisors with hyperlock
Pék et al. nEther: In-guest Detection of Out-of-the-guest Malware Analyzers
Ning et al. Ninja: Towards Transparent Tracing and Debugging on {ARM}
Abeni et al. Using Xen and KVM as real-time hypervisors
Fu et al. Exterior: Using a dual-vm based external shell for guest-os introspection, configuration, and recovery
Pan et al. Digtool: A {virtualization-based} framework for detecting kernel vulnerabilities
US20080250400A1 (en) Method for System Call Interception in User Space
Wu et al. Taming hosted hypervisors with (mostly) deprivileged execution.
US10127137B2 (en) Methods and systems for increased debugging transparency
Amit et al. Virtual CPU validation
Rittinghaus Simuboost: Scalable parallelization of functional system simulation
Chen et al. CRETE: A versatile binary-level concolic testing framework
Hsiao et al. Hardware-assisted MMU redirection for in-guest monitoring and API profiling
Ning et al. Hardware-assisted transparent tracing and debugging on ARM
Johnson et al. Composable multi-level debugging with Stackdb
KR101182346B1 (en) Apparatus and method for dynamic binary instrumentaion
Wilhelm Tracing privileged memory accesses to discover software vulnerabilities
Wei et al. Mose: Live migration based on-the-fly software emulation

Legal Events

Date Code Title Description
A201 Request for examination
E701 Decision to grant or registration of patent right
GRNT Written decision to grant
FPAY Annual fee payment

Payment date: 20150703

Year of fee payment: 4

FPAY Annual fee payment

Payment date: 20160607

Year of fee payment: 5

LAPS Lapse due to unpaid annual fee