KR20150078806A - Method and system for indirectness branch monitoring of program - Google Patents

Method and system for indirectness branch monitoring of program Download PDF

Info

Publication number
KR20150078806A
KR20150078806A KR1020130168536A KR20130168536A KR20150078806A KR 20150078806 A KR20150078806 A KR 20150078806A KR 1020130168536 A KR1020130168536 A KR 1020130168536A KR 20130168536 A KR20130168536 A KR 20130168536A KR 20150078806 A KR20150078806 A KR 20150078806A
Authority
KR
South Korea
Prior art keywords
program
address
control flow
indirect branch
branch instruction
Prior art date
Application number
KR1020130168536A
Other languages
Korean (ko)
Other versions
KR101625129B1 (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 KR1020130168536A priority Critical patent/KR101625129B1/en
Publication of KR20150078806A publication Critical patent/KR20150078806A/en
Application granted granted Critical
Publication of KR101625129B1 publication Critical patent/KR101625129B1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3051Monitoring arrangements for monitoring the configuration of the computing system or of the computing system component, e.g. monitoring the presence of processing resources, peripherals, I/O links, software programs
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/30003Arrangements for executing specific machine instructions
    • G06F9/3005Arrangements for executing specific machine instructions to perform operations for flow control
    • G06F9/30061Multi-way branch instructions, e.g. CASE
    • 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/52Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems during program execution, e.g. stack integrity ; Preventing unwanted data erasure; Buffer overflow

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Hardware Design (AREA)
  • Computing Systems (AREA)
  • Quality & Reliability (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The present invention relates to a method and a system for monitoring an indirect branch of a program, which comprises following steps. A learning unit generates an address pair table showing a control flow of a program to learn the control flow of the program to be monitored. A verification unit receives a source address and a designation address for an indirect branch instruction within the program in operation and determines whether the received source address and designation address for the indirect branch instruction are present in the address pair table to verify the control flow of the program. Accordingly, the method and the system for monitoring an indirect branch of a program of the present invention determines whether a program is being driven according to a preset control flow when an indirect branch occurs within the program to be executed, prevents modified program codes by a hacker from being executed to ensure the accurate driving of the program according to the preset control flow.

Description

프로그램의 간접 분기 모니터링 방법 및 시스템{Method and system for indirectness branch monitoring of program}[0001] The present invention relates to a method and system for indirect branch monitoring of a program,

본 발명은 프로그램의 간접 분기 모니터링 방법 및 시스템에 관한 것으로, 특히 실행하고자 하는 프로그램이 미리 설정된 제어 흐름을 벗어나 변조가 발생하는 것을 미리 탐지할 수 있는 프로그램의 간접 분기 모니터링 방법 및 시스템에 관한 것이다.
The present invention relates to a method and system for indirect branch monitoring of a program, and more particularly, to a method and system for indirect branch monitoring of a program that can detect in advance that a program to be executed is out of a preset control flow and modulation occurs.

소프트웨어 관련 기술이 발달함에 따라, 보안, 금융 등의 다양한 분야에서 사용되는 프로그램에 대하여 네트워크를 통해 각종 변조 코드가 삽입되어 해당 프로그램이 오작동하도록 하는 공격 방법이 급격히 대두되었다. As the technology related to software is developed, a variety of modulated codes have been inserted into networks for programs used in various fields such as security, finance, and the like, and an attacking method for causing the program to malfunction has rapidly emerged.

이러한 공격 방법은 프로그램을 실행하는 도중에 공격이 발생하면, 정상적인 제어 흐름에서 벗어나, 공격자가 몰래 주입한 공격 코드를 실행하거나(code injection attack), 이미 시스템 내에 존재하는 프로그램 명령의 제어 흐름을 재편성하여 공격자가 원하는 순서대로 실행하도록 유도(return-to-libc, ROP)하게 한다. Such an attack method is a method in which, when an attack occurs during execution of a program, the attack flow code is executed by executing attack code injected by an attacker (code injection attack) (Return-to-libc, ROP).

하지만, 구동 중인 프로그램이 외부 공격자에 의해 공격을 받아 미리 설정된 정상적인 제어 흐름으로 되는지 여부를 확인하기 어려운 문제점이 발생했다.
However, there is a problem that it is difficult to confirm whether a running program is attacked by an external attacker and becomes a predetermined normal control flow.

KR 10-2000-0070127 (소프트웨어 프로그램의 규정된 실행을 모니터링하기 위한 방법, 지멘스 악티엔게젤샤프트) 2000.11.25.KR 10-2000-0070127 (METHOD FOR MONITORING PROVIDED IMPLEMENTATION OF SOFTWARE PROGRAM, Siemens Aktiengesellschaft).

상기와 같은 종래 기술의 문제점을 해결하기 위해, 본 발명은 실행되는 프로그램의 일부가 외부 공격자에 의해 변조되는 것을 미리 파악하여 미리 설정된 정상적인 제어 흐름으로 프로그램이 운영될 수 있도록 하는 프로그램의 간접 분기 모니터링 방법 및 시스템을 제공하고자 한다.
In order to solve the problems of the prior art as described above, the present invention provides an indirect branch monitoring method of a program that grasps that a part of a program to be executed is modulated by an external attacker, And systems.

위와 같은 과제를 해결하기 위한 본 발명의 한 실시 예에 따른 프로그램의 간접 분기 모니터링 방법은 학습부가 프로그램의 제어 흐름을 나타내는 주소 쌍 테이블을 생성하여 감시하고자 하는 상기 프로그램의 제어 흐름을 학습하는 단계; 및 검증부가 운영되는 프로그램 내 간접 분기 명령에 대한 출처 주소 및 목적지 주소를 입력받고, 입력받은 간접 분기 명령에 대한 출처 주소 및 목적지 주소가 상기 주소 쌍 테이블 내 존재하는지 비교하여 상기 프로그램의 제어 흐름을 검증하는 단계;를 포함한다.According to another aspect of the present invention, there is provided a method for monitoring an indirect branch of a program, the method comprising: learning a control flow of the program to generate and monitor an address pair table representing a control flow of a learning part program; And verifying the control flow of the program by comparing the source address and the destination address of the indirect branch instruction in the program in which the verification unit is operated and comparing whether the source address and the destination address of the input indirect branch instruction exist in the address pair table, ; ≪ / RTI >

특히, 상기 프로그램 내 제어 흐름을 나타내는 간접 분기 명령의 출처 주소 및 목적지 주소 쌍 들을 수집하여 주소 쌍 테이블을 생성하는 학습부가 프로그램의 제어 흐름을 학습하는 단계를 포함할 수 있다. Particularly, it may include learning a control flow of a learning part program for collecting source address and destination address pairs of an indirect branch instruction indicating a control flow in the program to generate an address pair table.

특히, 해시 테이블로 이루어지는 주소 쌍 테이블을 포함할 수 있다.In particular, it may include an address pair table comprising a hash table.

보다 바람직하게는 상기 주소 쌍 테이블 내 프로그램의 간접 분기 시 발생하는 출처 주소 및 목적지 주소의 주소 쌍이 존재하지 않는 경우, 상기 프로그램 내 제어흐름에 변조가 존재한다고 판단하는 검증부가 프로그램의 제어흐름을 검증하는 단계를 포함할 수 있다.More preferably, when there is no address pair of a source address and a destination address generated in the indirect branching of the program in the address pair table, the verification unit verifies the control flow of the verification unit program that determines that there is a modulation in the control flow in the program Step < / RTI >

보다 바람직하게는 처리부가 상기 입력받은 간접 분기 명령에 대한 출처 주소 및 목적지 주소가 상기 주소 쌍 테이블 내 존재하지 않는 경우, 상기 프로그램의 실행을 정지 또는 종료시키는 단계;를 더 포함할 수 있다.More preferably, the step of stopping or terminating the execution of the program when the processing unit does not exist in the address pair table of the source address and the destination address of the input indirect branch instruction.

위와 같은 과제를 해결하기 위한 본 발명의 다른 실시 예에 따른 프로그램의 간접 분기 모니터링 시스템은 프로그램의 제어 흐름을 나타내는 주소 쌍 테이블을 생성하여 감시하고자 하는 상기 프로그램의 제어 흐름을 학습하는 학습부; 운영되는 프로그램 내 간접 분기 명령에 대한 출처 주소 및 목적지 주소를 입력받고, 입력받은 간접 분기 명령에 대한 출처 주소 및 목적지 주소가 상기 주소 쌍 테이블 내 존재하는지 비교하여 상기 프로그램의 제어 흐름을 검증하는 검증부; 및 상기 입력받은 간접 분기 명령에 대한 출처 주소 및 목적지 주소가 상기 주소 쌍 테이블 내 존재하지 않는 경우, 상기 프로그램의 실행을 정지 또는 종료시키는 처리부;를 포함한다.
According to another aspect of the present invention, there is provided an indirect branch monitoring system for a program, comprising: a learning unit for learning a control flow of the program to generate and monitor an address pair table representing a control flow of the program; A verification unit for receiving a source address and a destination address for an indirect branch instruction in an operating program and verifying a control flow of the program by comparing whether a source address and a destination address for the input indirect branch instruction exist in the address pair table; ; And a processor for stopping or terminating the execution of the program when the source address and the destination address of the input indirect branch instruction do not exist in the address pair table.

본 발명의 프로그램의 간접 분기 모니터링 방법 및 시스템은 실행하고자 하는 프로그램 내 간접 분기 발생 시, 미리 설정된 제어 흐름에 따라 프로그램이 구동되는지 여부를 파악하여, 공격자에 의해 변조된 프로그램 코드가 수행되는 것을 미연에 방지하여 미리 설정된 제어 흐름에 따라 프로그램이 정확하게 구동될 수 있도록 하는 효과가 있다.
The indirect branch monitoring method and system of the program of the present invention can detect whether or not a program is driven according to a preset control flow when an indirect branch occurs in a program to be executed and recognize that the program code modulated by the attacker is executed So that the program can be accurately driven according to a preset control flow.

도 1은 본 발명의 일 실시 예에 따른 프로그램의 간접 분기 모니터링 시스템의 개략도이다.
도 2는 주소 쌍 해시 테이블의 구조를 나타낸 도면이다.
도 3은 비트 수에 대한 체인 길이가 1인 버킷 체인의 비율을 나타낸 그래프이다.
도 4는 비트 수에 따른 비교로 분기 주소 쌍의 적법 여부를 검증할 수 있는 비율을 나타낸 표이다.
도 5는 간접 분기의 모니터링 실행 시간을 예측하는 그래프이다.
도 6은 전체 명령에 대한 간접 분기 명령의 동적 비율을 나타낸 표이다.
도 7은 간접 분기 모니터링의 방어 실험을 정리한 표이다.
1 is a schematic diagram of an indirect branch monitoring system of a program according to an embodiment of the present invention.
2 is a diagram illustrating a structure of an address pair hash table.
3 is a graph showing the ratio of a bucket chain having a chain length of 1 to the number of bits.
FIG. 4 is a table showing the ratio of verifying whether or not the branch address pair can be verified by comparison according to the number of bits.
5 is a graph for predicting the monitoring execution time of the indirect branch.
FIG. 6 is a table showing the dynamic ratio of the indirect branch instruction to the entire instruction.
FIG. 7 is a table summarizing defense experiments of indirect branch monitoring.

이하, 본 발명을 바람직한 실시 예와 첨부한 도면을 참고로 하여 본 발명이 속하는 기술 분야에서 통상의 지식을 가진 자가 용이하게 실시할 수 있도록 상세히 설명한다. 그러나 본 발명은 여러 가지 상이한 형태로 구현될 수 있으며, 여기에서 설명하는 실시 예에 한정되는 것은 아니다. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENT Hereinafter, the present invention will be described in detail with reference to preferred embodiments and accompanying drawings, which will be easily understood by those skilled in the art. The present invention may, however, be embodied in many different forms and should not be construed as limited to the embodiments set forth herein.

먼저, 본 발명에 대해 설명하기에 앞서 제어 흐름 검증에 대하여 간략히 살펴보도록 한다. 제어 흐름 검증이란, 정적 또는 동적 분석을 통해 제어 흐름 그래프를 추출하고, 간선에 해당하는 제어 이동만 발생하는지를 확인하는 작업을 말한다. 간선의 출발점인 분기 명령의 출처 주소와 간선의 도착점인 분기의 목적지 주소가 제어 흐름 그래프에 속한다면 정상적인 제어 이동이라고 판단할 수 있다. 간선의 출발점과 도착점을 모두 확인하면 ROP(return oriented programming) 또는 JOP(jump oriented programming)와 같이 아무런 악성 코드 주입 없이 프로그램에 이미 포함되어 있는 명령을 이용하거나 원하는 명령 비트 열을 발굴하여 시행되는 공격도 탐지할 수 있다.First, the control flow verification will be briefly described before describing the present invention. Control flow verification refers to the operation of extracting the control flow graph through static or dynamic analysis and confirming that only the control movement corresponding to the trunk occurs. If the source address of the branch instruction, which is the starting point of the trunk, and the destination address of the branch, which is the destination of the trunk, belong to the control flow graph, it can be judged as a normal control shift. If you check both the starting and ending points of the trunk, you can use commands already included in the program without any malicious code injection, such as return oriented programming (ROP) or jump oriented programming (JOP) It can detect.

이러한 제어 흐름의 검증은 간접 분기 명령을 중심으로 수행해야 비용 대비 효과적이다. 공격자는 제어 흐름에 관여하는 자료의 값을 변경하여 프로그램의 제어 흐름을 변경한다. 제어 흐름과 관계있는 자료는 일반 변수에 저장되어 조건 분기 명령이 참조하거나, 코드 포인터에 저장되어 간접 분기 명령이 참조한다. 특히, 조건 분기 명령은 변수에 저장된 값에 대한 조건에 따라 분기하거나 바로 다음 명령으로 진행한다. 그러므로 공격이 성공하려면 프로그램의 의미를 미리 파악하여 제어 흐름을 의도한 대로 변경할 수 있는 조건을 알고 이를 만족하도록 관계된 변수 값을 변경해야 한다. 하지만 이와 달리, 간접 분기 명령은 참조된 코드 포인터의 값으로 분기하기 때문에 프로그램의 의미를 모르더라도 코드 포인터에 저장된 주소를 공격자가 원하는 주소로 바꾸기만 하면 공격에 성공할 가능성이 높다. 이와 같은 이유로 대부분의 프로그램 공격은 명령어의 주소를 담고 있는 코드 포인터를 대상으로 하고 있다. This verification of the control flow is cost-effective if it is performed based on the indirect branch instruction. The attacker changes the control flow of the program by changing the value of the data involved in the control flow. The data related to the control flow is stored in the general variables and referenced by the conditional branch instruction, or stored in the code pointer and referenced by the indirect branch instruction. In particular, the conditional branch instruction branches according to the condition for the value stored in the variable or proceeds to the next instruction immediately. Therefore, for an attack to be successful, you need to know the meaning of the program in advance, know the conditions that can change the control flow as intended, and change the related variable values to satisfy it. However, since the indirect branch instruction branches to the value of the referenced code pointer, it is highly likely that the attack will succeed if the address stored in the code pointer is changed to the address desired by the attacker even though the program does not know the meaning. For this reason, most program attacks target code pointers that contain the address of a command.

이처럼 프로그램의 제어 흐름은 정적 또는 동적 분석을 통해 분석할 수 있다.In this way, the control flow of the program can be analyzed through static or dynamic analysis.

정적 분석에 의한 제어 흐름 분석은 프로그램 컴파일 또는 변환 과정 중에 소스 프로그램이나 중간 표현에 대하여 수행된다. 분석된 제어 흐름 정보는 제어 흐름 그래프로 나타내며, 그래프의 간선이 가능한 제어 흐름을 나타낸다. 중간 표현에서 더 아래 수준의 표현이나 어셈블리 언어로 변환된 후에도 제어 흐름 그래프를 사용하려면, 구성된 제어 흐름 그래프를 다음 단계의 프로그램의 주소 공간에 적절히 사상해 주어야 한다. 특히, 대부분의 컴파일러들은 기계어 프로그램으로 변환하는 과정에서 제어 흐름 정보를 더 이상 필요로 하지 않게 되어 제어 흐름을 기계어 프로그램의 주소 공간으로 사상하지는 않는다. Control flow analysis by static analysis is performed on the source program or intermediate representation during program compilation or conversion. The analyzed control flow information is represented by a control flow graph, and the graph truncation represents a possible control flow. If you want to use a control flow graph even after conversion to a lower level representation or assembly language in the intermediate representation, you must map the configured control flow graph to the address space of the next step, as appropriate. In particular, most compilers no longer need control flow information in the process of converting to machine language programs, and do not map the control flow to the address space of the machine language program.

이러한 정적 제어 흐름 분석은 일반적으로 함수 단위로 진행되어 함수 호출과 귀환과 같이 전역적인 제어 흐름은 연결 과정 이후에 진행되어야 하는데, 이 단계에서는 프로그램이 기계어 프로그램 상태이므로 제어 흐름 분석이 용이하지 않다. 이에 대한 가장 큰 요인은 간접 분기 명령때문인 것을 알 수 있다. 간접 분기 명령은 피연산자가 메모리 또는 레지스터인데, 피연산자에 저장되어 있는 값을 참조하여 프로그램 카운터 값을 조정한 후 그 주소로 분기한다. 이때, 간접 분기 명령의 피연산자 값은 정적 분석으로 정확히 예측하기 힘들다. 소스 프로그램의 부재로 실행 프로그램으로부터 역공학 방식으로 제어 흐름 그래프를 추출하려 할 때에도 동일한 어려움이 존재한다. 마지막으로 실행 시간에 연결되는 공유 라이브러리는 사전에 제어 흐름 분석이 완료되어 있어야 하며, 제어 흐름은 위치 독립적인 방식으로 표시될 수 있어야 한다.This static control flow analysis generally proceeds on a function basis, and a global control flow such as a function call and a feedback should be performed after the connection process. In this stage, the control flow analysis is not easy because the program is in a state of a machine language program. The biggest factor for this is the indirect branch instruction. An indirect branch instruction is a memory or register whose operand is referenced to the value stored in the operand, and then branches to the address after adjusting the program counter value. At this time, the operand value of the indirect branch instruction can not be accurately predicted by static analysis. The same difficulty exists in trying to extract the control flow graph from a running program in a reverse engineering manner in the absence of a source program. Finally, the shared library that is linked to the runtime must have the control flow analysis completed beforehand, and the control flow must be able to be displayed in a position-independent manner.

또는 정적 분석으로 정확한 분석이 어려울 경우, 가능성이 있는 모든 제어 흐름을 결과에 포함할 경우 실제로 발생하지 않는 제어 흐름을 포함할 수 있게 된다. 프로그램 보안 목적의 제어 흐름 검증 관점에서 보면 탐지를 못하는 문제가 발생할 수 있다. 이러한 문제는 정적 분석의 한계 때문에 제어 흐름에 포함되었지만 실제적으로 발생하지 않는 제어 흐름이며, 동시에 보안약점으로 작용할 수도 있기 때문이다. Or static analysis, it is possible to include a control flow that does not actually occur when all possible control flows are included in the results. From the point of view of the control flow verification of program security objectives, problems that can not be detected can occur. This problem is caused by the limitation of static analysis, but it is a control flow that is included in the control flow but does not actually occur, and may act as a security weakness at the same time.

하지만 이와 달리, 확실히 발생할 수 있는 제어 흐름만을 포함하거나 분석이 정확히 수행될 수 없는 제어 흐름은 배제하는 경우에는 잘못 탐지하는 문제가 발생할 수 있다.On the other hand, if the control flow includes only a control flow that can be surely generated or a control flow that can not be analyzed accurately, there may be a problem of false detection.

뿐만 아니라, 상술한 정적 분석 외에도, 동적 분석 방법을 통해 제어 흐름 그래프를 구성할 수 있다. 이 방법의 장점은 전체 실행 프로그램을 대상으로 수행하기 때문에 함수 사이의 제어 이동과 함수 내에서 제어 흐름을 같은 관점에서 다룰 수 있다는 것이다. 특히, 다른 파일에서 정의된 함수 또는 공유 라이브러리 같은 사전에 설치된 실행 프로그램에 대한 분석도 경계 없이 연결될 수 있다. 하지만 이러한 동적 분석에 의한 제어 흐름의 최대 약점은 분석해 내지 못하는 제어 흐름 경로가 많다는 것이다. 즉, 사용되는 입력 데이터에 따라 달라질 수 있고, 어떤 입력 데이터를 사용해야 효과적으로 분석해 낼 수 있는지 연구들이 진행되고 있지만 만족할 만한 수준은 아니다.In addition to the above-mentioned static analysis, a control flow graph can be constructed through a dynamic analysis method. The advantage of this method is that it can handle the control flow between functions and the control flow within the function from the same point of view because it carries out the whole executable program. In particular, analysis of pre-installed executables, such as functions defined in other files or shared libraries, can be bound without bounds. However, the greatest weakness of the control flow by this dynamic analysis is that there are many control flow paths that can not be analyzed. In other words, it depends on the input data to be used, and it is not satisfactory, although studies are under way to analyze which input data can be effectively used.

이하, 도 1을 참조하여 본 발명의 일 실시 예에 따른 프로그램의 간접 분기 모니터링 시스템에 대하여 보다 자세히 살펴보도록 한다. Hereinafter, an indirect branch monitoring system for a program according to an embodiment of the present invention will be described in detail with reference to FIG.

도 1은 본 발명의 일 실시 예에 따른 프로그램의 간접 분기 모니터링 시스템의 개략도이다.1 is a schematic diagram of an indirect branch monitoring system of a program according to an embodiment of the present invention.

도 1에 도시된 바와 같이, 본 발명에 따른 프로그램의 간접 분기 모니터링 시스템(100)은 학습부(120), 검증부(140) 및 처리부(160)를 포함한다. 1, an indirect branch monitoring system 100 of a program according to the present invention includes a learning unit 120, a verification unit 140, and a processing unit 160. As shown in FIG.

학습부(120)는 프로그램의 제어 흐름을 나타내는 주소 쌍 테이블을 생성하여 주소 쌍 테이블 DB(180)에 저장하고, 감시하고자 하는 상기 프로그램의 제어 흐름을 학습한다.The learning unit 120 generates an address pair table indicating a control flow of the program, stores it in the address pair table DB 180, and learns the control flow of the program to be monitored.

검증부(140)는 운영되는 프로그램 내 간접 분기 명령에 대한 출처 주소 및 목적지 주소를 입력받고, 입력받은 간접 분기 명령에 대한 출처 주소 및 목적지 주소가 상기 주소 쌍 테이블 내 존재하는지 비교하여 상기 프로그램의 제어 흐름을 검증한다. The verification unit 140 receives the source address and the destination address of the indirect branch instruction in the program to be operated and compares the source address and the destination address of the input indirect branch instruction in the address pair table, Verify the flow.

처리부(160)는 상기 입력받은 간접 분기 명령에 대한 출처 주소 및 목적지 주소가 상기 주소 쌍 테이블 내 존재하지 않는 경우, 상기 프로그램의 실행을 정지 또는 종료시킨다. The processing unit 160 stops or terminates the execution of the program when the source address and the destination address of the input indirect branch instruction are not present in the address pair table.

이하에서는 본 발명의 다른 실시 예에 따른 프로그램의 간접 분기 모니터링 방법에 대하여 보다 자세히 살펴보도록 한다. Hereinafter, an indirect branch monitoring method of a program according to another embodiment of the present invention will be described in more detail.

본 발명의 다른 실시 예에 따른 프로그램의 간접 분기 모니터링 방법은 먼저, 학습부(120)가 프로그램의 제어 흐름을 나타내는 주소 쌍 테이블을 생성하여 주소 쌍 테이블 DB(180)에 저장하고, 감시하고자 하는 상기 프로그램의 제어 흐름을 학습한다. 이러한 상기 학습부(120)는 감시 대상인 프로그램이 운영되기 전에 안전한 환경에서 프로파일링을 미리 실시하여 간접 분기 명령의 출처 주소 및 목적지 주소 쌍 들을 수집하여 주소 쌍 테이블을 생성할 수 있다. 즉, 감시하고자 하는 대상 프로세스 내부에서 jmp *, call *, return과 같은 간접 분기 명령이 실행되기 직전에 출처 주소와 목적지 주소를 검사한다. 이때, 상기 주소 쌍 테이블은 해시 테이블로 이루어질 수 있으며, 상기 테이블의 값은 제어 흐름의 간선 중 간접 분기의 일부에 대응된다. 또한, 상기 주소 쌍 테이블 내 동일한 간접 분기 명령의 출처 주소 및 목적지 주소 쌍 들이 존재하는 경우에는 중복하여 상기 주소 쌍 테이블에 삽입하지 않는다. 이러한 주소 쌍 테이블은 주소 쌍 테이블 DB(180)에 저장된다. In the indirect branch monitoring method for a program according to another embodiment of the present invention, the learning unit 120 generates an address pair table indicating a control flow of the program, stores the address pair table in the address pair table DB 180, Learn the control flow of the program. The learning unit 120 may generate the address pair table by collecting the source address and destination address pairs of the indirect branch instruction by performing the profiling in advance in a safe environment before the program to be monitored is operated. That is, source address and destination address are checked immediately before the indirect branch instruction such as jmp *, call *, return is executed within the target process to be monitored. At this time, the address pair table may be a hash table, and the value of the table corresponds to a part of the indirect branch of the trunk of the control flow. When source address and destination address pairs of the same indirect branch instruction exist in the address pair table, they are not inserted in the address pair table in duplicate. This address pair table is stored in the address pair table DB 180. [

이어서, 검증부(140)가 감시하고자 하는 상기 프로그램을 운영하여 제어 흐름이 미리 설정된 정상적인 제어 흐름 그래프에 속하는지 확인한다. 즉, 상기 검증부(140)가 운영하는 프로그램 내 간접 분기 명령에 대한 출처 주소 및 목적지 주소를 입력받고, 간접 분기 명령이 발생할 때 마다 해당하는 출처 주소 및 목적지 주소가 상기 주소 쌍 테이블 내 존재하는지 비교하여 상기 프로그램의 제어 흐름을 검증한다. 이러한 검증부(140)는 만약, 상기 주소 쌍 테이블 내 프로그램의 간접 분기 시 발생하는 출처 주소 및 목적지 주소의 주소 쌍이 존재하지 않는 경우, 상기 프로그램 내 제어흐름에 변조가 존재한다고 판단할 수 있다. 즉, 공격에 의해 코드 포인터가 변조되었거나 제어 흐름이 유효하지만 학습부(120)에서 감지하지 못한 경우에 발생하였다고 판단할 수 있다.Then, the verification unit 140 operates the program to be monitored and checks whether the control flow belongs to a predetermined normal control flow graph. That is, the source address and the destination address of the indirect branch instruction in the program operated by the verification unit 140 are received, and whenever the indirect branch instruction is generated, whether the corresponding source address and destination address exist in the address pair table To verify the control flow of the program. The verifying unit 140 may determine that there is a modulation in the control flow in the program if there is no address pair of the source address and the destination address generated in the indirect branching of the program in the address pair table. That is, it can be determined that a code pointer has been modulated due to an attack or a control flow is valid, but the learning unit 120 can not detect it.

이후, 처리부(160)가 상기 입력받은 간접 분기 명령에 대한 출처 주소 및 목적지 주소가 상기 주소 쌍 테이블 내 존재하지 않는 경우, 상기 프로그램의 실행을 정지 또는 종료시킨다. Thereafter, if the source address and the destination address of the indirect branch instruction input by the processing unit 160 do not exist in the address pair table, the execution of the program is stopped or terminated.

상술한 바와 같이, 실행 시간 프로파일링으로 간접 분기 명령어의 출처 주소와 목적지 주소를 수집하면 실험에 사용되는 입력 데이터에 따라 탐지하지 못하는 분기 명령이 존재할 수 있으며, 학습부에서 포착하지 못한 적법한 분기 명령이 실행되는 경우에는 잘못된 탐지가 발생한다. As described above, when the source address and the destination address of the indirect branch instruction are collected by the execution time profiling, a branch instruction that can not be detected according to the input data used in the experiment may exist, and a legitimate branch instruction When executed, false detection occurs.

이를 방지하고자, 정적 분석에 의한 제어 흐름 그래프를 구성할 수 있다. 그러나 실행 파일의 정적 분석을 위해서는 역어셈블을 해야 하는데, x86과 같이 명령어의 길이가 일정하지 않은 마이크로프로세서에 대한 역어셈블은 완벽하게 수행해 낼 수가 없다. 또한 간접 분기는 실행 시간에 메모리로부터 주소 데이터를 읽어 분기 목적지를 확정하기 때문에 정적 분석으로 정확한 목적지를 예상할 수 없다. 이에 더하여, 공유 라이브러리와 같이 각 프로세스 별로 가상 메모리에서의 주소가 다른 경우에는 정적 분석의 결과는 실행 시간 가상 메모리 주소로 변환되어야 하는 과정을 거쳐야 한다. 즉, 라이브러리 프로그램에 대한 분석 한 번으로 라이브러리를 공유하는 모든 프로세서가 즉시 사용할 수 있는 주소 쌍 테이블을 구성하는 것이 쉽지 않다.To prevent this, a control flow graph based on static analysis can be constructed. However, for the static analysis of the executable file, disassembly is necessary, but disassembly for a microprocessor whose length is not constant like x86 can not be performed completely. In addition, indirect branching can not predict the exact destination by static analysis because it reads the address data from memory at runtime to determine the branch destination. In addition, if the address in the virtual memory is different for each process like the shared library, the result of the static analysis must be converted to the execution time virtual memory address. In other words, it is not easy to construct an address pair table that can be used immediately by all processors sharing the library once analysis of the library program.

동적 분석은 누락되는 적법한 분기가 있지만, 웹 서버와 같이 단순한 임수를 수행하는 프로그램은 일정한 제어 흐름을 반복하기 때문에 전형적인 제어 흐름에 대응하는 주소 쌍 테이블을 구성하면 충분히 실용적인 방어력을 갖게 할 수 있다. 또한, 동적 분석에서 포획된 제어 흐름은 제어 이동의 가능성만 아닌 실제로 일어나는 제어 흐름이기 때문에 동적 분석은 정적 분석보다 정확한 흐름 정보를 줄 수 있다.Dynamic analysis has a legitimate branch that is missing, but a program that performs a simple task, such as a web server, repeats a certain control flow, so that if the address pair table corresponding to a typical control flow is constructed, it can have sufficient practical defense. In addition, since the control flow captured in the dynamic analysis is not a possibility of control movement but is actually a control flow, the dynamic analysis can give more accurate flow information than the static analysis.

특히, 상기 검증부가 제어 흐름의 변조 여부를 빠르게 판단하기 위해서는 검색 성능이 우수한 자료 구조가 필요하다. 실행 시간에 발생하는 간접 분기 명령어 주소 s 와, 목적지 주소 t의 쌍 <s, t> 의 집합형태로 해시 테이블을 구성한다. 검색 성능은 주소 쌍 테이블의 키 값을 구하기 위한 해시 함수와 해시 값의 충돌 처리 방식에 따라 결정된다. Particularly, in order for the verifier to quickly determine whether the control flow is modulated, a data structure having an excellent search performance is needed. The hash table is constructed as a set of indirect branch instruction address s and destination address t pair <s, t> occurring at execution time. The search performance is determined by the hash function for obtaining the key value of the address pair table and the collision processing method of the hash value.

주소 쌍 테이블 접근을 위한 해시 주소는 각 주소의 하위 m 비트를 추출하여 연결한 2m 비트를 사용한다. The hash address for accessing the address pair table uses the 2m bits extracted from the lower m bits of each address.

하기의 수학식 1은 명령어 주소 s 와 목적지 주소 t의 하위 m 비트를 입력 값으로 받는 해시 함수 hm 을 나타낸다.Equation (1) below represents a hash function h m that receives the lower m bits of the command address s and the destination address t as input values.

[수학식 1][Equation 1]

Figure pat00001
(1)
Figure pat00001
(One)

상기 명령어 주소 s와 목적지 주소 t 각각에서 하위 m비트를 추출하여, 이 중 하나의 비트 값을 길이 m 만큼 좌측 시프트 연산으로 상위 비트로 옮긴 후 비트 합 연산으로 두 비트 값을 합친다. The lower m bits are extracted from each of the instruction address s and the destination address t, and one bit value is shifted to the upper bit by the left shift operation by the length m, and the two bit values are added by the bit sum operation.

본 발명에서는 상기 명령어 주소 s 를 상위 비트의 대상으로 구성하였다. 주소의 하위 m 비트는 값의 변화가 가장 빈번한 부분이므로, 해시 주소의 충돌을 확률이 다른 부분의 비트들을 사용하는 것보다 효과적이다.In the present invention, the instruction address s is configured to be a higher bit. Since the lower m bits of the address are the most frequent part of the change in value, it is more effective to use the bits of the parts with different probability of collision of hash addresses.

도 2는 주소 쌍 해시 테이블의 구조를 나타낸 도면이다. 2 is a diagram illustrating a structure of an address pair hash table.

도 2에 도시된 바와 같이, 버킷 체이닝 방식의 테이블 구조로서, 모든 주소 쌍은 주소 쌍 풀 P에 저장하고, 충돌을 일으키는 주소 쌍들은 체인 인덱스 테이블 C를 사용하여 원형 연결 리스트 구조로 버킷 체인을 이루게 한다. 버킷 헤더 테이블

Figure pat00002
의 각 레코드는 주소 쌍 풀 P 의 인덱스 값과 버킷 체인의 길이를 저장한다. As shown in FIG. 2, in a table structure of a bucket chaining type, all address pairs are stored in the address pair pool P, and the address pairs causing the collision are formed into a bucket chain using a circular link list structure using the chain index table C do. Bucket header table
Figure pat00002
Stores the index value of the address pair pool P and the length of the bucket chain.

주소 쌍을 검색할 때

Figure pat00003
에 저장된 색인이 찾고 있는 주소 쌍이 아니면, 주소 쌍을 찾을 때까지 혹은 체인 길이만큼 원형 체인을 검사한다. 체인 내에서 주소 쌍이 확인되면 버킷 헤더에 저장된 체인 시작 인덱스를 검색된 주소 쌍의 풀 인덱스로 갱신한다. 이에 따라, 버킷 체인의 헤더는 항상 최근에 검색한 주소 쌍 인덱스를 갖고 있게 되어 캐싱 효과를 볼 수 있다. 반복문 안에서 발생하는 간접 분기는 동일한 목적지로 제어 흐름을 이동할 가능성이 높기 때문에 P 의 동일 주소 쌍을 반복해서 검색하게 되는데, 두 번째 검색부터는 한 번의 검색으로 제어 흐름을 검증할 수 있게 된다. When searching for an address pair
Figure pat00003
If the stored index is not the address pair you are looking for, check the circular chain until you find the address pair or by the chain length. If an address pair is found in the chain, the chain start index stored in the bucket header is updated with the full index of the retrieved address pair. Thus, the header of the bucket chain always has the address pair index searched recently, so that the caching effect can be seen. Since the indirect branching in the loop is likely to move the control flow to the same destination, the same address pair of P is repeatedly searched. From the second search, the control flow can be verified by one search.

도 3은 비트 수에 대한 체인 길이가 1인 버킷 체인의 비율을 나타낸 그래프이다.3 is a graph showing the ratio of a bucket chain having a chain length of 1 to the number of bits.

도 3에 도시된 바와 같이, SPECint 2006의 각 벤치마크 별 비트 수 m 에 대한 체인 길이가 1인 버킷 체인의 비율을 나타낸다. 이 지표는 해시함수 hm 이 주는 해시 주소의 충돌 가능성이 얼마나 높은지를 간접적으로 보여 주고 있다. 모든 벤치마크에 대하여 m 이 커질수록 길이가 1인 버킷 체인의 비율이 증가한다. 만약, m = 10이면, 길이가 1인 비율이 최대 99% 및 평균 97%를 나타냈다. As shown in FIG. 3, SPECint 2006 represents the ratio of the chain length of 1 to the number of bits per each benchmark, m, of the bucket chain. This indicator indirectly shows how likely the hash address collision is given by the hash function h m . For all benchmarks, the greater the m, the greater the percentage of bucket chains with length 1. If m = 10, the ratio of 1 in length is 99% maximum and 97% average.

도 4는 비트 수에 따른 비교로 분기 주소 쌍의 적법 여부를 검증할 수 있는 비율을 나타낸 표이다.FIG. 4 is a table showing the ratio of verifying whether or not the branch address pair can be verified by comparison according to the number of bits.

도 4에 도시된 바와 같이, 이러한 지표는 체인을 원형 연결 리스트로 구성하였을 때의 캐싱 효과를 보여 준다. 도 4의 가장 왼쪽 열은 벤치마크 명을, 오른쪽 열은 간접 분기 명령어 주소와 목적지 주소에서 추출한 비트 수 m 에 따라 나타나는 비율을 나타낸다. 모든 벤치마크에 대하여 m이 커질수록 비율이 증가함을 알 수 있다. 만약 m=8이상 이면, 정상적인 간접 분기 명령의 경우 평균 1.01회의 비교로 검색을 마칠 수 있음을 확인할 수 있다. 이와 같은 현상은 도 3과 비교하여 비트 수 m이 작아서 해시 테이블에 길이 1을 가지는 주소 쌍의 체인 비율이 낮더라도 원형 체인 구조가 주는 캐시 효과로 성능이 향상될 수 있음을 나타낸다. As shown in FIG. 4, this index shows the caching effect when the chain is composed of circular linked lists. The leftmost column in FIG. 4 represents the benchmark name, and the right column represents the ratio of the number of bits extracted from the indirect branch instruction address and destination address m. It can be seen that the ratio increases as m increases for all benchmarks. If m = 8 or more, it can be confirmed that the search can be completed with an average of 1.01 times of comparison in the case of a normal indirect branch instruction. This phenomenon is compared with FIG. 3, and it is shown that even if the chain ratio of the address pair having the length 1 in the hash table is low because the number of bits is small, the performance can be improved by the cache effect of the circular chain structure.

본 발명에서는 실험을 통해 활발히 변화하는 하위 주소 비트 범위는 m = 16정도인 것을 확인하였다. 특히, m ≥ 16 인 경우에는 성능에 별다른 영향을 주지 않는다. 이러한 현상은 대부분의 간접 분기가 64 KB 범위내에서 이동하는 것을 나타낸다.In the present invention, it has been confirmed through experiments that the range of the lower address bit that is actively changing is about m = 16. Especially, when m ≥ 16, there is no significant effect on performance. This phenomenon indicates that most indirect branches move within the 64 KB range.

이하에서는 앞서 설명한 해시 테이블에 제어 흐름 정보를 저장하고 제어 흐름 감시 코드를 실행 프로그램에 주입하여 실행할 때 발생하는 간접비용을 모의실험을 통해 예측해 보도록 한다. Hereinafter, the control flow information is stored in the hash table described above, and the indirect costs incurred when the control flow monitoring code is injected into the execution program are predicted through simulation.

동적 이진 계측화 도구 Pin을 사용하여 주소 쌍 트레이스를 발생시켜 파일에 저장하고 제어 흐름 검증 프로그램을 실행하는 프로세스와 파일을 통해 주소 쌍 트레이스를 공유할 수 있게 한다. 트레이스가 공유 파일 크기에 도달하면 트레이스 발생을 멈추고, 제어 흐름 검증 프로그램을 실행한다. 파일에 있는 모든 주소 쌍이 소비되면 검증 프로세스는 실행 중단 상태로 들어가고, 감시 대상 프로그램이 다시 주소 쌍 트레이스를 발생시켜 공유 파일에 저장한다. 이와 같은 방법으로 감시 대상 프로그램이 실행을 마칠 때가지 반복하면, 간접 분기 제어 흐름을 나타내는 해시 테이블이 구성된다. Using the dynamic binary metering tool Pin, address-pair traces are generated and stored in a file, allowing the address-pair traces to be shared through processes and files that run the control flow verification program. When the trace reaches the shared file size, it stops tracing and executes the control flow verification program. If all the address pairs in the file are consumed, the verification process enters the execution abort state and the monitored program again generates the address pair trace and stores it in the shared file. When the monitoring target program is repeatedly executed at the end of execution in this manner, a hash table indicating the indirect branch control flow is constructed.

상술한 모의 실험과 동일한 실험 환경에서 벤치마크 프로그램을 검증부에서 운영한다. 학습부에서 구성한 주소 쌍 테이블을 검증부가 읽어 들이고, 학습부와 같은 방식으로 공유 파일을 통해 주소 쌍 트레이스를 검증 프로세스로 전달한다. 제어 흐름에 소요되는 간접비용을 추정하기 위해서 입출력 시간을 제외한 주소 쌍 검색 시간만을 누적시킨다. The benchmark program is operated in the verification department in the same experimental environment as the above-mentioned simulation. The verification unit reads the address pair table constructed by the learning unit and transfers the address pair trace to the verification process through the shared file in the same manner as the learning unit. In order to estimate the indirect cost for the control flow, only the address pair search time excluding the input / output time is accumulated.

실험 환경은 인텔 코어2 쿼드 Q6600 2.40GHz x86 프로세서와 4GB 메모리를 가진 네트워크가 연결 된 Fedora Core 14 리눅스(커널 버전 2.6.35.14-106) 시스템으로 구성하였다. 동적 계측화 도구로서는 Pin(버전 2.11(49303))을, 대상 프로그램은 SPECint 2006(버전 112(v1.1))의 벤치마크를, 컴파일러는 gcc(버전 4.6.3)를 사용하였다. 실험에는 해시 함수 hm 으로 구성한 자료 구조를 활용하였다.The experimental environment consisted of a Fedora Core 14 Linux (kernel version 2.6.35.14-106) system with a network with Intel Core 2 Quad Q6600 2.40GHz x86 processor and 4GB memory. Pin (version 2.11 (49303)) was used as a dynamic measurement tool, SPECint 2006 (version 112 (v1.1)) benchmark was used as a target program, and gcc (version 4.6.3) was used as a compiler. In the experiment, data structure composed of hash function h m was used.

도 5는 간접 분기의 모니터링 실행 시간을 예측하는 그래프이다.5 is a graph for predicting the monitoring execution time of the indirect branch.

도 5에 도시된 바와 같이, 모니터링 기능 없이 실행한 경우에, 측정한 실행 시간에 대한 간접 분기 명령 검증 시간의 비율을 보여주고 있다. 해시 주소에 사용하는 비트 수 m 이 증가할수록 검색 성능이 향상되어 실행 시간이 줄어들며, m ≥ 8 이면, 간접비용의 비율 차가 느리게 감소한다. As shown in FIG. 5, the ratio of the indirect branch instruction verification time to the measured execution time in the case of execution without the monitoring function is shown. As the number of bits m used in the hash address increases, search performance improves and execution time decreases. When m ≥ 8, the ratio of indirect cost decreases slowly.

또한, m = 10 일때, C 언어로 구성된 벤치마크들은 22.3%, C++ 벤치마크들은 131.6% 정도가 간접 분기 감시로 인해 실행 시간이 증가하였다. 간접 분기 감시 비용은 사용 프로그래밍 언어에 의해서도 차이가 난다. 벤치마크의 마지막 세 개는 C++ 프로그램으로, C 프로그램보다 감시 비용이 높게 관찰되었다. 그 이유는 멤버 변수들이 멤버 함수들을 통하여 접근되기 때문에 귀환 명령이 증가하였으며, C++의 가상함수 포인터로 인해 간접 함수 호출이 증가했기 때문이다. 이를 확인하기 위해, 간접 분기 명령의 실행 시간 혼합 비율을 측정하여 보았는데, 그 결과는 도 6과 같다. Also, when m = 10, the execution time was increased by 22.3% for C language benchmarks and 131.6% for C ++ benchmarks due to indirect branch monitoring. The cost of indirect branch monitoring differs depending on the programming language used. The last three of the benchmarks were C ++ programs, which were observed to have higher monitoring costs than C programs. The reason for this is that since the member variables are accessed through member functions, the number of return instructions has increased, and indirect function calls have increased due to C ++ virtual function pointers. In order to confirm this, the execution time mixing ratio of the indirect branch instruction is measured, and the result is shown in FIG.

도 6은 전체 명령에 대한 간접 분기 명령의 동적 비율을 나타낸 표이다. FIG. 6 is a table showing the dynamic ratio of the indirect branch instruction to the entire instruction.

도 6에 도시된 바와 같이, 실행 시간에 간접 분기 명령이 실행되는 비율은 return이 가장 많고, 이어서 jmp *, call * 순이다. 동적 비율의 총합에 대한 평균은 C 벤치마크가 0.007418 이고, C++ 벤치마크는 0.029932로 C++ 언어 측 프로그램이 약 4배 정도 크다.As shown in FIG. 6, the rate at which the indirect branch instruction is executed at the execution time has the largest return, followed by jmp *, call *. The average for the sum of the dynamic ratios is 0.007418 for the C benchmark and 0.029932 for the C ++ benchmark, which is about four times as large as the C ++ language side program.

더불어, 간접 분기 모니터링 방법이 프로그램 공격 탐지 능력을 갖는지 확인하기 위하여 실제 공격 사례들을 재현한 공격 실험을 실시하였다. 또한 RIPE 벤치마크를 사용하여 C 프로그램에 대한 다양한 형태의 버퍼 오버플로우 공격에 대한 방어 여부도 실험하였다. 간접 분기 모니터링의 공격 탐지 실험은 성능과는 무관한 실험이므로 동적 계측화 도구를 사용하여 실험 환경을 구현하였다. 공격 대상으로 사용한 프로그램은 proftpd-1.2.7, samba-2.2, snort-2.4.2 이다.In addition, attack experiments were performed to reproduce actual attack cases in order to confirm whether the indirect branch monitoring method has program attack detection capability. We also tested the protection against various types of buffer overflow attacks on C programs using the RIPE benchmark. Since the attack detection test of the indirect branch monitoring is an experiment independent of the performance, the experimental environment is implemented using the dynamic measurement tool. The programs used for attacking are proftpd-1.2.7, samba-2.2, and snort-2.4.2.

proftpd-1.2.7에는 ASCII 방식의 파일 전송 중 개행 문자를 이용하여 관리자 권한을 얻을 수 있는 치명적인 오류가 있다. CVE-2003-0831에 해당하는 이 취약점을 공격하는 방식은 다음과 같다. 악의적인 파일을 FTP 서버에 업로드하고 같은 파일을 아스키 방식으로 다운로드 받을 때 개행문자를 정확하게 검사하지 못하도록 방해하여 힙에서 버퍼 오버플로우를 발생시킨다. 결과적으로 버퍼 오버플로우를 통해 힙에 저장된 함수 포인터의 주소를 변경하여 공격자가 원하는 공격 코드를 실행하도록 유도한다. 이를 재현하기 위한 취약점 공격은 Solar Eclipse가 작성한 proftpd-not-pro-enough를 사용하였다. 원본 FTP 서버에서 이 공격을 실행하면 공격 성공 시 관리자 쉘을 띄우게 된다. 그러나 본 발명에 따른 프로그램의 간접 분기 모니터링 방법을 사용한 제어 흐름 검증을 실시하면 함수 포인터의 주소가 변경되었음을 확인할 수 있기 때문에 공격이 실패하는 것을 확인하였다.There is a fatal error in proftpd-1.2.7 that can get administrator privileges using newline characters in ASCII file transfer. The following are the ways to exploit this vulnerability, CVE-2003-0831. When uploading a malicious file to an FTP server and downloading the same file as an ASCII file, it prevents the newline character from being correctly scanned, causing a buffer overflow in the heap. As a result, the address of the function pointer stored in the heap is changed through a buffer overflow, which induces the attacker to execute the desired attack code. We used proftpd-not-pro-enough by Solar Eclipse to exploit this vulnerability. If this attack is executed on the original FTP server, the administrator shell will be launched when the attack is successful. However, when the control flow verification using the indirect branch monitoring method of the program according to the present invention is performed, it is confirmed that the address of the function pointer is changed, so that the attack is confirmed to fail.

samba-2.2.1a에는 특정 함수를 실행하는 과정에서 버퍼에 과도한 문자열을 복사하여 버퍼 오버플로우를 일으키고, 관리자 권한을 얻을 수 있는 치명적인 버그가 있다. CVE-2003-0201에 해당하는 이 취약점을 공격하는 방식은 다음과 같다. There is a fatal bug in samba-2.2.1a that causes a buffer overflow by copying excessive strings to the buffer during the execution of certain functions, and getting administrator privileges. The following are the ways to exploit this vulnerability, CVE-2003-0201.

원격 공격자가 1024바이트를 넘는 문자열을 변수에 전달함으로써 버퍼 오버플로우를 발생시킨다. 이때, 스택에 저장되어 있는 반환 주소가 변경되어 반환 시 공격 코드가 실행되고 관리자 권한을 얻게 된다. samba의 취약점 공격을 재현하기 위해 H D Moore가 작성한 trans2root.pl을 사용하였다. 이 공격은 변조된 스택의 반환 주소를 추적하기 위해 무작위 대입 공격을 시도한다. 원본 Samba에서는 공격이 성공하면 화면이 멈추고 커서만 깜박거리게 된다. A remote attacker passes a string of more than 1024 bytes to a variable, causing a buffer overflow. At this time, the return address stored in the stack is changed, and upon return, the attack code is executed and the administrator authority is obtained. We use trans2root.pl written by H D Moore to simulate vulnerability attacks of samba. This attack attempts a random assignment attack to track the return address of the modulated stack. In the original Samba, if the attack succeeds, the screen stops and only the cursor blinks.

이때, ?hoami' 명령을 통해 관리자 권한을 획득할 수 있다. 간접 분기 모니터링을 사용한 제어 흐름 검증을 실시하면 공격이 탐지된다. FTP 서버에서와 마찬가지로 검색 단계에서 간접 분기 주소와의 비교를 통해 반환 주소가 변경되었음을 확인할 수 있기 때문이다.At this time, you can acquire administrator privilege through? Hoami 'command. An attack is detected when a control flow verification using indirect branch monitoring is performed. This is because, as in the FTP server, it can be verified that the return address has been changed through comparison with the indirect branch address in the search phase.

snort-2.4.2에 있는 Back Orifice 전처리기는 취약한 시스템에서 임의의 코드를 원격으로 실행할 수 있는 버퍼 오버플로우 취약점을 가지고 있다. CVE-2005-3252에 해당하는 이 취약점을 공격하는 방식은 다음과 같다. Back Orifice 전처리기는 Back Orifice의 ping 메시지가 있는지 확인하기 위한 패킷을 복호화 한다. 이때 ping 탐지 코드는 패킷으로부터 읽어 들인 데이터의 양을 제한하지 않고 고정된 크기의 버퍼에 저장한다. 이 취약 코드는 Back Orifice의 포트를 오가는 UDP 패킷을 처리하며, 공격자는 호스트나 네트워크에 조작된 UDP 패킷을 보냄으로써 임의의 코드를 실행하여 관리자 권한을 얻을 수 있다. The Back Orifice preprocessor in snort-2.4.2 has a buffer overflow vulnerability that could allow arbitrary code to be executed remotely on a vulnerable system. The following are the ways to exploit this vulnerability, CVE-2005-3252. The Back Orifice preprocessor decrypts packets to determine if there is a ping message in the back Orifice. At this time, the ping detection code does not limit the amount of data read from the packet but stores it in a fixed size buffer. This vulnerability handles UDP packets that traverse ports on Back Orifice, and attackers can execute arbitrary code to gain administrative privileges by sending manipulated UDP packets to the host or network.

또한, snort의 취약점 공격을 재현하기 위해 rd가 작성한 THCsnortbo.c를 사용하였다. 이 공격은 snort의 취약한 코드에 있는 변수 값을 조작하고 패킷에 임의의 코드가 포함된 과다한 데이터를 전송하여 스택 버퍼 오버플로우를 일으킴으로써, 원격으로 접속하여 관리자 권한을 수행할 수 있도록 리버스 텔넷을 위한 특정 포트를 반환한다. NetCat을 이용하여 해당 IP 주소와 특정 포트로 접속하여 'whoami' 명령을 수행하면 관리자 권한을 얻었음을 확인할 수 있다. 이때, 간접 분기 모니터링을 사용한 제어 흐름 검증을 실시하면 공격이 실패하고 snort는 즉시 종료된다. 검색 단계에서 간접 분기 주소와의 비교를 통해 비정상적인 주소로 제어 흐름이 변경되었음을 확인할 수 있기 때문이다.We also used THCsnortbo.c, written by rd, to recreate snort vulnerability attacks. This attack manipulates variable values in snort's vulnerable code and sends an excessive amount of data containing arbitrary code to the packet, causing a stack buffer overflow, so that it can remotely connect to perform administrative privileges. Returns a specific port. Using NetCat, connect to the IP address and the specific port and confirm that you obtained the administrator privilege by executing 'whoami' command. At this time, if the control flow verification using indirect branch monitoring is performed, the attack fails and the snort is terminated immediately. In the search phase, it can be confirmed that the control flow is changed to an abnormal address by comparing with the indirect branch address.

마지막으로 C 프로그램에 대한 다양한 형태의 버퍼 오버플로우 공격에 대한 방어 효과를 실험하기 위해 Wilander와 Kamkar가 개발한 RIPE에 대해 공격과 방어를 실험하였다. 기존의 18가지 프로그램에 형식 문자열 공격을 추가하여 확장시킨 이 벤치마크는 공격자가 직접 공격 방식을 선택해서 쉘코드를 수행할 수 있다. 간접 분기 모니터링과 함께 벤치마크를 실행할 경우에는 모든 공격이 탐지되었다. 이 실험 결과로 다양한 공격 방식에 대해서도 간접 분기 모니터링이 효과적임을 확인할 수 있다. Finally, we experimented with attacks and defenses against RIPE developed by Wilander and Kamkar in order to test the effectiveness of various types of buffer overflow attacks against C programs. This benchmark, extended by adding format string attacks to the existing 18 programs, allows an attacker to execute shell code by choosing direct attack methods. When performing benchmarks with indirect branch monitoring, all attacks were detected. As a result of this experiment, we can confirm that indirect branch monitoring is effective for various attack methods.

도 7은 간접 분기 모니터링의 방어 실험을 정리한 표이다.FIG. 7 is a table summarizing defense experiments of indirect branch monitoring.

도 7에 도시된 바와 같이, 왼쪽 열부터 취약한 소프트웨어 명, 방어한 공격 형태와 방어한 메모리 영역 및 방어 대상을 확인할 수 있다. As shown in FIG. 7, from the left column, a weak software name, a defensive attack type, a defended memory area, and a defensive target can be confirmed.

이처럼, 본 발명에 따른 프로그램의 간접 분기 모니터링 방법 및 시스템은 제어 흐름을 보호하기 위해 실행 시간 중 제어 흐름 자료 구조와의 비교를 통한 분기 주소 쌍 검증을 수행한다. 주소 쌍 테이블의 효율성 검증 실험을 통해 해시 함수를 최적화하는 주소 쌍의 비트 수를 찾을 수 있다. 또한 이를 적용하여 최신 프로세서에서 성능을 측정하는 모의 실험을 실시하였고, 예측한 간접 비용의 수준은 사용자가 충분히 감내할 수 있는 정도로 예상할 수 있다. 더불어, 공격자의 다양한 공격을 효과적으로 방어함으로써 프로그램을 안전하고 실용적으로 사용할 수 있음을 확인하였다. As described above, the method and system for indirect branch monitoring of a program according to the present invention performs branch address pair verification through comparison with a control flow data structure during execution time in order to protect the control flow. We can find the number of bits of the address pair that optimizes the hash function through the efficiency verification experiment of the address pair table. In addition, we have implemented simulations to measure the performance of the latest processors by applying them, and predicted levels of indirect costs can be expected to be enough for the user to tolerate. In addition, we confirmed that the program can be used safely and practically by effectively defending various attacks by attackers.

또한, 이러한 프로그램의 간접 분기 모니터링 방법 및 시스템은 컴퓨터로 실행하기 위한 프로그램이 기록된 컴퓨터 판독가능 기록매체에 저장될 수 있다. 이때, 컴퓨터가 읽을 수 있는 기록매체는 컴퓨터 시스템에 의하여 읽혀질 수 있는 데이터가 저장되는 모든 종류의 기록 장치를 포함한다. 컴퓨터가 읽을 수 있는 기록 장치의 예로는 ROM, RAM, CD-ROM, DVD±ROM, DVD-RAM, 자기 테이프, 플로피 디스크, 하드 디스크(hard disk), 광데이터 저장장치 등이 있다. 또한, 컴퓨터가 읽을 수 있는 기록매체는 네트워크로 연결된 컴퓨터 장치에 분산되어 분산방식으로 컴퓨터가 읽을 수 있는 코드가 저장되고 실행될 수 있다.Also, an indirect branch monitoring method and system for such a program may be stored in a computer-readable recording medium on which a program for execution by a computer is recorded. At this time, the computer-readable recording medium includes all kinds of recording apparatuses in which data that can be read by a computer system is stored. Examples of the computer readable recording medium include ROM, RAM, CD-ROM, DVD 占 ROM, DVD-RAM, magnetic tape, floppy disk, hard disk, optical data storage, and the like. In addition, the computer-readable recording medium may be distributed to network-connected computer devices so that computer-readable codes can be stored and executed in a distributed manner.

본 발명의 프로그램의 간접 분기 모니터링 방법 및 시스템은 실행하고자 하는 프로그램 내 간접 분기 발생 시, 미리 설정된 제어 흐름에 따라 프로그램이 구동되는지 여부를 파악하여, 공격자에 의해 변조된 프로그램 코드가 수행되는 것을 미연에 방지하여 미리 설정된 제어 흐름에 따라 프로그램이 정확하게 구동될 수 있도록 하는 효과가 있다. The indirect branch monitoring method and system of the program of the present invention can detect whether or not a program is driven according to a preset control flow when an indirect branch occurs in a program to be executed and recognize that the program code modulated by the attacker is executed So that the program can be accurately driven according to a preset control flow.

상기에서는 본 발명의 바람직한 실시 예에 대하여 설명하였지만, 본 발명은 이에 한정되는 것이 아니고 본 발명의 기술 사상 범위 내에서 여러 가지로 변형하여 실시하는 것이 가능하고 이 또한 첨부된 특허청구범위에 속하는 것은 당연하다.
While the present invention has been described in connection with what is presently considered to be practical exemplary embodiments, it is to be understood that the invention is not limited to the disclosed embodiments, but, on the contrary, Do.

120: 학습부 140: 검증부
160: 처리부 180: 주소 쌍 테이블 DB
120: learning unit 140: verification unit
160: processor 180: address pair table DB

Claims (7)

학습부가 프로그램의 제어 흐름을 나타내는 주소 쌍 테이블을 생성하여 감시하고자 하는 상기 프로그램의 제어 흐름을 학습하는 단계; 및
검증부가 운영되는 프로그램 내 간접 분기 명령에 대한 출처 주소 및 목적지 주소를 입력받고, 입력받은 간접 분기 명령에 대한 출처 주소 및 목적지 주소가 상기 주소 쌍 테이블 내 존재하는지 비교하여 상기 프로그램의 제어 흐름을 검증하는 단계;
를 포함하는 프로그램의 간접 분기 모니터링 방법.
Learning a control flow of the program to be monitored by generating an address pair table indicating a control flow of the learning part program; And
A source address and a destination address of an indirect branch instruction in the program in which the verification unit is operated, and verifies the control flow of the program by comparing source address and destination address of the input indirect branch instruction in the address pair table step;
A method for monitoring an indirect branch of a program.
제1항에 있어서,
상기 학습부가 프로그램의 제어 흐름을 학습하는 단계는
상기 프로그램 내 제어 흐름을 나타내는 간접 분기 명령의 출처 주소 및 목적지 주소 쌍 들을 수집하여 주소 쌍 테이블을 생성하는 것을 특징으로 하는 프로그램의 간접 분기 모니터링 방법.
The method according to claim 1,
The step of learning the control flow of the learning part program
Wherein the address pair table is generated by collecting source address and destination address pairs of an indirect branch instruction indicating a control flow in the program.
제2항에 있어서,
상기 주소 쌍 테이블은
해시 테이블로 이루어지는 것을 특징으로 하는 프로그램의 간접 분기 모니터링 방법.
3. The method of claim 2,
The address pair table
A hash table, and a hash table.
제1항에 있어서,
상기 검증부가 프로그램의 제어흐름을 검증하는 단계는
상기 주소 쌍 테이블 내 프로그램의 간접 분기 시 발생하는 출처 주소 및 목적지 주소의 주소 쌍이 존재하지 않는 경우, 상기 프로그램 내 제어흐름에 변조가 존재한다고 판단하는 것을 특징으로 하는 프로그램의 간접 분기 모니터링 방법.
The method according to claim 1,
The step of verifying the control flow of the verifying part program
Wherein if there is no address pair of a source address and a destination address generated in indirect branching of the program in the address pair table, it is determined that there is a modulation in the control flow in the program.
제1항에 있어서,
처리부가 상기 입력받은 간접 분기 명령에 대한 출처 주소 및 목적지 주소가 상기 주소 쌍 테이블 내 존재하지 않는 경우, 상기 프로그램의 실행을 정지 또는 종료시키는 단계;
를 더 포함하는 것을 특징으로 하는 프로그램의 간접 분기 모니터링 방법.
The method according to claim 1,
Stopping or terminating the execution of the program if the source address and the destination address of the indirect branch instruction are not present in the address pair table;
Further comprising the steps of:
제1항 내지 제5항 중 어느 한 항에 따른 방법을 컴퓨터로 실행하기 위한 프로그램이 기록된 컴퓨터 판독가능 기록매체.
A computer-readable recording medium on which a program for executing a method according to any one of claims 1 to 5 is recorded.
프로그램의 제어 흐름을 나타내는 주소 쌍 테이블을 생성하여 감시하고자 하는 상기 프로그램의 제어 흐름을 학습하는 학습부;
운영되는 프로그램 내 간접 분기 명령에 대한 출처 주소 및 목적지 주소를 입력받고, 입력받은 간접 분기 명령에 대한 출처 주소 및 목적지 주소가 상기 주소 쌍 테이블 내 존재하는지 비교하여 상기 프로그램의 제어 흐름을 검증하는 검증부; 및
상기 입력받은 간접 분기 명령에 대한 출처 주소 및 목적지 주소가 상기 주소 쌍 테이블 내 존재하지 않는 경우, 상기 프로그램의 실행을 정지 또는 종료시키는 처리부;
를 포함하는 프로그램의 간접 분기 모니터링 시스템.
A learning unit for learning a control flow of the program to be monitored by generating an address pair table indicating a control flow of the program;
A verification unit for receiving a source address and a destination address for an indirect branch instruction in an operating program and verifying a control flow of the program by comparing whether a source address and a destination address for the input indirect branch instruction exist in the address pair table; ; And
A processing unit for stopping or terminating the execution of the program when the source address and the destination address for the input indirect branch instruction do not exist in the address pair table;
The program comprising:
KR1020130168536A 2013-12-31 2013-12-31 Method and system for indirectness branch monitoring of program KR101625129B1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
KR1020130168536A KR101625129B1 (en) 2013-12-31 2013-12-31 Method and system for indirectness branch monitoring of program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
KR1020130168536A KR101625129B1 (en) 2013-12-31 2013-12-31 Method and system for indirectness branch monitoring of program

Publications (2)

Publication Number Publication Date
KR20150078806A true KR20150078806A (en) 2015-07-08
KR101625129B1 KR101625129B1 (en) 2016-05-27

Family

ID=53791272

Family Applications (1)

Application Number Title Priority Date Filing Date
KR1020130168536A KR101625129B1 (en) 2013-12-31 2013-12-31 Method and system for indirectness branch monitoring of program

Country Status (1)

Country Link
KR (1) KR101625129B1 (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20180078702A (en) * 2016-12-30 2018-07-10 홍익대학교 산학협력단 Apparatus and method for dynamic control-flow analysis for prescribing control-flow with Inputs generated from grammar
KR20200092744A (en) * 2019-01-25 2020-08-04 서울대학교산학협력단 Apparatus for detecting abnormal branch based on machine learning and method therefor
CN111898120A (en) * 2020-06-29 2020-11-06 中国科学院信息工程研究所 Control flow integrity protection method and device
CN112463164A (en) * 2020-12-14 2021-03-09 记忆科技(深圳)有限公司 SoC program execution display positioning method and device, computer equipment and storage medium
CN114363394A (en) * 2021-12-23 2022-04-15 杭州当虹科技股份有限公司 Edge equipment discovery method based on BUSYBOX

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2020188731A1 (en) * 2019-03-19 2020-09-24 日本電気株式会社 Information processing device, information processing method, and recording medium

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20180078702A (en) * 2016-12-30 2018-07-10 홍익대학교 산학협력단 Apparatus and method for dynamic control-flow analysis for prescribing control-flow with Inputs generated from grammar
KR20200092744A (en) * 2019-01-25 2020-08-04 서울대학교산학협력단 Apparatus for detecting abnormal branch based on machine learning and method therefor
CN111898120A (en) * 2020-06-29 2020-11-06 中国科学院信息工程研究所 Control flow integrity protection method and device
CN111898120B (en) * 2020-06-29 2023-10-10 中国科学院信息工程研究所 Control flow integrity protection method and device
CN112463164A (en) * 2020-12-14 2021-03-09 记忆科技(深圳)有限公司 SoC program execution display positioning method and device, computer equipment and storage medium
CN112463164B (en) * 2020-12-14 2024-02-13 记忆科技(深圳)有限公司 SoC program execution display positioning method, device, computer equipment and storage medium
CN114363394A (en) * 2021-12-23 2022-04-15 杭州当虹科技股份有限公司 Edge equipment discovery method based on BUSYBOX

Also Published As

Publication number Publication date
KR101625129B1 (en) 2016-05-27

Similar Documents

Publication Publication Date Title
CN109002721B (en) Mining analysis method for information security vulnerability
Schwartz et al. All you ever wanted to know about dynamic taint analysis and forward symbolic execution (but might have been afraid to ask)
Abera et al. C-FLAT: control-flow attestation for embedded systems software
KR101625129B1 (en) Method and system for indirectness branch monitoring of program
Wang et al. Software tamper resistance: Obstructing static analysis of programs
Clause et al. Dytan: a generic dynamic taint analysis framework
Brumley et al. BitScope: Automatically dissecting malicious binaries
Huang et al. Software crash analysis for automatic exploit generation on binary programs
US7913092B1 (en) System and method for enforcing application security policies using authenticated system calls
Chang et al. Inputs of coma: Static detection of denial-of-service vulnerabilities
Chen et al. Pinpointing vulnerabilities
Graa et al. Detecting control flow in smarphones: Combining static and dynamic analyses
Wood et al. Keyloggers in Cybersecurity Education.
Wang et al. {MetaSymploit}:{Day-One} Defense against Script-based Attacks with {Security-Enhanced} Symbolic Analysis
CN110647748B (en) Code multiplexing attack detection system and method based on hardware characteristics
Zhang et al. A distributed framework for demand-driven software vulnerability detection
Wang et al. Tunter: assessing exploitability of vulnerabilities with taint-guided exploitable states exploration
CN113779578A (en) Intelligent confusion method and system for mobile terminal application
CN115168861A (en) Data security verification method, device, equipment and storage medium
Hauser et al. Sleak: Automating address space layout derandomization
Fan et al. Obfuscated malicious code detection with path condition analysis
Shoshitaishvili Building a Base for Cyber-autonomy
Atzeni et al. HAIT: Heap Analyzer with Input Tracing.
Oh et al. Deview: Confining progressive web applications by debloating web apis
Zhao et al. Collaborative reversing of input formats and program data structures for security applications

Legal Events

Date Code Title Description
E902 Notification of reason for refusal
E701 Decision to grant or registration of patent right
GRNT Written decision to grant
LAPS Lapse due to unpaid annual fee