KR101989580B1 - Apparatus and method for defensing of code reuse attack - Google Patents

Apparatus and method for defensing of code reuse attack Download PDF

Info

Publication number
KR101989580B1
KR101989580B1 KR1020170143672A KR20170143672A KR101989580B1 KR 101989580 B1 KR101989580 B1 KR 101989580B1 KR 1020170143672 A KR1020170143672 A KR 1020170143672A KR 20170143672 A KR20170143672 A KR 20170143672A KR 101989580 B1 KR101989580 B1 KR 101989580B1
Authority
KR
South Korea
Prior art keywords
core
cfi
monitored
monitoring
program
Prior art date
Application number
KR1020170143672A
Other languages
Korean (ko)
Other versions
KR20190048590A (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 KR1020170143672A priority Critical patent/KR101989580B1/en
Publication of KR20190048590A publication Critical patent/KR20190048590A/en
Application granted granted Critical
Publication of KR101989580B1 publication Critical patent/KR101989580B1/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/50Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
    • G06F21/55Detecting local intrusion or implementing counter-measures
    • G06F21/56Computer malware detection or handling, e.g. anti-virus arrangements

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Hardware Design (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • General Health & Medical Sciences (AREA)
  • Virology (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

코드 재사용 공격 방어 장치 및 방법이 개시된다. 본 발명에 따른 코드 재사용 공격 방어 장치에 의해 수행되는 코드 재사용 공격 방어 방법은, 멀티 코어 시스템의 유휴 상태 코어 중에서 모니터링 코어를 선택하는 단계, 상기 모니터링 코어에 CFI 감시부를 로딩하고, 상기 CFI 감시부로 제어 데이터를 전송하는 단계, 상기 CFI 감시부가 상기 제어 데이터를 이용하여, 감시 대상 프로그램이 실행되는 감시 대상 코어의 CPU 인스트럭션을 추출하는 단계, 상기 CFI 감시부가 상기 감시 대상 프로그램의 정상적인 실행 흐름을 추출하는 단계, 상기 CFI 감시부가 상기 정상적인 실행 흐름을 기반으로, 상기 CPU 인스트럭션의 제어 흐름 정책 위배 여부를 판단하는 단계, 그리고 상기 CFI 감시부가 상기 제어 흐름 정책 위배 여부를 기반으로, 상기 감시 대상 코어의 실행을 제어하여, 코드 재사용 공격을 방어하는 단계를 포함한다. A code reuse attack defense apparatus and method are disclosed. A method of protecting a code reuse attack performed by a code reuse attack defense apparatus according to the present invention includes the steps of selecting a monitoring core among idle cores of a multicore system, loading a CFI monitoring unit to the monitoring core, The CFI monitoring unit extracting a CPU instruction of a monitored core on which the monitored program is executed using the control data; extracting a normal execution flow of the monitored program from the CFI monitoring unit; Determining whether the CFI monitoring unit is in violation of a control flow policy of the CPU instruction based on the normal execution flow, and controlling the execution of the monitored core based on whether the CFI monitoring unit violates the control flow policy , Thereby protecting the code reuse attack It includes.

Figure 112017107928728-pat00001
Figure 112017107928728-pat00001

Description

코드 재사용 공격 방어 장치 및 방법{APPARATUS AND METHOD FOR DEFENSING OF CODE REUSE ATTACK}[0001] APPARATUS AND METHOD FOR DEFENSIBILITY OF CODE REUSE ATTACK [0002]

본 발명은 멀티 코어 시스템에서 코드 재사용 공격을 방어하는 기술에 관한 것으로, 유휴 상태의 코어를 모니터링 코어로 설정하고, 감시 대상 코어에서 실행되는 감시 대상 프로그램의 인스트럭션 및 데이터를 분석하여 코드 재사용 공격을 탐지 및 방어하는 기술에 관한 것이다.The present invention relates to a technology for protecting a code reuse attack in a multi-core system, in which an idle core is set as a monitoring core, and a code reuse attack is detected by analyzing instructions and data of a monitored program executed in the monitored core And techniques for defending.

동영상을 재생하거나 게임을 플레이하기 위하여 데스크톱 PC를 주로 사용하던 과거와 달리, 최근에는 스마트폰이나 태블릿 등의 모바일 장치를 이용하는 사용자들이 크게 증가하였다. 이러한 고성능 애플리케이션을 구동하기 위하여, 모바일 기기에 사용되는 CPU 코어의 개수가 증가하고 있으며, 칩 제조사나 CPU 아키텍처 회사는 CPU 코어의 수를 늘리는 방향으로 성능을 향상시키고 있다. Unlike in the past, where users mainly use desktop PCs to play videos or play games, users who use mobile devices such as smartphones and tablets have increased in recent years. To drive these high performance applications, the number of CPU cores used in mobile devices is increasing, and chip makers and CPU architecture companies are improving performance in the direction of increasing the number of CPU cores.

모바일 기기에 사용되는 CPU 코어의 개수는 증가하고 있으나, 최근 연구 결과에 따르면 모바일 응용 프로그램이 실행 중에 실제로 사용하는 코어의 수는 2개 미만이다. 이미 데스크톱 PC 영역에서는, CPU 코어를 다 사용하지 못하는 현상(CPU underutilization)이 2010년에 연구되어 보고된 바 있다. The number of CPU cores used in mobile devices is increasing, but recent research shows that the number of cores that a mobile application actually uses during execution is less than two. CPU core underutilization has already been studied and reported in 2010 in the area of desktop PCs.

한편, 코드 재사용 공격(Code Reuse Attack, CRA)은 기존에 존재하는 코드들의 일부를 조합하여, 새로운 공격 코드를 합성하는 공격 형태이다. 코드 재사용 공격은 일반적인 응용 프로그램이나 라이브러리 코드에서 점프 또는 리턴 명령으로 끝나는 작은 코드 영역을 찾아 영역들을 체인처럼 연결하여 실행한다. 코드 재사용 공격은 주로 루트 또는 커널 권한과 같은 상승된 권한을 획득하는데 사용되며, 코드 재사용 공격이 확산됨에 따라 다양한 제어 흐름 기반의 무결성 탐지(Control Flow Integrity, CFI) 방법이 제안되었다. On the other hand, a code reuse attack (CRA) is an attack type in which a new attack code is synthesized by combining some existing codes. A code reuse attack finds a small code area that ends with a jump or return instruction in a typical application or library code, and executes the regions as a chain. Code reuse attacks are mainly used to gain elevated privileges, such as root or kernel privileges. As code reuse attacks spread, various control flow based control flow integrity (CFI) methods have been proposed.

종래 기술에 따른 CFI 기술은 크게 소프트웨어 기반 CFI(Software based CFI), 하드웨어 지원 CFI(Hardware assisted CFI) 및 하드웨어 기반 CFI(Hardware based CFI)로 분류될 수 있다.The conventional CFI technology can be classified into software based CFI, hardware assisted CFI, and hardware based CFI.

소프트웨어 기반 CFI는 기존 응용 프로그램을 실행하기 위해 하드웨어를 변경할 필요가 없으므로, 비교적 쉽게 적용할 수 있다. 소프트웨어 기반의 CFI는 대상 응용 프로그램의 소스 코드를 이용하거나, 바이너리 패치를 통해 CFG(Control Flow Graph)를 추출하고, 실행 시간에 CFI에 사용한다. 그러나 소프트웨어 기반 CFI는 대상 응용 프로그램에서 21%의 평균 성능 저하가 발생하고, 소스 코드나 디버깅 기호를 필요로 한다는 단점이 있다. Software-based CFIs are relatively easy to apply because they do not require hardware changes to run existing applications. The software-based CFI extracts the CFG (Control Flow Graph) through the source code of the target application or through the binary patch, and uses it for the CFI at execution time. However, the software-based CFI has the disadvantage that it causes an average performance degradation of 21% in the target application and requires source code and debugging symbols.

성능 저하의 단점을 극복하기 위하여 제안된 휴리스틱 기반 CFI 방법은, CFI 정책을 모델링하기 위해 과거에 공격자가 사용한 ROP(Return Oriented Programming) 또는 JOP(Jump Oriented Programming) 공격 코드의 특성을 분석하는 방법과 공격 코드가 사용하지 않는 정상적인 코드의 특성을 분석하고 모델링하여 CRA를 탐지하는 방법으로 구분된다. 그러나 휴리스틱 기반의 CFI는 CFI 정책이 공개된 경우 공격자가 적용된 CFI 정책을 우회 할 수 있는 방법을 쉽게 찾을 수 있어, 취약한 접근 방법이다.To overcome the drawbacks of performance degradation, the proposed heuristic based CFI method is used to model the CFI policy and to analyze the characteristics of ROP (Return Oriented Programming) or JOP (Jump Oriented Programming) And the CRA is detected by analyzing and modeling the characteristics of normal code that the code does not use. However, heuristic-based CFI is a weak approach because it can easily find a way to bypass the applied CFI policy if the CFI policy is disclosed.

반면, 하드웨어 기반 CFI 방법은 별도의 하드웨어에서 CFI 정책을 검사하는 방법이다. 그러나 기존 시스템에 하드웨어를 추가하거나, 기존 시스템을 변경하거나, CFI를 위한 하드웨어 장착 공간을 필요로 한다는 점에서, 실제 환경에서 적용하기가 어렵다. On the other hand, the hardware-based CFI method is a method of inspecting the CFI policy in a separate hardware. However, it is difficult to apply it in a real environment because it adds hardware to an existing system, changes an existing system, or requires hardware mounting space for CFI.

CFI를 위해 별도의 CPU 인스트럭션을 추가하는 방법이 제안되었지만, CPU 구조를 변경하고 CPU를 새로 제작해야 하므로 기존에 출시된 기기에 적용할 수 없다는 단점이 있다. Although a method of adding a separate CPU instruction for CFI has been proposed, it has a disadvantage that it can not be applied to a previously released device because a CPU structure is changed and a CPU is newly manufactured.

기존 CPU 칩 아키텍처를 변경하지 않고 ARM Coresight를 이용하는 방법도 연구되었다. 이 방법은 CFI를 위해 제작된 하드웨어를 ARM Coresight의 TPIU에 연결하고, Coresight의 Program Trace Macrocell(PTM)이 추출한 CPU 코어 인스트럭션을 TPIU를 통하여 해당 하드웨어로 전송되는 구조이다. 그러나 이 방법도 새로운 하드웨어를 추가 해야 한다는 점에서 기존의 기기에는 적용할 수 없으며, 분기 인스트럭션(Call, Return, Jump)이 발생한 위치를 획득하기 위해, 대상 응용 프로그램의 수정이 필요하다는 단점이 있다. A way to use ARM Coresight without changing the existing CPU chip architecture was also studied. In this method, hardware created for CFI is connected to TPIU of ARM Coresight, and CPU core instruction extracted by Coresight's Program Trace Macrocell (PTM) is transferred to corresponding hardware through TPIU. However, this method can not be applied to existing devices because new hardware must be added, and there is a disadvantage in that it is necessary to modify the target application program in order to acquire the position where the branch instruction (Call, Return, Jump) occurs.

그리고 하드웨어 지원 CFI(HW Assisted CFI)는 기존 장치의 하드웨어에서 제공하는 기능을 이용하여, 소프트웨어에서의 CFI 정책을 검사하는 방법으로, 별도의 하드웨어를 필요로 하지 않는다. 하드웨어 지원 CFI로는 Intel/AMD CPU가 제공하는 LBR(Last Branch Record)을 사용하여 CFI 검사를 수행하는 kBouncer와 ROPecker이 있다. And hardware support CFI (HW Assisted CFI) is a method to check CFI policy in software by using functions provided by hardware of existing device, and does not require any additional hardware. Hardware Support CFI includes kBouncer and ROPecker that perform CFI check using LBR (Last Branch Record) provided by Intel / AMD CPU.

LBR은 가장 최근에 실행된 16개의 CPU 분기 인스트럭션 정보를 기록하고, 분기가 발생한 소스 주소 및 대상 주소를 기록한다. 그리고 CFIMon은 Intel CPU의 PMU(Performance Monitoring Unit) 및 BTS(Branch Trace Store)를 기반으로 하는 CFI 방식이다. The LBR records the most recently executed 16 CPU branch instruction information and records the source address and the destination address where the branch occurred. CFIMon is a CFI based on Intel Performance Monitor Unit (PMU) and Branch Trace Store (BTS).

LBR은 CPU 코어가 실행한 분기 인스트럭션(Call, Return, Jump) 중 마지막 16개의 인스트럭션만 저장할 수 있으므로, LBR을 이용한 하드웨어 지원 CFI 기술들은 처리 속도를 높이기 위해, 강한 실행 흐름 정책(Control Flow Policy)를 적용하지 못하고, 휴리스틱 기법에 기반한 약한 실행 흐름 정책(Coarse-Grained CFI)를 적용한다. 즉, LBR은 저장 용량의 제약을 극복하기 위해 약한 실행 흐름 정책을 적용하여, 처리 속도는 향상시킬 수 있으나 보안성은 낮아진다는 단점이 있다. Since LBR can store only the last 16 instructions among the branch instructions (Call, Return, Jump) executed by the CPU core, hardware-supported CFI technologies using LBR have a strong control flow policy And applies a weak coarse-grained CFI based on the heuristic technique. In other words, LBR can apply the weak execution flow policy to overcome the limitation of the storage capacity and improve the processing speed, but it has a disadvantage that the security is lowered.

따라서, 종래의 제어 흐름 기반의 무결성 탐지(Control Flow Integrity, CFI) 기술의 한계를 극복하여, 성능 저하 없이 CFI 검사를 수행하고, 새로운 하드웨어의 추가 설치 없이 기존 기기를 이용하여 코드 재사용 공격을 방어할 수 있는 기술의 개발이 필요하다. Therefore, it is possible to overcome the limitations of the conventional control flow based control flow integrity (CFI) technology, to perform the CFI inspection without degrading performance, and to protect the code reuse attack using existing devices without installing new hardware It is necessary to develop the technology that can be used.

한국 등록 특허 제10-1715759호, 2017년 03월 15일 공고(명칭: 멀티코어 환경에서의 악성코드 분석 장치 및 방법)Korean Registered Patent No. 10-1715759, March 15, 2017 (Name: Apparatus and Method for Analyzing Malicious Code in Multicore Environment)

본 발명의 목적은 하드웨어 추가 또는 재설계 없이 기존의 출시된 단말기에 적용 가능한 CFI 감시 기술을 제공하는 것이다. It is an object of the present invention to provide a CFI monitoring technology applicable to existing released terminals without adding or redesigning hardware.

또한, 본 발명의 목적은 멀티코어 시스템에서 유휴 상태 코어를 이용하여 CFI 감시를 수행함으로써, 기존의 성능 저하 문제를 극복하는 것이다. It is also an object of the present invention to overcome the existing performance degradation problem by performing CFI monitoring using an idle core in a multicore system.

또한, 본 발명의 목적은 다수의 유휴 상태 코어를 이용하여 CFI 감시를 수행함으로써, 성능을 향상시키고, 향상된 성능을 이용하여 강력한 CFI 정책(Fine Grained CFI)을 적용하여 보안성을 강화하는 것이다. It is also an object of the present invention to improve security by performing CFI monitoring using a plurality of idle cores, and to enhance security by applying a strong CFI policy (Fine Grained CFI) using improved performance.

또한, 본 발명의 목적은 감시 대상 프로그램 및 시스템의 부하에 따라 자동으로 유휴 상태 코어를 탐색하고, CFI 감시 소프트웨어를 동적으로 로딩, 시작, 정지, 언로딩하거나 코어를 이동하여, CFI 감시의 성능 문제를 개선하는 것이다. It is also an object of the present invention to provide a CFI monitoring system capable of automatically searching for an idle core according to a load of a monitored program and a system, dynamically loading, starting, stopping, .

또한, 본 발명의 목적은 멀티 코어 시스템에서 유휴 상태의 코어를 자동으로 탐지하고 유휴 코어의 개수와 위치에 따라 CFI 감시부를 스케줄링하여, CFI 감시를 수행하는 것이다. It is also an object of the present invention to automatically detect an idle core in a multicore system and to perform CFI monitoring by scheduling a CFI monitoring unit according to the number and position of idle cores.

또한, 본 발명의 목적은 CFI 정책을 위배하여 악성코드인 것으로 판단된 감시 대상 프로그램을 정지하고, 커널의 스케줄링 리스트에서 제거하여, 종래 기술의 한계를 극복하고, 데이터를 보존하며 사용자가 연속적으로 기기를 사용할 수 있도록 하는 것이다. It is another object of the present invention to provide an apparatus and method for monitoring a program to be monitored, which suspends a monitoring target program determined to be a malicious code in violation of the CFI policy and removes the monitoring target program from the scheduling list of the kernel, To be used.

또한, 본 발명의 목적은 감시 대상 프로그램이 실행해야 하는 정상 실행 흐름을 추출하고, 실제 실행한 인스트럭션이 정상 실행 흐름에 부합하는지 여부를 판단하는 CFI 방식으로 악성코드를 탐지하는 것이다. It is also an object of the present invention to detect a malicious code by a CFI method for extracting a normal execution flow to be executed by the monitoring target program and judging whether the actually executed instruction conforms to the normal execution flow.

상기한 목적을 달성하기 위한 본 발명에 따른 코드 재사용 공격 방어 장치에 의해 수행되는 코드 재사용 공격 방어 방법은, 멀티 코어 시스템의 유휴 상태 코어 중에서 모니터링 코어를 선택하는 단계, 상기 모니터링 코어에 CFI 감시부를 로딩하고, 상기 CFI 감시부로 제어 데이터를 전송하는 단계, 상기 CFI 감시부가 상기 제어 데이터를 이용하여, 감시 대상 프로그램이 실행되는 감시 대상 코어의 CPU 인스트럭션을 추출하는 단계, 상기 CFI 감시부가 상기 감시 대상 프로그램의 정상적인 실행 흐름을 추출하는 단계, 상기 CFI 감시부가 상기 정상적인 실행 흐름을 기반으로, 상기 CPU 인스트럭션의 제어 흐름 정책 위배 여부를 판단하는 단계, 그리고 상기 CFI 감시부가 상기 제어 흐름 정책 위배 여부를 기반으로, 상기 감시 대상 코어의 실행을 제어하여, 코드 재사용 공격을 방어하는 단계를 포함한다.  According to another aspect of the present invention, there is provided a method of protecting a code reuse attack performed by a code reuse attack defense apparatus, the method comprising: selecting a monitoring core from idle cores of a multicore system; The CFI monitoring unit extracting a CPU instruction of a monitored core on which a monitoring target program is executed using the control data, Determining whether the CFI monitoring unit is in violation of a control flow policy of the CPU instruction based on the normal execution flow, and determining whether the CFI monitoring unit violates the control flow policy based on whether the CFI monitoring unit violates the control flow policy By controlling the execution of the monitored core, It comprises the use of defensive attack.

이때, 상기 감시 대상 코어의 CPU 인스트럭션을 추출하는 단계는, 상기 감시 대상 코어의 트레이스 하드웨어로 상기 제어 데이터를 전송하는 단계, 그리고 메모리로부터 상기 트레이스 하드웨어가 저장한 상기 CPU 인스트럭션을 추출하는 단계를 포함할 수 있다. The step of extracting the CPU instruction of the monitored core may include transmitting the control data to the trace hardware of the monitored core and extracting the CPU instruction stored in the trace hardware from the memory .

이때, 상기 메모리에 저장된 상기 CPU 인스트럭션을 추출하는 단계는, 상기 CPU 인스트럭션이 저장된 메모리 주소를 폴링하거나, 상기 트레이스 하드웨어로부터 인터럽트 이벤트를 수신한 후, 상기 메모리 주소에 저장된 상기 CPU 인스트럭션을 추출할 수 있다. At this time, the step of extracting the CPU instruction stored in the memory may be performed by polling a memory address where the CPU instruction is stored or extracting the CPU instruction stored in the memory address after receiving an interrupt event from the trace hardware .

이때, 상기 정상적인 실행 흐름을 추출하는 단계는, 상기 감시 대상 프로그램의 실행 전에 오프라인 실행 흐름을 추출하는 단계, 그리고 상기 감시 대상 프로그램의 실행 중에 온라인 실행 흐름을 추출하는 단계를 포함할 수 있다. The step of extracting the normal execution flow may include extracting an offline execution flow before execution of the monitoring target program, and extracting an online execution flow during execution of the monitoring target program.

이때, 상기 CPU 인스트럭션의 제어 흐름 정책 위배 여부를 판단하는 단계는, 추출된 상기 CPU 인스트럭션과 상기 정상적인 실행 흐름을 비교하여, 상기 감시 대상 코어의 정상적인 실행 흐름 위배 여부를 판단할 수 있다. In this case, the step of determining whether the CPU instruction violates the control flow policy may compare the extracted CPU instruction with the normal execution flow to determine whether the monitored core violates normal execution flow.

이때, 상기 코드 재사용 공격을 방어하는 단계는, 상기 감시 대상 프로그램이 커널 영역 프로그램인 경우, 온 칩 디버그 하드웨어를 이용하여 상기 제어 흐름 정책을 위배한 상기 감시 대상 코어를 정지할 수 있다. At this time, when the monitored program is a kernel area program, the step of defending the code reuse attack may stop the monitored core violating the control flow policy using the on-chip debug hardware.

이때, 상기 코드 재사용 공격을 방어하는 단계는, 상기 감시 대상 코어를 정지한 후, 상기 제어 흐름 정책을 위배한 상기 감시 대상 프로그램을 상기 감시 대상 코어에서 언로드할 수 있다. At this time, in the step of defending the code reuse attack, the monitoring target core may be unloaded from the monitored core after stopping the monitored core, and then violating the control flow policy.

이때, 상기 코드 재사용 공격을 방어하는 단계는, 상기 감시 대상 프로그램이 사용자 영역 프로그램인 경우, 온 칩 디버그 하드웨어 및 커널의 프로그램 제어 기능 중 적어도 어느 하나를 이용하여 상기 제어 흐름 정책을 위배한 상기 감시 대상 코어를 정지할 수 있다. In this case, when the monitored program is a user area program, the step of defending the code reuse attack may be performed by using at least one of on-chip debug hardware and a kernel program control function, The core can be stopped.

이때, 상기 유휴 상태 코어는, 파워다운 상태이거나, 어플리케이션을 실행하지 않고 커널의 유휴 루프(idle loop)만 실행하는 코어일 수 있다. At this time, the idle core may be a power-down state or a core that executes only an idle loop of the kernel without executing an application.

이때, 상기 모니터링 코어를 선택하는 단계는, 계산된 CFI 감시 처리 속도를 기반으로 상기 모니터링 코어를 결정할 수 있다. At this time, the step of selecting the monitoring core may determine the monitoring core based on the calculated CFI monitoring processing speed.

또한, 본 발명의 일실시예에 따른 코드 재사용 공격 방어 장치는, 멀티 코어 시스템에서 유휴 상태 코어를 탐지하는 코어 관리부, 상기 유휴 상태 코어의 정보를 기반으로, 상기 유휴 상태 코어 중에서 모니터링 코어를 선택하는 CFI 스케줄러, 그리고 상기 모니터링 코어에 로딩되어, 감시 대상 프로그램을 실행하는 감시 대상 코어에 대한 CFI 감시를 수행하는 CFI 감시부를 포함하고, 상기 CFI 감시부는, 상기 CFI 스케줄러로부터 수신한 제어 데이터를 이용하여, 상기 감시 대상 프로그램이 실행되는 상기 감시 대상 코어의 CPU 인스트럭션을 추출하는 인스트럭션 추출부, 상기 감시 대상 프로그램의 정상적인 실행 흐름을 추출하는 정상 실행 흐름 추출부, 상기 정상적인 실행 흐름을 기반으로, 상기 CPU 인스트럭션의 제어 흐름 정책 위배 여부를 판단하는 CFI 검사부, 그리고 상기 제어 흐름 정책 위배 여부를 기반으로, 상기 감시 대상 코어의 실행을 제어하여, 코드 재사용 공격을 방어하는 코어 제어부를 포함한다. Also, a code reuse attack defense apparatus according to an exemplary embodiment of the present invention includes a core management unit for detecting an idle core in a multicore system, a processor for selecting a monitoring core from the idle core based on the information of the idle core And a CFI monitoring unit which is loaded in the monitoring core and performs CFI monitoring on a monitored core that executes a monitoring target program, wherein the CFI monitoring unit monitors the CFI using the control data received from the CFI scheduler, A normal execution flow extracting unit for extracting a normal execution flow of the monitored program; and a normal execution flow extracting unit for extracting a CPU instruction of the supervisory core from the CPU instruction based on the normal execution flow CFI to judge whether control flow policy violation In Blackwood, and based on whether the control flow violates the policy, to control the execution of the monitored core, a core controller to defend the attack code reuse.

이때, 상기 감시 대상 코어의 트레이스 하드웨어로 상기 제어 데이터를 전송하고, 메모리로부터 상기 트레이스 하드웨어가 저장한 상기 CPU 인스트럭션을 추출할 수 있다. At this time, the control data may be transmitted to the trace hardware of the monitored core, and the CPU instruction stored in the trace hardware may be extracted from the memory.

이때, 상기 인스트럭션 추출부는, 상기 CPU 인스트럭션이 저장된 메모리 주소를 폴링하거나, 상기 트레이스 하드웨어로부터 인터럽트 이벤트를 수신한 후, 상기 메모리 주소에 저장된 상기 CPU 인스트럭션을 추출할 수 있다. At this time, the instruction extraction unit may poll the memory address where the CPU instruction is stored, or extract the CPU instruction stored in the memory address after receiving the interrupt event from the trace hardware.

이때, 상기 정상 실행 흐름 추출부는, 상기 감시 대상 프로그램의 실행 전에 오프라인 실행 흐름을 추출하고, 상기 감시 대상 프로그램의 실행 중에 온라인 실행 흐름을 추출할 수 있다. At this time, the normal execution flow extracting unit may extract an offline execution flow before executing the monitoring target program, and extract an online execution flow during execution of the monitoring target program.

이때, 상기 CFI 검사부는, 추출된 상기 CPU 인스트럭션과 상기 정상적인 실행 흐름을 비교하여, 상기 감시 대상 코어의 정상적인 실행 흐름 위배 여부를 판단할 수 있다. At this time, the CFI checking unit may compare the extracted CPU instruction with the normal execution flow to determine whether the monitored core violates normal execution flow.

이때, 상기 코어 제어부는, 상기 감시 대상 프로그램이 커널 영역 프로그램인 경우, 온 칩 디버그 하드웨어를 이용하여 상기 제어 흐름 정책을 위배한 상기 감시 대상 코어를 정지할 수 있다. At this time, if the monitored program is a kernel area program, the core control unit can stop the monitored core that violates the control flow policy using the on-chip debug hardware.

이때, 상기 코어 제어부는, 상기 감시 대상 코어를 정지한 후, 상기 제어 흐름 정책을 위배한 상기 감시 대상 프로그램을 상기 감시 대상 코어에서 언로드할 수 있다. At this time, after stopping the monitored core, the core control unit may unload the monitored program that violates the control flow policy from the monitored core.

이때, 상기 코어 제어부는, 상기 감시 대상 프로그램이 사용자 영역 프로그램인 경우, 온 칩 디버그 하드웨어 및 커널의 프로그램 제어 기능 중 적어도 어느 하나를 이용하여 상기 제어 흐름 정책을 위배한 상기 감시 대상 코어를 정지할 수 있다. At this time, if the monitored program is a user area program, the core control unit can stop the monitored core violating the control flow policy using at least one of the on-chip debug hardware and the program control function of the kernel have.

이때, 상기 코어 관리부는, 상기 멀티 코어 시스템에 포함된 코어의 상태 변경을 감지하고, 상기 유휴 상태 코어의 개수 및 상태가 변경된 경우 상기 CFI 스케줄러로 상기 유휴 상태 코어의 정보를 전송할 수 있다. At this time, the core management unit may detect a state change of the core included in the multi-core system, and may transmit the idle core information to the CFI scheduler when the number and state of the idle core are changed.

이때, 상기 CFI 스케줄러는, 상기 유휴 상태 코어의 상태가 활성 상태로 변경된 경우, 상기 유휴 상태 코어에서 실행 중인 상기 CFI 감시부를 다른 유휴 상태 코어에 로드하거나, 상기 CFI 감시부의 동작을 중지할 수 있다.At this time, when the state of the idle core is changed to the active state, the CFI scheduler may load the CFI monitoring unit running in the idle core into another idle core or suspend the operation of the CFI monitoring unit.

본 발명에 따르면, 하드웨어 추가 또는 재설계 없이 기존의 출시된 단말기에 적용 가능한 CFI 감시 기술을 제공할 수 있다. According to the present invention, it is possible to provide a CFI monitoring technology applicable to existing terminals without adding or redesigning hardware.

또한 본 발명에 따르면, 멀티코어 시스템에서 유휴 상태 코어를 이용하여 CFI 감시를 수행함으로써, 기존의 성능 저하 문제를 극복할 수 있다. Also, according to the present invention, CFI monitoring is performed using an idle core in a multicore system, thereby overcoming the existing performance degradation problem.

또한 본 발명에 따르면, 감시 대상 프로그램 및 시스템의 부하에 따라 자동으로 유휴 상태 코어를 탐색하고, CFI 감시 소프트웨어를 동적으로 로딩, 시작, 정지, 언로딩하거나 코어를 이동하여, CFI 감시의 성능 문제를 개선할 수 있다. According to the present invention, the idle core is automatically searched according to the load of the monitored program and the system, and the CFI monitoring software is dynamically loaded, started, stopped, unloaded, Can be improved.

또한 본 발명에 따르면, 멀티 코어 시스템에서 유휴 상태의 코어를 자동으로 탐지하고 유휴 코어의 개수와 위치에 따라 CFI 감시부를 스케줄링하여, CFI 감시를 수행할 수 있다. Also, according to the present invention, CFI monitoring can be performed by automatically detecting an idle core in a multicore system and scheduling a CFI monitoring unit according to the number and position of idle cores.

또한 본 발명에 따르면, CFI 정책을 위배하여 악성코드인 것으로 판단된 감시 대상 프로그램을 정지하고, 커널의 스케줄링 리스트에서 제거하여, 종래 기술의 한계를 극복하고, 데이터를 보존하며 사용자가 연속적으로 기기를 사용할 수 있도록 한다. According to the present invention, a monitoring target program determined to be a malicious code in violation of the CFI policy is stopped and removed from the scheduling list of the kernel, thereby overcoming the limitations of the related art, preserving data, So that it can be used.

또한 본 발명에 따르면, 감시 대상 프로그램이 실행해야 하는 정상 실행 흐름을 추출하고, 실제 실행한 인스트럭션이 정상 실행 흐름에 부합하는지 여부를 판단하는 CFI 방식으로 악성코드를 탐지할 수 있다. Further, according to the present invention, a malicious code can be detected by a CFI method for extracting a normal execution flow to be executed by the monitoring target program and judging whether the actually executed instruction conforms to the normal execution flow.

도 1은 본 발명의 일실시예에 따른 코드 재사용 공격 방어 장치가 적용되는 환경을 개략적으로 나타낸 도면이다.
도 2는 본 발명의 일실시예에 따른 코드 재사용 공격 방어 장치의 구성을 나타낸 블록도이다.
도 3은 본 발명의 일실시예에 따른 코드 재사용 공격 방어 방법을 설명하기 위한 순서도이다.
도 4는 본 발명의 일 실시예에 따른 인스트럭션 추출부의 동작을 설명하기 위한 도면이다.
도 5는 본 발명의 일 실시예에 따른 정상 실행 흐름 추출부의 동작을 설명하기 위한 도면이다.
도 6은 본 발명의 일실시예에 따른 분기 테이블(Branch Table)을 나타낸 도면이다.
도 7은 본 발명의 일실시예에 따른 함수 주소 테이블(Function Address Table)을 나타낸 도면이다.
도 8은 본 발명의 일실시예에 따른 쉐도우 콜 스택(Shadow Call Stack)을 나타낸 도면이다.
도 9는 본 발명의 일실시예에 따른 코어 제어부가 온 칩 디버그 하드웨어를 이용하여 코어를 제어하는 방법을 나타낸 도면이다.
도 10은 본 발명의 일실시예에 따른 코어 제어부가 커널의 기능을 이용하여 코어를 제어하는 방법을 나타낸 도면이다.
도 11은 본 발명의 일실시예에 따른 CFI 검사부가 시큐어 월드에서 동작하는 방법을 나타낸 도면이다.
도 12는 본 발명의 일실시예에 따른 컴퓨터 시스템을 나타낸 블록도이다.
1 is a diagram schematically illustrating an environment to which a code reuse attack defense apparatus according to an embodiment of the present invention is applied.
2 is a block diagram illustrating a configuration of a code reuse attack defense apparatus according to an embodiment of the present invention.
3 is a flowchart for explaining a code reuse attack defense method according to an embodiment of the present invention.
4 is a diagram for explaining the operation of the instruction extracting unit according to an embodiment of the present invention.
5 is a view for explaining the operation of the normal execution flow extracting unit according to an embodiment of the present invention.
6 is a diagram illustrating a branch table according to an embodiment of the present invention.
7 is a functional address table according to an embodiment of the present invention.
FIG. 8 is a diagram illustrating a shadow call stack according to an exemplary embodiment of the present invention. Referring to FIG.
9 is a diagram illustrating a core control unit controlling a core using on-chip debug hardware according to an embodiment of the present invention.
10 is a diagram illustrating a method of controlling a core using a kernel function according to an embodiment of the present invention.
11 is a diagram illustrating a method of operating in a secure world according to an exemplary embodiment of the present invention.
12 is a block diagram illustrating a computer system in accordance with an embodiment of the present invention.

본 발명은 다양한 변경을 가할 수 있고 여러 가지 실시예를 가질 수 있는 바, 특정 실시 예들을 도면에 예시하고 상세하게 설명하고자 한다.While the invention is susceptible to various modifications and alternative forms, specific embodiments thereof are shown by way of example in the drawings and will herein be described in detail.

그러나, 이는 본 발명을 특정한 실시 형태에 대해 한정하려는 것이 아니며, 본 발명의 사상 및 기술 범위에 포함되는 모든 변경, 균등물 내지 대체물을 포함하는 것으로 이해되어야 한다.It should be understood, however, that the invention is not intended to be limited to the particular embodiments, but includes all modifications, equivalents, and alternatives falling within the spirit and scope of the invention.

본 출원에서 사용한 용어는 단지 특정한 실시예를 설명하기 위해 사용된 것으로, 본 발명을 한정하려는 의도가 아니다. 단수의 표현은 문맥상 명백하게 다르게 뜻하지 않는 한, 복수의 표현을 포함한다. 본 출원에서, "포함하다" 또는 "가지다" 등의 용어는 명세서상에 기재된 특징, 숫자, 단계, 동작, 구성요소, 부품 또는 이들을 조합한 것이 존재함을 지정하려는 것이지, 하나 또는 그 이상의 다른 특징들이나 숫자, 단계, 동작, 구성요소, 부품 또는 이들을 조합한 것들의 존재 또는 부가 가능성을 미리 배제하지 않는 것으로 이해되어야 한다.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 "comprises" or "having" and the like are used to specify that there is a feature, a number, a step, an operation, an element, a component or a combination thereof described in the specification, But do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, or combinations thereof.

다르게 정의되지 않는 한, 기술적이거나 과학적인 용어를 포함해서 여기서 사용되는 모든 용어들은 본 발명이 속하는 기술 분야에서 통상의 지식을 가진 자에 의해 일반적으로 이해되는 것과 동일한 의미를 가지고 있다. 일반적으로 사용되는 사전에 정의되어 있는 것과 같은 용어들은 관련 기술의 문맥 상 가지는 의미와 일치하는 의미를 가진 것으로 해석되어야 하며, 본 출원에서 명백하게 정의하지 않는 한, 이상적이거나 과도하게 형식적인 의미로 해석되지 않는다.Unless defined otherwise, all terms used herein, including technical or scientific terms, have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs. Terms such as those defined in commonly used dictionaries should be interpreted as having a meaning consistent with the meaning in the context of the relevant art and are to be interpreted in an ideal or overly formal sense unless explicitly defined in the present application Do not.

이하, 첨부한 도면들을 참조하여, 본 발명의 바람직한 실시예를 보다 상세하게 설명하고자 한다. 본 발명을 설명함에 있어 전체적인 이해를 용이하게 하기 위하여 도면상의 동일한 구성요소에 대해서는 동일한 참조부호를 사용하고 동일한 구성요소에 대해서 중복된 설명은 생략한다.Hereinafter, preferred embodiments of the present invention will be described in detail with reference to the accompanying drawings. In order to facilitate the understanding of the present invention, 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은 본 발명의 일실시예에 따른 코드 재사용 공격 방어 장치가 적용되는 환경을 개략적으로 나타낸 도면이다. 1 is a diagram schematically illustrating an environment to which a code reuse attack defense apparatus according to an embodiment of the present invention is applied.

도 1에 도시한 바와 같이, 코드 재사용 공격 방어 장치(100)는 코어 관리부(110), CFI 스케줄러(120) 및 CFI 감시부(130)를 포함한다. 코어 관리부(110)는 멀티 코어 시스템의 코어들을 관리하고, 유휴 상태 코어를 탐지한다. 그리고 CFI 스케줄러(120)는 유휴 상태 코어 중에서 모니터링 코어(200)를 선택하고, 모니터링 코어(200)에 CFI 감시부(130)를 로딩하며, CFI 감시부(130)로 제어 데이터를 전송한다. 1, the code reuse attack defense apparatus 100 includes a core management unit 110, a CFI scheduler 120, and a CFI monitoring unit 130. As shown in FIG. The core management unit 110 manages the cores of the multicore system and detects the idle core. The CFI scheduler 120 selects the monitoring core 200 from among the idle cores and loads the CFI monitoring unit 130 into the monitoring core 200 and transmits the control data to the CFI monitoring unit 130.

모니터링 코어(200)에 로딩된 CFI 감시부(130)는 하나 이상의 감시 대상 코어(300)에 대한 CFI 감시를 수행하여, 코드 재사용 공격(Code Reuse Attack, CRA)을 탐지한다. 이때, CFI 감시부(130)는 실행 파일(10) 및 메모리(20)로부터 감시 대상 코어(300)에서 실행되는 감시 대상 프로그램의 정상 실행 흐름 정보를 추출하고, 추출된 정상 실행 흐름과 감시 대상 프로그램의 CPU 인스트럭션을 비교하여 CFI 감시를 수행할 수 있다. The CFI monitoring unit 130 loaded in the monitoring core 200 performs CFI monitoring on one or more monitored cores 300 to detect a code reuse attack (CRA). At this time, the CFI monitoring unit 130 extracts the normal execution flow information of the monitoring target program executed in the monitored core 300 from the execution file 10 and the memory 20, The CFI monitoring can be performed.

또한, CFI 감시부(130)는 CFI 감시를 수행하여 악성코드를 분석한 후, 악성 코드인 것으로 판단된 경우 악성 코드를 메모리 및 저장 장치에서 제거할 수 있다. In addition, the CFI monitoring unit 130 may perform CFI monitoring to analyze the malicious code, and if the malicious code is determined to be malicious code, the CFI monitoring unit 130 may remove the malicious code from the memory and the storage device.

동영상이나 게임 등의 고성능 응용 프로그램의 사용 환경이 데스크톱 PC에서 모바일 기기로 이동함에 따라, 모바일에서도 복잡한 응용 프로그램 개발을 위해 CPU의 성능 향상과 함께 향상된 디버깅 기능이 필요해졌다. 전통적으로 제공되는 브레이크 포인트(Breakpoint) 및 와치 포인트(Watchpoint)와 같은 JTAG(Joint Test Action Group) 기능 외에도, 응용 프로그램의 각 모듈간 데이터 송수신 흐름을 파악하기 위해 응용 프로그램이 실행하는 명령 흐름을 실시간으로 보여줄 필요가 있다. 이를 위해 ARM은 코어사이트(Coresight)라는 하드웨어 IP(Intellectual Property)를 제공한다. As the use of high-performance applications such as video and games moves from desktop PCs to mobile devices, improved performance of the CPU and improved debugging capabilities are required for complex application development on mobile devices. In addition to the JTAG (Joint Test Action Group) functions such as breakpoint and watchpoint, which are traditionally provided, in order to understand the flow of data transmission / reception between each module of an application program, I need to show. To this end, ARM provides a hardware intellectual property called CoreSight.

특히, ETM(Embedded Trace Macrocell)은 각 CPU 코어에서 실행되는 인스트럭션을 추출하여 TPIU(Trace Port Interface Unit)나 CPU 내부 메모리 또는 모바일 장치의 메인 메모리를 통해 실시간으로 외부 디버거 하드웨어로 전송한다. In particular, ETM (Embedded Trace Macrocell) extracts instruction executed in each CPU core and transfers it to external debugger hardware in real time through TPIU (Trace Port Interface Unit), CPU internal memory or main memory of mobile device.

Samsung Exynos 및 Qualcomm Snapdragon과 같은 대부분의 상용 모바일 AP에는 각 코어에 ETM이 장착되어 있으며, 개별 코어에 대한 인스트럭션을 추출할지 여부를 제어 할 수 있다. 외부 디버거를 사용하여 코어사이트 IP에 액세스하거나, CPU 코어에서 시스템 버스를 통하여 코어사이트 하드웨어 IP를 읽고 쓸 수 있다. Most commercial mobile APs, such as Samsung Exynos and Qualcomm Snapdragon, have an ETM on each core and can control whether or not to extract instructions to individual cores. You can use an external debugger to access the core site IP, or you can read and write the core site hardware IP from the CPU core through the system bus.

따라서, 본 발명의 일실시예에 따른 코드 재사용 공격 방어 장치(100)는 모바일 AP의 코어 중 일부를 모니터링 코어로 구성하고, 모니터링 타깃이 되는 코어(감시 대상 코어)(300)에 연결된 ETM을 제어하여 타깃 코어가 실행하는 명령어를 추출하고 검사할 수 있다.Accordingly, the code reuse attack defense apparatus 100 according to an embodiment of the present invention includes a core part of the mobile AP as a monitoring core, and controls an ETM connected to a core (monitored core) To extract and inspect the instructions executed by the target core.

설명의 편의를 위하여 ARM CPU의 ETM에 대하여 설명하였으나 이에 한정하지 않고, 본 발명의 일실시예에 따른 코드 재사용 공격 방어 장치(100)는 ARM ETM/PTM, Intel LBR/BTS/AET/PT, Freescale PM 등을 제어하는 형태로 구현될 수 있다. However, the present invention is not limited to the ETM of the ARM CPU, but the present invention may be applied to an ARM ETM / PTM, an Intel LBR / BTS / AET / PT, a Freescale PM, and so on.

이하에서는 도 2를 통하여 본 발명의 일실시예에 따른 코드 재사용 공격 방어 장치의 구성에 대하여 더욱 상세하게 설명한다. Hereinafter, a configuration of a code reuse attack defense apparatus according to an embodiment of the present invention will be described in more detail with reference to FIG.

도 2는 본 발명의 일실시예에 따른 코드 재사용 공격 방어 장치의 구성을 나타낸 블록도이다. 2 is a block diagram illustrating a configuration of a code reuse attack defense apparatus according to an embodiment of the present invention.

도 2에 도시한 바와 같이, 코드 재사용 공격 방어 장치(100)는 코어 관리부(110), CFI 스케줄러(120) 및 CFI 감시부(130)를 포함한다. 그리고 CFI 감시부(130)는 인스트럭션 추출부(131), 정상 실행 흐름 추출부(133), CFI 검사부(135) 및 코어 제어부(137)를 포함할 수 있다. 2, the code reuse attack defense apparatus 100 includes a core management unit 110, a CFI scheduler 120, and a CFI monitoring unit 130. As shown in FIG. The CFI monitoring unit 130 may include an instruction extraction unit 131, a normal execution flow extraction unit 133, a CFI checking unit 135, and a core control unit 137.

먼저, 코어 관리부(110)는 멀티 코어 시스템의 코어들을 관리하며, 유휴 상태 코어를 탐지한다. 코어 관리부(110)는 멀티 코어 시스템에서 유의미한 프로그램을 실행하지 않고, 유휴 루프(idle loop)를 수행하거나, 파워다운(power down) 상태인 코어(유휴 상태 코어)를 탐지하고, 탐지된 유휴 상태 코어의 정보를 CFI 스케줄러(120)로 전달할 수 있다. First, the core management unit 110 manages the cores of the multicore system and detects the idle core. The core management unit 110 may perform an idle loop without executing a significant program in the multicore system or may detect a core that is in a power down state (idle core) Information to the CFI scheduler 120. [

이때, 코어 관리부(110)는 멀티 코어 시스템에 포함된 코어들의 상태 변경을 감지하고, 유휴 상태 코어의 개수 또는 상태가 변경된 것으로 감지된 경우 CFI 스케줄러(120)로 유휴 상태 코어의 정보를 전송할 수 있다. At this time, the core management unit 110 detects the state change of the cores included in the multicore system, and can transmit information of the idle core to the CFI scheduler 120 when it is detected that the number or the state of the idle core is changed .

다음으로 CFI 스케줄러(120)는 유휴 상태 코어의 정보를 수신하고, 유휴 상태 코어 중에서 모니터링 코어를 선택한다. CFI 스케줄러(120)는 CFI 감시 수행 시 필요한 처리 속도를 연산하고, CFI 감시부(130)가 동작할 모니터링 코어를 결정할 수 있으며, CFI 스케줄러(120)는 하나 이상의 모니터링 코어를 선택할 수 있다. Next, the CFI scheduler 120 receives the information of the idle core and selects the monitoring core from the idle core. The CFI scheduler 120 may calculate the processing speed required to perform the CFI monitoring, determine the monitoring core in which the CFI monitoring unit 130 operates, and the CFI scheduler 120 may select one or more monitoring cores.

그리고 CFI 스케줄러(120)는 모니터링 코어에 CFI 감시부(130)를 로딩하며, CFI 감시를 시작하도록 모니터링 코어에 로딩된 CFI 감시부(130)로 제어 데이터를 전송한다. The CFI scheduler 120 loads the CFI monitoring unit 130 into the monitoring core and transmits the control data to the CFI monitoring unit 130 loaded in the monitoring core to start the CFI monitoring.

제어 데이터는, CFI 감시 동작 시작/중지 여부, 각각의 코어에 로드된 CFI 감시부(130)가 담당해야 하는 활성 상태의 코어(감시 대상 코어)의 정보, CFI 감시부(130)가 처리할 인스트럭션 데이터, 처리해야 할 실행파일 데이터, 처리해야 할 메모리 데이터 및 처리해야 할 IO 데이터 중 적어도 어느 하나를 포함할 수 있다. The control data includes information on whether or not the CFI monitoring operation is started or stopped, information on the core (monitored core) in the active state that the CFI monitoring unit 130 loaded on each core is responsible for, information on the instruction to be processed by the CFI monitoring unit 130 Data to be processed, executable file data to be processed, memory data to be processed, and IO data to be processed.

또한, CFI 스케줄러(120)는 유휴 상태 코어의 개수, 상태, 위치 등이 변경된 경우 코어 관리부(110)로부터 유휴 상태 코어의 정보를 수신할 수 있다. 그리고 CFI 스케줄러(120)는 유휴 상태인 제1 코어의 상태가 활성 상태로 변경된 경우, 제1 코어에서 실행 중인 CFI 감시부(130)를 다른 유휴 상태 코어에 로드하거나, 제1 코어에 로드된 CFI 감시부(130)의 동작을 중지하고 언로드할 수 있다. In addition, the CFI scheduler 120 may receive the information of the idle core from the core manager 110 when the number, the state, the location, and the like of the idle core are changed. When the state of the first core in the idle state is changed to the active state, the CFI scheduler 120 loads the CFI monitoring unit 130 running in the first core into another idle core, or loads the CFI The operation of the monitoring unit 130 can be stopped and unloaded.

다음으로 CFI 감시부(130)는 감시 대상 프로그램의 실행 파일이 실행되는 감시 대상 코어의 CPU 인스트럭션을 추출하는 인스트럭션 추출부(Core Instruction Extractor)(131), 감시 대상 프로그램의 실행파일, 메모리 및 CPU 인스트럭션으로부터 정상 실행 흐름 정보를 추출하는 정상 실행 흐름 추출부(Control Flow Extractor)(133)를 포함한다. Next, the CFI monitoring unit 130 includes an instruction extracting unit 131 for extracting a CPU instruction of a monitored core on which an executable file of the monitored program is executed, an executable file of the monitored program, a memory and a CPU instruction And a normal execution flow extractor 133 for extracting normal execution flow information from the normal execution flow information.

또한, CFI 감시부(130)는 정상 실행 흐름 정보를 기반으로, 감시 대상 코어가 실행한 CPU 인스트럭션이 제어 흐름 정책에 위배되는지 여부를 판단하는 CFI 검사부(CFI Inspector)(135) 및 CFI 검사부(135)의 검사 결과에 따라 감시 대상 프로그램을 실행하는 감시 대상 코어의 실행을 제어하는 코어 제어부(Core Action Controller)(137)를 포함한다. The CFI monitoring unit 130 includes a CFI inspection unit 135 and a CFI inspection unit 135 for determining whether the CPU instruction executed by the monitored core is in violation of the control flow policy based on normal execution flow information. (Core action controller) 137 for controlling the execution of the monitored core that executes the monitoring target program according to the result of the inspection of the monitoring target core.

CFI 감시부(130)의 인스트럭션 추출부(131)는 CFI 스케줄러(120)로부터 수신한 제어 데이터를 이용하여, 감시 대상 프로그램이 실행되는 감시 대상 코어의 CPU 인스트럭션을 추출한다. 여기서, 감시 대상 프로그램은 사용자 영역 어플리케이션이거나, 커널, 커널 영역 프로그램일 수 있다. The instruction extraction unit 131 of the CFI monitoring unit 130 extracts the CPU instruction of the monitored core on which the monitoring target program is executed by using the control data received from the CFI scheduler 120. Here, the monitored program may be a user area application, a kernel, or a kernel area program.

인스트럭션 추출부(131)는 시스템 버스를 이용하여 감시 대상 코어의 트레이스 하드웨어(ARM ETM/PTM, Intel LBR/BTS/AET/PT, Freescale PM)로 제어 데이터를 전송한다. 여기서, 트레이스 하드웨어는 ARM CPU인 경우 코어사이트 트레이스 하드웨어를 의미할 수 있으며, 트레이스 기능을 포함하는 인텔 CPU 등에도 적용 가능하며, 트레이스 하드웨어의 종류는 이에 한정되지 않는다. The instruction extractor 131 transmits control data to the trace hardware (ARM ETM / PTM, Intel LBR / BTS / AET / PT, and Freescale PM) of the monitored core using the system bus. Here, the trace hardware may refer to core site trace hardware in the case of an ARM CPU, and may also be applied to an Intel CPU including a trace function, and the type of trace hardware is not limited thereto.

그리고 인스트럭션 추출부(131)는 메모리로부터 트레이스 하드웨어가 저장한 CPU 인스트럭션을 추출할 수 있다. The instruction extracting unit 131 may extract the CPU instruction stored in the trace hardware from the memory.

트레이스 하드웨어는, 인스트럭션 추출부(131)로부터 제어 데이터를 수신하고, 트레이스 하드웨어 자신과 연결된 감시 대상 코어가 실행하는 인스트럭션 정보를 시스템 내부의 메모리로 전송한다. 이때, 메모리는 트레이스 하드웨어의 내부 레지스터, 메모리 또는 시스템 메인 메모리일 수 있으며, 트레이스 하드웨어는 인스트럭션 추출부(131)가 미리 설정한 저장 위치에 인스트럭션 정보를 저장할 수 있다. The trace hardware receives control data from the instruction extracting unit 131 and transfers instruction information executed by the monitored core connected to the trace hardware itself to a memory inside the system. In this case, the memory may be an internal register of the trace hardware, a memory, or a system main memory, and the trace hardware may store the instruction information in a storage location preset by the instruction extracting unit 131. [

인스트럭션 추출부(131)는 트레이스 하드웨어에 의해 인스트럭션이 저장되었음을 알기 위하여, 해당 메모리 주소를 폴링하거나, 트레이스 하드웨어로부터 인터럽트 등의 이벤트를 수신할 수 있다. The instruction extracting unit 131 may poll the memory address or receive an event such as an interrupt from the trace hardware in order to know that the instruction is stored by the trace hardware.

또한, 인스트럭션 추출부(131)는 메모리로부터 CPU 인스트럭션을 추출한 후, CFI 검사부(135), 정상 실행 흐름 추출부(133)로 메모리의 위치, 메모리의 크기를 포함하는 인스트럭션 정보를 전송할 수 있다. The instruction extracting unit 131 may extract the CPU instruction from the memory and then transmit the instruction information including the memory location and the size of the memory to the CFI checking unit 135 and the normal execution flow extracting unit 133.

다음으로 정상 실행 흐름 추출부(133)는 감시 대상 프로그램의 정상적인 실행 흐름을 추출한다. 정상 실행 흐름 추출부(133)는 감시 대상 프로그램의 실행 전에 프로그램 파일로부터 실행 흐름을 추출하거나, 감시 대상 프로그램의 실행 중에 메모리나 추출한 인스트럭션으로부터 실행 흐름을 추출할 수 있다. Next, the normal execution flow extracting unit 133 extracts a normal execution flow of the monitoring target program. The normal execution flow extracting unit 133 can extract the execution flow from the program file before execution of the monitoring target program, or extract the execution flow from the memory or the extracted instruction during execution of the monitoring target program.

그리고 CFI 검사부(135)는 정상적인 실행 흐름을 기반으로, CPU 인스트럭션이 제어 흐름 정책(Control Flow Policy)에 위배되는지 여부를 판단한다. 이때, CFI 검사부(135)는 추출된 CPU 인스트럭션과 정상적인 실행 흐름을 비교하여, 감시 대상 코어가 실행하는 감시 대상 프로그램이 정상적인 실행 흐름에 위배되는지 여부를 판단할 수 있다. Based on the normal execution flow, the CFI checking unit 135 determines whether or not the CPU instruction violates the Control Flow Policy. At this time, the CFI checking unit 135 compares the extracted CPU instruction with a normal execution flow, and can determine whether the monitored program executed by the monitored core violates a normal execution flow.

코어 제어부(137)는 제어 흐름 정책의 위배 여부를 기반으로 감시 대상 코어의 실행을 제어하여, 코드 재사용 공격을 방어한다. 코어 제어부(137)는 감시 대상 프로그램이 커널 영역 프로그램인 경우, 온 칩 디버그 하드웨어를 이용하여 제어 흐름 정책을 위배한 감시 대상 코어를 정지할 수 있다. 그리고 코어 제어부(137)는 감시 대상 코어를 정지한 후, 제어 흐름 정책을 위배한 감시 대상 프로그램을 감시 대상 코어에 언로드할 수 있다. The core control unit 137 controls the execution of the core to be monitored based on the violation of the control flow policy to prevent the code reuse attack. When the monitored program is a kernel area program, the core control unit 137 can stop the monitored core that violates the control flow policy using the on-chip debug hardware. After stopping the core to be monitored, the core control unit 137 can unload the monitored program that violates the control flow policy to the monitored core.

또한, 감시 대상 프로그램이 사용자 영역 프로그램인 경우, 코어 제어부(137)는 커널의 프로그램 제어 기능을 이용하여 제어 흐름 정책을 위배한 감시 대상 코어를 정지할 수 있다. 설명의 편의상, 감시 대상 프로그램이 커널 영역 프로그램인 경우 온 칩 디버그 하드웨어를 이용하여 감시 대상 코어를 정지하는 것으로 설명하였으나, 감시 대상 프로그램이 사용자 영역 프로그램인 경우에도, 온 칩 디버그 하드웨어를 이용하여 제어 흐름 정책을 위배한 감시 대상 코어를 정지할 수 있다. When the monitored program is a user area program, the core control unit 137 can stop the monitored core that violates the control flow policy using the program control function of the kernel. For convenience of explanation, it has been described that the monitored core is stopped using the on-chip debug hardware when the monitored program is a kernel area program. However, even if the monitored program is a user area program, It is possible to stop a monitored core that violates the policy.

이하에서는 도 3을 통하여 코드 재사용 공격 방어 장치에 의해 수행되는 코드 재사용 공격 방어 방법에 대하여 더욱 상세하게 설명한다. Hereinafter, a code reuse attack defense method performed by the code reuse attack defense apparatus will be described in more detail with reference to FIG.

도 3은 본 발명의 일실시예에 따른 코드 재사용 공격 방어 방법을 설명하기 위한 순서도이다. 3 is a flowchart for explaining a code reuse attack defense method according to an embodiment of the present invention.

먼저, 코드 재사용 공격 방어 장치(100)는 유휴 상태 코어를 탐지한다(S310). First, the code reuse attack defense apparatus 100 detects an idle core (S310).

코드 재사용 공격 방어 장치(100)는 멀티 코어 시스템의 코어들 중에서, 유의미한 프로그램을 수행하지 않고 유휴 루프를 수행하거나, 파워다운 상태에 있는 코어인 유휴 상태 코어를 탐지한다. The code reuse attack defense apparatus 100 performs an idle loop without performing a significant program among cores of the multicore system or detects an idle core which is a core in a power down state.

그리고 코드 재사용 공격 방어 장치(100)는 유휴 상태 코어 중에서 모니터링 코어 및 감시 대상 코어를 선택하고(S320), 선택된 모니터링 코어에 CFI 감시부를 로딩한다(S330).The code reuse attack defense apparatus 100 selects a monitoring core and a monitored core from among the idle cores (S320), and loads the CFI monitoring unit on the selected monitoring core (S330).

코드 재사용 공격 방어 장치(100)는 CFI 감시부를 로딩할 하나 이상의 모니터링 코어를 선택한다. 이때, 코드 재사용 공격 방어 장치(100)는 CFI 감시 수행 시 필요한 처리 속도를 계산하고, 계산된 처리 속도를 기반으로 적합한 모니터링 코어를 선택할 수 있다. The code reuse attack defense apparatus 100 selects one or more monitoring cores to load the CFI monitoring unit. At this time, the code reuse attack defense apparatus 100 can calculate the processing speed required to perform the CFI monitoring and select a suitable monitoring core based on the calculated processing speed.

또한, 코드 재사용 공격 방어 장치(100)는 선택된 모니터링 코어에 CFI 감시부를 로딩하고, 코드 재사용 공격 방어 장치(100)의 CFI 스케줄러는 로딩된 CFI 감시부로 제어 데이터를 전달한다. Also, the code reuse attack defense apparatus 100 loads the CFI monitoring unit into the selected monitoring core, and the CFI scheduler of the code reuse attack defense apparatus 100 transfers the control data to the loaded CFI monitoring unit.

여기서, 제어 데이터는 CFI 감시 동작의 시작/중지 여부, 각각의 모니터링 코어가 감시를 담당할 감시 대상 코어 정보, 각각의 모니터링 코어가 처리할 인스트럭션 데이터, 실행파일 데이터, 메모리 데이터 및 IO데이터 중 적어도 어느 하나를 포함할 수 있다. Here, the control data includes at least one of whether to start / stop CFI monitoring operation, monitored core information to be monitored by each monitoring core, instruction data to be processed by each monitoring core, executable file data, memory data, and IO data One can be included.

다음으로 코드 재사용 공격 방어 장치(100)는 감시 대상 코어의 CPU 인스트럭션을 추출한다(S340). Next, the code reuse attack defense apparatus 100 extracts the CPU instruction of the monitored core (S340).

모니터링 코어에 로딩된 코드 재사용 공격 방어 장치(100)의 CFI 감시부는 제어 데이터를 기반으로 감시 대상 코어가 실행한 CPU 인스트럭션을 추출한다. 이때, CPU 인스트럭션을 추출하는 과정은 모니터링 코어에 로딩된 CFI 감시부의 인스트럭션 추출부에 의해 수행될 수 있다. The CFI monitoring unit of the code reuse attack defense apparatus 100 loaded on the monitoring core extracts CPU instructions executed by the monitored core based on the control data. At this time, the process of extracting the CPU instruction can be performed by the instruction extracting unit of the CFI monitoring unit loaded in the monitoring core.

이때, 코드 재사용 공격 방어 장치(100)의 CFI 감시부는, 감시 대상 프로그램이 실행되는 감시 대상 코어가 실행한 CPU 인스트럭션을 추출하여 메모리에 저장하고, CPU 인스트럭션 정보를 CFI 검사부 및 정상 실행 흐름 정보 추출부로 전달할 수 있다. At this time, the CFI monitoring unit of the code reuse attack defense apparatus 100 extracts the CPU instruction executed by the monitored core on which the monitoring target program is executed, stores it in the memory, and outputs the CPU instruction information to the CFI checking unit and the normal execution flow information extracting unit .

도 4는 본 발명의 일 실시예에 따른 인스트럭션 추출부의 동작을 설명하기 위한 도면이다. 4 is a diagram for explaining the operation of the instruction extracting unit according to an embodiment of the present invention.

도 4에 도시한 바와 같이, 모니터링 코어(200) 상에서 동작하는 인스트럭션 추출부는, 감시 대상 코어(300)에 연결된 트레이스 하드웨어(ARM ETM/PTM, Intel LBR/BTS/AET/PT, Freescale PM)(310)로 트레이스 제어 데이터를 전송한다. 4, the instruction extraction unit operating on the monitoring core 200 includes trace hardware (ARM ETM / PTM, Intel LBR / BTS / AET / PT, Freescale PM) 310 connected to the monitored core 300 To transmit the trace control data.

그리고 트레이스 제어 데이터를 수신한 트레이스 하드웨어(310)는 연결된 감시 대상 코어(300)가 실행하는 인스트럭션 정보를 시스템 내부의 메모리(20)로 전송한다. 여기서 메모리(20)는 트레이스 하드웨어의 내부 레지스터나 메모리일 수 있으며, 시스템 메모리일 수 있다. 또한, 트레이스 하드웨어(310)는 인스트럭션 추출부가 미리 설정한 메모리 주소에 상응하는 위치에 인스트럭션 정보를 저장할 수 있다. The trace hardware 310 receiving the trace control data transfers the instruction information executed by the connected monitored core 300 to the memory 20 in the system. The memory 20 may be an internal register or memory of the trace hardware, and may be a system memory. Also, the trace hardware 310 may store instruction information at a location corresponding to a memory address preset by the instruction extractor.

인스트럭션 추출부는 메모리(20)에 저장된 인스트럭션 정보(CPU 인스트럭션)를 추출하며, 추출된 인스트럭션 정보를 CFI 감시부의 CFI 검사부 및 정상 실행 흐름 추출부로 전달할 수 있다. 이때, 인스트럭션 추출부는 메모리의 위치 및 크기 정보를 포함하는 인스트럭션 정보를 CFI 검사부 및 정상 실행 흐름 추출부로 전송할 수 있다. The instruction extracting unit extracts the instruction information (CPU instruction) stored in the memory 20 and can transmit the extracted instruction information to the CFI checking unit and the normal execution flow extracting unit of the CFI monitoring unit. At this time, the instruction extracting unit may transmit the instruction information including the memory position and size information to the CFI checking unit and the normal execution flow extracting unit.

다시 도 3에 대하여 설명하면, 코드 재사용 공격 방어 장치(100)는 감시 대상 코어에서 실행되는 감시 대상 프로그램의 정상적인 실행 흐름을 추출한다(S350). Referring again to FIG. 3, the code reuse attack defense apparatus 100 extracts a normal execution flow of the monitoring target program executed in the monitored core (S350).

도 5는 본 발명의 일 실시예에 따른 정상 실행 흐름 추출부의 동작을 설명하기 위한 도면이다. 5 is a view for explaining the operation of the normal execution flow extracting unit according to an embodiment of the present invention.

도 5에 도시한 바와 같이, CFI 감시부의 정상 실행 흐름 추출부(133)는 대상 시스템 내부의 모니터링 코어에서 동작하거나, 호스트에서 정상 실행 흐름을 추출한 후 대상 시스템 내부로 추출된 정상 실행 흐름을 전달할 수 있다. 5, the normal execution flow extracting unit 133 of the CFI monitoring unit operates on the monitoring core in the target system, or extracts the normal execution flow from the host, and then transmits the normal execution flow extracted into the target system have.

이때, 정상 실행 흐름 추출부(133)의 위치는 실행 파일(10)에서 실행 흐름을 추출하거나, CFI 검사를 수행하는데 요구되는 처리 속도나 메모리 등의 자원 크기에 따라 선택적으로 구성될 수 있다. 요구되는 CPU의 성능이나 메모리 용량이 큰 경우에는 호스트에서 정상 실행 흐름을 추출한 후, CFI 검사에 필요한 정보만을 대상 시스템 내부로 전송할 수 있다. At this time, the location of the normal execution flow extracting unit 133 can be selectively configured according to the processing speed required to extract the execution flow from the execution file 10, the CFI inspection, or the resource size such as memory. When the required CPU performance or memory capacity is large, the host can extract the normal execution flow, and then only the information necessary for the CFI inspection can be transferred to the target system.

반면, 정상 실행 흐름 추출 및 CFI 검사에 필요한 CPU의 성능이나 메모리 용량이 대상 시스템 내부에서 충분히 처리할 수 있는 경우, 정상 실행 흐름 추출부(133_1)는 대상 시스템의 내부에 포함되는 형태로 구현될 수 있다. On the other hand, when the performance or the memory capacity of the CPU necessary for normal execution flow extraction and CFI inspection can be sufficiently processed in the target system, the normal execution flow extracting unit 133_1 can be implemented in a form included in the target system have.

감시 대상 프로그램이 실행되는 중에, 해당 프로그램이 사용하고 있는 메모리와 코어에서 실행한 인스트럭션으로부터 실행 흐름을 추출하기 위하여, 정상 실행 흐름 추출부(133_1)는 메모리(20)에 저장된 프로그램 코드, 데이터 메모리, 실행된 인스트럭션을 읽어온다. 그리고 정상 실행 흐름 추출부(133_1)는 요구되는 처리 속도나 CFI 검사에 소요되는 부하 등에 따라 대상 시스템 내부에서 정상 실행 흐름을 추출하거나, 외부의 호스트로 전달하여 외부의 정상 실행 흐름 추출부(133_2)로부터 정상 실행 흐름을 수신하는 형태로 구현될 수 있다.  The normal execution flow extracting unit 133_1 extracts the program codes stored in the memory 20, the data memory, and the data stored in the memory 20 in order to extract the execution flow from the memory used by the program and the instructions executed in the core, Read the executed instruction. The normal execution flow extracting unit 133_1 extracts a normal execution flow from the target system according to a required processing speed or a load required for the CFI inspection or transmits the normal execution flow to an external host, A normal execution flow may be received from the normal execution flow.

또한, 정상 실행 흐름 추출부가 추출하는 정상 실행 흐름 정보는 분기 테이블, 함수 주소 테이블 및 쉐도우 콜 스택 등을 포함할 수 있다.The normal execution flow information extracted by the normal execution flow extraction unit may include a branch table, a function address table, a shadow call stack, and the like.

도 6은 본 발명의 일실시예에 따른 분기 테이블(Branch Table)을 나타낸 도면이고, 도 7은 본 발명의 일실시예에 따른 함수 주소 테이블(Function Address Table)을 나타낸 도면이며, 도 8은 본 발명의 일실시예에 따른 쉐도우 콜 스택(Shadow Call Stack)을 나타낸 도면이다. FIG. 6 is a diagram illustrating a branch table according to an embodiment of the present invention. FIG. 7 is a functional address table according to an embodiment of the present invention. FIG. FIG. 5 is a diagram illustrating a shadow call stack according to an embodiment of the present invention. FIG.

도 6 내지 도 8과 같이, 정상 실행 흐름 추출부는 감시 대상 프로그램의 실행 파일과 메모리로부터, 분기 테이블(Branch Table), 함수 주소 테이블(Function Address Table), 쉐도우 콜 스택(Shadow Call Stack) 등의 정상 실행 정보를 추출할 수 있다. 여기서, 정상 실행 정보의 종류는 이에 한정되지 않으며, 적용되는 CFI 정책에 따라 정상 실행 정보의 종류 및 양은 다양하게 설계 변경되어 구현될 수 있다. 6 to 8, the normal execution flow extracting unit extracts, from the executable file of the monitoring target program and the memory, a normal table such as a branch table, a function address table, a shadow call stack, The execution information can be extracted. Here, the type of the normal execution information is not limited to this, and the type and amount of the normal execution information can be variously modified and implemented according to the applied CFI policy.

또한, 정상 실행 흐름 추출부는 CFI 스케줄러의 제어 데이터를 이용하여, 감시 대상 프로그램의 실행 전에 바이너리 파일로부터 정상 실행 흐름 정보를 추출하는 오프라인 추출 기능을 수행할 수 있다. 그리고 정상 실행 흐름 추출부는 감시 대상 프로그램의 실행 중에 메모리나 인스트럭션으로부터 정상 실행 흐름 정보를 추출하는 온라인 실행 흐름 추출 기능을 수행할 수 있다. Also, the normal execution flow extracting unit can perform the offline extraction function of extracting the normal execution flow information from the binary file before execution of the monitoring target program by using the control data of the CFI scheduler. The normal execution flow extracting unit may perform an online execution flow extracting function for extracting normal execution flow information from a memory or an instruction while the monitored program is being executed.

정상 실행 흐름 정보는 분기 인스트럭션 콜, 리턴(Return), 점프(Jump) 등의 정상적인 분기 위치를 포함할 수 있다. 그리고 오프라인 추출 기능은 대상 시스템 내부의 모니터링 코어에 위치할 수 있으며, 시스템 외부의 호스트 PC에 위치할 수 있다. 반면, 온라인 추출 기능은 감시 대상 프로그램의 실행 중에 메모리와 감시 대상 코어의 실행 인스트럭션으로부터 정상 실행 흐름 정보를 추출하며, 대상 시스템 내부의 모니터링 코어에서 동작할 수 있다. Normal execution flow information may include normal branch locations such as branch instruction calls, returns, and jumps. And the offline extraction function can be located in the monitoring core inside the target system and can be located in the host PC outside the system. On the other hand, the on-line extraction function extracts the normal execution flow information from the execution instructions of the memory and the monitored core during execution of the monitored program, and can operate in the monitoring core in the target system.

다시 도 3에 대하여 설명하면, 코드 재사용 공격 방어 장치(100)는 정상적인 실행 흐름을 기반으로, 감시 대상 코어의 CPU 인스트럭션이 제어 흐름 정책에 위배되는지 여부를 판단한다(S360). Referring again to FIG. 3, the code reuse attack defense apparatus 100 determines whether the CPU instruction of the monitored core is in violation of the control flow policy, based on the normal execution flow (S360).

코드 재사용 공격 방어 장치(100)의 CFI 검사부는 정상 실행 흐름 추출부가 추출한 정상 실행 흐름 정보를 이용하여, 인스트럭션 추출부가 추출한 감시 대상 코어의 CPU 인스트럭션이 정상 실행 흐름에 위배되는지 여부(Control Flow Integrity, CFI)를 판단한다. The CFI checking unit of the code reuse attack defense apparatus 100 determines whether the CPU instruction of the monitored core extracted by the instruction extracting unit violates the normal execution flow (Control Flow Integrity, CFI ).

제어 흐름 정책에 위배된 것으로 판단된 경우(S360 YES), 코드 재사용 공격 방어 장치(100)는 감시 대상 코어의 실행을 제어하여, 코드 재사용 공격을 방어한다(S370). If it is determined that the policy is violating the control flow policy (YES in S360), the code reuse attack defense apparatus 100 controls the execution of the monitored core to protect the code reuse attack (S370).

제어 흐름 정책에 위배된다는 것은 감시 대상 코어에서 실행되는 감시 대상 프로그램이 코드 재사용 공격을 수행하는 악성 코드라는 것을 의미할 수 있다. 따라서, 제어 흐름 정책에 위배된 것으로 판단된 경우, 코드 재사용 공격 방어 장치(100)의 CFI 검사부는 코어 제어부로 제어 흐름 정책에 위배되었음을 알리고, 코어 제어부는 제어 흐름 정책에 위배된 감시 대상 코어의 실행을 제어하여, 코드 재사용 공격을 방어할 수 있다. A violation of the control flow policy may mean that the monitored program running on the monitored core is a malicious code performing a code reuse attack. Accordingly, when it is determined that the policy is in violation of the control flow policy, the CFI checking unit of the code reuse attack defense apparatus 100 informs the core control unit of the violation of the control flow policy, and the core control unit executes the execution of the monitored core To prevent a code reuse attack.

코드 재사용 공격 방어 장치(100)는 CFI 스케줄러의 제어 데이터를 이용하여, 감시 대상 코어의 실행을 정지하고, 이를 통하여 악성 코드의 실행을 중지시킨다. 이때, 코드 재사용 공격 방어 장치(100)는 온 칩 디버그 하드웨어를 이용하여 감시 대상 코어를 정지하거나, 커널에 포함된 프로그램 정지 및 종료(kill) 기능을 이용하여 감시 대상 코어를 제어할 수 있다. The code reuse attack defense apparatus 100 stops the execution of the monitored core by using the control data of the CFI scheduler, thereby stopping execution of the malicious code. At this time, the code reuse attack defense apparatus 100 can stop the monitored core using the on-chip debug hardware or control the monitored core using the program stop and kill functions included in the kernel.

도 9는 본 발명의 일실시예에 따른 코어 제어부가 온 칩 디버그 하드웨어를 이용하여 코어를 제어하는 방법을 나타낸 도면이다. 9 is a diagram illustrating a core control unit controlling a core using on-chip debug hardware according to an embodiment of the present invention.

도 9에 도시한 바와 같이, 코드 재사용 공격 방어 장치(100)의 코어 제어부는 온 칩 디버그(On-Chip Debug, OCD) 하드웨어를 이용하여 감시 대상 코어를 정지한다. 그리고 코드 재사용 공격 방어 장치(100)의 코어 제어부는 추가적인 처리를 수행하기 위하여 외부 사용자의 명령 입력을 대기하거나, CFI를 위반한 감시 대상 프로그램을 감시 대상 코어에서 언로드하고, 프로세스를 종료(Kill)할 수 있다. As shown in FIG. 9, the core control unit of the code reuse attack defense apparatus 100 uses the on-chip debug (OCD) hardware to stop the monitored core. In order to perform additional processing, the core control unit of the code reuse attack defense apparatus 100 waits for an instruction input of the external user, unloads the monitored program violating the CFI from the monitored core, and kills the process .

프로그램을 언로드하고 종료하기 위하여, 코어 제어부는 온 칩 디버그 하드웨어로 실행할 명령을 직접 전송하여 감시 대상 코어가 디버그 상태(ARM CPU에서는 Halt state)에서 해당 명령을 실행하도록 할 수 있다. 이때, 온 칩 디버그 하드웨어로 전송된 명령은 감시 대상 프로그램이 스스로 실행을 중지하도록 하거나, 커널 스케줄러가 감시 대상 프로그램을 종료(kill)하도록 설계된 명령일 수 있다. 이러한 기능을 수행할 수 있는 온 칩 디버그 하드웨어는 대부분의 PC나 모바일 기기 등의 사용자 단말기에 내장되어 있으며, JTAG 등이 대표적인 온 칩 디버그 하드웨어이다. In order to unload and terminate the program, the core control unit can directly transmit a command to be executed on the on-chip debug hardware so that the monitored core can execute the corresponding command in the debug state (the ARM state in the ARM CPU). At this time, the command transmitted to the on-chip debug hardware may be a command designed to cause the monitored program to stop executing itself, or the kernel scheduler to kill the monitored program. On-chip debug hardware capable of performing these functions is embedded in user terminals such as most PCs and mobile devices, and JTAG is a representative on-chip debug hardware.

도 9와 같이 코어 제어부가 온 칩 디버그 하드웨어를 이용하여 코어를 제어할 경우, 감시 대상 프로그램과 커널 등의 기존 소프트웨어를 변조하지 않고 그대로 사용할 수 있으며, 실행 파일이나 커널의 변경 여부를 탐지하여 악성 행위를 은닉하는 악성 코드도 탐지할 수 있다. As shown in FIG. 9, when the core control unit controls the core using the on-chip debug hardware, existing software such as a monitoring target program and a kernel can be used without modification, and it is possible to detect whether an executable file or a kernel has been changed, Can also detect malicious code that hides.

도 10은 본 발명의 일실시예에 따른 코어 제어부가 커널의 기능을 이용하여 코어를 제어하는 방법을 나타낸 도면이다. 10 is a diagram illustrating a method of controlling a core using a kernel function according to an embodiment of the present invention.

코드 재사용 공격 방어 장치(100)의 코어 제어부는 도 10에 도시한 바와 같이, 온 칩 디버그 하드웨어를 사용하지 않고 커널에 포함된 프로그램 정지 및 종료(kill) 기능을 이용하여 감시 대상 코어를 제어할 수 있다. As shown in FIG. 10, the core control unit of the code reuse attack defense apparatus 100 can control the target core by using a program stop and kill function included in the kernel without using the on-chip debug hardware have.

도 9에 도시된 온 칩 디버그 하드웨어를 이용하는 방식은 감시 대상 프로그램이 사용자 영역이나 커널 영역에서 실행되는 프로그램일 때 사용되고, 도 10에 도시된 커널에 포함된 프로그램 정지 및 종료(kill) 기능을 이용하는 방식은 감시 대상 프로그램이 사용자 영역 프로그램일 때 적용될 수 있다.The method using the on-chip debug hardware shown in FIG. 9 is used when the monitored program is a program executed in a user area or a kernel area, and a method using a program stop and kill function included in the kernel shown in FIG. Can be applied when the monitored program is a user area program.

다시 도 3에 대하여 설명하면, 제어 흐름 정책에 위배되지 않는 경우(S360 NO), 코드 재사용 공격 방어 장치(100)는 감시 대상 프로그램이 종료되었는지 여부를 판단하고(S380), 감시 대상 프로그램이 종료되지 않은 경우 정상적인 실행 흐름을 추출하는 S350 단계를 수행한다. Referring again to FIG. 3, if the policy reuse attack defense apparatus 100 does not violate the control flow policy (NO at S360), it is determined whether the monitoring target program is terminated (S380). If the monitoring target program is not terminated If it is not, a normal execution flow is extracted at step S350.

S380 단계에서 프로그램이 종료된 것으로 판단된 경우, 코드 재사용 공격 방어 장치(100)는 감시 대상 코어 및 감시 대상 프로그램이 정상적인 동작을 수행하는 것으로 판단할 수 있다. 또한, 코드 재사용 공격 방어 장치(100)는 S360 단계의 CFI 위패 여부 판단 결과를 시스템 외부로 전송할 수 있다. If it is determined in step S380 that the program is terminated, the code reuse attack defense apparatus 100 may determine that the monitored core and the monitored program perform normal operations. In addition, the code reuse attack defense apparatus 100 may transmit the determination result of CFI disqualification in step S360 to the outside of the system.

코드 재사용 공격 방어 장치(100)는 S340 단계에서 인스트럭션이 추출될 때마다 S360 단계를 수행하여 제어 흐름 정책에 위배되었는지 여부를 검사할 수 있으며, 감시 대상 프로그램이 종료되면 CFI 검사의 수행도 종료할 수 있다. The code reuse attack defense apparatus 100 may perform step S360 whenever the instruction is extracted in step S340 to check whether it is in violation of the control flow policy. If the monitoring target program is terminated, the execution of the CFI check may also be terminated have.

이하에서는 도 11을 통하여 본 발명의 일실시예에 따른 코드 재사용 공격 방어 장치의 CFI 검사부가 시큐어 월드 영역에서 동작함에 대하여 더욱 상세하게 설명한다. Hereinafter, the operation of the CFI inspecting unit of the code reuse attack defense apparatus according to the embodiment of the present invention in the secure world region will be described in more detail with reference to FIG.

도 11은 본 발명의 일실시예에 따른 CFI 검사부가 시큐어 월드에서 동작하는 방법을 나타낸 도면이다. 11 is a diagram illustrating a method of operating in a secure world according to an exemplary embodiment of the present invention.

코드 재사용 공격 방어 장치(100)의 CFI 감시부(130)는 감시 대상 코어의 노멀 월드(Normal World)에서 접근이 제한된 영역에서 동작한다. 대상 시스템에서 감시 대상 코어의 접근이 불가능한 영역은 모니터링 코어의 시큐어 월드(Secure World) 영역(ARM Trust Zone)과 애플리케이션 프로세서(AP)에서 접근이 불가능한 프로세서들을 포함한다. The CFI monitoring unit 130 of the code reuse attack defense apparatus 100 operates in an area where access is restricted in the normal world of the monitored core. Areas in the target system where the monitored core is inaccessible include processors that are inaccessible to the monitoring core's Secure World (ARM Trust Zone) and application processor (AP).

도 11에서, 추출된 인스트럭션, 코어 관리부(110) 및 CFI 스케줄러(120)와 CFI 감시부(130)의 인스트럭션 추출부(131), 정상 실행 흐름 추출부(133), CFI 검사부(135) 및 코어 제어부(137)는 시큐어 월드 영역에서 동작할 수 있다. 11, the instruction extracting unit 131, the normal execution flow extracting unit 133, the CFI checking unit 135 and the core extracting unit 132 of the CFI monitoring unit 130 and the core management unit 110 and the CFI scheduler 120, The control unit 137 can operate in the secure world area.

감시 대상 코어에서의 접근이 불가능하므로, 감시 대상 코어에서 악성 코드에 의해 커널이 장악된 경우에도 시큐어 월드 영역의 CFI 검사부는 공격자로부터 보호된다. 또한, 커널 영역 악성 코드에 대한 CFI 검사 시에도 CFI 검사부를 시큐어 월드 영역에서 동작하도록 구성할 수 있다. Since the access to the monitored core is not possible, even if the kernel is taken over by the malicious code in the monitored core, the CFI checking part of the secure world area is protected from the attacker. Also, the CFI checking unit can be configured to operate in the secure world area even when the CFI is checked against the kernel area malicious code.

사용자 영역 악성 코드에 대한 CFI 검사 시에는 CFI 검사부를 모니터링 코어의 노멀 월드 영역에서 동작하도록 구성할 수 있으며, 커널 영역 악성 코드에 대한 검사와 동일한 형태로 모니터링 코어의 시큐어 월드와 AP가 아닌 별도의 프로세스에서 CFI 검사부가 동작하도록 구성할 수 있다. User area CFI inspection for malicious code can be configured to operate in the normal world area of the monitoring core. In the same form as the inspection of kernel area malicious code, The CFI checking unit can be configured to operate.

본 발명의 일실시예에 따른 코드 재사용 공격 방어 장치는 하드웨어의 추가 또는 재설계없이, 이미 장착된 인스트럭션 트레이스 하드웨어(Instruction Trace HW)를 이용하므로, 기존에 출시된 PC나 모바일 기기 등의 단말기에 그대로 적용할 수 있다. 또한, 유휴 상태인 CPU 코어에서 CFI 감시가 실행되므로, 종래 기술에 따른 소프트웨어 기반 CFI 방법과 달리 감시 대상 프로그램에 대한 성능 저하를 유발하지 않는다. Since the code reuse attack defense device according to the embodiment of the present invention uses the instruction trace hardware (HW) already installed without adding or redesigning the hardware, Can be applied. Also, since the CFI monitoring is executed in the idle CPU core, unlike the conventional software-based CFI method, the performance of the monitored program is not deteriorated.

그리고 유휴 상태인 복수의 CPU 코어에서 CFI 감시를 수행할 수 있어, 강력한 CFI 정책(Fine grained CFI)을 적용할 수 있으며, 이를 통하여 기존의 하드웨어 지원 CFI에서 Coarse grained CFI 정책을 적용할 수 밖에 없었던 한계를 극복할 수 있다. 또한, CFI 감시가 감시 대상 프로그램을 실행하는 CPU 코어와 다른 CPU 코어에서 병렬적으로 실행되므로, 감시 대상 프로그램이나 시스템 커널에 대한 변경을 필요로 하지 않는다. In addition, it is possible to apply CFI policy (Fine Grained CFI), which can perform CFI monitoring on idle CPU cores, and to apply the coarse grained CFI policy in existing hardware support CFI Can be overcome. In addition, since the CFI monitoring is executed in parallel on the CPU core that is different from the CPU core that executes the monitored program, there is no need to change the monitored program or the system kernel.

뿐만 아니라, 본 발명의 실시예에 따른 코드 재사용 공격 방어 장치는 CFI 감시 및 탐지를 수행하고, CFI 정책에 위배되는 것으로 탐지된 경우 온 칩 디버그 하드웨어를 이용하여, 감시 대상 프로그램이 실행하는 CPU 코어를 정지하고, 해당 감시 대상 프로그램을 정지하며, 커널의 스케줄링 프로세스 리스트에서 제거할 수 있다. In addition, the code reuse attack defense apparatus according to the embodiment of the present invention performs CFI monitoring and detection, and when detected as a violation of the CFI policy, uses the on-chip debug hardware to detect the CPU core executed by the monitored program Stops the monitoring target program, and removes it from the scheduling process list of the kernel.

또한, 온 칩 디버그 하드웨어를 이용하지 않는 경우에도, 커널에 프로그램 제어 기능을 추가하여 사용자 영역의 감시 대상 프로그램을 정지하고, 커널 스케줄링 리스트에서 프로세스를 제거할 수 있다. Also, even when the on-chip debug hardware is not used, the program control function is added to the kernel to stop the monitoring target program in the user area and remove the process from the kernel scheduling list.

도 12는 본 발명의 일실시예에 따른 컴퓨터 시스템을 나타낸 블록도이다.12 is a block diagram illustrating a computer system in accordance with an embodiment of the present invention.

도 12를 참조하면, 본 발명의 실시예는 컴퓨터로 읽을 수 있는 기록매체와 같은 컴퓨터 시스템(1200)에서 구현될 수 있다. 도 12에 도시된 바와 같이, 컴퓨터 시스템(1200)은 버스(1220)를 통하여 서로 통신하는 하나 이상의 프로세서(1210), 메모리(1230), 사용자 인터페이스 입력 장치(1240), 사용자 인터페이스 출력 장치(1250) 및 스토리지(1260)를 포함할 수 있다. 또한, 컴퓨터 시스템(1200)은 네트워크(1280)에 연결되는 네트워크 인터페이스(1270)를 더 포함할 수 있다. 프로세서(1210)는 중앙 처리 장치 또는 메모리(1230)나 스토리지(1260)에 저장된 프로세싱 인스트럭션들을 실행하는 반도체 장치일 수 있다. 메모리(1230) 및 스토리지(1260)는 다양한 형태의 휘발성 또는 비휘발성 저장 매체일 수 있다. 예를 들어, 메모리는 ROM(1231)이나 RAM(1232)을 포함할 수 있다.12, embodiments of the present invention may be implemented in a computer system 1200, such as a computer-readable recording medium. 12, the computer system 1200 includes one or more processors 1210, a memory 1230, a user interface input device 1240, a user interface output device 1250, And storage 1260. In addition, the computer system 1200 may further include a network interface 1270 connected to the network 1280. The processor 1210 may be a central processing unit or a semiconductor device that executes the processing instructions stored in the memory 1230 or the storage 1260. [ Memory 1230 and storage 1260 can be various types of volatile or non-volatile storage media. For example, the memory may include a ROM 1231 or a RAM 1232. [

따라서, 본 발명의 실시예는 컴퓨터로 구현된 방법이나 컴퓨터에서 실행 가능한 명령어들이 기록된 비일시적인 컴퓨터에서 읽을 수 있는 매체로 구현될 수 있다. 컴퓨터에서 읽을 수 있는 명령어들이 프로세서에 의해서 수행될 때, 컴퓨터에서 읽을 수 있는 명령어들은 본 발명의 적어도 한 가지 태양에 따른 방법을 수행할 수 있다.Thus, embodiments of the invention may be embodied in a computer-implemented method or in a non-volatile computer readable medium having recorded thereon instructions executable by the computer. When computer readable instructions are executed by a processor, the instructions readable by the computer are capable of performing the method according to at least one aspect of the present invention.

이상에서와 같이 본 발명에 따른 코드 재사용 공격 방어 장치 및 방법은 상기한 바와 같이 설명된 실시예들의 구성과 방법이 한정되게 적용될 수 있는 것이 아니라, 상기 실시예들은 다양한 변형이 이루어질 수 있도록 각 실시예들의 전부 또는 일부가 선택적으로 조합되어 구성될 수도 있다. As described above, the apparatus and method for reusing code reuse according to the present invention are not limited to the configurations and methods of the embodiments described above, but the embodiments may be modified in various ways, All or a part of the above-described elements may be selectively combined.

10: 실행 파일 20: 메모리
30: 시스템 버스 100: 코드 재사용 공격 방어 장치
110: 코어 관리부 120: CFI 스케줄러
130: CFI 감시부 131: 인스트럭션 추출부
133: 정상 실행 흐름 추출부 135: CFI 검사부
137: 코어 제어부 200: 모니터링 코어
300: 감시 대상 코어 310: 트레이스 하드웨어
600: 분기 테이블 700: 함수 주소 테이블
800: 쉐도우 콜 스택 1200: 컴퓨터 시스템
1210: 프로세서 1220: 버스
1230: 메모리 1231: 롬
1232: 램
1240: 사용자 인터페이스 입력 장치
1250: 사용자 인터페이스 출력 장치
1260: 스토리지 1270: 네트워크 인터페이스
1280: 네트워크
10: Executable file 20: Memory
30: System bus 100: Code reuse attack defense device
110: core management unit 120: CFI scheduler
130: CFI monitoring unit 131: Instruction extracting unit
133: normal execution flow extraction unit 135: CFI inspection unit
137: core control unit 200: monitoring core
300: Monitored core 310: Trace hardware
600: branch table 700: function address table
800: Shadow call stack 1200: Computer system
1210: Processor 1220: Bus
1230: Memory 1231: ROM
1232: RAM
1240: User interface input device
1250: User interface output device
1260: Storage 1270: Network Interface
1280: Network

Claims (20)

코드 재사용 공격 방어 장치에 의해 수행되는 코드 재사용 공격 방어 방법에 있어서,
멀티 코어 시스템의 유휴 상태 코어 중에서 모니터링 코어를 선택하는 단계,
상기 모니터링 코어에 CFI 감시부를 로딩하고, 상기 CFI 감시부로 제어 데이터를 전송하는 단계,
상기 CFI 감시부가 상기 제어 데이터를 이용하여, 감시 대상 프로그램이 실행되는 감시 대상 코어의 CPU 인스트럭션을 추출하는 단계,
상기 CFI 감시부가 상기 감시 대상 프로그램의 실행파일, 메모리 및 CPU 인스트럭션 중 적어도 어느 하나로부터 상기 감시 대상 프로그램에 상응하는 기 설정된 정상 실행 플로우를 추출하는 단계,
상기 CFI 감시부가 추출된 감시 대상 코어의 CPU 인스트럭션과 상기 정상 실행 플로우를 비교하여, 상기 감시 대상 코어의 CPU 인스트럭션이 상기 정상 실행 플로우를 위배하는지 여부를 판단하는 단계, 그리고
상기 CFI 감시부가 상기 위배 여부를 기반으로, 상기 감시 대상 코어의 실행을 제어하여, 코드 재사용 공격을 방어하는 단계를 포함하는 코드 재사용 공격 방어 방법.
A code reuse attack prevention method performed by a code reuse attack defense device,
Selecting a monitoring core from the idle cores of the multicore system,
Loading the CFI monitoring unit to the monitoring core and transmitting control data to the CFI monitoring unit,
The CFI monitoring unit extracting the CPU instruction of the monitored core on which the monitored program is executed using the control data,
The CFI monitoring unit extracting a predetermined normal execution flow corresponding to the monitored program from at least one of an executable file of the monitored program, a memory, and a CPU instruction,
Comparing the CPU instruction of the monitored core extracted by the CFI monitoring unit with the normal execution flow to determine whether the CPU instruction of the monitored core violates the normal execution flow,
And controlling the execution of the monitored core based on whether the CFI monitoring unit is in violation to prevent a code reuse attack.
제1항에 있어서,
상기 감시 대상 코어의 CPU 인스트럭션을 추출하는 단계는,
상기 감시 대상 코어의 트레이스 하드웨어로 상기 제어 데이터를 전송하는 단계, 그리고
메모리로부터 상기 트레이스 하드웨어가 저장한 상기 CPU 인스트럭션을 추출하는 단계를 포함하는 코드 재사용 공격 방어 방법.
The method according to claim 1,
The step of extracting the CPU instruction of the monitored core comprises:
Transmitting the control data to the trace hardware of the monitored core, and
And extracting the CPU instruction stored in the trace hardware from the memory.
제2항에 있어서,
상기 메모리에 저장된 상기 CPU 인스트럭션을 추출하는 단계는,
상기 CPU 인스트럭션이 저장된 메모리 주소를 폴링하거나, 상기 트레이스 하드웨어로부터 인터럽트 이벤트를 수신한 후, 상기 메모리 주소에 저장된 상기 CPU 인스트럭션을 추출하는 코드 재사용 공격 방어 방법.
3. The method of claim 2,
Wherein the extracting the CPU instructions stored in the memory further comprises:
Wherein the CPU instruction polls a memory address stored in the CPU instruction or receives an interrupt event from the trace hardware and then extracts the CPU instruction stored in the memory address.
제1항에 있어서,
상기 정상 실행 플로우를 추출하는 단계는,
상기 감시 대상 프로그램의 실행 전에 상기 감시 대상 프로그램의 상기 실행파일로부터 오프라인 정상 실행 플로우를 추출하는 단계, 그리고
상기 감시 대상 프로그램의 실행 중에 상기 감시 대상 프로그램이 로딩된 상기 메모리 및 상기 감시 대상 프로그램에서 실행된 상기 CPU 인스트럭션 중 적어도 어느 하나를 분석하여 온라인 정상 실행 플로우를 추출하는 단계
를 포함하는 코드 재사용 공격 방어 방법.
The method according to claim 1,
The step of extracting the normal execution flow includes:
Extracting an offline normal execution flow from the execution file of the monitoring target program before execution of the monitoring target program; and
Analyzing at least one of the memory loaded with the monitored program and the CPU instructions executed in the monitored program during execution of the monitored program to extract an online normal execution flow
Wherein the code reuse attack defense method comprises:
삭제delete 제1항에 있어서,
상기 코드 재사용 공격을 방어하는 단계는,
상기 감시 대상 프로그램이 커널 영역 프로그램인 경우, 온 칩 디버그 하드웨어를 이용하여 제어 흐름 정책을 위배한 상기 감시 대상 코어를 정지하는 코드 재사용 공격 방어 방법.
The method according to claim 1,
Wherein the step of defending the code reuse attack comprises:
And stopping the monitored core violating the control flow policy using the on-chip debug hardware when the monitored program is a kernel area program.
제6항에 있어서,
상기 코드 재사용 공격을 방어하는 단계는,
상기 감시 대상 코어를 정지한 후, 상기 제어 흐름 정책을 위배한 상기 감시 대상 프로그램을 상기 감시 대상 코어에서 언로드하는 코드 재사용 공격 방어 방법.
The method according to claim 6,
Wherein the step of defending the code reuse attack comprises:
And after the monitoring target core is stopped, unloading the monitoring target program that violates the control flow policy from the monitoring target core.
제1항에 있어서,
상기 코드 재사용 공격을 방어하는 단계는,
상기 감시 대상 프로그램이 사용자 영역 프로그램인 경우, 온 칩 디버그 하드웨어 및 커널의 프로그램 제어 기능 중 적어도 어느 하나를 이용하여 제어 흐름 정책을 위배한 상기 감시 대상 코어를 정지하는 코드 재사용 공격 방어 방법.
The method according to claim 1,
Wherein the step of defending the code reuse attack comprises:
And stopping the monitored core violating the control flow policy by using at least one of on-chip debug hardware and a program control function of the kernel when the monitored program is a user area program.
제1항에 있어서,
상기 유휴 상태 코어는,
파워다운 상태이거나, 어플리케이션을 실행하지 않고 커널의 유휴 루프(idle loop)만 실행하는 코어인 코드 재사용 공격 방어 방법.
The method according to claim 1,
The idle core includes:
A core reuse attack defense method that is either a power-down state or a core that executes only the idle loop of the kernel without running the application.
제1항에 있어서,
상기 모니터링 코어를 선택하는 단계는,
계산된 CFI 감시 처리 속도를 기반으로 상기 모니터링 코어를 결정하는 코드 재사용 공격 방어 방법.
The method according to claim 1,
Wherein selecting the monitoring core comprises:
And determining the monitoring core based on the computed CFI monitoring processing rate.
멀티 코어 시스템에서 유휴 상태 코어를 탐지하는 코어 관리부,
상기 유휴 상태 코어의 정보를 기반으로, 상기 유휴 상태 코어 중에서 모니터링 코어를 선택하는 CFI 스케줄러, 그리고
상기 모니터링 코어에 로딩되어, 감시 대상 프로그램을 실행하는 감시 대상 코어에 대한 CFI 감시를 수행하는 CFI 감시부를 포함하고,
상기 CFI 감시부는,
상기 CFI 스케줄러로부터 수신한 제어 데이터를 이용하여, 상기 감시 대상 프로그램이 실행되는 상기 감시 대상 코어의 CPU 인스트럭션을 추출하는 인스트럭션 추출부,
상기 감시 대상 프로그램의 실행파일, 메모리 및 CPU 인스트럭션 중 적어도 어느 하나로부터 상기 감시 대상 프로그램에 상응하는 기 설정된 정상 실행 플로우를 추출하는 정상 실행 흐름 추출부,
추출된 감시 대상 코어의 CPU 인스트럭션과 상기 정상 실행 플로우를 비교하여, 상기 감시 대상 코어의 CPU 인스트럭션이 상기 정상 실행 플로우를 위배하는지 여부를 판단하는 CFI 검사부, 그리고
상기 위배 여부를 기반으로, 상기 감시 대상 코어의 실행을 제어하여, 코드 재사용 공격을 방어하는 코어 제어부를 포함하는 코드 재사용 공격 방어 장치.
A core manager for detecting idle cores in a multicore system,
A CFI scheduler for selecting a monitoring core from the idle core based on the information of the idle core, and
And a CFI monitoring unit that is loaded on the monitoring core and performs CFI monitoring on the monitored core that executes the monitored program,
The CFI monitoring unit,
An instruction extracting unit for extracting a CPU instruction of the monitored core on which the monitored program is executed by using the control data received from the CFI scheduler,
A normal execution flow extracting unit for extracting a predetermined normal execution flow corresponding to the monitoring target program from at least one of an executable file of the monitoring target program, a memory and a CPU instruction,
A CFI checking unit for comparing the CPU instruction of the extracted monitored core with the normal execution flow to determine whether the CPU instruction of the monitored core violates the normal execution flow,
And a core control unit for controlling the execution of the monitored core based on the violation to prevent a code reuse attack.
제11항에 있어서,
상기 인스트럭션 추출부는,
상기 감시 대상 코어의 트레이스 하드웨어로 상기 제어 데이터를 전송하고, 메모리로부터 상기 트레이스 하드웨어가 저장한 상기 CPU 인스트럭션을 추출하는 코드 재사용 공격 방어 장치.
12. The method of claim 11,
Wherein the instruction extracting unit comprises:
And transmits the control data to the trace hardware of the monitored core, and extracts the CPU instruction stored in the trace hardware from the memory.
제12항에 있어서,
상기 인스트럭션 추출부는,
상기 CPU 인스트럭션이 저장된 메모리 주소를 폴링하거나, 상기 트레이스 하드웨어로부터 인터럽트 이벤트를 수신한 후, 상기 메모리 주소에 저장된 상기 CPU 인스트럭션을 추출하는 코드 재사용 공격 방어 장치.
13. The method of claim 12,
Wherein the instruction extracting unit comprises:
Wherein the CPU instruction polls a memory address where the CPU instruction is stored, or after receiving an interrupt event from the trace hardware, extracts the CPU instruction stored in the memory address.
제11항에 있어서,
상기 정상 실행 흐름 추출부는,
상기 감시 대상 프로그램의 실행 전에 상기 감시 대상 프로그램의 상기 실행파일로부터 오프라인 정상 실행 플로우를 추출하고, 상기 감시 대상 프로그램의 실행 중에 상기 감시 대상 프로그램이 로딩된 상기 메모리 및 상기 감시 대상 프로그램에서 실행된 상기 CPU 인스트럭션 중 적어도 어느 하나를 분석하여 온라인 정상 실행 플로우를 추출하는 코드 재사용 공격 방어 장치.
12. The method of claim 11,
Wherein the normal execution flow extracting unit comprises:
And a control unit configured to extract an offline normal execution flow from the execution file of the monitoring target program before execution of the monitoring target program, And extracts an online normal execution flow by analyzing at least one of the instructions.
삭제delete 제11항에 있어서,
상기 코어 제어부는,
상기 감시 대상 프로그램이 커널 영역 프로그램인 경우, 온 칩 디버그 하드웨어를 이용하여 제어 흐름 정책을 위배한 상기 감시 대상 코어를 정지하는 코드 재사용 공격 방어 장치.
12. The method of claim 11,
Wherein the core control unit comprises:
And stops the monitored core violating the control flow policy using the on-chip debug hardware when the monitored program is a kernel area program.
제16항에 있어서,
상기 코어 제어부는,
상기 감시 대상 코어를 정지한 후, 상기 제어 흐름 정책을 위배한 상기 감시 대상 프로그램을 상기 감시 대상 코어에서 언로드하는 코드 재사용 공격 방어 장치.
17. The method of claim 16,
Wherein the core control unit comprises:
Wherein the monitoring target core is unloaded from the monitored core after stopping the monitored core, the monitoring target program violating the control flow policy.
제11항에 있어서,
상기 코어 제어부는,
상기 감시 대상 프로그램이 사용자 영역 프로그램인 경우, 온 칩 디버그 하드웨어 및 커널의 프로그램 제어 기능 중 적어도 어느 하나를 이용하여 제어 흐름 정책을 위배한 상기 감시 대상 코어를 정지하는 코드 재사용 공격 방어 장치.
12. The method of claim 11,
Wherein the core control unit comprises:
And stops the monitored core violating the control flow policy by using at least one of the on-chip debug hardware and the program control function of the kernel when the monitored program is a user area program.
제11항에 있어서,
상기 코어 관리부는,
상기 멀티 코어 시스템에 포함된 코어의 상태 변경을 감지하고, 상기 유휴 상태 코어의 개수 및 상태가 변경된 경우 상기 CFI 스케줄러로 상기 유휴 상태 코어의 정보를 전송하는 코드 재사용 공격 방어 장치.
12. The method of claim 11,
The core management unit,
Core system, and transmits information of the idle core to the CFI scheduler when the number and state of the idle core are changed.
제19항에 있어서,
상기 CFI 스케줄러는,
상기 유휴 상태 코어의 상태가 활성 상태로 변경된 경우, 상기 유휴 상태 코어에서 실행 중인 상기 CFI 감시부를 다른 유휴 상태 코어에 로드하거나, 상기 CFI 감시부의 동작을 중지하는 코드 재사용 공격 방어 장치.
20. The method of claim 19,
The CFI scheduler includes:
And loads the CFI monitoring unit running in the idle core into another idle core or stops the operation of the CFI monitoring unit when the state of the idle core is changed to the active state.
KR1020170143672A 2017-10-31 2017-10-31 Apparatus and method for defensing of code reuse attack KR101989580B1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
KR1020170143672A KR101989580B1 (en) 2017-10-31 2017-10-31 Apparatus and method for defensing of code reuse attack

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
KR1020170143672A KR101989580B1 (en) 2017-10-31 2017-10-31 Apparatus and method for defensing of code reuse attack

Publications (2)

Publication Number Publication Date
KR20190048590A KR20190048590A (en) 2019-05-09
KR101989580B1 true KR101989580B1 (en) 2019-06-14

Family

ID=66546026

Family Applications (1)

Application Number Title Priority Date Filing Date
KR1020170143672A KR101989580B1 (en) 2017-10-31 2017-10-31 Apparatus and method for defensing of code reuse attack

Country Status (1)

Country Link
KR (1) KR101989580B1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR102567924B1 (en) 2021-11-01 2023-08-17 부산대학교 산학협력단 System and Method for Protecting Indirect Call in WebAssembly

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101715759B1 (en) 2015-09-22 2017-03-15 한국전자통신연구원 Apparatus and method for analysing malicious code in multi core environments
KR101775029B1 (en) 2016-12-21 2017-09-05 삼성전자주식회사 System and method of scheduling

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101715759B1 (en) 2015-09-22 2017-03-15 한국전자통신연구원 Apparatus and method for analysing malicious code in multi core environments
KR101775029B1 (en) 2016-12-21 2017-09-05 삼성전자주식회사 System and method of scheduling

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
김주혁외 1인, '스택 영역에서의 코드 재사용 공격 탐지 메커니즘', 한국산학기술학회 논문지 15(5), 2014.05
박용규외 1인, '코드 재사용을 방어하기 위한 시큐어 코딩 방안', 한국정보과학회 학술발표논문집 pp. 1136-1138, 2016.6

Also Published As

Publication number Publication date
KR20190048590A (en) 2019-05-09

Similar Documents

Publication Publication Date Title
US12013940B2 (en) Automatic detection of software that performs unauthorized privilege escalation
US9223964B2 (en) Detecting JAVA sandbox escaping attacks based on JAVA bytecode instrumentation and JAVA method hooking
US8627478B2 (en) Method and apparatus for inspecting non-portable executable files
Kawakoya et al. Memory behavior-based automatic malware unpacking in stealth debugging environment
US9832215B2 (en) Automatic content inspection system for exploit detection
KR101519845B1 (en) Method For Anti-Debugging
US8484732B1 (en) Protecting computers against virtual machine exploits
US7603713B1 (en) Method for accelerating hardware emulator used for malware detection and analysis
CN101515316B (en) Trusted computing terminal and trusted computing method
JP6680437B2 (en) System and method for detecting unknown vulnerabilities in a computing process
US9146833B2 (en) System and method for correct execution of software based on a variance between baseline and real time information
US10984096B2 (en) Systems, methods, and apparatus for detecting control flow attacks
US20090300764A1 (en) System and method for identification and blocking of malicious code for web browser script engines
US20210303658A1 (en) Hardware-Assisted System and Method for Detecting and Analyzing System Calls Made to an Operating System Kernel
Prakash et al. Enforcing system-wide control flow integrity for exploit detection and diagnosis
CN111859394B (en) Software behavior active measurement method and system based on TEE
CN107301082A (en) A kind of method and apparatus for realizing operating system integrity protection
CN101599113A (en) Driven malware defence method and device
KR101989580B1 (en) Apparatus and method for defensing of code reuse attack
US20140095936A1 (en) System and Method for Correct Execution of Software
Dong et al. Kims: kernel integrity measuring system based on trustzone
EP3535681A1 (en) System and method for detecting and for alerting of exploits in computerized systems
Benameur et al. {MINESTRONE}: Testing the {SOUP}
Hao et al. Transparent driver-kernel isolation with VMM intervention
Chyłek Emulation based software reliability evaluation and optimization

Legal Events

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