KR101671336B1 - Method of unpacking protection with code separation and apparatus thereof - Google Patents

Method of unpacking protection with code separation and apparatus thereof Download PDF

Info

Publication number
KR101671336B1
KR101671336B1 KR1020140023561A KR20140023561A KR101671336B1 KR 101671336 B1 KR101671336 B1 KR 101671336B1 KR 1020140023561 A KR1020140023561 A KR 1020140023561A KR 20140023561 A KR20140023561 A KR 20140023561A KR 101671336 B1 KR101671336 B1 KR 101671336B1
Authority
KR
South Korea
Prior art keywords
executable file
code
program
unpacking
packed
Prior art date
Application number
KR1020140023561A
Other languages
Korean (ko)
Other versions
KR20150101811A (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 KR1020140023561A priority Critical patent/KR101671336B1/en
Publication of KR20150101811A publication Critical patent/KR20150101811A/en
Application granted granted Critical
Publication of KR101671336B1 publication Critical patent/KR101671336B1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/10Protecting distributed programs or content, e.g. vending or licensing of copyrighted material ; Digital rights management [DRM]
    • G06F21/12Protecting executable software

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Multimedia (AREA)
  • Technology Law (AREA)
  • Computer Hardware Design (AREA)
  • Computer Security & Cryptography (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Storage Device Security (AREA)

Abstract

종래 기술에 의한 패커는 패킹된 실행파일의 내부에 복호화 코드를 포함하여, 분석자의 실행파일 분석이 어렵지 않다는 문제점이 있었다.
본 발명은 이러한 문제점을 해결하기 위하여, 복호화 코드를 하나의 외부 프로그램으로 패킹하여 패킹된 실행파일에 통합함으로써, 분석자의 분석을 어렵게 하고, 프로세스 보호를 통한 디버거의 접근을 통제함으로써 보다 향상된 실행파일 보호 방법을 제공할 수 있다.
The packer according to the prior art has a problem in that it is difficult to analyze the executable file of the analyst by including the decoded code in the packed executable file.
In order to solve this problem, the present invention packs the decoded code into one external program and integrates it into the packed executable file, thereby making it difficult to analyze the analysis, and to control the access of the debugger through process protection, Method can be provided.

Description

코드 분리가 적용된 언패킹 보호 방법 및 장치{METHOD OF UNPACKING PROTECTION WITH CODE SEPARATION AND APPARATUS THEREOF}METHOD OF UNPACKING PROTECTION WITH CODE SEPARATION AND APPARATUS THEREOF FIELD OF THE INVENTION [0001]

본 발명은 언패킹(unpacking) 보호 방법에 관한 것으로, 특히 코드 분리를 이용하여 더욱 보안성이 높은 언패킹 보호 방법에 관한 것이다.The present invention relates to an unpacking protection method, and more particularly to a more secure unpacking protection method using code separation.

종래에는 실행파일의 용량을 줄이기 위한 목적으로서 실행파일 압축 기술이 연구되어 왔으나, 최근에는 인터넷의 발달과 함께 실행파일 압축 기술은 용량의 최소화보다는 프로그램의 분석을 보호하고 프로그램을 보호하는 방법으로서 연구되고 있다.Conventionally, an executable file compression technique has been studied for the purpose of reducing the capacity of an executable file. However, in recent years, along with the development of the Internet, an executable file compression technique has been studied as a method of protecting program analysis and protecting programs, have.

이와 관련하여, 본 발명의 선행문헌으로서 참조되는 선행문헌 1(Paul Royal, Mitch Halpin, David Dagon, Robert Edmonds, Wenke Lee, "PolyUnpack: Automating the Hidden-Code Extraction of Unpack-Executing Malware", IEEE, 2006), 선행문헌 2(Tobias Graf, "GENERIC UNPACKING - HOW TO HANDLE MODIFIED OR UNKNOWN PE COMPRESSION ENGINES", Virus Bulletin Conference, 2005) 및 선행문헌 3(Neel Bavishi, "An Executable Packer", San Jose State University, 2011)에는, 방해 코드(Anti Debugging Code), IAT(Import Address Table) 재배열, 난독화(Obfuscation) 및 가상 머신(Virtual Machine)을 이용하여 프로그램을 보호하고 분석을 방해하는 방법에 대하여 개시되어 있다.In this regard, the prior art reference 1 (Paul Royal, Mitch Halpin, David Dagon, Robert Edmonds, Wenke Lee, "PolyUnpack: Automating the Hidden-Code Extraction of Unpack-Executing Malware" Nebul Bavishi, "An Executable Packer ", San Jose State University, < RTI ID = 0.0 > 2011) < / RTI & ) Discloses a method for protecting a program and preventing analysis using an Anti Debugging Code, an IAT (Import Address Table) rearrangement, obfuscation and a virtual machine.

이러한 실행파일 압축 기술에는, 복호화(Unpacking) 코드와 언패킹 보호 기능이라는 두 가지의 필수적 기능이 존재한다. 패킹된 프로그램을 실행하기 위하여는 복호화 코드가 프로그램 내부에 반드시 포함되어야 한다. 실행파일 압축기술이 적용된 파일은 기본적으로 코드가 암호화되어 있기 때문에, 그 프로그램을 실행하기 위하여는 일단 복호화 코드가 실행될 필요가 있다.In this executable file compression technique, there are two essential functions: unpacking code and unpacking protection function. In order to execute the packed program, the decryption code must be included in the program. Since the file to which the executable file compression technique is applied basically has the code encrypted, the decryption code needs to be executed once to execute the program.

그러나, 이러한 암호화에 따른 복호화 방지 기능에 의한다고 하더라도, 분석자는 패킹된 파일 내부에 반드시 복호화 코드가 존재한다고 가정하고 복호화 코드를 찾기 위하여 패킹된 파일을 분석하기 때문에, 패킹된 내부 파일에 존재하는 복호화 코드는 안전할 수 없다는 문제가 있다.However, even if it is based on the decryption prevention function based on such encryption, the analyst analyzes the packed file in order to find the decoded code, assuming that the decoded code exists in the packed file. Therefore, There is a problem that the code can not be safe.

본 발명은 상술한 문제점을 해결하기 위하여, 복호화 코드를 외부의 파일형태로 나눈 언패킹 보호 방법을 제공하는 것을 목적으로 한다. 이러한 코드 분리를 통하여 보안성이 강화된 패킹 방법/언패킹 보호 방법을 제시하고자 한다.SUMMARY OF THE INVENTION The present invention has been made to solve the above problem, and it is an object of the present invention to provide an unpacking protection method in which a decryption code is divided into an external file. We propose a packing method / unpacking protection method that enhances security through code separation.

본 발명의 일 실시예에 따른 코드 분리가 적용된 언패킹(unpacking) 보호 장치는 분리 실행 압축 모듈을 포함할 수 있고, 분리 실행 압축 모듈은, 제 1 실행파일을 패킹(packing)하고, 패킹된 제 1 실행파일을 언패킹하기 위한 복호화 프로그램을 생성하고, 생성된 복호화 프로그램은 패킹된 파일 구조를 가지며, 그리고 패킹된 제 1 실행파일과 생성된 복호화 프로그램을 제 2 실행파일로서 통합하도록 구성되고, 복호화 프로그램은 언패킹을 위한 독립적인 프로그램 또는 상기 제 1 실행파일에 의하여 호출될 수 있다. 또한, 제 1 실행파일을 패킹하는 것은, 제 1 실행파일로부터 미리 정의된 섹션을 추출하여 미리 정의된 섹션을 암호화하는 것을 포함할 수 있고, 복호화 프로그램은 암호화된 미리 정의된 섹션을 복호화 하기 위한 복호화 코드를 포함하고, 복호화 코드는 분리 실행 압축 모듈에 의하여 암호화될 수 있다.An unpacking protection device to which a code separation according to an embodiment of the present invention is applied may include a detachment execution compression module, and the detachment execution compression module may pack the first execution file, 1 executable file, the generated decrypted program has a packed file structure, and is configured to integrate the packed first executable file and the generated decrypted program as a second executable file, and decrypts The program may be invoked by an independent program for unpacking or by the first executable file. Packing the first executable may also include extracting a predefined section from the first executable file and encrypting the predefined section, and the decrypting program may include decrypting the decrypted predefined section Code, and the decoded code may be encrypted by a separate execution compression module.

본 발명에서 개시된 기술은 다음과 같은 효과를 가질 수 있다. 다만, 특정 실시예가 다음의 효과를 전부 포함하여야 한다거나, 다음의 효과만을 포함하여야 하는 것은 아니므로, 개시된 기술의 권리범위는 이에 의하여 제한되는 것으로 이해되서는 아니 될 것이다.The technique disclosed in the present invention can have the following effects. It is to be understood, however, that the scope of the disclosed technology is not to be construed as limited thereby, since the specific embodiments should include all of the following effects or merely include the following effects.

본 발명은 코드 분리가 적용된 언패킹 보호 방법을 제공하고, 본 발명의 언패킹 보호 방법을 이용하여 다양한 방해코드를 적용하여 실행파일의 분석 시간을 지연시킬 수 있다.The present invention provides an unpacking protection method to which code separation is applied and can delay analysis time of an executable file by applying various interruption codes using the unpacking protection method of the present invention.

도 1은 PE(Portable Executable) 파일 구조 및 메모리 매핑을 도시한다.
도 2는 UPX(Ultimate Packer for eXecutables) 패커(Packer)를 이용한 패킹 과정을 도시한다.
도 3a는 본 발명의 일 실시예에 따른 코드 분리가 적용된 언패킹 보호 장치의 구성 및 흐름도이다.
도 3b는 본 발명의 일 실시예에 따른 코드 분리가 적용된 파일의 언패킹 장치의 구성 및 흐름도이다.
도 4는 본 발명의 일 실시예에 따른 코드 분리가 적용된 언패킹 보호 방법에서의 패킹 방법의 개략도이다.
도 5a는 본원 발명의 일 실시예에 따른 .text 섹션 추출 코드의 예시이다.
도 5b는 본원 발명의 일 실시예에 따른 비트 연산 암호화 코드의 예시이다.
도 5c는 생성된 패킹 파일의 구조를 도시한다.
도 5d는 생성된 복호화 프로그램의 파일 구조를 도시한다.
도 6은 본 발명의 일 실시예에 따른 코드 분리가 적용된 언패킹 보호 방법에서의 언패킹 방법의 개략도이다.
도 7a는 복호화 프로그램을 추출하기 위한 코드의 예시이다.
도 7b는 프로세스 보호 코드의 예시이다.
도 7c는 실행파일의 패킹된 영역에 대한 접근 코드의 예시이다.
도 7d는 복호화된 데이터를 빈 메모리 영역에 기록하기 위한 코드의 예시이다.
도 7e는 실행파일의 빈 메모리 영역에 복호화 데이터를 기록하는 방법의 개략도이다.
도 8a는 UPX 언패킹 과정을 도시한다.
도 8b는 PECompact 언패킹 과정을 도시한다.
도 8c는 FSG 언패킹 과정을 도시한다.
도 8d는 ASProtect 언패킹 과정을 도시한다.
도 8e는 본 발명의 일 실시예에 따른 분리 실행 압축 언패킹 과정을 도시한다.
Figure 1 shows a PE (Portable Executable) file structure and memory mapping.
2 shows a packing process using a UPX (Ultimate Packer for eXecutables) packer.
3A is a configuration and a flowchart of an unpacking protection apparatus to which a code separation is applied according to an embodiment of the present invention.
3B is a configuration and a flowchart of a file unpacking apparatus to which a code separation is applied according to an embodiment of the present invention.
4 is a schematic view of a packing method in an unpacking protection method using code separation according to an embodiment of the present invention.
5A is an example of a .text section extraction code according to an embodiment of the present invention.
FIG. 5B is an illustration of a bit operation encryption code according to one embodiment of the present invention.
Fig. 5C shows the structure of the generated packing file.
FIG. 5D shows the file structure of the generated decryption program.
6 is a schematic diagram of an unpacking method in an unpacking protection method applied with code separation according to an embodiment of the present invention.
7A is an example of a code for extracting a decryption program.
7B is an illustration of a process protection code.
7C is an illustration of an access code for a packed area of an executable file.
7D is an example of a code for writing decoded data in an empty memory area.
7E is a schematic diagram of a method of recording decoded data in an empty memory area of an executable file.
8A shows a UPX unpacking process.
FIG. 8B shows a PECompact unpacking process.
8C shows the FSG unpacking process.
FIG. 8D shows an ASProtect unpacking process.
FIG. 8E illustrates a separate running compressed unpacking process according to an embodiment of the present invention.

본문에 개시되어 있는 본 발명의 실시예들에 대하여, 특정한 구조적 내지 기능적 설명들은 단지 본 발명의 실시예를 설명하기 위한 목적으로 예시된 것으로, 본 발명의 실시예들은 다양한 형태로 실시될 수 있으며 본문에 설명된 실시예들에 한정되는 것으로 해석되어서는 아니 된다.For the embodiments of the present invention disclosed herein, specific structural and functional descriptions are merely illustrative for purposes of illustrating embodiments of the present invention, and embodiments of the present invention may be embodied in various forms, The present invention should not be construed as limited to the embodiments described in Figs.

본 발명은 다양한 변경을 가할 수 있고 여러 가지 실시 형태를 가질 수 있는바, 특정 실시예들을 도면에 예시하고 본문에 상세하게 설명하고자 한다. 그러나, 이는 본 발명을 특정한 개시 형태에 대하여 한정하려는 것이 아니며, 본 발명의 사상 및 기술 범위에 포함되는 모든 변경, 균등물 내지 대체물을 포함하는 것으로 이해되어야 한다.The present invention is capable of various modifications and various embodiments, and specific embodiments are illustrated in the drawings and described in detail in the text. It should be understood, however, that the invention is not intended to be limited to the particular forms disclosed, but on the contrary, is intended to cover all modifications, equivalents, and alternatives falling within the spirit and scope of the invention.

어떤 구성요소가 다른 구성요소에 "연결되어" 있다거나 "접속되어" 있다고 언급된 때에는, 그 다른 구성요소에 직접적으로 연결되어 있거나 또는 접속되어 있을 수도 있지만, 중간에 다른 구성요소가 존재할 수도 있다고 이해되어야 할 것이다. 반면에, 어떤 구성요소가 다른 구성요소에 "직접 연결되어" 있다거나 "직접 접속되어" 있다고 언급된 때에는, 중간에 다른 구성요소가 존재하지 않는 것으로 이해되어야 할 것이다. 구성요소들 간의 관계를 설명하는 다른 표현들, 즉 "~사이에"와 "바로 ~사이에" 또는 "~에 이웃하는"과 "~에 직접 이웃하는" 등도 마찬가지로 해석되어야 한다.It is to be understood that when an element is referred to as being "connected" or "connected" to another element, it may be directly connected or connected to the other element, . On the other hand, when an element is referred to as being "directly connected" or "directly connected" to another element, it should be understood that there are no other elements in between. Other expressions that describe the relationship between components, such as "between" and "between" or "neighboring to" and "directly adjacent to" should be interpreted as well.

본 출원에서 사용한 용어는 단지 특정한 실시예를 설명하기 위해 사용된 것으로, 본 발명을 한정하려는 의도가 아니다. 단수의 표현은 문맥상 명백하게 다르게 뜻하지 않는 한, 복수의 표현을 포함한다. 본 출원에서, "포함하다" 또는 "가지다" 등의 용어는 설시된 특징, 숫자, 단계, 동작, 구성요소, 부분품 또는 이들을 조합한 것이 존재함을 지정하려는 것이지, 하나 또는 그 이상의 다른 특징들이나 숫자, 단계, 동작, 구성요소, 부분품 또는 이들을 조합한 것들의 존재 또는 부가 가능성을 미리 배제하지 않는 것으로 이해되어야 한다.The terminology used in this application is used only to describe a specific embodiment and is not intended to limit the invention. The singular expressions include plural expressions unless the context clearly dictates otherwise. In the present application, the terms "comprise", "having", and the like are intended to specify the presence of stated features, integers, steps, operations, elements, components, or combinations thereof, , Steps, operations, components, parts, or combinations thereof, as a matter of principle.

또한, 명세서에 기재된 "...부", "...기", "모듈", "블록" 등의 용어는 적어도 하나의 기능이나 동작을 처리하는 단위를 의미하며, 이는 하드웨어 및/또는 소프트웨어의 결합으로 구현될 수 있다.Also, the terms " part, "" module, "" module "," block ", and the like described in the specification mean units for processing at least one function or operation, Lt; / RTI >

이하, 첨부한 도면들을 참조하여, 본 발명의 바람직한 실시예를 보다 상세하게 설명하고자 한다. 도면상의 동일한 구성요소에 대해서는 동일한 참조부호를 사용하고 동일한 구성요소에 대해서 중복된 설명은 생략한다.Hereinafter, preferred embodiments of the present invention will be described in detail with reference to the accompanying drawings. The same reference numerals are used for the same constituent elements in the drawings and redundant explanations for the same constituent elements are omitted.

도 1은 PE(Portable Executable) 파일 구조 및 메모리 매핑을 도시한다.Figure 1 shows a PE (Portable Executable) file structure and memory mapping.

도 1의 PE 파일 구조는 COFF(Common Object File Format)를 계승한 파일 포맷으로서, COFF 포맷은 수많은 프로그램을 하나로 합쳐 메모리에 옮기는 과정에서 발생하는 복잡하고 긴 시간을 요구하는 문제를 개선하기 위하여 미국 AT&T 사에서 고안한 규칙이다. 이러한 PE 파일 포맷은, cpl, exe, dll, ocx, vxd, sys, scr, drv 등의 파일에서 이용되고 있다.The PE file structure shown in FIG. 1 is a file format that inherits the Common Object File Format (COFF). The COFF format is a file format used by AT & T It is a rule designed by the company. These PE file formats are used in files such as cpl, exe, dll, ocx, vxd, sys, scr, and drv.

도 1에 도시된 PE 파일의 주요 섹션들을 살펴보면, .text 섹션은 실행파일에 사용하는 메인 코드가 들어 있는 섹션으로서, 실행 및 읽기 권한을 가지고 있으며, .data 섹션은 초기화된 전역 변수들을 담고 있는 섹션으로서, 읽기 및 쓰기 권한을 소유하고, .reloc 섹션은 실행파일에 대한 기본 재배치 정보를 담고 있는 섹션이다. 이와 같은 PE 파일의 섹션들 중에서, .text 섹션은 패킹 과정에서 반드시 사용되는 섹션으로서, .text 섹션은 실행파일에서 사용되는 메인코드가 포함되어 있어 패킹 과정에서 반드시 보호되어야 하는 대상이다.Referring to the main sections of the PE file shown in FIG. 1, the .text section is a section that contains main code used for an executable file, and has execute and read permission. A .data section includes a section containing initialized global variables , Which has read and write permissions, and the .reloc section is the section containing default relocation information for the executable file. Among the sections of the PE file, the .text section is a section that is necessarily used in the packing process. The .text section includes the main code used in the executable file and must be protected during the packing process.

도 2는 UPX(Ultimate Packer for eXecutables) 패커(Packer)를 이용한 패킹 과정을 도시한다.2 shows a packing process using a UPX (Ultimate Packer for eXecutables) packer.

패킹은 패커를 통해 패킹될 섹션을 선택하고 선택된 섹션을 암호화하는 과정을 의미하는 것으로서, 패커는 실행파일을 압축하거나 방해코드를 삽입하는 매개체 역활을 하며, 패커가 패킹을하고 난 뒤, 실행파일이 동작하는 시점에서 먼저 복호화 코드가 실행된다.Packing refers to the process of selecting a section to be packed through a packer and encrypting the selected section. The packer acts as a medium for compressing an executable file or inserting an interruption code. After the packer has packed, At the time of operation, the decryption code is executed first.

도 2에 도시된 바와 같이, UPX 패커는 먼저 패킹될 실행파일(200)을 패커에서 로딩하고, 로딩된 상태에서 패킹된 파일(210)에서 사용할 코드 섹션(204) 및 데이터 섹션(205)을 빈 공간(212)에 추가한다. 추가된 이후. 패킹될 실행파일(200) 내에 존재하는 코드 섹션(204) 및 데이터 섹션(205)을 암호화하여 패킹된 파일(210)의 공간에 저장한다.As shown in FIG. 2, the UPX packer loads the executable file 200 to be packed first from the packer, and inserts the code section 204 and the data section 205 to be used in the packed file 210 in the loaded state, And adds it to the space 212. Since added. The code section 204 and the data section 205 existing in the executable file 200 to be packed are encrypted and stored in the space of the packed file 210.

이와 같이 패킹이 적용된 실행파일은 언패킹에 의하여 패킹을 풀 수 있는데, 언패킹은, 패킹된 코드를 메모리에 로드하기 전에 언패킹 코드가 먼저 메모리 상에서 대기하고, 대기된 상태에서 패킹된 코드를 읽어 암호화된 내용을 복호화 한다. 또한, 실행 메모리의 빈 공간에 복호화된 코드를 기록하고, 언패킹이 완료된 이후에 프로그램을 실행시키기 위하여 OEP(Original Entry Point) 지점으로 이동하게 된다. An unpacked executable file can be unpacked by unpacking, where unpacking code is first queued in memory before loading the packed code into memory, and the packed code is read Decrypt the encrypted content. In addition, the decoded code is recorded in the empty space of the execution memory, and after the unpacking is completed, the program moves to the OEP (Original Entry Point) point to execute the program.

언패킹 보호 기능은 분석자에게 프로그램이 분석되는 과정에서 분석을 지연시켜 프로그램을 보호하는 것이다. 이러한 언패킹 보호 기능에는 방해코드(Anti Debugging Code), IAT(Import Address Table) 재배열, 난독화(Obfuscate), 코드 가상화(Code Virtualization) 등이 있다.Unpacking protection protects the program by delaying analysis in the process of analyzing the program to the analyst. These unpacking protection features include Anti Debugging Code, IAT (Import Address Table) rearrangement, obfuscation, and code virtualization.

먼저, 방해코드는 디버거를 이용한 방해코드를 의미하는 것으로서, 프로세스가 디버깅 상태인지를 체크하는 API 함수(예를 들어, IsDebuggerPresent, CheckRemoteDebuggerPresent, NtQueryInformationProcess 및 NtsetInformation Thread, NtQueryInformationProcess 등)를 이용하는 방식, 디버거의 특징(예를 들어, 각 디버거의 특정 레지스트리 정보 확인, 하드웨어 브레이크 포인트 사용 유무 체크 등)을 이용하는 방식, 및 분석자의 특성(예를 들어, 각 라인이 실행되는 시간을 확인)을 이용하는 방식이 있다.First, the disturbance code refers to a disturbance code using a debugger. The disturbance code includes a method of using an API function (e.g., IsDebuggerPresent, CheckRemoteDebuggerPresent, NtQueryInformationProcess and NtsetInformation Thread, NtQueryInformationProcess, etc.) for checking whether a process is in a debugging state, (For example, checking specific registry information of each debugger, checking whether hardware breakpoints are used, etc.), and analyzer characteristics (e.g., checking the time each line is executed).

또한, IAT 재배열은 패커가 섹션을 추가하고 IAT 정보의 변경을 통하여 복호화 코드에서 사용하는 함수를 숨기는 것으로, IAT 재배열을 할 경우 분석자는 실행파일에서 사용하는 함수의 경로를 찾기 위하여 프로그램을 분석하는데에 어려움을 겪게된다.In addition, the IAT rearrangement hides the functions used by the decoded code by adding the section and changing the IAT information by the packer. When the IAT rearrangement is performed, the analyzer analyzes the program to find the path of the function used in the executable file It becomes difficult to do.

또한, 난독화는 정상적인 코드의 복잡성을 높여 분석자에게 난독화를 적용하기 전보다 더 많은 분석 시간을 요구하도록 하는 방식이다. In addition, obfuscation increases the complexity of the normal code and allows the analyst to require more analysis time than before the obfuscation is applied.

또한, 코드 가상화는 분석자로 하여금 기존의 방해코드, IAT 재배열, 난독화보다 더 많은 분석 시간을 소요케할 수 있는 방법으로서, 패커가 가상머신(Virtual Machine)을 구축한 후 가상화 코드(VM Code)를 이용하여 복호화 코드 보호 및 은폐를 하게 된다.In addition, code virtualization is a way for analysts to spend more time analyzing than interfering code, IAT rearrangement, and obfuscation. Packer builds a virtual machine, ) Is used to protect and hide the decoded code.

그러나, 이러한 언패킹 보호 기능들에도 불구하고, 보다 분석자의 분석을 어렵게하는 언패킹 보호 방법의 필요성이 있는바, 이하에서는 도 3a 및 도 3b를 참조하여 본 발명의 언패킹 보호 방법을 설명한다.However, in spite of these unpacking protection functions, there is a need for an unpacking protection method that makes it difficult for the analyst to analyze. Hereinafter, the unpacking protection method of the present invention will be described with reference to FIGS. 3A and 3B.

도 3a는 본 발명의 일 실시예에 따른 코드 분리가 적용된 언패킹 보호 장치(310)의 구성 및 흐름도이다.3A is a configuration and a flowchart of an unpacking protection apparatus 310 to which a code separation is applied according to an embodiment of the present invention.

도 3a에 도시된 바와 같이, 본 발명의 일 실시예에 따른 언패킹 보호 장치(310)는 패킹 프로그램을 실행(S301)하면, 패킹할 실행파일을 선택(S302)한다. 패킹할 실행파일은 사용자로부터의 입력 또는 미리 설정된 파일명의 지정에 기초하여 선택될 수도 있다.3A, the unpacking protection apparatus 310 according to an embodiment of the present invention executes a packing program (S301), and selects an executable file to be packed (S302). The executable file to be packed may be selected based on input from the user or designation of a predetermined file name.

분리 실행 압축 모듈(320)은 선택된 실행파일을 패킹(S303)하고, 패킹된 실행파일을 언패킹하기 위한 복호화 프로그램을 생성(S304)한다. 생성된 복호화 프로그램은 패킹된 파일 구조를 가지며, 언패킹을 위한 독립적인 프로그램이나 실행파일에서 호출하는 특정 인자를 가지므로, 복호화 프로그램을 추출하여 독립적인 프로그램으로서 실행할 경우 동작을 하지 않게 된다. 또한, 분리 실행 압축 모듈(320)은 패킹된 실행파일과 생성된 복호화 프로그램을 하나의 실행파일로서 통합(S305)한다. 이러한 분리 실행 압축 모듈(320)의 통합 과정이 모두 완료되면 언패킹 보호 장치(310)는 패킹 프로그램을 종료(S306)한다. 또한, 분리 실행 압축 모듈(320)은 상술한 언패킹 보호 기능들(예를 들어, 방해 코드, IAT 재배열, 난독화 및/또는 코드 가상화 등)을 이용하여 실행파일을 패킹하고 복호화 프로그램을 생성할 수도 있다.The separation executing compression module 320 packs the selected executable file (S303) and generates a decoding program for unpacking the packed executable file (S304). The generated decrypting program has a packed file structure and has independent arguments for unpacking or specific parameters to be called from the executable file. Therefore, when the decrypting program is extracted and executed as an independent program, the decrypting program is not operated. In addition, the separation executing compression module 320 merges the packed execution file and the generated decoding program as one execution file (S305). When the unification process of the separation executing compression module 320 is completed, the unpacking protection device 310 ends the packing program (S306). The separation execution compression module 320 also packs executable files and generates decryption programs using the above-described unpacking protection functions (e.g., interfering code, IAT rearrangement, obfuscation and / or code virtualization) You may.

도 3b는 본 발명의 일 실시예에 따른 코드 분리가 적용된 파일의 언패킹 장치(330)의 구성 및 흐름도이다.3B is a configuration and a flowchart of a file unpacking apparatus 330 to which a code separation is applied according to an embodiment of the present invention.

도 3b에 도시된 바와 같이, 패킹된 프로그램을 실행(S311)하면, 분리 실행 압축 언패킹 모듈(340)은 패킹된 실행 파일에 포함된 패킹된 구조의 복호화 프로그램을 추출(S312)하고, 추출된 복호화 프로그램을 실행(S313)하고, 패킹된 실행파일을 복호화 프로그램에 의하여 복호화(S314)한다. 이때, 복호화된 데이터는 패킹된 실행파일의 빈 메모리 영역에 저장된다. 복호화가 완료되면 언패킹된 실행파일을 실행(S315)시킬 수도 있다.3B, when the packed program is executed (S311), the separation executing compression / unpacking module 340 extracts the decoding program of the packed structure included in the packed execution file (S312) The decryption program is executed (S313), and the packed executable file is decrypted by the decryption program (S314). At this time, the decoded data is stored in the empty memory area of the packed executable file. When the decoding is completed, the unpacked executable file may be executed (S315).

한편, 도 3a 및 도 3b에는 도시되지 않았으나, 언패킹 보호 장치(310) 및 언패킹 장치(330)는 위 프로세스들을 실행하기 위한 프로세서 및/또는 프로세서를 더 포함할 수 있음을 통상의 기술자는 이해할 수 있다.3A and 3B, it is understood that the unpacking protection device 310 and the unpacking device 330 may further include a processor and / or a processor for executing the above processes. .

이하에서는, 도면들을 참조하여 본 발명의 일 실시예에 따른 코드 분리가 적용된 언패킹 보호 방법에서의 패킹 방식 및 언패킹 방식을 구체적으로 설명한다.Hereinafter, the packing method and the unpacking method in the unpacking protection method applied with code separation according to an embodiment of the present invention will be described in detail with reference to the drawings.

먼저, 도 4는 본 발명의 일 실시예에 따른 코드 분리가 적용된 언패킹 보호 방법에서의 패킹 방법의 개략도이다.4 is a schematic diagram of a packing method in an unpacking protection method using code separation according to an embodiment of the present invention.

패킹할 실행파일이 선택(S401)되면, 선택된 실행파일의 .text 섹션을 추출(S402)한다. 일반적으로, .text 섹션의 데이터는 프로그램이 동작하는 실행 코드가 포함되어 있는바, .text 섹션의 보호가 우선시될 필요가 있다.When an executable file to be packed is selected (S401), a .text section of the selected executable file is extracted (S402). Generally, the data in the .text section contains the executable code that the program runs in, so the protection of the .text section should take precedence.

도 5a는 본원 발명의 일 실시예에 따른 .text 섹션 추출 코드의 예시로써, 도 5a에 도시된 바와 같이, .text 섹션 추출 코드는 PE 구조체인 PIMAGE_DOS_HEADER 이용한다. PIMAGE_DOS_HEADER 구조체에서 PIMAGE_NT_HEADERS의 구조체의 위치를 계산하고 계산된 메모리 주소를 기반으로 섹션 해더(Section Header)의 위치를 확인한다. 섹션 해더의 위치가 확인된 후, BaseOfCode(즉, .text 섹션의 오프셋)를 저장한다. 저장된 오프셋과 DOS_Header의 시작점을 연산하여 .text 섹션의 실제 주소를 확인한다. 확인된 .text 섹션의 주소의 사이즈는 PIMAGE_SECTION_HEADER 구조체 내부 VirtualSize를 기반으로 .text 섹션의 사이즈를 확인하여 결정되고, 그 이후 .text 섹션을 추출한다.5A is an example of a .text section extraction code according to an embodiment of the present invention. As shown in FIG. 5A, a .text section extraction code uses a PE structure PIMAGE_DOS_HEADER. In the PIMAGE_DOS_HEADER structure, calculate the position of the structure of PIMAGE_NT_HEADERS and check the position of the section header based on the calculated memory address. After the position of the section header is confirmed, it stores BaseOfCode (ie, the offset of the .text section). Computes the stored offset and the starting point of the DOS_Header to determine the actual address of the .text section. The size of the address of the identified .text section is determined by checking the size of the .text section based on the VirtualSize inside the PIMAGE_SECTION_HEADER structure, and then extracting the .text section.

다시 도 4를 참조하여, .text 섹션이 추출되면 .text 섹션을 암호화(S403)한다. Referring again to FIG. 4, if the .text section is extracted, the .text section is encrypted (S403).

도 5b는 본원 발명의 일 실시예에 따른 비트(bit)-연산 암호화 코드의 예시로써, 도 5b에 도시된 바와 같이, 추출된 .text 섹션의 데이터는 비트-연산 암호화 코드를 이용하여 암호화된다. 비트-연산 암호화는 키(Key) 입력에 기초하여 .text 섹션을 암호화할 수 있으며, 키 입력은 사용자로부터의 입력값, 랜덤(random) 함수에 의하여 생성된 값 및/또는 미리 설정된 값 중 하나 이상에 기초하여 결정될 수도 있다.5B is an example of a bit-operation encryption code according to an embodiment of the present invention. As shown in FIG. 5B, the data of the extracted .text section is encrypted using a bit-operation encryption code. The bit-operation encryption may encrypt a .text section based on a key input, wherein the key input may be one or more of an input value from a user, a value generated by a random function, and / . ≪ / RTI >

다시 도 4를 참조하여, .text 섹션의 암호화가 완료되면 암호화된 .text 섹션을 포함하는 패킹 파일(즉, 패킹된 실행파일)을 생성(S404)한다. 도 5c는 생성된 패킹 파일의 구조를 도시한다. 본원 발명의 설명을 돕기 위하여, 도 5c에는 생성된 패킹 파일의 일부 구성이 생략되어 기타 섹션 및 데이터로서 도시되어 있다.Referring again to FIG. 4, when the encryption of the .text section is completed, a packing file (i.e., a packed executable file) including the encrypted .text section is generated (S404). Fig. 5C shows the structure of the generated packing file. In order to facilitate the description of the present invention, in FIG. 5C, a part of the constitution of the generated packing file is omitted and is shown as other section and data.

다시 도 4를 참조하여, .text 섹션의 암호화가 완료되면, 암호화된 섹션을 복호화 하기 위한 복호화 코드가 포함된 복호화 프로그램을 생성(S405)한다. 복호화 코드는 비트-연산 암호화 코드가 적용되었기 때문에, 도 5b에 도시된 코드와 같은 종류의 코드가 복호화 프로그램을 생성하는 데에 이용될 수 있다.Referring again to FIG. 4, when the encryption of the .text section is completed, a decryption program including a decryption code for decrypting the encrypted section is generated (S405). Since the decryption code is applied to the bit-operation encryption code, a code of the same kind as the code shown in Fig. 5B can be used to generate the decryption program.

도 5d는 생성된 복호화 프로그램의 파일 구조를 도시한다. 본원 발명의 설명을 돕기 위하여, 도 5d에는 생성된 복호화 프로그램의 일부 구성이 생략되어 기타 섹션 및 데이터로서 도시되어 있다.FIG. 5D shows the file structure of the generated decryption program. In order to facilitate the description of the present invention, a part of the constitution of the generated decryption program is omitted in FIG. 5D and is shown as other sections and data.

생성된 복호화 프로그램은 별도의 실행 화면을 가지고 있지 않으며, 상술된 바와 같이 패킹을 위한 독립적인 프로그램이나 실행파일에서 호출하는 특정 인자를 가지므로, 독립적으로 실행될 수 없고, 언패킹을 위한 독립적 프로그램이나 패킹된 실행 파일이 호출하는 경우에만 실행된다.The generated decryption program does not have a separate execution screen, and can not be independently executed because it has independent programs for packing or specific parameters to be called from the executable file as described above, and independent programs or packings for unpacking It is executed only when the executed executable file is called.

도 4를 참조하여, 복호화 프로그램의 생성이 완료되면, 패킹된 실행 파일과 생성된 복호화 프로그램을 새로운 하나의 파일인 최종 실행파일로서 통합(S406)한다.Referring to FIG. 4, when the generation of the decoded program is completed, the packed executable file and the generated decoded program are combined as a final executable file (S406).

도 5e는 통합된 최종 실행파일의 구조를 도시한다. 도 5e에는 통합된 최종 실행파일의 일부 구성이 생략되어 기타 섹션 및 데이터로서 도시되어 있다. 도 5e에 도시된 바와 같이, 복호화 프로그램은 최종 실행파일의 .reloc 섹션에 저장될 수도 있다. 도 5e에 도시된 바와 같이, 패킹된 실행파일과 생성된 복호화 프로그램을 하나의 최종 실행파일로서 통합함으로써 프로그램을 배포할 때 복호화 프로그램이 누락되는 것을 방지할 수 있다.Figure 5E shows the structure of the final executable file integrated. In Figure 5E, some configuration of the final executable file integrated is omitted and is shown as other sections and data. As shown in FIG. 5E, the decryption program may be stored in the .reloc section of the final executable file. As shown in FIG. 5E, the packed executable file and the generated decoded program are integrated as one final execution file, thereby preventing the decoded program from being omitted when distributing the program.

도 6은 본 발명의 일 실시예에 따른 코드 분리가 적용된 언패킹 보호 방법에서의 언패킹 방법의 개략도이다.6 is a schematic diagram of an unpacking method in an unpacking protection method applied with code separation according to an embodiment of the present invention.

먼저, 패킹된 실행파일을 실행(S601)하면 실행파일로부터 패킹된 구조의 복호화 프로그램을 추출(S602)한다.First, when the packed executable file is executed (S601), the decoded program of the packed structure is extracted from the executable file (S602).

도 7a는 복호화 프로그램을 추출하기 위한 코드의 예시이다. 복호화 프로그램을 추출하는 것은, 패킹된 파일의 총 용량을 확인하고, 총 용량에서 추출한 복호화 프로그램의 용량을 확인하고, 실제 패킹된 실행파일의 용량을 확인하는 것을 포함한다. 또한, 복호화 프로그램을 기록할 핸들(handle)을 생성한 후, 총 용량에서 실제 패킹된 실행파일의 용량만큼 파일 포인터를 이동시킨 후, 복호화 프로그램의 용량만큼 기록한다.7A is an example of a code for extracting a decryption program. The extraction of the decryption program includes checking the total capacity of the packed file, checking the capacity of the decryption program extracted from the total capacity, and checking the capacity of the actual packed executable file. Further, after generating a handle for recording the decryption program, the file pointer is moved by the capacity of the actual packed executable file in the total capacity, and then recorded by the capacity of the decryption program.

다시 도 6을 참조하여, 복호화 프로그램이 추출된 후, 패킹된 실행파일은 복호화 프로그램에 패킹된 실행파일의 암호화된 .txt 섹션의 정보를 전달(S603)한다. 이 때에, 복호화 프로그램은 다른 디버거(debugger)의 접근을 차단할 수도 있다.Referring again to FIG. 6, after the decrypted program is extracted, the packed executable file transfers information of the encrypted .txt section of the executable file packed in the decrypted program (S603). At this time, the decryption program may block access to another debugger.

이와 관련하여, 도 7b에는 프로세스 보호 코드의 예시가 도시되어 있다. 도 7b에 도시된 바와 같이, 디버그 모드로 프로세스를 점유할 경우, ollydbg와 같은 디버거는 실행중인 패킹된 프로그램에 접근(attatch)할 수 없다. 따라서, 복호화 프로그램은 실행파일에 대한 프로세스를 디버깅 모드로 선점유함으로써 다른 디버거의 프로세스 접근을 원천차단할 수 있다.In this regard, an example of a process protection code is shown in Figure 7B. As shown in FIG. 7B, when occupying a process in the debug mode, a debugger such as ollydbg can not attatch a running packed program. Thus, the decryption program can preempt the process access of other debuggers by preempting the process for the executable file in the debugging mode.

다시 도 6을 참조하여, 암호화된 .txt 섹션 데이터를 전달받아 암호화된 .txt 섹션을 복호화(S604)한다. 이와 관련하여, 도 7c에는 실행파일의 패킹된 영역에 대한 접근 코드의 예시가 도시되어 있다.Referring back to FIG. 6, the encrypted .txt section data is received and the encrypted .txt section is decrypted (S604). In this regard, FIG. 7C shows an example of an access code for a packed area of an executable file.

도 7c에 도시된 바와 같이, 복호화 프로그램은 패킹된 실행파일에 대한 전체 메모리 접근 권한을 획득하고, .text 섹션의 주소와 사이즈를 확인한다. 확인된 .text 섹션의 내용은 메모리에 복사하여 도 5b에 도시된 비트 연산 암호화 코드를 이용한 복호화 과정을 진행한다.As shown in FIG. 7C, the decryption program obtains full memory access authority to the packed executable file, and confirms the address and size of the .text section. The contents of the identified .text section are copied to a memory and decoded using the bit operation encryption code shown in FIG. 5B.

도 7d는 복호화된 데이터를 빈 메모리 영역에 기록하기 위한 코드의 예시로써, 패킹된 실행파일의 빈 메모리 공간을 복호화 프로그램에서 예약하고, 예약된 메모리를 확정한 뒤, 확정된 메모리에 복호화된 데이터를 기록하는 과정을 포함하며, 도 7e에 도시된 실행파일의 빈 메모리 영역에 복호화 데이터를 기록하는 방법의 개략도와 같이 동작한다.FIG. 7D is an example of a code for writing decoded data in an empty memory area. In FIG. 7D, an empty memory space of a packed executable file is reserved in a decoding program, the reserved memory is determined, And it operates as a schematic diagram of a method of recording decoded data in an empty memory area of the executable file shown in FIG. 7E.

다시 도 6을 참조하여, 복호화된 .txt 섹션의 저장이 완료됨으로써 실행파일의 언패킹이 종료되면, 추출된 복호화 프로그램을 삭제(S605)한다. 복호화 프로그램이 계속하여 존재할 경우, 분석에 활용될 수 있기 때문이다. 또한, 실행파일의 언패킹이 종료되면 언패킹된 실행파일을 실행(S606)할 수도 있다.Referring to FIG. 6 again, when unpacking of the executable file is completed by storing the decoded .txt section, the extracted decoded program is deleted (S605). If a decryption program continues to exist, it can be used for analysis. In addition, when the unpacking of the executable file ends, the unpacked executable file may be executed (S606).

이하에서는, 상술한 도 4 내지 도 5e와 관련하여 상술한 본 발명의 실시예에 따른 코드 분리가 적용된 보호 방법을 다른 비교예와 비교하여 설명한다. Hereinafter, the protection method using the code separation according to the embodiment of the present invention described above with reference to FIGS. 4 to 5E will be described in comparison with other comparative examples.

본 발명의 실시예에 따른 패커는 Windows 7 Professional Service Pack 1의 Visual Studio 2010을 이용하여 개발되었으며, 본 발명의 패커에 의하여 패킹된 실행파일과 기존의 패커에 의하여 패킹된 실행파일을 Windows 7 Professional Service Pack 1 환경에서 ollydbg 프로그램을 이용하여 언패킹을 시도함으로써 비교하였다.The packer according to the embodiment of the present invention was developed using Visual Studio 2010 of Windows 7 Professional Service Pack 1 and the executable packed by the packer of the present invention and the packer packed by the existing packer are transferred to the Windows 7 Professional Service Pack 1 environment by using the ollydbg program.

비교예 1은 UPX 패커를 이용하여 패킹된 실행파일의 언패킹으로써, 도 8a의 UPX 언패킹 과정에 도시된 바와 같이, 프로그램이 실행된 후 복호화 프로그램(코드)이 실행되어 복호화가 진행된다. 이 과정에서 IAT 재배열이 이루어지고, IAT 재배열이 완료되면 복호화 완료된 지점인 OEP 지점으로 이동하여 프로그램이 실행된다. UPX 패커는 방어코드도 존재하지 않는 상태에서 복호화 과정이 진행되므로 분석에 소비된 시간이 미비하였다.In the first comparative example, as shown in the UPX unpacking process of Fig. 8A, the unpacking of the packed executable file using the UPX packer causes the decryption program (code) to be executed after the program is executed to proceed decryption. In this process, the IAT is rearranged and when the IAT rearrangement is completed, the program is moved to the OEP point where decoding is completed. The UPX packer did not have the time spent analyzing because the decryption process proceeded with no defense code.

비교예 2는 PECompact 패커를 이용하여 패킹된 실행파일의 언패킹으로써, 도 8b의 PECompact 언패킹 과정에 도시된 바와 같이, 프로그램이 실행된 후, 난독화가 진행되어 디버거의 혼란을 유발하고, 난독화 지점을 통과한 후 IAT 재배열이 실행된다. 재배열된 IAT를 기반으로 복호화 프로그램(코드)이 실행되고 복호화가 완료되면 OEP 지점으로 이동한다. PECompact의 경우, UPX 패커에 비하여 난독화 기능이 더 적용되어 그 분석에 비교예 1보다 많은 시간이 소요되었다.Comparative Example 2 shows that the unpacking of the packed executable file using the PECompact packer causes the obfuscation to proceed after the program is executed as shown in the PECompact unpacking process of Fig. 8B, causing the debugger to be confused, After passing the point, the IAT rearrangement is executed. When the decryption program (code) is executed based on the rearranged IAT and the decryption is completed, it moves to the OEP point. In the case of PECompact, the obfuscation function was further applied as compared to the UPX packer, and the analysis required more time than Comparative Example 1.

비교예 3은 FSG(Fast Small Good) 패커를 이용하여 패킹된 실행파일의 언패킹으로써, 도 8c의 FSG 언패킹 과정에 도시된 바와 같이, 프로그램이 실행된 후, IAT 재배열이 진행되고, IAT 재배열이 완료된 시점에서 난독화가 진행된다. 난독화 코드를 지난 후 복호화 코드가 암호화된 코드를 복호화한다. 복호화 완료 이후 OEP 지점으로 이동한다. 비교예 3은 그 분석에 비교예 2와 비슷한 시간이 소요되었다.In the comparative example 3, unpacking of the packed executable file using the FSG (Fast Small Good) packer causes the IAT rearrangement to proceed after the program is executed, as shown in the FSG unpacking process of FIG. 8C, Obfuscation proceeds at the point when rearrangement is completed. After passing the obfuscation code, the decryption code decrypts the encrypted code. After decryption is completed, it moves to OEP point. Comparative Example 3 took a time similar to Comparative Example 2 for its analysis.

비교예 4는 ASProtect 패커를 이용하여 패킹된 실행파일의 언패킹으로써, 도 8d의 ASProtect 언패킹 과정에 도시된 바와 같이, 프로그램이 실행된 후, IAT 재배열이 진행되고, IAT 재배열이 완료된 시점에서 난독화가 진행된다. 또한, 방해 코드가 작동되어 현재 상태의 분석 여부를 확인한다. 분석 여부가 확인된 이후, 가상 머신을 생성하고, 생성된 가상 머신 내부에서 난독화 코드가 동작한다. 난독화가 진행된 이후, 복호화 과정이 진행되어 암호화된 코드를 복호화시킨다. 복호화 과정이 완료되면, 복호화된 코드의 OEP 지점으로 이동 후, 프로그램이 실행된다. 비교예 4는 다양한 언패킹 보호 방법이 적용되어 비교예 1 내지 3에 비하여 보다 많은 분석 시간이 소요되었다.In the comparative example 4, the unpacking of the packed executable file using the ASProtect packer, the IAT re-arrangement is performed after the program is executed as shown in the ASProtect unpacking process of FIG. 8D, Obfuscation progresses. In addition, an interrupting code is activated to check whether the current state is analyzed. After the analysis is confirmed, a virtual machine is created, and the obfuscation code operates in the created virtual machine. After the obfuscation proceeds, the decryption process proceeds to decrypt the encrypted code. When the decoding process is completed, the program is executed after moving to the OEP point of the decoded code. In Comparative Example 4, various unpacking protection methods were applied and more analysis time was required than in Comparative Examples 1 to 3.

이하에서는, 본원 발명의 일 실시예에 따른 분리 실행 압축의 언패킹(실시예 1)에 대하여 설명한다. 도 8e의 분리 실행 압축 언패킹 과정에 도시된 바와 같이, 프로그램이 실행되면, IAT 재배열이 이루어지고, IAT 재배열이 완료되면 난독화가 진행되고, 난독화 과정에서 방해코드가 동작하여 현재 상태를 확인하게 된다. 방해코드의 동작이 정상적인 경우, 가상 머신을 생성한 뒤 다시 난독화가 실행된다. 이 과정은 비교예 4와 동일하다. 하지만, 복호화 프로그램이 추출되고 추출된 복호화 프로그램이 실행되면 프로세스는 이미 디버거에 의하여 분석되는 중이므로, 프로세스 보호 기능에 의하여 복호화 프로그램이 종료된다. 따라서, 분석자는 더 이상의 분석을 진행할 수 없다.Hereinafter, unpacking of separate execution compression according to an embodiment of the present invention (Embodiment 1) will be described. As shown in FIG. 8E, when the program is executed, the IAT rearrangement is performed. When the IAT rearrangement is completed, the obfuscation proceeds, and the obstructive code operates in the obfuscation process, . If the operation of the disturb code is normal, the obfuscation is executed again after the virtual machine is created. This process is the same as in Comparative Example 4. [ However, when the decrypted program is extracted and the decrypted decrypted program is executed, the decrypted program is terminated by the process protection function because the process is already being analyzed by the debugger. Therefore, the analyst can not proceed further analysis.

그 외의 디버거가 프로세스에 접근(attatch)하는 방법을 통하여 언패킹 과정을 추적하는 경우에도 프로세스를 선 점유하는 방식인 프로세스 보호 기능에 의하여 디버거의 접근이 차단되므로 분석을 차단할 수 있다. 이와 같이, 본 발명에 따른 분리 실행 압축 기법을 적용할 경우, 비교예 1 내지 4에서 소비된 분석 시간에 비하여 보다 많은 분석 시간의 투자가 요구된다.Even if the other debugger traces the unpacking process through the method of attatching the process, the analysis can be blocked because the access of the debugger is blocked by the process protection function which occupies the process preemptively. As described above, when the separate execution compression method according to the present invention is applied, more analysis time investment is required compared with the analysis time spent in Comparative Examples 1 to 4.

상술한 비교예 1 내지 4와 실시예 1의 패커의 기능 적용 비교 분석은 다음의 표 1과 같다.The comparative analysis of the functional application of the packers of Comparative Examples 1 to 4 and Example 1 described above is shown in Table 1 below.

Figure 112014019694592-pat00001
Figure 112014019694592-pat00001

종래의 패커는 기본적으로 하나의 파일 안에 복호화 코드가 포함되어 있는바, 종래의 언패킹 보호 방법(예를 들어, 방해 코드, IAT 재배열, 난독화, 가상화)이 적용된다고 하더라도 분석자가 내부에 존재하는 복호화 코드를 찾는 것이 어렵지 않았다.Conventional packers basically contain a decoding code in one file. Even if a conventional unpacking protection method (for example, an interrupt code, IAT rearrangement, obfuscation, or virtualization) is applied, It was not difficult to find the decoded code.

그러나, 본원 발명의 일 실시예에 따른 분리 실행 압축 기능의 경우, 복호화 코드가 외부에 존재하며, 외부에 존재하는 복호화 프로그램의 파일명 및 구조를 다양하게 생성할 수 있다. 그로 인하여 분석자는 복호화 코드의 위치를 파악하는데 어려움을 겪게 되고, 프로세스 보호 기능을 통해 패킹된 프로그램과 복호화 프로그램이 서로 상호 작용하는 과정에서 현재의 알려진 디버깅 프로세스 접근 방법을 차단할 수 있다.However, in the case of the separate execution compression function according to an embodiment of the present invention, a decryption code exists externally, and a file name and a structure of a decryption program existing outside can be variously generated. As a result, the analyst may have difficulty locating the decoded code and the process protection function may block the currently known debugging process approach in the course of the interaction between the packed program and the decoded program.

또한, 분리 실행 압축 기법은 기존에 적용되었던 언패킹 보호 방법에서 제시된 모든 내용을 이중으로 적용 가능하게 되므로, 분석자는 패킹된 프로그램과 복호화 프로그램 모두를 동시에 분석해야하는 부담이 생기고 이는 기존의 패킹된 방식보다 많은 분석 시간을 소모하게끔 한다.In addition, since the separate execution compression technique can apply all the contents presented in the previously-proposed unpacking protection method, the analyst needs to analyze both the packed program and the decryption program at the same time, It consumes a lot of analysis time.

이러한 본 발명의 코드 분리가 적용된 언패킹 보호 방법은, 언패킹 보호 방법을 패킹될 파일과 복호화 프로그램에 이중적으로 적용할 수 있어 분석을 지연시키고, 프로세스 보호 기법을 통해 디버거의 접근을 통제할 수 있으며, 복호화 프로그램을 분리시켜 분석자에게 분석의 대상을 증가시켜 분석을 지연시킬 수 있다는 장점을 가진다.According to the unpacking protection method of the present invention, unpacking protection method can be applied to a file to be packed and a decryption program in a double manner, so that analysis can be delayed and the access of a debugger can be controlled through a process protection technique , The decoding program is separated and the analysis can be delayed by increasing the object of analysis to the analyst.

한편, 본 발명은 컴퓨터 판독가능 저장 매체에 저장된 컴퓨터 실행 가능한 명령들에 의하여 구현될 수 있다. 본원의 컴퓨터 판독가능 저장 매체는 컴퓨터 시스템에 의하여 판독될 수 있는 데이터가 저장되는 모든 종류의 저장 장치를 포함한다.Alternatively, the invention may be embodied by computer-executable instructions stored on a computer-readable storage medium. The computer-readable storage medium of the present disclosure includes any kind of storage device in which data that can be read by a computer system is stored.

컴퓨터 판독가능 저장 매체의 예로는 ROM, RAM, CD-ROM, 자기 테이프, 플로피디스크, 광 데이터 저장장치 등이 있으며, 또한 반송파 (예를 들어, 인터넷을 통한 전송) 의 형태로 구현하는 것을 포함한다. 또한, 컴퓨터 판독가능 저장 매체는 네트워크로 연결된 컴퓨터 시스템에 분산되어, 분산 방식으로 컴퓨터가 판독 가능한 코드가 저장되고 실행될 수 있다.Examples of computer-readable storage media include ROM, RAM, CD-ROM, magnetic tape, floppy disk, optical data storage, etc., and also implementations in the form of carrier waves (e.g., transmission over the Internet) . In addition, the computer-readable storage medium may be distributed over a networked computer system so that computer readable code in a distributed manner may be stored and executed.

이제까지 본 발명에 대한 실시 예를 중심으로 살펴보았다. 본 발명이 속하는 기술 분야에서 통상의 지식을 가진 자는 본 발명의 본질적인 특성에서 벗어나지 않는 범위에서 변형된 형태로 본 발명을 구현할 수 있음을 이해할 것이다. 그러므로 상술한 실시 예들은 한정적인 관점이 아니라 설명적인 관점에서 고려되어야 한다. 본 발명의 범위는 전술한 설명이 아니라 특허청구범위에 나타나 있으며, 특허청구범위에 의해 청구된 발명 및 청구된 발명과 균등한 발명들은 본 발명에 포함된 것으로 해석되어야 한다.The embodiments of the present invention have been described above. It will be understood by those skilled in the art that the present invention may be embodied in various other forms without departing from the spirit or essential characteristics thereof. Therefore, the above-described embodiments should be considered from an illustrative point of view, not from a limiting viewpoint. The scope of the present invention is defined by the appended claims rather than by the foregoing description, and the inventions claimed by the claims and the inventions equivalent to the claimed invention are to be construed as being included in the present invention.

Claims (11)

분리 실행 압축 모듈을 포함하는 코드 분리가 적용된 언패킹(unpacking) 보호 장치로서,
상기 분리 실행 압축 모듈은,
제 1 실행파일을 패킹(packing)하고;
상기 패킹된 제 1 실행파일을 언패킹하기 위한 복호화 프로그램을 생성하고, 상기 생성된 복호화 프로그램은 패킹된 파일 구조를 가지며; 그리고
상기 패킹된 제 1 실행파일과 상기 생성된 복호화 프로그램을 제 2 실행파일로서 통합하도록 구성되고,
상기 복호화 프로그램은 암호화된 미리 정의된 섹션을 복호화 하기 위한 복호화 코드를 포함하고, 언패킹을 위한 독립적인 프로그램 또는 상기 제 2 실행파일에 의하여 호출되며,
상기 제 1 실행파일을 패킹하는 것은, 상기 제 1 실행파일로부터 미리 정의된 섹션을 추출하여 상기 미리 정의된 섹션을 암호화하는 것을 포함하고,
상기 복호화 코드는 상기 분리 실행 압축 모듈에 의하여 암호화되고,
상기 패킹된 제 1 실행파일 및 상기 생성된 복호화 프로그램은 PE(Portable Executable) 파일 구조를 가지고, 암호화된 미리 정의된 섹션 및 암호화된 복호화 코드는 키(key) 입력에 기초하여 비트(bit)-연산 암호화되며, 상기 키 입력은 사용자로부터의 입력값, 랜덤(random) 함수에 의하여 생성된 값 및 미리 설정된 값 중 하나 이상에 기초하여 결정되며,
상기 패킹된 제 1 실행파일과 상기 생성된 복호화 프로그램을 제 2 실행파일로서 통합하는 것은, 상기 생성된 복호화 프로그램을 상기 패킹된 제 1 실행파일의 .reloc 섹션에 포함시키는 것을 포함하는, 코드 분리가 적용된 언패킹 보호 장치.
An unpacking protection device with a code separation comprising a detachable compression module,
Wherein the separation executing compression module comprises:
Packing a first executable file;
Generating a decryption program for unpacking the packed first executable file, the decrypted program having a packed file structure; And
And to integrate the packed first executable file and the generated decoded program as a second executable file,
Wherein the decryption program includes a decryption code for decrypting an encrypted predefined section and is called by an independent program for unpacking or by the second executable file,
Packing the first executable file includes extracting a predefined section from the first executable file and encrypting the predefined section,
The decryption code is encrypted by the separation executing compression module,
The packed first executable file and the generated decryption program have a PE (Portable Executable) file structure, and the encrypted predefined section and the encrypted decryption code are subjected to bit-arithmetic operation Wherein the key input is determined based on at least one of an input value from a user, a value generated by a random function, and a preset value,
And integrating the packed first executable file and the generated decoded program as a second executable file includes inserting the generated decoded program into the .reloc section of the packed first executable file, Applied unpacking protection device.
제 1 항에 있어서,
상기 분리 실행 압축 모듈은 방해 코드, IAT(Import Address Table) 재배열, 난독화 및 코드 가상화 중 하나 이상을 이용하여, 상기 제 1 실행파일을 패킹하고 복호화 프로그램을 생성하도록 더 구성되는, 코드 분리가 적용된 언패킹 보호 장치.
The method according to claim 1,
Wherein the separate execution compression module is further configured to pack the first executable file and generate a decryption program using one or more of an interrupt code, an IAT (Import Address Table) rearrangement, obfuscation and code virtualization, Applied unpacking protection device.
삭제delete 삭제delete 삭제delete 삭제delete 삭제delete 삭제delete 삭제delete 분리 실행 압축 모듈을 포함하는 코드 분리가 적용된 언패킹(unpacking) 보호 장치의 코드 분리가 적용된 실행파일의 패킹 방법에 있어서,
상기 분리 실행 압축 모듈이 제 1 실행파일로부터 미리 정의된 섹션을 추출하여 암호화하고 상기 제 1 실행파일을 패킹하는 단계;
상기 분리 실행 압축 모듈이 상기 패킹된 제 1 실행파일을 언패킹하기 위한 복호화 프로그램을 생성하는 단계; 및
상기 분리 실행 압축 모듈이 상기 패킹된 제 1 실행파일과 상기 생성된 복호화 프로그램을 제 2 실행파일로서 통합하는 단계를 포함하고,
상기 제 1 실행파일을 패킹하는 단계는 상기 제 1 실행파일로부터 미리 정의된 섹션을 추출하여 상기 미리 정의된 섹션을 암호화하고,
상기 제 2 실행파일로서 통합하는 단계는 상기 생성된 복호화 프로그램을 상기 패킹된 제 1 실행파일의 .reloc 섹션에 포함시키고,
상기 복호화 프로그램은, 상기 암호화된 미리 정의된 섹션을 복호화 하기 위한 복호화 코드를 포함하고, 언패킹을 위한 독립적인 프로그램 또는 상기 제 2 실행파일에 의하여 호출되며, 상기 복호화 코드는 상기 분리 실행 압축 모듈에 의하여 암호화되고, 상기 패킹된 제 1 실행파일 및 상기 생성된 복호화 프로그램은 PE(Portable Executable) 파일 구조를 가지고, 상기 암호화된 미리 정의된 섹션 및 상기 암호화된 복호화 코드는 키(key) 입력에 기초하여 비트(bit)-연산 암호화되며, 상기 키 입력은 사용자로부터의 입력값, 랜덤(random) 함수에 의하여 생성된 값 및 미리 설정된 값 중 하나 이상에 기초하여 결정되는, 코드 분리가 적용된 실행파일의 패킹 방법.
CLAIMS 1. A packing method of an executable file to which code separation of an unpacking protection device with a code separation including a separation executing compression module is applied,
Extracting and encrypting a predefined section from the first executable file and packing the first executable file;
Generating a decryption program for unpacking the packed first executable file; And
And the detachment executing compression module integrating the packed first executable file and the generated decrypting program as a second executable file,
Wherein packing the first executable file comprises extracting a predefined section from the first executable file, encrypting the predefined section,
The merging as the second executable file includes the generated decoding program in the .reloc section of the packed first executable file,
Wherein the decryption program includes a decryption code for decrypting the encrypted predefined section and is called by an independent program for unpacking or by the second executable file, Wherein the packed first executable file and the generated decryption program have a PE (Portable Executable) file structure, and the encrypted predefined section and the decrypted code are encrypted based on a key input Wherein the key input is based on at least one of an input value from a user, a value generated by a random function, and a preset value, Way.
삭제delete
KR1020140023561A 2014-02-27 2014-02-27 Method of unpacking protection with code separation and apparatus thereof KR101671336B1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
KR1020140023561A KR101671336B1 (en) 2014-02-27 2014-02-27 Method of unpacking protection with code separation and apparatus thereof

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
KR1020140023561A KR101671336B1 (en) 2014-02-27 2014-02-27 Method of unpacking protection with code separation and apparatus thereof

Publications (2)

Publication Number Publication Date
KR20150101811A KR20150101811A (en) 2015-09-04
KR101671336B1 true KR101671336B1 (en) 2016-11-16

Family

ID=54242855

Family Applications (1)

Application Number Title Priority Date Filing Date
KR1020140023561A KR101671336B1 (en) 2014-02-27 2014-02-27 Method of unpacking protection with code separation and apparatus thereof

Country Status (1)

Country Link
KR (1) KR101671336B1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20200041524A (en) * 2018-10-12 2020-04-22 네이버비즈니스플랫폼 주식회사 Apparatus and method for packing original source code
US11061998B2 (en) 2017-11-24 2021-07-13 Inka Entworks, Inc. Apparatus and method for providing security and apparatus and method for executing security to protect code of shared object

Families Citing this family (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9710648B2 (en) 2014-08-11 2017-07-18 Sentinel Labs Israel Ltd. Method of malware detection and system thereof
US10102374B1 (en) 2014-08-11 2018-10-16 Sentinel Labs Israel Ltd. Method of remediating a program and system thereof by undoing operations
US11507663B2 (en) 2014-08-11 2022-11-22 Sentinel Labs Israel Ltd. Method of remediating operations performed by a program and system thereof
US11616812B2 (en) 2016-12-19 2023-03-28 Attivo Networks Inc. Deceiving attackers accessing active directory data
US11695800B2 (en) 2016-12-19 2023-07-04 SentinelOne, Inc. Deceiving attackers accessing network data
WO2019032728A1 (en) 2017-08-08 2019-02-14 Sentinel Labs, Inc. Methods, systems, and devices for dynamically modeling and grouping endpoints for edge networking
US11470115B2 (en) 2018-02-09 2022-10-11 Attivo Networks, Inc. Implementing decoys in a network environment
WO2019235664A1 (en) * 2018-06-08 2019-12-12 라인플러스 주식회사 Debugger blocking method and system for program protection
US10762200B1 (en) 2019-05-20 2020-09-01 Sentinel Labs Israel Ltd. Systems and methods for executable code detection, automatic feature extraction and position independent code detection
US11579857B2 (en) 2020-12-16 2023-02-14 Sentinel Labs Israel Ltd. Systems, methods and devices for device fingerprinting and automatic deployment of software in a computing network using a peer-to-peer approach
US11899782B1 (en) 2021-07-13 2024-02-13 SentinelOne, Inc. Preserving DLL hooks
KR102341431B1 (en) * 2021-08-02 2021-12-21 주식회사 포스로직 Method for protecting protection target execution file and device for performing the method

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101487176B1 (en) * 2009-07-30 2015-02-02 에스케이플래닛 주식회사 System for providing code block for separating execution based contents, method thereof and computer recordable medium storing the method
KR101265099B1 (en) * 2011-06-15 2013-05-20 주식회사 터보테크 A Method For Software Security Treatment And A Storage Medium

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11061998B2 (en) 2017-11-24 2021-07-13 Inka Entworks, Inc. Apparatus and method for providing security and apparatus and method for executing security to protect code of shared object
KR20200041524A (en) * 2018-10-12 2020-04-22 네이버비즈니스플랫폼 주식회사 Apparatus and method for packing original source code
KR102177920B1 (en) * 2018-10-12 2020-11-13 네이버비즈니스플랫폼 주식회사 Apparatus and method for packing original source code

Also Published As

Publication number Publication date
KR20150101811A (en) 2015-09-04

Similar Documents

Publication Publication Date Title
KR101671336B1 (en) Method of unpacking protection with code separation and apparatus thereof
US20210124824A1 (en) Securing secret data embedded in code against compromised interrupt and exception handlers
Carlini et al. {Control-Flow} bending: On the effectiveness of {Control-Flow} integrity
US7930743B2 (en) Information processing system, information processing method, information processing program, computer readable medium and computer data signal
Yan et al. Revealing packed malware
US9275229B2 (en) System to bypass a compromised mass storage device driver stack and method thereof
JP5875690B2 (en) Triage dump generation method and computing device
WO2013170724A1 (en) Method for protecting java application programs in android system
US11269992B2 (en) Systems and methods for hypervisor-based protection of code
Onarlioglu et al. Privexec: Private execution as an operating system service
US9256756B2 (en) Method of encryption and decryption for shared library in open operating system
US20080028462A1 (en) System and method for loading and analyzing files
US20140082356A1 (en) Protection of interpreted source code in virtual appliances
Wang et al. Binary code retrofitting and hardening using SGX
Suk et al. UnThemida: Commercial obfuscation technique analysis with a fully obfuscated program
KR101749209B1 (en) Method and apparatus for hiding information of application, and method and apparatus for executing application
US20080028388A1 (en) System and method for analyzing packed files
WO2016188134A1 (en) Application reinforcing implementation method and apparatus
US9563785B2 (en) Optimized encryption filtering of files
CN110232261B (en) Operation method of package file, file processing device and device with storage function
Giuliani ZeroAccess, an advanced kernel mode rootkit
KR102557007B1 (en) Method for rebuilding binary file and apparatus thereof
Li et al. A token strengthened encryption packer to prevent reverse engineering PE files
KR101300256B1 (en) Method for securing software executable files by prohibiting dynamic and static analysis, and computer-readable recording medium for storing program for securing software executable files for the same
Li et al. Bridge the Future: High-Performance Networks in Confidential VMs without Trusted I/O devices

Legal Events

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

Payment date: 20191022

Year of fee payment: 4