KR101900813B1 - Apparatus and method for dynamic control-flow analysis for prescribing control-flow with Inputs generated from grammar - Google Patents

Apparatus and method for dynamic control-flow analysis for prescribing control-flow with Inputs generated from grammar Download PDF

Info

Publication number
KR101900813B1
KR101900813B1 KR1020160183723A KR20160183723A KR101900813B1 KR 101900813 B1 KR101900813 B1 KR 101900813B1 KR 1020160183723 A KR1020160183723 A KR 1020160183723A KR 20160183723 A KR20160183723 A KR 20160183723A KR 101900813 B1 KR101900813 B1 KR 101900813B1
Authority
KR
South Korea
Prior art keywords
control flow
character string
grammar
input
address
Prior art date
Application number
KR1020160183723A
Other languages
Korean (ko)
Other versions
KR20180078702A (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 KR1020160183723A priority Critical patent/KR101900813B1/en
Publication of KR20180078702A publication Critical patent/KR20180078702A/en
Application granted granted Critical
Publication of KR101900813B1 publication Critical patent/KR101900813B1/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/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
    • G06F21/54Monitoring 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 by adding security routines or objects to 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
    • G06F17/2264
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/12Use of codes for handling textual entities
    • G06F40/151Transformation

Abstract

문법에 의하여 생성된 입력으로 제어흐름을 처방하기 위한 동적 제어흐름 분석 장치 및 방법이 제공된다. 입력 생성 장치는 문맥 자유 문법에 따라 생성된 문장들의 집합인 문장 집합을 확장하여, 문장들의 특수 단말을 확장 정규 문법으로 제한된 문자열 생성 규칙에 따라 의미있는 문자열로 변환하고, 제어흐름 분석 장치는 변환된 문자열을 포함하는 전체 문자열을 입력으로 받아 프로그램이 실행되는 중 간접 분기 명령이 발생하면, 적법한 제어흐름을 분석 및 선별한다.An apparatus and method for dynamic control flow analysis for prescribing a control flow with inputs generated by a grammar are provided. The input generating apparatus expands a set of sentences, which is a set of sentences generated according to the context free grammar, to convert a special terminal of sentences into a meaningful string according to a rule for generating a string limited to an extended regular grammar. If an indirect branch instruction occurs while the program is being executed with the entire string containing the string as input, the legitimate control flow is analyzed and selected.

Figure R1020160183723
Figure R1020160183723

Description

문법에 의하여 생성된 입력으로 제어흐름을 처방하기 위한 동적 제어흐름 분석 장치 및 방법{Apparatus and method for dynamic control-flow analysis for prescribing control-flow with Inputs generated from grammar}TECHNICAL FIELD The present invention relates to a dynamic control flow analysis apparatus and method for prescribing a control flow using an input generated by a grammar,

본 발명은 문법에 의하여 생성된 입력으로 제어흐름을 처방하기 위한 동적 제어흐름 분석 장치 및 방법에 관한 것으로서, 보다 상세하게는, 문맥 자유 문법과 확장 정규 문법에 의하여 생성된 문장을 의미있는 임의의 문자열로 변환하고, 변환된 문자열을 입력으로 하여 적법한 제어흐름을 처방할 수 있는 동적 제어흐름 분석 장치 및 방법에 관한 것이다.The present invention relates to a dynamic control flow analysis apparatus and method for prescribing a control flow with an input generated by a grammar, and more particularly, to a dynamic control flow analysis apparatus and method for analyzing a sentence generated by a context free grammar and an extended regular grammar, To a dynamic control flow analysis apparatus and method capable of prescribing a proper control flow by using a converted character string as an input.

실행 중에 공격받은 프로그램은 정상적인 제어흐름에서 벗어나 공격자가 주입한 공격 코드를 실행하거나, 시스템 내에 이미 있는 프로그램의 명령어들을 공격자가 원하는 순서로 제어흐름을 재편성하여 실행하게 한다. 공격자는 프로그램의 제어흐름을 바꾸기 위해 제어흐름에 관여하는 데이터 값을 변경한다. 제어흐름에 관여하는 데이터는 명령어 주소를 담고 있는 주소 메모리의 코드 포인터를 공격하는 경우가 대부분이다.An attacked program runs out of normal control flow, executes an attack code injected by an attacker, or re-forms a control flow in an order that an attacker wants to execute a program command already in the system. The attacker changes the data value involved in the control flow to change the control flow of the program. Most of the data involved in the control flow attacks the code pointer of the address memory that contains the instruction address.

일 예로 배열 경계를 넘지 않게 하는 안전 장치를 두지 않으면 프로그램은 버퍼 오버플로우 공격에 취약하다. 최근에는 악성 코드를 직접 삽입하기 보다는 시스템에 상존하고 있는 프로그램의 명령어들을 재사용하는 공격인 ROP[8, 9]가 더 위협적이다. ROP 공격은 표준 C 라이브러리에서 튜링-완전(turing-complete)한 가젯을 찾을 수 있어 공격자는 시스템에서 의도하는 모든 작업을 프로그래밍 할 수 있다.For example, programs are vulnerable to buffer overflow attacks if they do not have a safeguard that does not cross the array boundaries. In recent years, ROP [8, 9], an attack that reuses program commands residing in the system, is more threatening than directly inserting malicious code. An ROP attack can find a turing-complete gadget in the standard C library, allowing an attacker to program any work the system intends to do.

이러한 공격을 극복하기 위해 제시되는 기존의 방어 방법들은 대부분 실행 시간 과부하가 높고 호환성 문제로 인하여 실용성이 떨어진다. The existing defense methods presented to overcome these attacks are mostly overloaded with execution time and are not practical because of compatibility problems.

한편, 제어흐름의 측면에서 프로그램의 구조는 예상되는 정상적인 입력을 처리하는 부분과 예외적인 상황을 처리하는 부분으로 구분된다. 웹 서버를 예로 들면 서비스의 요청 및 응답과 같이 평상적인 작업이 반복되는 부분과 비정상적인 입력이나 오류 상황에 대응하는 부분으로 나뉜다. 정적 분석은 이러한 두 가지 경우의 제어흐름을 구분하지 못하고 모든 가능한 제어흐름을 합법적이라고 판단한다. 이러한 정적 분석의 문제는 예외적인 상황을 대비하여 작성된 부분이 모든 경우를 감당하지 못할 뿐만 아니라, 정적 분석의 한계인 간접 분기 명령의 목적지 분석이 완전하지 못하여 실제로 발생하지 않는 흐름까지 합법적인 제어흐름에 포함시키는 것이다. 따라서, 정적 분석에 의한 제어흐름 정보들은 공격에 이용당할 가능성이 크다.On the other hand, in terms of the control flow, the structure of the program is divided into two parts, one part for processing the expected normal input and the other part for handling the exceptional situation. Web servers, for example, are divided into two parts: normal tasks such as service request and response, and repetition of abnormal input or error situations. Static analysis can not distinguish between these two cases of control flow and judges all possible control flows as legitimate. The problem of this static analysis is that not only the part prepared for the exceptional situation can not cope with all cases but also the flow of the indirect branching command which is the limit of the static analysis is not completely complete . Therefore, the control flow information by static analysis is likely to be used for attack.

국내 등록특허 제10-0965426호(2010.06.15. 등록)Domestic Registration No. 10-0965426 (Registered on June 15, 2010)

전술한 문제점을 해결하기 위하여 본 발명이 이루고자 하는 기술적 과제는, 실제 정상적인 웹 서버의 제어흐름만 비교해보면 정적 분석 결과의 일부만이 관찰되며, 그 외의 제어흐름은 외부 공격이나 내부적인 오류 상황에 발생하거나, 본래부터 발생하지 않으므로, 극도의 안전성이나 보안이 요구되는 프로그램 실행에 있어서는 가능한 모든 제어흐름을 합법적으로 간주하지 않고, 사전에 테스팅 또는 동적 분석 과정을 거쳐 확인된 제어흐름만을 허용함으로써 프로그램의 안전성과 보안성을 향상시킬 수 있는 문법에 의하여 생성된 입력으로 제어흐름을 처방하기 위한 동적 제어흐름 분석 장치 및 방법을 제시하는 데 있다.SUMMARY OF THE INVENTION In order to solve the above-described problems, the technical problem to be solved by the present invention is that only a part of a static analysis result is actually observed in comparison with a control flow of a normal web server, and other control flows occur in an external attack or an internal error situation , It does not occur inherently. Therefore, it is not necessary to consider all possible control flows as legitimate in the execution of programs requiring extreme safety or security, And to propose a dynamic control flow analysis apparatus and method for prescribing a control flow with an input generated by a grammar capable of improving security.

본 발명의 해결과제는 이상에서 언급된 것들에 한정되지 않으며, 언급되지 아니한 다른 해결과제들은 아래의 기재로부터 당업자에게 명확하게 이해될 수 있을 것이다.The solution of the present invention is not limited to those mentioned above, and other solutions not mentioned can be clearly understood by those skilled in the art from the following description.

전술한 기술적 과제를 해결하기 위한 수단으로서, 본 발명의 실시 예에 따르면, 문법에 의하여 생성된 입력으로 제어흐름을 처방하기 위한 동적 제어흐름 분석 장치는, 문맥 자유 문법에 따라 생성된 문장들의 집합인 문장 집합을 확장하여, 상기 문장들의 특수 단말을 확장 정규 문법으로 제한된 문자열 생성 규칙에 따라 의미있는 문자열로 변환하는 입력 생성 장치; 및 상기 변환된 문자열을 포함하는 전체 문자열을 입력으로 받아 프로그램이 실행되는 중 간접 분기 명령이 발생하면, 적법한 제어흐름을 분석 및 선별하는 제어흐름 분석 장치;를 포함한다.According to an embodiment of the present invention, a dynamic control flow analysis apparatus for prescribing a control flow with input generated by a grammar includes a set of sentences generated according to a context free grammar An input generating device for expanding a sentence set and converting a special terminal of the sentences into a meaningful string according to a rule for generating a string limited by an extended normal grammar; And a control flow analyzing unit for analyzing and selecting a proper control flow when an intermediate branch instruction for executing a program is received and the entire string including the converted character string is inputted.

상기 입력 생성 장치는, 상기 문맥 자유 문법 기반의 입력 명세를 해석하여 문법 매핑 테이블을 생성하고, 상기 정규 문법 기반의 문자열 명세를 해석하여 문자열 생성 규칙 테이블을 생성하는 명세 해석부; 상기 문법 매핑 테이블로부터 도출가능한 모든 문장들을 생성하여 문장 집합 테이블에 열거하는 문장 열거부; 상기 문장 집합 테이블로부터 사용하고자 하는 모든 문장들을 출력하는 문장 출력부; 및 상기 문자열 생성 규칙 테이블에 설정된 문자열 생성 규칙에 따라 상기 출력된 문장들 내의 특수 단말을 상기 의미있는 문자열로 변환하는 문자열 변환부;를 포함한다.Wherein the input generating apparatus comprises: a specification analyzing unit for generating a syntax mapping table by interpreting the input specification based on the context free grammar and generating a string generating rule table by analyzing the string specification based on the regular grammar; A sentence sequence rejection unit for generating all sentences derivable from the grammar mapping table and listing them in a sentence set table; A sentence output unit for outputting all sentences to be used from the sentence set table; And a character string conversion unit for converting the special terminal in the output sentences into the meaningful character string according to the character string generation rule set in the character string generation rule table.

상기 명세 해석부는, 상기 문맥 자유 문법을 기반으로 작성된 입력 명세를 해석하여 비단말에 색인 번호를 매핑한 비단말 테이블을 생성하고, 단말에 색인 번호를 매핑한 단말 테이블을 생성한 후, 상기 비단말 테이블과 상기 단말 테이블의 색인 번호와 상기 입력 명세의 줄번호로 이루어진 상기 문법 매핑 테이블을 생성한다.The specification analyzing unit analyzes an input specification created on the basis of the context free grammar, generates a non-terminal table in which an index number is mapped to non-terminal words, generates a terminal table in which an index number is mapped to the terminal, The grammar mapping table including a table, an index number of the terminal table, and a line number of the input specification.

상기 명세 해석부는, 상기 문자열 명세에 상기 특수 단말 별로 지정된 문자열을 이용하여 상기 문자열 생성 규칙 테이블을 생성한다.The specification analyzing unit generates the character string generation rule table using the character string specified for each special terminal in the character string specification.

상기 문자열 변환부는, 상기 출력된 모든 문장들에 속한 일반 단말은 문장에서 문자열로 속성을 변환하고, 상기 모든 문장들에 속한 특수 단말은 상기 문자열 생성 규칙을 참조하여 해당하는 문자열로 변환하여 상기 모든 문장들을 상기 전체 문자열로 변환한다.The character string conversion unit converts an attribute of a sentence into a character string of a general terminal belonging to the output sentences, converts the attribute into a corresponding character string by referring to the character string generation rule, Into the entire string.

상기 제어흐름 분석 장치는, 상기 전체 문자열을 입력받아 상기 프로그램이 실행되는 동안 간접 분기 명령이 발생하면, 상기 간접 분기 명령에 해당하는 주소 쌍을 추출하여 누적 주소 저장부에 저장하는 주소 검사부; 및 상기 누적 주소 저장부에 누적된 주소쌍을 제어흐름 처방 테이블로 출력하는 주소 출력부;를 포함한다.An address checking unit for extracting an address pair corresponding to the indirect branch instruction and storing the address pair in an accumulated address storage unit when an indirect branch instruction is generated while the program is being executed and the entire string is input; And an address output unit for outputting the address pairs accumulated in the cumulative address storage unit to the control flow prescription table.

상기 주소 검사부는, 상기 프로그램이 실행되는 동안 입력되는 명령어를 분석하여 상기 간접 분기 명령인지를 판단하고, 상기 명령어가 발생한 메모리의 출처 주소 및 상기 명령어의 목적지 주소를 추출하여 상기 주소 쌍을 생성하며, 상기 생성된 주소 쌍은 상기 프로그램의 동적 제어흐름 분석 결과로서 상기 제어흐름 처방 테이블에 저장된다.Wherein the address checking unit analyzes the instruction input during the execution of the program to determine whether the instruction is an indirect branch instruction and generates the address pair by extracting a source address of the memory where the instruction is generated and a destination address of the instruction, The generated address pair is stored in the control flow prescription table as a result of dynamic control flow analysis of the program.

한편, 본 발명의 다른 실시 예에 따르면, (A) 문맥 자유 문법에 따라 생성된 문장들의 집합인 문장 집합을 확장하여, 상기 문장들의 특수 단말을 확장 정규 문법으로 제한된 문자열 생성 규칙에 따라 의미있는 문자열로 변환하는 단계; 및 (B) 상기 변환된 문자열을 포함하는 전체 문자열을 입력으로 받아 프로그램이 실행되는 중 간접 분기 명령이 발생하면, 적법한 제어흐름을 분석 및 선별하는 단계;를 포함한다.According to another embodiment of the present invention, (A) a sentence set which is a set of sentences generated according to a context free grammar is extended, and a special terminal of the sentences is defined as a meaningful string ; And (B) analyzing and selecting a legitimate control flow when an intermediate branch instruction for executing a program is received, taking an entire string including the converted string as an input.

상기 (A) 단계는, (A1) 상기 문맥 자유 문법 기반의 입력 명세를 해석하여 문법 매핑 테이블을 생성하고, 상기 정규 문법 기반의 문자열 명세를 해석하여 문자열 생성 규칙 테이블을 생성하는 단계; (A2) 상기 문법 매핑 테이블로부터 도출가능한 모든 문장들을 생성하여 문장 집합 테이블에 열거하는 단계; (A3) 상기 문장 집합 테이블로부터 사용하고자 하는 모든 문장들을 출력하는 단계; 및 (A4) 상기 문자열 생성 규칙 테이블에 설정된 문자열 생성 규칙에 따라 상기 출력된 문장들 내의 특수 단말을 상기 의미있는 문자열로 변환하는 단계;를 포함한다.The step (A) includes the steps of: (A1) generating a grammar mapping table by interpreting the input specification based on the context free grammar, and generating a string generating rule table by analyzing the string specification based on the regular grammar; (A2) generating all sentences derivable from the grammar mapping table and listing them in a sentence set table; (A3) outputting all sentences to be used from the sentence set table; And (A4) converting the special terminal in the output sentences into the meaningful character string according to the character string generation rule set in the character string generation rule table.

상기 (B) 단계는, (B1) 상기 전체 문자열을 입력받아 상기 프로그램이 실행되는 동안 간접 분기 명령이 발생하면, 상기 간접 분기 명령에 해당하는 주소 쌍을 추출하여 누적 주소 저장부에 저장하는 단계; 및 (B2) 상기 누적 주소 저장부에 누적된 주소쌍을 제어흐름 처방 테이블로 출력하는 단계;를 포함한다.The step (B) comprises the steps of: (B1) extracting an address pair corresponding to the indirect branch instruction and storing the address pair in an accumulated address storage when an indirect branch instruction is generated while the program is being executed; And (B2) outputting the address pair accumulated in the cumulative address storage unit to the control flow prescription table.

본 발명에 따르면, 극도의 안전성이나 보안이 요구되는 프로그램 실행에 있어서는 가능한 모든 제어흐름을 합법적으로 간주하지 않고, 사전에 테스팅 또는 동적 분석 과정을 거쳐 적법한 것으로 확인된 제어흐름만을 허용함으로써 프로그램의 안전성과 보안성을 향상시킬 수 있다. According to the present invention, in the execution of a program requiring extreme safety or security, only the control flow confirmed to be legitimate through a pre-test or a dynamic analysis process without regard to all possible control flows, The security can be improved.

본 발명의 효과는 이상에서 언급된 것들에 한정되지 않으며, 언급되지 아니한 다른 효과들은 아래의 기재로부터 당업자에게 명확하게 이해될 수 있을 것이다.The effects of the present invention are not limited to those mentioned above, and other effects not mentioned can be clearly understood by those skilled in the art from the following description.

도 1은 본 발명의 실시 예에 의한 문법에 의하여 생성된 입력으로 제어흐름을 처방하기 위한 동적 제어흐름 분석 장치를 개략적으로 도시한 도면,
도 2는 도 1에 도시된 동적 제어흐름 분석 장치를 자세히 도시한 블록도,
도 3은 입력 생성 장치의 동작을 자세히 설명하기 위한 도면,
도 4는 제어흐름 분석 장치의 동작을 자세히 설명하기 위한 도면,
도 5는 프로그램 매뉴얼과 입력 명세의 일 예를 도시한 도면,
도 6은 비단말 테이블, 단말 테이블 및 문법 매핑 테이블의 일 예를 도시한 도면,
도 7은 명세 해석부로 입력되는 문자열 명세의 일 예를 보여주는 도면,
도 8은 문장 열거부에서 도출된 문장 집합의 예를 보여주는 도면,
도 9는 문자열 변환부에 의해 변환된 전체 문자열의 예를 보여주는 도면,
도 10은 주소 검사부가 주소 쌍을 추출 및 생성하는 일련의 과정을 개략적으로 설명하기 위한 도면, 그리고,
도 11 내지 도 13은 본 발명의 실시 예에 따른 문법에 의하여 생성된 입력으로 제어흐름을 처방하기 위한 동적 제어흐름 분석 방법을 설명하기 위한 흐름도이다.
FIG. 1 schematically illustrates a dynamic control flow analysis apparatus for prescribing a control flow with inputs generated by a grammar according to an embodiment of the present invention; FIG.
FIG. 2 is a detailed block diagram of the dynamic control flow analysis apparatus shown in FIG. 1;
3 is a view for explaining the operation of the input generating apparatus in detail,
4 is a view for explaining the operation of the control flow analysis apparatus in detail,
5 is a diagram showing an example of a program manual and an input specification,
6 is a diagram showing an example of a non-terminal table, a terminal table, and a syntax mapping table;
7 is a diagram showing an example of a character string specification input to the specification analyzing unit;
8 is a diagram showing an example of a sentence set derived from sentence rejection,
9 is a diagram showing an example of the entire character string converted by the character string conversion unit,
10 is a diagram for schematically explaining a series of processes of extracting and generating an address pair of an address checker,
11 to 13 are flowcharts for explaining a dynamic control flow analysis method for prescribing a control flow to an input generated by a grammar according to an embodiment of the present invention.

이상의 본 발명의 목적들, 다른 목적들, 특징들 및 이점들은 첨부된 도면과 관련된 이하의 바람직한 실시 예들을 통해서 쉽게 이해될 것이다.BRIEF DESCRIPTION OF THE DRAWINGS The above and other objects, features, and advantages of the present invention will become more readily apparent from the following description of preferred embodiments with reference to the accompanying drawings.

본 명세서에서 어떤 엘리먼트, 구성요소, 장치, 또는 시스템이 프로그램 또는 소프트웨어로 이루어진 구성요소를 포함하는 경우, 명시적인 언급이 없더라도, 그 엘리먼트, 구성요소, 장치, 또는 시스템은 그 프로그램 또는 소프트웨어가 실행 또는 동작하는데 필요한 하드웨어(예를 들면, 메모리, CPU 등)나 다른 프로그램 또는 소프트웨어(예를 들면 운영체제나 하드웨어를 구동하는데 필요한 드라이버 등)를 포함하는 것으로 이해되어야 할 것이다.Where an element, component, apparatus, or system comprises an element comprising a program or software, an element, component, apparatus, or system, unless expressly stated otherwise, It should be understood to include hardware (e.g., memory, CPU, etc.) necessary for operation or other programs or software (e.g., drivers necessary to drive an operating system or hardware).

또한, 어떤 엘리먼트(또는 구성요소)가 구현됨에 있어서 특별한 언급이 없다면, 그 엘리먼트(또는 구성요소)는 소프트웨어, 하드웨어, 또는 소프트웨어 및 하드웨어 어떤 형태로도 구현될 수 있는 것으로 이해되어야 할 것이다.It is also to be understood that the elements (or elements) may be implemented in software, hardware, or any form of software and hardware, unless the context requires otherwise.

또한, 본 명세서에서 사용된 용어는 실시 예들을 설명하기 위한 것이며 본 발명을 제한하고자 하는 것은 아니다. 본 명세서에서, 단수형은 문구에서 특별히 언급하지 않는 한 복수형도 포함한다. 명세서에서 사용되는 '포함한다(comprises)' 및/또는 '포함하는(comprising)'은 언급된 구성요소는 하나 이상의 다른 구성요소의 존재 또는 추가를 배제하지 않는다.Also, terms used herein are for the purpose of illustrating embodiments and are not intended to limit the invention. In the present specification, the singular form includes plural forms unless otherwise specified in the specification. The terms "comprises" and / or "comprising" used in the specification do not exclude the presence or addition of one or more other elements.

이하, 본 발명에서 실시하고자 하는 구체적인 기술내용에 대해 첨부도면을 참조하여 상세하게 설명하기로 한다.DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS Hereinafter, the present invention will be described in detail with reference to the accompanying drawings.

도 1 및 도 2에 도시된 문법에 의하여 생성된 입력으로 제어흐름을 처방하기 위한 동적 제어흐름 분석 장치의 각각의 구성은 기능 및 논리적으로 분리될 수 있음을 나타내는 것이며, 반드시 각각의 구성이 별도의 물리적 장치로 구분되거나 별도의 코드로 작성됨을 의미하는 것은 아님을 본 발명의 기술분야의 전문가는 용이하게 추론할 수 있을 것이다. Each of the configurations of the dynamic control flow analysis apparatus for prescribing the control flow to the input generated by the grammar shown in Figs. 1 and 2 is shown to be functionally and logically separable, It will be easily understood by those skilled in the art that the present invention is not limited to a physical device or a separate code.

도 1은 본 발명의 실시 예에 의한 문법에 의하여 생성된 입력으로 제어흐름을 처방하기 위한 동적 제어흐름 분석 장치를 개략적으로 도시한 도면이다.FIG. 1 is a schematic diagram of a dynamic control flow analysis apparatus for prescribing a control flow with inputs generated by a grammar according to an embodiment of the present invention.

도 1에 도시된 동적 제어흐름 분석 장치는 확장 정규 문법에 의하여 변환된 문자열을 입력으로 하여, 간접 분기 명령에 해당하는 제어흐름을 동적으로 처방하도록 할 수 있다. The dynamic control flow analyzing apparatus shown in FIG. 1 can input a character string converted by an extended normal grammar and dynamically prescribe a control flow corresponding to an indirect branch instruction.

자세히 설명하면, 본 발명의 실시 예에서 제안하는 동적 제어흐름의 분석 결과는 프로그램 실행 중 입력되는 자료, 즉, 입력되는 문자열에 따라 달라진다. 방법론적 측면에서 보면, 동적 제어흐름 분석이 모든 프로그램에 해당하는 제어흐름을 추출하지 못하므로, 본 발명의 실시 예에서는, 특정 프로그램 실행 목적 때 나타나는 제어흐름의 분기 커버리지를 높이기 위한 입력 자료 생성 방식을 적용한다. 즉, 본 발명의 실시 예에서는, 프로그램의 목적을 위한 요구사항에 따른 전형적으로 정상인 입력 조건을 문맥 자유 문법으로 표시하고, 확장 정규 문법에 따른 문자열 생성 규칙을 사용하여 임의의 의미있는 문자열 입력을 생성한다. 그리고, 생성된 문자열을 프로그램에 입력함으로써 처방할 제어흐름을 동적 분석한다.More specifically, the analysis result of the dynamic control flow proposed in the embodiment of the present invention is dependent on the data inputted during the execution of the program, that is, the inputted character string. From the methodological point of view, since the dynamic control flow analysis does not extract the control flow corresponding to all the programs, in the embodiment of the present invention, an input data generation method for increasing the branch coverage of the control flow appearing for the purpose of executing a specific program To be applied. In other words, in the embodiment of the present invention, a normal input condition according to a requirement for a program purpose is displayed as a context free grammar, and an arbitrary meaningful character string input is generated using a string generation rule according to an extended normal grammar do. Then, the control flow to be prescribed is dynamically analyzed by inputting the generated character string into the program.

도 1을 참조하면, 동적 제어흐름 분석 장치는 입력 생성 장치(100), 메모리(200), 디스크(300) 및 제어흐름 분석 장치(400)를 포함한다.Referring to FIG. 1, a dynamic control flow analysis apparatus includes an input generating apparatus 100, a memory 200, a disk 300, and a control flow analysis apparatus 400.

입력 생성 장치(100)는 문맥 자유 문법에 따라 생성된 문장들의 집합인 문장 집합을 확장하여, 문장들의 특수 단말을 확장 정규 문법(Extended Regular Grammar)으로 제한된 문자열 생성 규칙에 따라 의미있는 문자열로 변환한다. 의미있는 문자열이라 함은 타입과 해당하는 값을 갖는 문자열을 의미한다.The input generating apparatus 100 converts a set of sentences, which is a set of sentences generated according to the context free grammar, into a meaningful string according to a rule for generating a string limited to an extended regular grammar . A meaningful string means a string having a type and a corresponding value.

어휘 분석론에 의하면 문장(Sentence)을 이루는 기본 단위를 토큰(Token)이라고 하며, 이는 타입과 값으로 이루어져 있다. 입력 생성 장치(100)에서 생성되는 문장은 다수의 단말들을 포함하고, 단말 역시 토큰으로 분류할 수 있다. 토큰의 타입은 식별자를 나타낸다. 어휘 분석 시에는 토큰의 종류를 분류해야 하는데, 이 때, 식별자를 통해 속성을 구분한다. 즉, 식별자가 같으면 동일한 속성을 갖는다고 할 수 있으며, 타입은 특수 단말의 속성을 나타내는 정보라고 할 수도 있다. 그러나, 특수 단말의 경우에도 타입과 값이 존재하지만 아직 값이 정해진 상태가 아니다. 예를 들어, 후술할 실시 예에서 FILE이라는 값이 있지만, 이는 추후에 A라는 문자열로 변환된다. 따라서, 문장으로부터 변환된 문자열이 프로그램 요구사항을 따르거나 프로그램 매뉴얼에 있는 정보를 포함하고 있다면 문자열로 변환되었다고 할 수 있다. 즉, 문자열로 변환되었을 때, 프로그램 메뉴얼에 있는 실행 문자열로 변환이 되면 이는 의미있는 문자열로 변환된 것이라 할 수 있다.According to lexical analysis theory, the basic unit of sentence is called token, which is composed of type and value. The sentence generated by the input generating apparatus 100 includes a plurality of terminals, and the terminals can be classified into tokens. The type of the token indicates the identifier. At the time of lexical analysis, the kind of the token should be classified, and the attribute is distinguished through the identifier. That is, if identifiers are the same, they can have the same property, and the type can be referred to as information indicating the attribute of the special terminal. However, even in the case of a special terminal, a type and a value exist, but the value is not yet determined. For example, in the embodiment described below, there is a value of FILE, which is later converted into a character string A. Therefore, it can be said that the converted string from the sentence is converted to a string if it conforms to the program requirements or contains the information in the program manual. In other words, when converted to a string, when converted to an executable string in the program manual, it is converted to a meaningful string.

메모리(200)는 입력 생성 장치(100)에서 생성된 문법 매핑 테이블(210), 문자열 생성 규칙 테이블(220) 및 문장 집합 테이블(230)을 저장한다. 또한, 메모리(200)는 프로세싱부(240)에서 프로세스 즉, 프로그램이 실행되는 동안 입력 생성 장치(100)에서 변환된 문자열을 포함하는 전체 문자열을 입력으로 받아 프로그램을 지속 실행하며, 제어흐름 분석 장치(400)에 의해 추출 및 수집된 주소쌍을 주소 누적 테이블(250)에 누적 저장한다. The memory 200 stores a grammar mapping table 210, a string generating rule table 220 and a sentence set table 230 generated by the input generating apparatus 100. The memory 200 receives the entire string including the converted character string from the input generating apparatus 100 while the program is being executed in the processing unit 240. The memory 200 continuously executes the program, And accumulates the address pairs extracted and collected by the address accumulation table 250 in the address accumulation table 250.

디스크(300)는 입력 생성 장치(100)에서 생성된 모든 문장과, 모든 문장들로부터 변환된 문자열을 저장한다. 또한, 디스크(300)는 제어흐름 분석 장치(400)로부터 입력받은 주소 쌍을 제어흐름 처방으로서 기록하는 제어흐름 처방 테이블(330)을 저장한다. 이러한 디스크(300)는 HDD(Hard Disk Drive), SSD(Solid State Disk)와 같은 대용량 저장 매체일 수 있다.The disc 300 stores all sentences generated in the input generating apparatus 100 and converted strings from all sentences. In addition, the disk 300 stores a control flow prescription table 330 for recording the address pair input from the control flow analysis apparatus 400 as a control flow prescription. The disk 300 may be a mass storage medium such as a hard disk drive (HDD) or a solid state disk (SSD).

제어흐름 분석 장치(400)는 메모리(200)에서 프로그램이 실행되는 동안 간접 분기 명령의 발생 여부에 따라 적법한(legitimate) 제어흐름을 동적으로 분석 및 선별한다.The control flow analysis apparatus 400 dynamically analyzes and selects a legitimate control flow according to whether an indirect branch instruction is generated while a program is being executed in the memory 200. [

본 발명의 실시 예에서 '적법하다'의 의미는 프로그램의 요구사항을 따르며 실행에 문제가 없음을 의미한다. 따라서, 본 발명의 실시 예에서는 입력 생성 장치(100)에서 발생된 입력 자료(즉, 문자열)를 프로세스에 입력하였을 때 이에 따라 나타나는 제어흐름을 모두 적법하다고 판단할 수 있으며, 이를 위한 가정은 제어흐름 분석 과정 동안에는 내부적 또는 외부적인 공격이 없다는 전제를 필요로 한다. In the embodiment of the present invention, the meaning of 'legitimate' means that the program follows the requirements of the program and has no problems in its execution. Therefore, in the embodiment of the present invention, when the input data (i.e., character string) generated in the input generating apparatus 100 is input to the process, it can be determined that all the control flows appearing according to the input data are legitimate. During the analysis process, it is assumed that there is no internal or external attack.

도 2는 도 1에 도시된 동적 제어흐름 분석 장치를 자세히 도시한 블록도, 도 3은 입력 생성 장치(100)의 동작을 자세히 설명하기 위한 도면, 도 4는 제어흐름 분석 장치(400)의 동작을 자세히 설명하기 위한 도면이다.FIG. 2 is a detailed block diagram of the dynamic control flow analysis apparatus shown in FIG. 1, FIG. 3 is a view for explaining the operation of the input generation apparatus 100 in detail, Fig.

먼저, 도 2 및 도 3을 참조하면, 입력 생성 장치(100)는 명세 해석부(110), 문장 열거부(120), 문장 출력부(130) 및 문자열 변환부(140)를 포함한다.2 and 3, the input generation apparatus 100 includes a specification analysis unit 110, a sentence rejection unit 120, a sentence output unit 130, and a character string conversion unit 140.

명세 해석부(110)는 문맥 자유 문법을 기반으로 작성된 입력 명세와, 확장 정규 문법을 기반으로 작성된 문자열 명세를 입력받는다.The specification analyzing unit 110 receives the input specification created based on the context free grammar and the character string specification created based on the extended normal grammar.

입력 생성을 위해 문맥 자유 문법과 확장 정규 문법을 사용하는 이유는 동적 제어흐름 분석의 정확성을 높이기 위함이다. 특정 조건이 없는 상태에서 생성한 임의의 입력은 대부분 프로그램의 오류를 유발한다. 따라서, 이를 피하기 위해, 본 발명의 실시 예에서는 프로그램에서 받아들일 수 있는 적법한 입력 명세를 문법으로 표시한다. 여기서, '명세'는 '문법'을 의미하며, 입력 명세와 문자열 명세 작성은 프로그램 매뉴얼을 참고한다.The reason for using context free grammar and extended regular grammar for input generation is to improve the accuracy of dynamic control flow analysis. Any input that is generated in the absence of a specific condition will most likely cause the program to fail. Therefore, in order to avoid this, in the embodiment of the present invention, a legitimate input specification that can be accepted in the program is displayed in a grammar. Here, 'specification' means 'grammar', and refer to the program manual for the specification of input and the specification of string.

일반적으로 입력 표시 형식으로서 사용되는 문맥 자유 문법은 다음과 같이 구성된다.The context-free grammar, commonly used as an input display format, consists of:

G=(N, T, P, S)G = (N, T, P, S)

여기서, N은 비단말들의 유한 집합, T는 단말들의 유한 집합으로 NnT=f이다. P는 규칙들의 유한 집합으로 P⊆N×(N∪T)*이고, S는 시작 기호로서, S∈N이다.Where N is a finite set of nonterminals, and T is a finite set of terminals, NnT = f . P is a finite set of rules P ⊆ N × (N ∪ T) * , where S is a start sign, S ∈ N.

또한, 단말은 일반 단말 집합(NT)과 특수 단말 집합(ST)을 포함하며, NT∪ST=T, NT∩ST=φ이다. 특수 단말 집합(ST)은 임의의 의미있는 문자열로 교체 가능한 특수 단말들로 구성된다. 일반 단말 집합(NT)은 특수 단말 집합(ST)을 제외한 모든 단말들로 구성된다.Also, the terminal includes a general terminal set (NT) and a special terminal set (ST), and NT∪ST = T and NT∩ST = ? . A special terminal set (ST) consists of special terminals that can be replaced with any meaningful string. The general terminal set (NT) is composed of all terminals except the special terminal set (ST).

도 5는 프로그램 매뉴얼과 입력 명세의 일 예를 도시한 도면이다.5 is a diagram showing an example of a program manual and an input specification.

도 5에 도시된 입력 명세는 프로그램 매뉴얼을 참고하여 문맥 자유 문법 형태로 작성된다. 도 5를 참조하면, 비단말들(N)은 <S>와 <OPTION>을 포함하고, 단말들(T)는 base64, FILE, OPT, COLS, UINT, -w, --help, --version, --decode, --ignore-garbage 및 -wrap을 포함한다.The input specification shown in FIG. 5 is written in the form of a context free grammar referring to the program manual. 5, the non-nouns N include <S> and <OPTION>, and the terminals T include base64, FILE, OPT, COLS, UINT, -w, , --decode, --ignore-garbage, and -wrap.

명세 해석부(110)는 도 5와 같은 문맥 자유 문법 기반의 입력 명세를 해석하여 문법 매핑 테이블(210)을 생성한다. The specification analyzing unit 110 generates a grammar mapping table 210 by analyzing the input specification based on the context free grammar as shown in FIG.

자세히 설명하면, 명세 해석부(110)는, 문맥 자유 문법을 기반으로 작성된 입력 명세를 해석하여 비단말에 색인 번호를 매핑한 비단말 테이블을 생성하고, 단말에 색인 번호를 매핑한 단말 테이블을 생성한다. 그리고, 명세 해석부(110)는 비단말 테이블과 단말 테이블에 표시된 색인 번호와 입력 명세의 줄번호로 이루어진 문법 매핑 테이블(210)을 생성한다.In detail, the specification analyzing unit 110 analyzes an input specification created on the basis of the context free grammar, generates a non-terminal table in which an index number is mapped to a non-terminal, generates a terminal table in which an index number is mapped to the terminal do. The specification analyzer 110 generates a syntax mapping table 210 including an index number and an input specification line number displayed on the non-terminal table and the terminal table.

도 5와 같은 입력 명세가 입력된 경우, 명세 해석부(110)는 입력된 입력 명세를 해석하여 도 6에 도시된 비단말 테이블과 단말 테이블을 생성한다. When the input specification as shown in FIG. 5 is input, the specification analysis unit 110 analyzes the input specification to generate the non-terminal table and the terminal table shown in FIG.

도 6을 참조하면, 명세 해석부(110)는 입력 명세를 해석한 결과로부터 비단말들(N)로서 <S>와 <OPTION>을 확인하고, 각각의 비단말에 색인 번호 0과 1을 매핑하여 비단말 테이블을 생성한다. 즉, 명세 해석부(110)는 규칙(P)의 줄 번호를 차례대로 해석하여 단말이 나타나는 순서대로 색인 번호를 매핑한다. Referring to FIG. 6, the specification analyzing unit 110 identifies <S> and <OPTION> as non-nouns N from the result of analyzing the input specification, maps the index numbers 0 and 1 to each non- And creates a non-ending table. That is, the specification analysis unit 110 sequentially analyzes the line numbers of the rule P and maps the index numbers in the order in which the terminals appear.

또한, 명세 해석부(110)는 입력 명세를 해석한 결과로부터 단말들(T)로서 base64, FILE, OPT, COLS, UINT, -w, --help, --version, --decode, --ignore-garbage 및 -wrap을 확인하고, 각각의 단말에 색인 번호 2~12를 매핑하여 단말 테이블을 생성한다. 명세 해석부(110)는 비단말 테이블의 마지막 색인 번호 이후부터 색인 번호를 각 단말에 매핑하고, 규칙(P)의 줄 번호에 나타난 순서대로 색인 번호를 매핑한다.The specification analyzing unit 110 extracts base64, FILE, OPT, COLS, UINT, -w, --help, --version, --decode, --ignore -garbage and -wrap, and generates terminal tables by mapping index numbers 2 to 12 to each terminal. The specification analyzer 110 maps the index numbers to the terminals after the last index number of the non-ending table and maps the index numbers in the order indicated in the line numbers of the rules P. [

명세 해석부(110)는 생성한 비단말 테이블과 단말 테이블을 명세 해석부(110) 내부에 저장하여 활용한다.The specification analyzer 110 stores the generated non-terminal table and terminal table in the specification analyzer 110 for utilization.

그리고, 명세 해석부(110)는 줄번호와 색인 번호로 구성된 문법 매핑 테이블(210)을 도 6에 도시된 것처럼 생성한다. 명세 해석부(110)는 입력 명세의 각 줄에 해당하는 줄 번호와, 각 줄에 표시된 비단말 또는 단말의 색인 번호를 비단말 테이블과 단말 테이블에서 확인하여 문법 매핑 테이블(210)을 생성한다. The specification analyzer 110 generates a grammar mapping table 210 including a line number and an index number as shown in FIG. The specification analyzer 110 generates the syntax mapping table 210 by checking the line numbers corresponding to the respective lines of the input specification and the index numbers of the non-terminal or terminal of each line in the non-terminal table and the terminal table.

이때, 명세 해석부(110)는 색인 번호의 가장 왼쪽의 열은 비단말 테이블의 번호에 표기된 색인 번호와 매핑하고, 색인 번호의 두 번째 열부터는 단말 테이블을 참조하여 색인 번호를 매핑한다. 예를 들어, 도 6의 입력 명세에서 줄번호 '1'에 해당하는 줄의 가장 왼쪽 열(즉, <S>의 바로 아래 부분)은 <S>에 매핑된 색인 번호 '0'을, 'base64'에 해당하는 열(즉, 줄번호 '1'의 두 번째 열)에는 색인 번호 '2'를, 'FILE'에 해당하는 열에는 색인 번호 '3'을 문법 매핑 테이블(210)에 차례대로 매핑한다.At this time, the specification analyzer 110 maps the leftmost column of the index number to the index number indicated in the number of the non-end table, and maps the index number referring to the terminal table from the second column of the index number. For example, in the input specification of FIG. 6, the leftmost column of the line corresponding to the line number '1' (ie, the portion immediately below the <S>) represents the index number '0' mapped to <S> 2 'to the column corresponding to' FILE 'and the index number' 3 'to the column corresponding to' FILE 'to the syntax mapping table 210 in order do.

또한, 줄번호 '5'에 해당하는 줄의 가장 왼쪽 열(즉, <OPTION>의 바로 아래 부분)은 <OPTION>에 매핑된 색인 번호 '1'을, 'OPT'에 해당하는 열에는 색인 번호 '6'을, <OPTION>에 해당하는 열에는 색인 번호 '1'을 문법 매핑 테이블(210)에 차례대로 매핑한다.In addition, the leftmost column of the line corresponding to the line number '5' (ie, immediately below the <OPTION>) has the index number '1' mapped to the <OPTION> 1 'in the column corresponding to &lt; OPTION &gt; to the grammar mapping table 210 in order.

이러한 방식으로 명세 해석부(110)는 입력 명세를 해석하여 도 6과 같은 문법 매핑 테이블(210)을 생성하고, 생성된 문법 매핑 테이블(210)을 메모리(200)에 저장한다.In this way, the specification analyzing unit 110 analyzes the input specification, generates a grammar mapping table 210 as shown in FIG. 6, and stores the generated syntax grammar mapping table 210 in the memory 200. FIG.

한편, 명세 해석부(110)는 입력된 확장 정규 문법 기반의 문자열 명세를 해석하여 문자열 생성 규칙 테이블(220)을 생성한다. On the other hand, the specification analyzing unit 110 generates a character string generating rule table 220 by analyzing the inputted character string specification based on the extended regular grammar.

프로그래밍 언어를 표시하는 방법 중 하나인 정규 문법(Regular Grammar)은 기본 정규 문법(Basic Regular Grammar)과 확장 정규 문법(Extended Regular Grammar)으로 구분된다. 기본 정규 문법은 최초에 제시된 정규 문법을 말하며, 확장 정규 문법은 기본 정규 문법에 메타 케릭터를 추가하여 표현 가능한 문법식을 증가시킨 방법을 말한다. Regular grammar, which is one of the ways to display programming languages, is divided into Basic Regular Grammar and Extended Regular Grammar. The basic regular grammar refers to the regular grammar presented at the beginning, and the extended regular grammar refers to a method that increases the expressible grammar expression by adding a meta character to the basic regular grammar.

도 7은 명세 해석부(110)로 입력되는 문자열 명세의 일 예를 보여주는 도면이다.7 is a diagram showing an example of a character string specification input to the specification analyzing unit 110. FIG.

도 7을 참조하면, 문자열 명세는 특수 단말 별로 지정된 의미있는 문자열을 포함한다. 즉, 문자열 명세에는 모든 단말들(T) 중 특수 단말 집합(ST)에 해당하는 특수 단말들을 의미있는 문자열로 변환하기 위한 문자열이 지정되어 있다. 이러한 문자열 명세의 표시법은 확장 정규 문법을 활용한다.Referring to FIG. 7, the character string specification includes a meaningful character string assigned to each special terminal. That is, in the string specification, a character string for converting special terminals corresponding to the special terminal set (ST) among all the terminals (T) into meaningful strings is designated. This specification of the string specification uses extended normal grammar.

명세 해석부(110)는 입력된 문자열 명세를 해석하여 특수 단말 별로 지정된 의미있는 문자열로부터 도 7에 도시된 문자열 생성 규칙 테이블(220)을 생성하고, 생성된 문자열 생성 규칙 테이블(220)을 메모리(200)에 저장한다.The specification analyzing unit 110 analyzes the inputted character string specification to generate a character string generating rule table 220 shown in FIG. 7 from a meaningful character string designated for each special terminal, and stores the generated character string generating rule table 220 in a memory 200).

다시 도 2를 참조하면, 문장 열거부(120)는 문법 매핑 테이블(210)로부터 도출가능한 모든 문장들을 생성하여 문장 집합 테이블(230)에 열거한다. 문장 열거부(120)는 Dong의 알고리즘을 활용한다. 즉, 문장 열거부(120)는, 문맥 자유 문법에 기반한 파스 트리(Parse Tree)를 구성하고, 파스 트리의 계층 관계로부터 도출되는 모든 문장들을 생성하며, 생성된 모든 문장들을 사전식 순서에 따라 계층적으로 열거한 문장 집합 테이블(230)을 생성한다.Referring again to FIG. 2, the sentence rejection unit 120 generates all sentences derivable from the grammar mapping table 210 and lists them in the sentence set table 230. Sentence rejection 120 uses Dong's algorithm. That is, the sentence rejection unit 120 constructs a parse tree based on the context free grammar, generates all sentences derived from the hierarchical relationship of the parse tree, The sentence set table 230 is generated.

Dong의 알고리즘에 대해 간략히 설명하면, N = {X1, ?, Xm}, i = 1, ?, m일 때 Gi = (N, T, P, Xi)에 의하여 도출된 문맥 자유 언어를 Li, 트리의 높이를 n이라 하면, 문장 구성을 위한 계층은 다음의 네 가지 문장 집합으로 구성한다.The algorithm of Dong is briefly described as follows: G i = (N, T, P, X i ) when N = {X 1 ,?, X m }, i = L i , and the height of the tree is n, the hierarchy for constructing the sentence consists of the following four sentence sets.

- heapi(231): 높이가 n+1보다 크지 않으면서 Li에 포함된 문장들. - heap i (231): sentences contained in L i with height not greater than n + 1.

- hierarchyi(232): 높이가 n+1인 Li에 포함된 문장들.- hierarchy i (232): sentences contained in L i of height n + 1.

- clusterp(233): 비단말 규칙 p를 문장 도출 시 가장 먼저 활용하는 높이가 n+1인 문장들.- cluster p (233): Sentences with height n + 1 that are used first when deriving sentence rule p.

- cubep,t(234): (n-1)번 계층으로부터 추출한 t번째 부분문장들(sub-sentences)에 해당하는 clusterp에 포함된 문장들.- cube p, t (234): Sentences contained in cluster p corresponding to t-th sub-sentences extracted from layer (n-1).

따라서, 문장 열거부(120)는 문법 매핑 테이블(210)에 저장된 줄번호와 색인 번호를 활용하여 도출가능한 모든 문장들을 생성한 후, 생성된 문장들을 Dong 알고리즘에 따라 계층적으로 열거하여 문장 집합 테이블(230)을 생성한다. 문장은 단말들의 집합으로서, 일반 단말과 특수 단말 중 적어도 하나를 포함한다.Therefore, the sentence rejection unit 120 generates all the derivable sentences using the line number and the index number stored in the grammar mapping table 210, hierarchically lists the generated sentences according to the Dong algorithm, (230). A sentence is a set of terminals, and includes at least one of a general terminal and a special terminal.

문장 출력부(130)는 문장 집합 테이블(230)로부터 사용하고자 하는 또는 사용가능한 모든 문장들을 출력하여 디스크(300)의 문장 저장 영역(310)에 저장한다.The sentence output unit 130 outputs all sentences to be used or available from the sentence set table 230 and stores the sentences in the sentence storage area 310 of the disc 300.

도 8은 문장 열거부(120)에서 도출된 문장 집합의 예를 보여주는 도면이다.FIG. 8 is a diagram showing an example of a sentence set derived from the sentence rejection unit 120. FIG.

도 8에서, FILE, UINT, COLS 및 OPT는 특수 단말을 의미한다. 예를 들어, base64 --help'라는 문장은 base64라는 일반 단말과, --help라는 일반 단말로 이루어진다. 또한, 'base64 FILE'은 base64라는 일반 단말과, FILE이라는 특수 단말로 이루어진다.In FIG. 8, FILE, UINT, COLS, and OPT represent special terminals. For example, the statement base64 --help 'consists of a base terminal called base64 and a generic terminal called --help. Also, 'base64 FILE' is composed of a general terminal called base64 and a special terminal called FILE.

한편, 문자열 변환부(140)는 문자열 생성 규칙 테이블(220)에 설정된 문자열 생성 규칙에 따라, 문장 출력부(130)에서 출력된 모든 문장들 내의 특수 단말들을 의미있는 문자열로 변환한다.On the other hand, the string conversion unit 140 converts the special terminals in all the sentences output from the sentence output unit 130 into a meaningful string according to the string creation rule set in the string creation rule table 220.

자세히 설명하면, 문자열 변환부(140)는 문장 저장 영역(310)에 저장된 모든 문장들을 순차적으로 문자열로 변환하되, 각 문장 내의 특수 단말은 문자열 생성 규칙을 참조하여 대응하는 문자열로 변환한다. 또한, 문자열 변환부(140)는 각 문장 내의 일반 단말은 속성을 문장에서 문자열로 변환한다. More specifically, the string conversion unit 140 sequentially converts all sentences stored in the sentence storage area 310 into a character string, and the special terminal in each sentence converts the character string into a corresponding character string by referring to the character string generation rule. Also, the character string conversion unit 140 converts the attribute from a sentence to a character string in a general terminal in each sentence.

예를 들어, 도 8의 base64 FILE이라는 문장 중 일반 단말인 base64는 문자열 변환부(140)에 의해 그 자체가 문자열로 인식되도록 변환되며, FILE은 도 7을 참조하여 A라는 문자열로 변환된다. For example, base64 which is a general terminal among the statements of base64 FILE in FIG. 8 is converted to be recognized as a character string by the character string conversion unit 140, and FILE is converted into a character string A with reference to FIG.

아래의 [표 1]은 문자열의 제한 사항을 설명하고 있다.Table 1 below describes the limitations of strings.

제한사항Limitations 설명Explanation 예시example 예시 설명
Example Description
문자열 길이String length 변환할 문자열의 길이The length of the string to convert A{1,10}A {1,10} 문자 A를 1~10개 중 임의의 개수만큼 변환Converts the letter A to any number from 1 to 10 숫자의 크기The size of the number 타입에 따른 숫자 크기를 제한Limit number sizes according to type

Figure 112016129645356-pat00001
Figure 112016129645356-pat00001
비부호 정수형 숫자 타입의 범위인 0~65536 사이의 임의의 숫자로 변환Converts to a random number between 0 and 65536, the range of unsigned integer type types 대소문자
구분
Case
division
영문자의 대소문자를 구분Capitalize alphabetic characters [a-zA-Z][a-zA-Z] 소문자 a부터 z 또는 대문자 A부터 Z 중 임의의 문자 하나를 변환Convert lowercase a to z or any one of uppercase A through Z
특수문자
구분
Special Characters
division
특수문자를 표시,
Figure 112016129645356-pat00002
를 추가 표시
Display special characters,
Figure 112016129645356-pat00002
Show more
Figure 112016129645356-pat00003
Figure 112016129645356-pat00003
특수문자
Figure 112016129645356-pat00004
으로 변환
Special Characters
Figure 112016129645356-pat00004
Convert to
논리연산자 구분Separate logical operators 논리연산자를 표시,
Figure 112016129645356-pat00005
를 추가 표시
Show logical operators,
Figure 112016129645356-pat00005
Show more
Figure 112016129645356-pat00006
Figure 112016129645356-pat00006
논리연산자 OR(|)로 변환,
A OR B를 나타냄
Convert to logical operator OR (|),
Represents A OR B

특수 단말 집합(ST)는 [표 1]의 제한 사항들을 조합하여 이에 만족하는 임의의 의미있는 문자열로 변환된다. [표 1]과 같은 확장 정규 문법을 기반으로 한 문자열 변환은 문장 열거를 확장한 입력 생성 방식으로서, 제한된 조건 하에서 부분적으로 문자열을 변환하므로 동일한 문장에서도 다양한 종류의 입력(즉, 문자열)이 생성될 수 있다. 예를 들어, 특수 단말 aaa를 A{1, 10}에 기반한 문자열로 2회 변환하는 경우, 변환된 문자열은 각각 1과 9로서 상이하거나 1과 1로 동일할 수 있다.The Special Terminal Set (ST) combines the restrictions of [Table 1] and converts it into any meaningful string satisfying it. As shown in [Table 1], character string conversion based on extended regular grammar is an input generation method that extends sentence enumeration. Since a string is partially converted under limited conditions, various types of input (ie, strings) are generated in the same sentence . For example, when converting a special terminal aaa into a string based on A {1, 10} twice, the converted string may be different between 1 and 9, or may be equal to 1 and 1.

이하에서는 각 문장이 문자열 변환부(140)에 의해 변환된 문자열을 전체 문자열이라 한다.Hereinafter, a character string converted by the string conversion unit 140 for each sentence is referred to as an entire character string.

도 9는 문자열 변환부(140)에 의해 변환된 전체 문자열의 예를 보여주는 도면이다.9 is a diagram showing an example of an entire character string converted by the character string conversion unit 140. As shown in FIG.

도 8 및 도 9를 참조하면, 일반 단말들로 이루어진 문장은 똑같은 형태의 전체 문자열로 변환되고, 일반 단말과 특수 단말로 이루어진 문장은 특수 단말만 표시 형태가 임의의 의미있는 문자열로 변환된다.8 and 9, a sentence composed of general terminals is converted into an entire character string of the same type, and a sentence composed of a general terminal and a special terminal is converted into an arbitrary meaningful character string only by the special terminal.

문자열 변환부(140)는 변환된 전체 문자열들을 디스크(300)의 문자열 저장 영역(320)에 저장한다.The string conversion unit 140 stores the converted entire strings in the character string storage area 320 of the disc 300.

한편, 도 2 및 도 4를 참조하면, 모든 문장이 전체 문자열로 변환된 후, 프로세싱부(240)는 입력되는 명령어에 따라 프로그램을 실행한다. 프로그램이 실행되는 동안, 문자열 저장 영역(320)에 저장된 전체 문자열은 순차적으로 프로세싱부(240)로 입력되어 처리된다.2 and 4, after all the sentences are converted into the entire character string, the processing unit 240 executes the program according to the input command. While the program is being executed, the entire character string stored in the character string storage area 320 is sequentially input to the processing unit 240 and processed.

제어흐름 분석 장치(400)는 전체 문자열을 순차적으로 입력으로 받아 프로그램이 실행되는 동안, 간접 분기 명령의 발생 여부에 따라 적법한 제어흐름을 분석 및 선별한다. 이를 위하여, 제어흐름 분석 장치(400)는 주소 검사부(410) 및 주소 출력부(420)를 포함한다.The control flow analyzing apparatus 400 sequentially inputs all the strings and analyzes and selects a legitimate control flow depending on whether an indirect branch instruction is generated while the program is being executed. For this, the control flow analyzing apparatus 400 includes an address checking unit 410 and an address outputting unit 420.

주소 검사부(410)는 전체 문자열을 입력받아 프로그램이 실행되는 동안 간접 분기 명령이 발생하면, 간접 분기 명령에 해당하는 주소 쌍을 추출하여 누적 주소 테이블(250)에 저장한다. 즉, 주소 검사부(410)는 변환된 문자열을 프로그램 실행 중 입력으로서 활용하여 제어흐름을 선별적 및 동적으로 분석한다. 제어흐름의 동적 분석은 x86계열에서의 저수준 간접 분기 명령을 대상으로 수행하며, 분기 유형은 다음과 같다.When the indirect branch instruction is generated while the program is being executed, the address checking unit 410 extracts the address pair corresponding to the indirect branch instruction and stores the extracted address in the cumulative address table 250. That is, the address checking unit 410 selectively and dynamically analyzes the control flow by using the converted character string as an input during program execution. The dynamic analysis of the control flow is performed on the low-level indirect branch instruction in the x86 series, and the branch type is as follows.

1. 간접 점프·호출: 함수 포인터, 가상 메소드 디스패치, 스위치문에 의해 발생1. Indirect jump / call: generated by function pointer, virtual method dispatch, switch statement

2. 귀환: 함수 호출 시 귀환 주소를 스택에 저장하고, 귀환 시 이를 읽어들임2. Return: Store the return address on the stack when calling the function, and read it when returning.

위 두 가지 유형의 간접 분기가 발생할 때마다 주소 검사부(410)는 명령어의 출처 주소와 목적지 주소를 추출하여 누적 주소 테이블(250)에 저장한다.Whenever the above two types of indirect branching occur, the address checking unit 410 extracts the source address and the destination address of the instruction and stores the same in the cumulative address table 250.

자세히 설명하면, 주소 검사부(410)는 프로세싱부(240)에서 실행되는 프로그램을 감시하여, 프로그램으로 입력되는 명령어를 모두 분석한다. 분석 결과, 입력된 명령어가 간접 분기 명령어이면, 주소 검사부(410)는 간접 분기 명령이 발생한 것으로 판단한다. 그리고, 주소 검사부(410)는 간접 분기 명령에 해당하는 명령어가 발생한 메모리(미도시, 또는 레지스터)의 출처 주소 및 명령어의 목적지 주소를 추출하여 간접 분기 명령에 해당하는 주소 쌍을 생성하고, 생성된 주소 쌍을 누적 주소 테이블(250)에 저장한다. In more detail, the address checking unit 410 monitors a program executed in the processing unit 240, and analyzes all the commands inputted into the program. As a result of the analysis, if the input instruction is an indirect branch instruction, the address checking unit 410 determines that an indirect branch instruction has occurred. The address checking unit 410 extracts a source address of a memory (not shown or a register) in which an instruction corresponding to the indirect branch instruction is generated and a destination address of the instruction to generate an address pair corresponding to the indirect branch instruction, And stores the address pair in the cumulative address table 250.

주소 검사부(410)가 주소 쌍을 추출 및 생성하는 방식은 동일 출원인에 의해 출원된 출원번호 제10-2014-0175623호에서 제안하는 '시간 지역성을 활용한 해시 기반의 주소 검색 장치 및 방법'을 사용할 수 있다.A method of extracting and generating an address pair by the address checking unit 410 is disclosed in Application No. 10-2014-0175623, filed by the same applicant, using a hash-based address searching apparatus and method using time locality .

도 10은 주소 검사부(410)가 주소 쌍을 추출 및 생성하는 일련의 과정을 개략적으로 설명하기 위한 도면이다.FIG. 10 is a diagram for explaining a process of extracting and generating an address pair by the address checking unit 410. Referring to FIG.

도 10을 참조하면, 실행 중인 프로그램으로 입력되는 명령어가 call이면, 주소 검사부(410)는 call이라는 명령어가 간접 분기 명령어인지 판단한다. 간접 분기 명령어로 판단되면, 주소 검사부(410)는 call이 저장된 주소를 주소 메모리(미도시)에서 확인한다. call 명령어가 0xA라는 메모리 주소에 등록되어 있음이 확인되면, 주소 검사부(410)는 0xA를 call 명령어의 출처 주소(Source Address)로서 추출한다. Referring to FIG. 10, if an instruction input to a running program is a call, the address checking unit 410 determines whether the instruction call is an indirect branch instruction. If it is determined that the branch instruction is an indirect branch instruction, the address checking unit 410 checks the address stored in the address memory (not shown). If it is confirmed that the call instruction is registered in the memory address 0xA, the address checking unit 410 extracts 0xA as the source address of the call instruction.

또한, 주소 검사부(410)는 call에 매칭된 *%eax를 참조하여 eax 레지스터에 저장된 값 push %ebp을 확인하고, ebp라는 메모리 주소에 있는 값으로서 0xB를 확인한다. 주소 검사부(410)는 확인된 0xB를 목적지 주소(Target Address)로서 추출한다. Also, the address checking unit 410 checks the value push% ebp stored in the eax register by referring to *% eax matched with the call, and confirms 0xB as a value at the memory address ebp. The address checking unit 410 extracts the checked 0xB as a destination address.

주소 검사부(410)는 추출된 출처 주소 0Xa와 목적지 주소 0Xb를 하나의 주소 쌍으로 정하고, call이라는 명령어에 매핑하여 누적 주소 테이블(250)에 저장한다. 이 때, 주소 검사부(410)는 추출된 주소 쌍이 누적 주소 테이블(250)에 저장되어 있는지 확인하고, 저장되어 있지 않으면, 누적 주소 테이블(250)에 저장한다. 주소 검사부(410)는 프로그램 실행이 완료될 때까지 입력되는 모든 명령어에 대해 간접 분기 명령인지를 판단하고, 간접 분기 명령에 해당하면 주소 쌍을 추출 후 저장한다.The address checking unit 410 determines the extracted source address 0Xa and the destination address 0Xb as one address pair, maps it to a command called "call", and stores it in the cumulative address table 250. At this time, the address checking unit 410 checks whether the extracted address pair is stored in the cumulative address table 250, and if not, the cumulative address table 250 stores the address pair. The address checking unit 410 determines whether the instruction is an indirect branch instruction for all instructions input until the execution of the program is completed. If the instruction is an indirect branch instruction, the address checking unit 410 extracts and stores the address pair.

프로그램 실행이 완료되고, 모든 문자열 입력에 대한 제어흐름 분석이 완료되면, 주소 출력부(420)는 누적 주소 테이블(250)에 누적된 주소쌍을 제어흐름 처방 테이블(330)로 출력한다. 이로써, 주소 검사부(410)에서 추출 및 생성된 주소 쌍들은 프로그램의 동적 제어흐름 분석 결과로서 제어흐름 처방 테이블(330)에 저장된다.When the program execution is completed and the analysis of the control flow for all the string inputs is completed, the address output unit 420 outputs the address pairs accumulated in the cumulative address table 250 to the control flow prescription table 330. As a result, the address pairs extracted and generated by the address checking unit 410 are stored in the control flow prescription table 330 as a result of dynamic control flow analysis of the program.

한편, 상술한 본 발명의 실시 예에 따른 문법에 의하여 생성된 입력으로 제어흐름을 처방하기 위한 동적 제어흐름 분석 장치는 입력 생성 장치(100), 메모리(200), 디스크(300) 및 제어흐름 분석 장치(400)와 통신연결관계를 맺은 상태에서 동적 제어흐름 분석 장치의 상술한 동작을 포함하는 전반적인 동작을 제어 및 관리하는 제어부(미도시)를 포함할 수 있음은 물론이다. Meanwhile, the dynamic control flow analysis apparatus for prescribing the control flow with the input generated by the grammar according to the above-described embodiment of the present invention includes an input generation apparatus 100, a memory 200, a disk 300, (Not shown) that controls and manages the overall operation including the above-described operation of the dynamic control flow analysis apparatus in a state of establishing communication connection with the apparatus 400. [

또한, 동적 제어흐름 분석 및 선별에 의해 제어흐름 처방 테이블(330)에 저장된 주소 쌍들은 제어흐름 처방으로서 사용된다. 예를 들어, 추후 프로그램 공격이 발생하였는지를 모르는 상태에서 프로그램을 실행하는 중, 주소 검사부(410)는 간접 분기 명령에 해당하는 주소 쌍을 추출하고, 추출된 주소 쌍이 제어흐름 처방 테이블(330)에 기저장되어 있지 않으면, 공격이 발생한 것으로 판단하고, 신속히 후속 조치를 취하도록 할 수 있다.In addition, the address pairs stored in the control flow prescription table 330 by dynamic control flow analysis and sorting are used as a control flow prescription. For example, during execution of a program without knowing whether a program attack occurs later, the address checking unit 410 extracts the address pair corresponding to the indirect branch instruction, and the extracted address pair is sent to the control flow prescription table 330 If it is not stored, it can be determined that an attack has occurred and can be promptly followed up.

이하에서는 도 11 내지 도 13을 참조하여 본 발명의 실시 예에 따른 문법에 의하여 생성된 입력으로 제어흐름을 처방하기 위한 동적 제어흐름 분석 방법을 설명한다.Hereinafter, a dynamic control flow analysis method for prescribing a control flow based on an input generated by a grammar according to an embodiment of the present invention will be described with reference to FIGS.

도 11은 본 발명의 실시 예에 따른 문법에 의하여 생성된 입력으로 제어흐름을 처방하기 위한 동적 제어흐름 분석 장치의 동적 제어흐름 분석 방법을 간략히 설명하기 위한 흐름도이다.11 is a flowchart briefly explaining a dynamic control flow analysis method of a dynamic control flow analysis apparatus for prescribing a control flow to an input generated by a grammar according to an embodiment of the present invention.

도 11 내지 도 13의 동적 제어흐름 분석 방법을 위한 장치는 도 1 내지 도 10을 참조하여 설명한 동적 제어흐름 분석 장치이므로, 이하에서는 동적 제어흐름 분석 방법의 구체적인 설명은 생략한다.Since the apparatus for the dynamic control flow analysis method of FIGS. 11 to 13 is the dynamic control flow analysis apparatus described with reference to FIGS. 1 to 10, a detailed description of the dynamic control flow analysis method will be omitted below.

도 11을 참조하면, 입력 생성 장치(100)는 문맥 자유 문법에 따라 생성된 문장들의 집합인 문장 집합을 확장하여, 문장들의 특수 단말을 확장 정규 문법으로 제한된 문자열 생성 규칙에 따라 의미있는 문자열로 변환하고, 일반 단말은 그대로 사용하되 속성을 문장에서 문자열로 변환한다(S1110).11, the input generating apparatus 100 may expand a set of sentences, which is a set of sentences generated according to a context free grammar, to convert special terminals of sentences into meaningful strings according to the rules for generating a string limited by extended regular grammars , And the general terminal is used as it is, but the attribute is converted from a sentence into a character string (S1110).

입력 생성 장치(100)는 S1110단계에서 변환된 모든 문자열을 디스크(300)에 저장한다(S1120).The input generating apparatus 100 stores all the converted strings in step S1110 on the disc 300 (S1120).

제어흐름 분석 장치(400)는 프로그램이 실행되면(S1130), 프로그램으로 입력되는 문자열이 처리되는 동안 간접 분기 명령의 발생 여부에 따라 적법한 제어흐름을 동적으로 분석 및 선별하고, 선별 결과에 해당하는 간접 분기 명령어에 해당하는 주소 쌍을 저장한다(S1140).When the program is executed (S1130), the control flow analyzing apparatus 400 dynamically analyzes and selects a legitimate control flow according to whether or not an indirect branch instruction is generated during the processing of a character string input by the program, The address pair corresponding to the branch instruction word is stored (S1140).

도 12는 도 11의 S1110단계를 보다 자세히 설명하기 위한 흐름도이다.FIG. 12 is a flowchart for explaining step S1110 of FIG. 11 in more detail.

도 12를 참조하면, 입력 생성 장치(100)는 도 5와 같은 문맥 자유 문법 기반의 입력 명세와 도 7과 같은 확장 정규 문법 기반의 문자열 명세를 입력받는다(S1210).Referring to FIG. 12, the input generating apparatus 100 receives a context-free grammar-based input specification as shown in FIG. 5 and a string specification based on an extended regular grammar as shown in FIG. 7 (S1210).

입력 생성 장치(100)는 입력된 문맥 자유 문법 기반의 입력 명세를 해석하여 문법 매핑 테이블(210)을 생성하고, 확장 정규 문법 기반의 문자열 명세를 해석하여 문자열 생성 규칙 테이블(220)을 생성하여 메모리(200)에 저장한다(S1220). The input generating apparatus 100 generates a grammar mapping table 210 by interpreting the input specification based on the input context free grammar and generates a string generating rule table 220 by analyzing the string specification based on the extended regular grammar, (Step S1220).

입력 생성 장치(100)는 생성된 문법 매핑 테이블(210)로부터 도출가능한 모든 문장들을 도 8과 같은 문장 집합으로서 생성하여 문장 집합 테이블(230)을 작성하여 메모리(200)에 저장한다(S1230).The input generating apparatus 100 generates all sentences that can be derived from the generated grammar mapping table 210 as a sentence set as shown in FIG. 8, and creates and stores the sentence set table 230 in the memory 200 (S1230).

입력 생성 장치(100)는 S1230에서 생성된 도출가능한 모든 문장들, 즉, 사용하고자 하는 모든 문장들을 문장 집합 테이블(230)에서 출력하여 디스크(300)에 저장한다(S1240).The input generating apparatus 100 outputs all the derivable sentences generated in step S1230, that is, all the sentences to be used, from the sentence set table 230 and stores them in the disc 300 (S1240).

입력 생성 장치(100)는 문자열 생성 규칙 테이블(220)에 설정된 문자열 생성 규칙에 따라 S1240단계에서 저장된 문장들 내의 특수 단말을 의미있는 문자열로 변환하고, 일반 단말을 문자열 속성으로 변환한다(S1250). S1250단계에서 모든 문장들이 변환된 문자열은 도 9와 같은 형태를 갖는다.The input generating apparatus 100 converts the special terminal in the sentences stored in step S1240 into a meaningful string according to the string generating rule set in the string generating rule table 220, and converts the special terminal into a string attribute (S1250). In step S1250, the converted string of all the sentences has the form as shown in FIG.

입력 생성 장치(100)는 문자열을 추가로 변환해야 하면(S1260-Yes), S1250단계로 진입한다. 이는, 동일한 문장에 대해 문자열로 변환하는 횟수가 2회 이상 지정되어 있을 수 있기 때문에, 문자열의 추가 변환 여부를 확인한다.If the input generating apparatus 100 has to further convert the character string (S1260-Yes), the input generating apparatus 100 enters the step S1250. This is because the number of times of conversion to a character string may be specified twice or more for the same sentence, so it is checked whether or not the character string is further converted.

또한, 입력 생성 장치(100)는 문자열의 변환이 완료된 경우(S1260-No), 변환된 전체 문자열을 디스크(300)에 저장한다(S11120).When the string conversion is completed (S1260-No), the input generating apparatus 100 stores the converted whole string on the disk 300 (S11120).

도 13은 도 11의 S1140단계를 보다 자세히 설명하기 위한 흐름도이다.FIG. 13 is a flowchart for explaining step S1140 of FIG. 11 in more detail.

도 13을 참조하면, 제어흐름 분석 장치(400)는 프로세스가 진행되는 동안, 즉, 프로그램이 실행되는 동안 S1120단계에서 저장된 문자열을 순차적으로 입력받아 처리한다(S1310).Referring to FIG. 13, the control flow analyzer 400 sequentially receives and processes the strings stored in step S1120 during the process, that is, during execution of the program (S1310).

제어흐름 분석 장치(400)는 문자열을 입력으로 받아 프로그램이 실행되는 동안, 프로세스로 명령어가 입력될 때마다 명령어를 분석한다(S1320).The control flow analysis apparatus 400 analyzes the command every time a command is input to the process while the program is being executed by receiving the character string as an input (S1320).

분석 결과, 명령어가 간접 분기 명령에 해당하는 명령어이면(S1330-Yes), 제어흐름 분석 장치(400)는 간접 분기 명령에 해당하는 주소 쌍을 추출한다(S1340).If the instruction is an instruction corresponding to the indirect branch instruction (S1330-Yes), the control flow analysis apparatus 400 extracts the address pair corresponding to the indirect branch instruction (S1340).

제어흐름 분석 장치(400)는 추출된 주소 쌍이 이전에 수집된 주소 쌍인지, 즉, 누적 주소 테이블(250)에 동일한 주소 쌍이 기저장되어 있는지 확인한다(S1350).The control flow analyzing unit 400 determines whether the extracted address pair is a previously collected address pair, that is, whether the same address pair is stored in the cumulative address table 250 (S1350).

추출된 주소 쌍이 기저장되어 있지 않으면(S1350-No), 제어흐름 분석 장치(400)는 추출된 주소 쌍을 누적 주소 테이블(250)에 저장한다(S1360).If the extracted address pair is not stored (S1350-No), the control flow analyzer 400 stores the extracted address pair in the cumulative address table 250 (S1360).

제어흐름 분석 장치(400)는 프로그램 실행이 완료될 때까지 S1330단계 내지 S1360단계를 반복 수행한다.The control flow analyzing apparatus 400 repeats steps S1330 to S1360 until the execution of the program is completed.

프로그램 실행이 완료되면(S1370-Yes), 제어흐름 분석 장치(400)는 모든 문자열 입력에 대한 제어흐름의 분석이 완료되었는지 판단한다(S1380).When the execution of the program is completed (S1370-Yes), the control flow analyzer 400 determines whether the analysis of the control flow for all character string input is completed (S1380).

모든 문자열 입력에 대한 제어흐름 분석이 완료되지 않은 경우(S1380-No), 제어흐름 분석 장치(400)는 S1310단계로 진입하여 프로그램을 재실행하고, 분석되지 않은 문자열이 입력되도록 하여 S1310단계 내지 S1370단계를 수행한다.If the analysis of the control flow for all the character strings is not completed (S1380-No), the control flow analyzing apparatus 400 proceeds to step S1310 to re-execute the program, .

모든 문자열 입력에 대한 분석이 완료된 경우(S1380-Yes), 제어흐름 분석 장치(400)는 디스크(300)의 제어흐름 처방 테이블(330)로 누적된 주소 쌍을 출력하여 저장되도록 한다(S1390). If the analysis of all the string inputs is completed (S1380-Yes), the control flow analyzing apparatus 400 outputs the accumulated address pairs to the control flow prescription table 330 of the disk 300 and stores them in the memory (S1390).

도 11 내지 도 13을 참조하여 상술한 방법에 의해, 동적 제어흐름 분석 장치는 실시간으로 입력되는 문자열을 이용하여 동적으로 제어흐름을 분석함을 알 수 있다.11 to 13, it can be seen that the dynamic control flow analysis apparatus dynamically analyzes the control flow using a string input in real time.

한편 본 발명에 따른 문법에 의하여 생성된 입력으로 제어흐름을 처방하기 위한 동적 제어흐름 분석 장치의 분석 방법은 이를 구현하기 위한 명령어들의 프로그램이 유형적으로 구현됨으로써, 컴퓨터를 통해 판독될 수 있는 기록매체에 포함되어 제공될 수도 있음은 통상의 기술자가 쉽게 이해할 수 있다.Meanwhile, the analysis method of the dynamic control flow analyzing apparatus for prescribing the control flow to the input generated by the grammar according to the present invention is characterized in that a program of instructions for implementing the method is tangibly embodied, It is easily understood by a person skilled in the art that the present invention may be included in the present invention.

따라서, 본 발명은 문법에 의하여 생성된 입력으로 제어흐름을 처방하기 위한 동적 제어흐름 분석 장치의 동적 제어흐름 분석 방법을 구현하기 위하여 상기 동적 제어흐름 분석 장치를 제어하는 컴퓨터 상에서 수행되는 컴퓨터 판독 가능한 기록매체에 저장된 프로그램을 함께 제공한다.Thus, the present invention provides a method for analyzing a dynamic control flow analysis apparatus for dynamic control flow analysis apparatus for prescribing a control flow with input generated by a grammar, Provides programs stored on media together.

100: 입력 생성 장치 110: 명세 해석부
120: 문장 열거부 130: 문장 출력부
140: 문자열 변환부 200: 메모리
300: 디스크 400: 제어흐름 분석 장치
410: 주소 검사부 420: 주소 출력부
100: input generating apparatus 110: specification analyzing unit
120: reject sentence 130: sentence output
140: string conversion unit 200: memory
300: Disk 400: Control Flow Analyzer
410: address checking unit 420: address output unit

Claims (15)

문맥 자유 문법에 따라 생성된 문장들의 집합인 문장 집합을 확장하여, 상기 문장들의 특수 단말을 확장 정규 문법으로 제한된 문자열 생성 규칙에 따라 의미있는 문자열로 변환하는 입력 생성 장치; 및
상기 변환된 문자열을 포함하는 전체 문자열을 입력으로 받아 프로그램이 실행되는 중 간접 분기 명령이 발생하면, 적법한 제어흐름을 분석 및 선별하는 제어흐름 분석 장치;를 포함하고,
상기 입력 생성 장치는,
상기 문맥 자유 문법 기반의 입력 명세를 해석하여 문법 매핑 테이블을 생성하고, 상기 확장 정규 문법 기반의 문자열 명세를 해석하여 문자열 생성 규칙 테이블을 생성하는 명세 해석부;
상기 문법 매핑 테이블로부터 도출가능한 모든 문장들을 생성하여 문장 집합 테이블에 열거하는 문장 열거부;
상기 문장 집합 테이블로부터 사용하고자 하는 모든 문장들을 출력하는 문장 출력부; 및
상기 문자열 생성 규칙 테이블에 설정된 문자열 생성 규칙에 따라 상기 출력된 문장들 내의 특수 단말을 상기 의미있는 문자열로 변환하고, 일반 단말은 속성을 문장에서 문자열로 변환하는 문자열 변환부;를 포함하는 문법에 의하여 생성된 입력으로 제어흐름을 처방하기 위한 동적 제어흐름 분석 장치.
An input generating device for expanding a set of sentences that is a set of sentences generated according to the context free grammar and converting the special terminal of the sentences into a meaningful string according to a rule for generating a string limited by an extended normal grammar; And
And a control flow analyzing apparatus for analyzing and selecting a proper control flow when an intermediate branch instruction for executing a program is received and receiving an entire string including the converted character string as an input,
The input generating apparatus includes:
A specification analyzer for generating a grammar mapping table by interpreting the input specification based on the context free grammar and generating a string generation rule table by analyzing the string specification based on the extended regular grammar;
A sentence sequence rejection unit for generating all sentences derivable from the grammar mapping table and listing them in a sentence set table;
A sentence output unit for outputting all sentences to be used from the sentence set table; And
And a character string conversion unit converting the special terminal in the output sentences into the meaningful character string according to a character string generation rule set in the character string generation rule table and converting the attribute into a character string in a general terminal. A dynamic control flow analysis device for prescribing a control flow with generated inputs.
삭제delete 제1항에 있어서,
상기 명세 해석부는,
상기 문맥 자유 문법을 기반으로 작성된 입력 명세를 해석하여 비단말에 색인 번호를 매핑한 비단말 테이블을 생성하고, 단말에 색인 번호를 매핑한 단말 테이블을 생성한 후, 상기 비단말 테이블과 상기 단말 테이블의 색인 번호와 상기 입력 명세의 줄번호로 이루어진 상기 문법 매핑 테이블을 생성하는 것을 특징으로 하는 문법에 의하여 생성된 입력으로 제어흐름을 처방하기 위한 동적 제어흐름 분석 장치.
The method according to claim 1,
The specification analyzing unit,
A non-terminal table in which an index number is mapped to a non-terminal word by interpreting an input specification created based on the context free grammar, a terminal table in which an index number is mapped to the terminal, The grammar mapping table including the index number of the input specification and the line number of the input specification is generated.
제1항에 있어서,
상기 명세 해석부는,
상기 문자열 명세에 상기 특수 단말 별로 지정된 문자열을 이용하여 상기 문자열 생성 규칙 테이블을 생성하는 것을 특징으로 하는 문법에 의하여 생성된 입력으로 제어흐름을 처방하기 위한 동적 제어흐름 분석 장치.
The method according to claim 1,
The specification analyzing unit,
Wherein the character string generation rule table is generated using the string specified for each special terminal in the character string specification.
제1항에 있어서,
상기 문자열 변환부는,
상기 출력된 모든 문장들에 속한 일반 단말은 문장에서 문자열로 속성을 변환하고, 상기 모든 문장들에 속한 특수 단말은 상기 문자열 생성 규칙을 참조하여 해당하는 문자열로 변환하여 상기 모든 문장들을 상기 전체 문자열로 변환하는 것을 특징으로 하는 문법에 의하여 생성된 입력으로 제어흐름을 처방하기 위한 동적 제어흐름 분석 장치.
The method according to claim 1,
Wherein the string conversion unit comprises:
The general terminal belonging to all the sentences converts the attribute into a character string in a sentence. The special terminal belonging to all the sentences converts the character string into a corresponding character string by referring to the character string generation rule, Wherein the controller is configured to generate a control flow based on the input generated by the grammar.
제1항에 있어서,
상기 제어흐름 분석 장치는,
상기 전체 문자열을 입력받아 상기 프로그램이 실행되는 동안 간접 분기 명령이 발생하면, 상기 간접 분기 명령에 해당하는 주소 쌍을 추출하여 누적 주소 테이블에 저장하는 주소 검사부; 및
상기 누적 주소 테이블에 누적된 주소쌍을 제어흐름 처방 테이블로 출력하는 주소 출력부;를 포함하는 것을 특징으로 하는 문법에 의하여 생성된 입력으로 제어흐름을 처방하기 위한 동적 제어흐름 분석 장치.
The method according to claim 1,
The control flow analyzing apparatus includes:
An address checking unit for extracting an address pair corresponding to the indirect branch instruction and storing the address pair in an accumulated address table when an indirect branch instruction is generated while the program is being executed, And
And an address output unit for outputting the address pairs accumulated in the cumulative address table to the control flow prescription table.
제6항에 있어서,
상기 주소 검사부는,
상기 프로그램이 실행되는 동안 입력되는 명령어를 분석하여 상기 간접 분기 명령인지를 판단하고, 상기 명령어가 발생한 메모리의 출처 주소 및 상기 명령어의 목적지 주소를 추출하여 상기 주소 쌍을 생성하며,
상기 생성된 주소 쌍은 상기 프로그램의 동적 제어흐름 분석 결과로서 상기 제어흐름 처방 테이블에 저장되는 것을 특징으로 하는 문법에 의하여 생성된 입력으로 제어흐름을 처방하기 위한 동적 제어흐름 분석 장치.
The method according to claim 6,
The address checking unit,
Wherein the address pair is generated by extracting a source address of a memory in which the instruction is generated and a destination address of the instruction in a case where the instruction is an indirect branch instruction by analyzing a command input during execution of the program,
Wherein the generated address pair is stored in the control flow prescription table as a result of dynamic control flow analysis of the program.
(A) 문맥 자유 문법에 따라 생성된 문장들의 집합인 문장 집합을 확장하여, 상기 문장들의 특수 단말을 확장 정규 문법으로 제한된 문자열 생성 규칙에 따라 의미있는 문자열로 변환하는 단계; 및
(B) 상기 변환된 문자열을 포함하는 전체 문자열을 입력으로 받아 프로그램이 실행되는 중 간접 분기 명령이 발생하면, 적법한 제어흐름을 분석 및 선별하는 단계;를 포함하고,
상기 (A) 단계는,
(A1) 상기 문맥 자유 문법 기반의 입력 명세를 해석하여 문법 매핑 테이블을 생성하고, 상기 확장 정규 문법 기반의 문자열 명세를 해석하여 문자열 생성 규칙 테이블을 생성하는 단계;
(A2) 상기 문법 매핑 테이블로부터 도출가능한 모든 문장들을 생성하여 문장 집합 테이블에 열거하는 단계;
(A3) 상기 문장 집합 테이블로부터 사용하고자 하는 모든 문장들을 출력하는 단계; 및
(A4) 상기 문자열 생성 규칙 테이블에 설정된 문자열 생성 규칙에 따라 상기 출력된 문장들 내의 특수 단말을 상기 의미있는 문자열로 변환하고, 일반 단말은 속성을 문장에서 문자열로 변환하는 단계;를 포함하는 문법에 의하여 생성된 입력으로 제어흐름을 처방하기 위한 동적 제어흐름 분석 방법.
(A) converting a set of sentences, which is a set of sentences generated according to a context free grammar, into a meaningful string according to a rule for generating a string limited to an extended regular grammar; And
(B) analyzing and selecting a legitimate control flow when an intermediate branch instruction for executing a program is received and an entire string including the converted string is input,
The step (A)
(A1) generating a grammar mapping table by interpreting the context-free grammar-based input specification, and generating a string generation rule table by interpreting the string specification based on the extended regular grammar;
(A2) generating all sentences derivable from the grammar mapping table and listing them in a sentence set table;
(A3) outputting all sentences to be used from the sentence set table; And
(A4) converting the special terminal in the output sentences into the meaningful character string according to the character string generation rule set in the character string generation rule table, and converting the attribute into a character string in the general terminal A method for dynamic control flow analysis for prescribing a control flow with input generated by the method.
삭제delete 제8항에 있어서,
상기 (A1) 단계는,
상기 문맥 자유 문법을 기반으로 작성된 입력 명세를 해석하여 비단말에 색인 번호를 매핑한 비단말 테이블을 생성하고, 단말에 색인 번호를 매핑한 단말 테이블을 생성한 후, 상기 비단말 테이블과 상기 단말 테이블의 색인 번호와 상기 입력 명세의 줄번호로 이루어진 상기 문법 매핑 테이블을 생성하는 것을 특징으로 하는 문법에 의하여 생성된 입력으로 제어흐름을 처방하기 위한 동적 제어흐름 분석 방법.
9. The method of claim 8,
The step (A1)
A non-terminal table in which an index number is mapped to a non-terminal word by interpreting an input specification created based on the context free grammar, a terminal table in which an index number is mapped to the terminal, The grammar mapping table including the index number of the input specification and the line number of the input specification is generated.
제8항에 있어서,
상기 (A1) 단계는,
상기 문자열 명세에 상기 특수 단말 별로 지정된 문자열을 이용하여 상기 문자열 생성 규칙 테이블을 생성하는 것을 특징으로 하는 문법에 의하여 생성된 입력으로 제어흐름을 처방하기 위한 동적 제어흐름 분석 방법.
9. The method of claim 8,
The step (A1)
Wherein the string generating rule table is generated using the character string specified for each special terminal in the character string specification.
제8항에 있어서,
상기 (A4) 단계는,
상기 출력된 모든 문장들에 속한 일반 단말은 문장에서 문자열로 속성을 변환하고, 상기 모든 문장들에 속한 특수 단말은 상기 문자열 생성 규칙을 참조하여 해당하는 문자열로 변환하여 상기 모든 문장들을 상기 전체 문자열로 변환하는 것을 특징으로 하는 문법에 의하여 생성된 입력으로 제어흐름을 처방하기 위한 동적 제어흐름 분석 방법.
9. The method of claim 8,
The step (A4)
The general terminal belonging to all the sentences converts the attribute into a character string in a sentence. The special terminal belonging to all the sentences converts the character string into a corresponding character string by referring to the character string generation rule, Wherein the input of the control flow is an input of a grammar generated by the grammar.
제8항에 있어서,
상기 (B) 단계는,
(B1) 상기 전체 문자열을 입력받아 상기 프로그램이 실행되는 동안 간접 분기 명령이 발생하면, 상기 간접 분기 명령에 해당하는 주소 쌍을 추출하여 누적 주소 테이블에 저장하는 단계; 및
(B2) 상기 누적 주소 테이블에 누적된 주소쌍을 제어흐름 처방 테이블로 출력하는 단계;를 포함하는 것을 특징으로 하는 문법에 의하여 생성된 입력으로 제어흐름을 처방하기 위한 동적 제어흐름 분석 방법.
9. The method of claim 8,
The step (B)
(B1) extracting an address pair corresponding to the indirect branch instruction and storing the branch in an accumulated address table when an indirect branch instruction is generated while the program is being executed; And
And (B2) outputting a pair of addresses accumulated in the cumulative address table to a control flow prescription table. &Lt; Desc / Clms Page number 19 &gt;
제13항에 있어서,
상기 (B1) 단계는,
상기 프로그램이 실행되는 동안 입력되는 명령어를 분석하여 상기 간접 분기 명령인지를 판단하고, 상기 명령어가 발생한 메모리의 출처 주소 및 상기 명령어의 목적지 주소를 추출하여 상기 주소 쌍을 생성하며,
상기 생성된 주소 쌍은 상기 프로그램의 동적 제어흐름 분석 결과로서 상기 제어흐름 처방 테이블에 저장되는 것을 특징으로 하는 문법에 의하여 생성된 입력으로 제어흐름을 처방하기 위한 동적 제어흐름 분석 방법.
14. The method of claim 13,
The step (B1)
Wherein the address pair is generated by extracting a source address of a memory in which the instruction is generated and a destination address of the instruction in a case where the instruction is an indirect branch instruction by analyzing a command input during execution of the program,
Wherein the generated address pair is stored in the control flow prescription table as a result of dynamic control flow analysis of the program.
삭제delete
KR1020160183723A 2016-12-30 2016-12-30 Apparatus and method for dynamic control-flow analysis for prescribing control-flow with Inputs generated from grammar KR101900813B1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
KR1020160183723A KR101900813B1 (en) 2016-12-30 2016-12-30 Apparatus and method for dynamic control-flow analysis for prescribing control-flow with Inputs generated from grammar

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
KR1020160183723A KR101900813B1 (en) 2016-12-30 2016-12-30 Apparatus and method for dynamic control-flow analysis for prescribing control-flow with Inputs generated from grammar

Publications (2)

Publication Number Publication Date
KR20180078702A KR20180078702A (en) 2018-07-10
KR101900813B1 true KR101900813B1 (en) 2018-09-20

Family

ID=62915779

Family Applications (1)

Application Number Title Priority Date Filing Date
KR1020160183723A KR101900813B1 (en) 2016-12-30 2016-12-30 Apparatus and method for dynamic control-flow analysis for prescribing control-flow with Inputs generated from grammar

Country Status (1)

Country Link
KR (1) KR101900813B1 (en)

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2012073794A (en) * 2010-09-28 2012-04-12 Fujitsu Ltd Character string selection method, character string selection program, and character string selection device

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102713839B (en) * 2009-10-08 2015-11-25 爱迪德技术有限公司 For the system and method for the positive oneself's amendment in kinematic function calling system
KR20120135782A (en) * 2011-06-07 2012-12-17 한국과학기술정보연구원 Method for transferring meta-data and apparatus thereof
KR101625129B1 (en) * 2013-12-31 2016-05-27 고려대학교 산학협력단 Method and system for indirectness branch monitoring of program

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2012073794A (en) * 2010-09-28 2012-04-12 Fujitsu Ltd Character string selection method, character string selection program, and character string selection device

Also Published As

Publication number Publication date
KR20180078702A (en) 2018-07-10

Similar Documents

Publication Publication Date Title
CN109842629B (en) Method for realizing self-defined protocol based on protocol analysis framework
EP2561453B1 (en) A dual dfa decomposition for large scale regular expression matching
US8626786B2 (en) Dynamic language checking
US10229104B2 (en) Efficient DFA generation for non-matching characters and character classes in regular expressions
US20130132410A1 (en) Systems And Methods For Identifying Potential Duplicate Entries In A Database
CN103853650A (en) Test case generating method and device for fuzz testing
CN107526742B (en) Method and apparatus for processing multilingual text
US9984064B2 (en) Reduction of memory usage in feature generation
US9495638B2 (en) Scalable, rule-based processing
CN111552792A (en) Information query method and device, electronic equipment and storage medium
US20130179147A1 (en) Methods and systems for tokenizing multilingual textual documents
KR20230084584A (en) code similarity search
EP3312740B1 (en) Data search program, data search device, and data search method
KR101900813B1 (en) Apparatus and method for dynamic control-flow analysis for prescribing control-flow with Inputs generated from grammar
JP4734400B2 (en) Document search apparatus and program
RU2660643C1 (en) System and method of detecting the harmful cil-file
KR101559651B1 (en) Method and apparatus of dynamic analysis
WO2018179729A1 (en) Index generating program, data search program, index generating device, data search device, index generating method, and data search method
JP4845921B2 (en) Machine translation apparatus, machine translation program, and machine translation method
JP7424393B2 (en) Estimation system, estimation method and estimation program
JP4061283B2 (en) Apparatus, method and program for converting lexical data to data
JP6717152B2 (en) Index generation program, index generation device, index generation method, search program, search device, and search method
JP6300512B2 (en) Determination device, determination method, and program
CN117648092A (en) Byte code processing method and device
JP4139805B2 (en) Apparatus, method and program for converting lexical data to data

Legal Events

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