KR102436522B1 - Protocol message format reversing apparatus and method thereof - Google Patents

Protocol message format reversing apparatus and method thereof Download PDF

Info

Publication number
KR102436522B1
KR102436522B1 KR1020200173233A KR20200173233A KR102436522B1 KR 102436522 B1 KR102436522 B1 KR 102436522B1 KR 1020200173233 A KR1020200173233 A KR 1020200173233A KR 20200173233 A KR20200173233 A KR 20200173233A KR 102436522 B1 KR102436522 B1 KR 102436522B1
Authority
KR
South Korea
Prior art keywords
api
bit
field
sequence
seed
Prior art date
Application number
KR1020200173233A
Other languages
Korean (ko)
Other versions
KR20220083214A (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 KR1020200173233A priority Critical patent/KR102436522B1/en
Publication of KR20220083214A publication Critical patent/KR20220083214A/en
Application granted granted Critical
Publication of KR102436522B1 publication Critical patent/KR102436522B1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3696Methods or tools to render software testable
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3604Software analysis for verifying properties of programs
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3692Test management for test results analysis
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/18Protocol analysers

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Software Systems (AREA)
  • Debugging And Monitoring (AREA)
  • Computer And Data Communications (AREA)

Abstract

본 발명은 악성 프로그램 혹은 C&C간의 주고 받는 프로토콜과 같이 비공개 되어 있는 정보를 메시지 혹은 파일과 같은 로우 데이터만으로 의미 있는 정보를 분석할 수 있도록 한 프로토콜 메시지 포맷 리버싱 장치 및 그 방법에 관한 것으로서, 상기 장치는, N비트의 크기를 갖는 시드가 입력되면, 입력된 N비트의 크기의 시드를 1비트씩 순서대로 전환하여 N개의 변형된 입력값을 생성하는 비트플립 퍼징 모듈; 상기 비트플립 퍼징 모듈로부터 생성된 N개의 변형된 입력값과, 상기 N비트 크기를 갖는 시드를 각각 수신하여 실행된 프로그램이 호출하는 API를 시간순으로 기록하여 N개의 API 시퀀스와 1개의 API 시퀀스를 출력하는 API로깅 모듈; 및 상기 API 로깅 모듈로부터 출력되는 N개의 API 시퀀스와 1개의 API 시퀀스를 각각 비교하여 입력되는 시드의 메시지 포맷을 분석하여 출력하는 프로토콜 분석 모듈을 포함한다. The present invention relates to a protocol message format reversing apparatus and method for analyzing meaningful information only with raw data such as messages or files for confidential information such as malicious programs or protocols exchanged between C&C, and the method, is, when a seed having a size of N bits is input, a bit flip fuzzing module that generates N modified input values by sequentially converting an input seed having a size of N bits by 1 bit; The N modified input values generated from the bit-flip fuzzing module and the seed having the N-bit size are received, respectively, and the API called by the executed program is recorded in chronological order, and N API sequences and one API sequence are output. API logging module; and a protocol analysis module that compares each of N API sequences and one API sequence output from the API logging module, and analyzes and outputs a message format of an input seed.

Figure R1020200173233
Figure R1020200173233

Description

프로토콜 메시지 포맷 리버싱 장치 및 그 방법{Protocol message format reversing apparatus and method thereof}Protocol message format reversing apparatus and method thereof

본 발명은 프로토콜 메시지 포맷 리버싱 장치 및 그 방법에 관한 것으로서, 특히 악성 프로그램 혹은 C&C간 주고 받는 프로토콜과 같이 비공개 되어 있는 정보를 메시지 혹은 파일과 같은 로우 데이터만으로 의미 있는 정보를 분석할 수 있도록 한 프로토콜 메시지 포맷 리버싱 장치 및 그 방법에 관한 것이다. The present invention relates to a protocol message format reversing apparatus and method, and in particular, a protocol that enables the analysis of meaningful information only with raw data such as messages or files for confidential information such as malicious programs or protocols exchanged between C&C. A message format reversing apparatus and method are provided.

일반적으로, 종래 기술에 따른 프로토콜 메시지 포맷 리버싱은 Taint 분석을 통해 수행할 수 있는데, Taint 분석은 프로그램이 실행되면서 입력값이 어떠한 레지스터들을 거치는지 분석함으로써, 입력값이 실행에 끼치는 영향을 분석한다.In general, protocol message format reversing according to the prior art can be performed through taint analysis, which analyzes which registers an input value passes through while a program is executed, and analyzes the influence of an input value on execution. .

또한, 종래 기술은 프로토콜 메세지 포맷 중에서 길이와 관련된 필드, 값의 경계를 의미하는 필드, 특정 값으로 정해진 키워드 필드, 데이터 필드 등을 알아내는 방법이다. In addition, the prior art is a method of finding out a field related to a length, a field indicating a boundary of values, a keyword field determined to a specific value, a data field, and the like from among protocol message formats.

해당 필드들은 일반적으로 개발하는 패턴을 기반으로 경험 지식적인(Huristic) 알고리즘으로 분석할 수 있다. Corresponding fields can be analyzed with a heuristic algorithm based on a generally developed pattern.

예를 들어, 입력값을 읽는 코드는 루프 문을 사용하여 사이즈만큼 읽었는지 확인하는 방식을 가진다. 이에 착안하여 프로그램 분석 시, 루프 문이 있고 사용자 입력값과 계속 증가하는 변수의 값이 같은지 확인하는 연산이 반복된다면 이 때의 사용자 입력값을 길이와 관련된 필드로 인식한다. For example, the code that reads the input value has a method of checking whether the size has been read using a loop statement. With this in mind, when analyzing the program, if there is a loop statement and the operation to check whether the value of the variable that is continuously increasing is the same as the user input value is repeated, the user input value at this time is recognized as a field related to the length.

경계를 의미하는 필드 역시 개행 문자, 콤마 등과 비교하는 동일한 연산이 있는지 확인하여 해당 사용자 입력값이 값의 경계를 의미하는 필드라고 인식한다. The field indicating the boundary is also recognized as a field indicating the boundary of the value by checking whether there is the same operation for comparison with a newline character or a comma.

이와 같은 종래기술은 명령어(instruction) 단위로 프로그램을 분석하기 때문에 많은 시간이 소요되는 문제점을 안고 있다. Such a prior art has a problem in that it takes a lot of time because it analyzes a program in units of instructions.

또한, 프로그램의 실행을 면밀하게 분석하는 화이트박스 분석방식을 취하기 때문에 많은 시간이 소요되며, 사이즈가 큰 프로그램은 사실상 분석이 불가능하다는 문제점이 있다. In addition, it takes a lot of time because it takes a white box analysis method that closely analyzes the execution of the program, and there is a problem in that it is virtually impossible to analyze a large size program.

따라서, 본 발명은 상기한 문제점을 해결하기 위한 것으로, 본 발명의 목적은, 소프트웨어 보안 테스트 기법인 퍼징(Fuzzing) 기술을 활용하여 프로그램이 정상적으로 실행하는 입력값을 변형하여 프로그램의 오류를 찾는 기술을 제공함에 있다. 즉, 본 발명은 퍼징으로 생성한 입력값을 실행하고 API 레벨에서 프로그램 분석을 수행하고, 정상적인 입력값을 실행했을 때의 API시퀀스와 변형된 입력값을 실행했을 때의 API 시퀀스를 비교하여, 변형한 bit가 어떠한 의미인지를 분석하여 프로토콜 메세지 포맷을 확인하도록 한 프로토콜 메시지 리버싱 장치 및 그 방법을 제공함에 있다. Therefore, the present invention is to solve the above problems, and an object of the present invention is to use a fuzzing technique, which is a software security test technique, to modify an input value normally executed by a program to find a technique for finding errors in the program. is in providing. That is, the present invention executes the input value generated by fuzzing, performs program analysis at the API level, compares the API sequence when the normal input value is executed and the API sequence when the modified input value is executed, An object of the present invention is to provide an apparatus for reversing a protocol message and a method therefor to check a protocol message format by analyzing the meaning of one bit.

상기한 목적을 달성하기 위한 본 발명에 따른 프로토콜 메시지 포맷 리버싱 장치는, N비트의 크기를 갖는 파일 형식의 시드가 입력되면, 입력된 N비트의 크기의 시드를 1비트씩 순서대로 전환하여 N개의 변형된 입력값을 생성하는 비트플립 퍼징 모듈; 상기 비트플립 퍼징 모듈로부터 생성된 N개의 변형된 입력값과, 상기 N비트 크기를 갖는 시드를 각각 수신하여 실행된 프로그램이 호출하는 API를 시간순으로 기록하여 N개의 API 시퀀스와 1개의 API 시퀀스를 출력하는 API로깅 모듈; 및 상기 API 로깅 모듈로부터 출력되는 N개의 API 시퀀스와 1개의 API 시퀀스를 각각 비교하여 입력되는 시드의 메시지 포맷을 분석하여 출력하는 프로토콜 분석 모듈을 포함할 수 있다. The protocol message format reversing apparatus according to the present invention for achieving the above object, when a file format seed having an N-bit size is input, sequentially converts the input N-bit seed size by 1 bit to N a bit-flip fuzzing module for generating modified input values; The N modified input values generated from the bit-flip fuzzing module and the seed having the N-bit size are received, respectively, and the API called by the executed program is recorded in chronological order, and N API sequences and one API sequence are output. API logging module; and a protocol analysis module that compares each of N API sequences and one API sequence output from the API logging module, and analyzes and outputs the message format of the input seed.

상기 비트플립 퍼징 모듈은, 퍼징 기법을 이용하여 입력되는N 비트 크기의 시드를 1번째 bit부터 N번째 bit까지 각각 1개 bit 만 flip하여 총 N개의 변형된 입력값을 생성할 수 있다. The bit flip fuzzing module may generate a total of N transformed input values by flipping the N-bit seed input by using a fuzzing technique by only one bit from the first bit to the N-th bit, respectively.

상기 API 로깅 모듈은, PIN Tool을 사용하여 프로그램을 분석할 수 있다. The API logging module may analyze the program using the PIN Tool.

상기 API 로깅 모듈은, 실행한 API의 이름, 파라미터, 반환 값, 리턴 주소 정보를 기록하고, Heap Allocation 관련 API를 로깅할 수 있다. The API logging module may record the name, parameter, return value, and return address information of the executed API, and log the Heap Allocation-related API.

상기 API 로깅 모듈은, createfile, readfile 함수를 로깅하여 프로그램이 입력을 읽는 시점을 파악하고, 상기 1개의 변형된 입력값을 실행하여 호출된 API를 시간순으로 기록하여 API 시퀀스를 생성할 수 있다. The API logging module may log the createfile and readfile functions to determine when the program reads the input, execute the one modified input value, and record the called APIs in chronological order to create an API sequence.

상기 프로토콜 분석 모듈은, 상기 시드에 대한 API 시퀀스와 N개의 변형된 입력값을 실행하였을 때에 변형된 bit가 어떠한 의미인지를 분석하여 동일한 시퀀스인지를 분석하고, 두 시퀀스의 API이름, 파라미터, 리턴값이 같은지 비교한 후, 동일하지 않을 경우, 변형된 API시퀀스의 API이름, 파라미터, 리턴값에 따라 필드 식별 및 식별된 필드의 용도를 분석할 수 있다. The protocol analysis module analyzes the meaning of the modified bit when the API sequence for the seed and N modified input values are executed to analyze whether the modified bit is the same sequence, and the API name, parameter, and return value of the two sequences After comparing whether they are the same, if they are not identical, the field identification and use of the identified field can be analyzed according to the API name, parameter, and return value of the modified API sequence.

상기 프로토콜 분석 모듈에서의 필드 식별은, 인접한 두 비트가 동일한 API 시퀀스를 가지는지 판단한 후, 동일한 API 시퀀스를 가지는 경우 하나의 필드로 식별할 수 있다. Field identification in the protocol analysis module can be identified as one field when two adjacent bits have the same API sequence after determining whether they have the same API sequence.

상기 필드는 프로그램에서 하나의 시멘틱으로 인식하는 비트 범위를 의미한다. The field means a bit range recognized as one semantic in the program.

상기 프로토콜 분석 모듈은, 상기 필드 식별이 완료되면, 식별된 필드별로 시드 입력값의 API시퀀스와 변형된 입력값의 API 시퀀스를 비교하여, 비교 결과에 따란 해당 필드의 용도를 분석할 수 있다. When the field identification is completed, the protocol analysis module may compare the API sequence of the seed input value with the API sequence of the modified input value for each identified field, and analyze the use of the corresponding field according to the comparison result.

상기 프로토콜 분석 모듈은, 상기 시드 입력값의 API 시퀀스 길이의 10% 미만의 길이를 가지는 필드는 프로그램 설정과 관련된 필드로 인식하고, 상기 시드 입력값의 API 시퀀스 길이의 10% 이상의 길이를 가지는 필드는 프로그램에서 인식하는 데이터와 관련된 필드로 인식할 수 있다. The protocol analysis module recognizes a field having a length less than 10% of the API sequence length of the seed input value as a field related to program setting, and a field having a length of 10% or more of the API sequence length of the seed input value is It can be recognized as a field related to data recognized by the program.

한편, 본 발명에 따른 프로토콜 메시지 포맷 리버싱 방법은, 비트플립 퍼징 모듈에서, N비트의 크기를 갖는 파일 형식의 시드가 입력되면, 입력된 N비트의 크기의 시드를 1비트씩 순서대로 전환하여 N개의 변형된 입력값을 생성하는 단계; API 로깅 모듈에서, 상기 비트플립 퍼징 모듈로부터 생성된 N개의 변형된 입력값과, 상기 N비트 크기를 갖는 시드를 각각 수신하여 실행된 프로그램이 호출하는 API를 시간순으로 기록하여 N개의 API 시퀀스와 1개의 API 시퀀스를 출력하는 단계; 및 프로토콜 분석 모듈에서, 상기 API 로깅 모듈로부터 출력되는 N개의 API 시퀀스와 1개의 API 시퀀스를 각각 비교하여 입력되는 시드의 메시지 포맷을 분석하여 출력하는 단계를 포함할 수 있다. On the other hand, in the protocol message format reversing method according to the present invention, when a file format seed having an N-bit size is input in the bit-flip fuzzing module, the N-bit size seed is sequentially converted by 1 bit. generating N transformed input values; In the API logging module, the N modified input values generated from the bit flip fuzzing module and the N number of API sequences and the 1 outputting API sequences; and comparing, in the protocol analysis module, each of N API sequences and one API sequence output from the API logging module, and analyzing and outputting the message format of the input seed.

상기 N개의 변형된 입력값을 생성하는 단계는, 퍼징 기법을 이용하여 입력되는N 비트 크기의 시드를 1번째 bit부터 N번째 bit까지 각각 1개 bit 만 flip하여 총 N개의 변형된 입력값을 생성할 수 있다. The generating of the N transformed input values generates a total of N transformed input values by flipping only one bit each from the 1st bit to the Nth bit of the N-bit seed input using a fuzzing technique. can do.

상기 시퀀스를 출력하는 단계는, PIN Tool을 사용하여 프로그램을 분석할 수 있다. In the step of outputting the sequence, the program may be analyzed using a PIN Tool.

상기 시퀀스를 출력하는 단계는, 실행한 API의 이름, 파라미터, 반환 값, 리턴 주소 정보를 기록하고, Heap Allocation 관련 API를 로깅할 수 있다. In the step of outputting the sequence, the name, parameter, return value, and return address information of the executed API may be recorded, and the Heap Allocation-related API may be logged.

상기 시퀀스를 출력하는 단계는, createfile, readfile 함수를 로깅하여 프로그램이 입력을 읽는 시점을 파악하고, 상기 1개의 변형된 입력값을 실행하여 호출된 API를 시간순으로 기록하여 API 시퀀스를 생성할 수 있다. The step of outputting the sequence may include logging the createfile and readfile functions to determine when the program reads the input, and executing the one modified input value to record the called APIs in chronological order to create an API sequence. .

상기 포맷을 분석하여 출력하는 단계는, 상기 시드에 대한 API 시퀀스와 N개의 변형된 입력값을 실행하였을 때에 변형된 bit가 어떠한 의미인지를 분석하여 동일한 시퀀스인지를 분석하고, 두 시퀀스의 API이름, 파라미터, 리턴값이 같은지 비교한 후, 동일하지 않을 경우, 변형된 API시퀀스의 API이름, 파라미터, 리턴값에 따라 필드 식별 및 식별된 필드의 용도를 분석할 수 있다. The step of analyzing and outputting the format includes analyzing the meaning of the modified bit when the API sequence for the seed and N modified input values are executed to analyze whether the modified bit is the same sequence, the API name of the two sequences, After comparing whether the parameters and return values are the same, if they are not the same, the field identification and use of the identified field can be analyzed according to the API name, parameter, and return value of the modified API sequence.

상기 포맷을 분석하여 출력하는 단계에서의 필드 식별은, 인접한 두 비트가 동일한 API 시퀀스를 가지는지 판단한 후, 동일한 API 시퀀스를 가지는 경우 하나의 필드로 식별할 수 있다. Field identification in the step of analyzing and outputting the format may be performed as one field when two adjacent bits have the same API sequence after determining whether they have the same API sequence.

상기 필드는 프로그램에서 하나의 시멘틱으로 인식하는 비트 범위를 의미한다. The field means a bit range recognized as one semantic in the program.

상기 포맷을 분석하여 출력하는 단계에서의 필드 용도 식별은, 상기 필드 식별이 완료되면, 식별된 필드별로 시드 입력값의 API시퀀스와 변형된 입력값의 API 시퀀스를 비교하여, 비교 결과에 따란 해당 필드의 용도를 분석할 수 있다. The field usage identification in the step of analyzing and outputting the format is performed by comparing the API sequence of the seed input value with the API sequence of the modified input value for each identified field when the field identification is completed, and the corresponding field according to the comparison result use can be analyzed.

상기 포맷을 분석하여 출력하는 단계에서의 필드 용도 식별은, 상기 시드 입력값의 API 시퀀스 길이의 10% 미만의 길이를 가지는 필드는 프로그램 설정과 관련된 필드로 인식하고, 상기 시드 입력값의 API 시퀀스 길이의 10% 이상의 길이를 가지는 필드는 프로그램에서 인식하는 데이터와 관련된 필드로 인식할 수 있다. In the step of analyzing and outputting the format, the field usage identification is that a field having a length less than 10% of the API sequence length of the seed input value is recognized as a field related to program setting, and the API sequence length of the seed input value A field having a length of 10% or more of ' can be recognized as a field related to data recognized by the program.

이와 같은 본 발명에 따르면, 기존의 프로토콜 메세지 포맷 리버싱 방법은 taint분석과 명령어 단위의 화이트 박스 분석을 하기 위하여 많은 메모리와 시간이 필요하여 크기가 작은 프로그램만 분석할 수 있는 한계를 개선한 것으로서, 본 발명은 퍼징 기법을 통해 입력값에 변화를 주고, 프로그램이 변형된 입력값이 반응하는 결과를 분석하는 방식으로 패러다임을 변경하였다. 또한, API레벨의 로깅 정보 분석을 통해 분석시간을 향상하고 적은 메모리를 요구함으로써 큰 용량의 프로그램에서 적용이 가능한 메세지 포맷 리버싱을 할 수 있는 것이다. According to the present invention as described above, the existing protocol message format reversing method requires a lot of memory and time to perform taint analysis and white box analysis in units of commands, so the limitation of analyzing only a small program is improved. The present invention changes the paradigm in a way that the input value is changed through the fuzzing technique, and the program analyzes the result of the response of the modified input value. In addition, it is possible to reverse the message format that can be applied to a large-capacity program by improving the analysis time and requiring less memory through the analysis of logging information at the API level.

이하에 첨부되는 도면들은 본 실시 예에 관한 이해를 돕기 위한 것으로, 상세한 설명과 함께 실시 예들을 제공한다. 다만, 본 실시예의 기술적 특징이 특정 도면에 한정되는 것은 아니며, 각 도면에서 개시하는 특징들은 서로 조합되어 새로운 실시 예로 구성될 수 있다.
도 1은 본 발명에 따른 프로토콜 메시지 포맷 리버싱 장치에 대한 블록 구성을 나타낸 도면.
도 2는 본 발명에 따른 프로토콜 메시지 포맷 리버싱 방법에 대한 동작 플로우챠트를 나타낸 도면.
The accompanying drawings below are provided to help understanding of the present embodiment, and provide embodiments together with detailed description. However, the technical features of the present embodiment are not limited to specific drawings, and features disclosed in each drawing may be combined with each other to constitute a new embodiment.
1 is a diagram showing a block configuration of a protocol message format reversing apparatus according to the present invention.
2 is a diagram showing an operation flowchart of a protocol message format reversing method according to the present invention;

본문에 개시되어 있는 본 발명의 실시 예들에 대해서, 특정한 구조적 내지 기능적 설명들은 단지 본 발명의 실시 예를 설명하기 위한 목적으로 예시된 것으로, 본 발명의 실시 예들은 다양한 형태로 실시될 수 있으며 본문에 설명된 실시 예들에 한정되는 것으로 해석되어서는 안 된다.With respect to the embodiments of the present invention disclosed in the text, specific structural or functional descriptions are only exemplified for the purpose of describing the embodiments of the present invention, the embodiments of the present invention may be implemented in various forms and It should not be construed as being limited to the described embodiments.

본 발명은 다양한 변경을 가할 수 있고 여러 가지 형태를 가질 수 있는 바, 특정 실시 예들을 도면에 예시하고 본문에 상세하게 설명하고자 한다. 그러나, 이는 본 발명을 특정한 개시 형태에 대해 한정하려는 것이 아니며, 본 발명의 사상 및 기술 범위에 포함되는 모든 변경, 균등물 내지 대체물을 포함하는 것으로 이해되어야 한다.Since the present invention can have various changes and can have various forms, specific embodiments are illustrated in the drawings and described in detail in the text. However, this is not intended to limit the present invention to the specific disclosed form, it should be understood to include all modifications, equivalents and substitutes included in the spirit and scope of the present invention.

제1, 제2 등의 용어는 다양한 구성요소들을 설명하는데 사용될 수 있지만, 상기 구성요소들은 상기 용어들에 의해 한정되어서는 안 된다. 상기 용어들은 하나의 구성요소를 다른 구성요소로부터 구별하는 목적으로만 사용된다. 예를 들어, 본 발명의 권리 범위로부터 이탈되지 않은 채 제1 구성요소는 제2 구성요소로 명명될 수 있고, 유사하게 제2 구성요소도 제1 구성요소로 명명될 수 있다.Terms such as first, second, etc. may be used to describe various elements, but the elements should not be limited by the terms. The above terms are used only for the purpose of distinguishing one component from another. For example, without departing from the scope of the present invention, a first component may be referred to as a second component, and similarly, a second component may also be referred to as a first component.

이하, 본 발명의 바람직한 실시 예에 따른 프로토콜 메시지 포맷 리버싱 장치 및 그 방법에 대하여 첨부한 도면을 참조하여 상세하게 설명하기로 한다. Hereinafter, a protocol message format reversing apparatus and method according to a preferred embodiment of the present invention will be described in detail with reference to the accompanying drawings.

도 1은 본 발명에 따른 프로토콜 메시지 리버싱 장치에 대한 블록 구성을 나타낸 도면이다. 1 is a diagram illustrating a block configuration of a protocol message reversing apparatus according to the present invention.

도 1을 참조하면, 본 발명에 따른 프로토콜 메시지 포맷 리버싱 장치는, 비트플립 퍼징 모듈(100), API 로깅 모듈(200) 및 프로토콜 분석 모듈(300)을 포함할 수 있다. Referring to FIG. 1 , the apparatus for reversing a protocol message format according to the present invention may include a bit flip fuzzing module 100 , an API logging module 200 , and a protocol analysis module 300 .

상기 비트플립 퍼징 모듈(100)은 예를 들어 운용자로부터 입력되는 N 비트의 크기를 가지는 시드가 입력되면, 퍼징 기법을 이용하여 입력된 시드를 1비트씩 순서대로 전환하여 총 N개의 변형된 입력값을 생성하여 N개의 변형된 입력값을 API 로깅 모듈(200)로 제공한다. 여기서, 상기 시드는 파일 형태로 입력되는 것으로 예를 들로, PDF, 이미지, HWP 등과 같은 파일을 의미한다. The bit flip fuzzing module 100, for example, when a seed having a size of N bits input from an operator is input, by using the fuzzing technique, the input seed is sequentially converted by 1 bit to obtain a total of N modified input values. to provide N transformed input values to the API logging module 200 . Here, the seed is input in the form of a file, and for example, means a file such as PDF, image, HWP, and the like.

상기 API 로깅 모듈(200)은 상기 비트플립 퍼징 모듈(100)으로부터 변형된 N개의 입력값을 실행된 프로그램이 호출하는 N개의 API 시퀀스를 프로토콜 분 모듈(300)로 제공하고, 입력되는 N 비트의 시드 역시 실행된 프로그램이 호출하는 1개의 API 시퀀스를 프로토콜 분석 모듈(300)로 각각 제공한다. The API logging module 200 provides the N API sequences that the executed program calls the N input values modified from the bit flip fuzzing module 100 to the protocol minute module 300, and The seed also provides one API sequence called by the executed program to the protocol analysis module 300 , respectively.

상기 프로토콜 분석 모듈(300)은 상기 API 로깅 모듈(200)에서 제공되는 N개의 API 시퀀스와 1개의 시퀀스를 수신하여, N개의 시퀀스간 비교 및 1개의 시드 API 시퀀스를 비교하여 시드의 메시지 포맷을 분석하여 분석 결과 정보 즉, 메시지의 포맷 분석 결과 정보를 운용자에게 제공하는 것이다. 여기서, 상기 메시지 포맷 분석은 메시지의 필드 분석과, 분석된 필드의 용도 분석이 될 수 있으며, 이러한 상세 분석 동작은 후술하도록 한다. The protocol analysis module 300 receives N API sequences and one sequence provided from the API logging module 200, and analyzes the message format of the seed by comparing N sequences and comparing one seed API sequence. Thus, the analysis result information, that is, the message format analysis result information is provided to the operator. Here, the message format analysis may be a field analysis of a message and a usage analysis of the analyzed field, and the detailed analysis operation will be described later.

이와 같이 구성된 본 발명에 따른 프로토콜 메시지 포맷 리버싱 장치의 구체적인 동작에 대하여 살펴보자. A detailed operation of the protocol message format reversing apparatus according to the present invention configured as described above will be described.

먼저, 상기 비트플립 퍼징 모듈(100)은 운용자에 의해 입력되는 n 비트 크기의 시드를 1번째 비트(Bit)부터 N번째 비트까지 각각 1개 비트만 플립(Flip)하여 총 N개의 변형된 입력값을 생성한 후, 생성된 변형된 N개의 변형된 입력값을 API 로깅 모듈(200)로 제공한다. First, the bit flip fuzzing module 100 flips the n-bit seed input by the operator by only one bit from the first bit to the N-th bit, so that a total of N transformed input values After generating , the generated N modified input values are provided to the API logging module 200 .

상기 API 로깅 모듈(200)은 PIN Tool을 사용하여 프로그램을 분석하는 모듈로서, 프로그램이 실행한 API의 이름, 파라미터, 반환 값, 리턴 주소 정보를 기록한다. The API logging module 200 is a module for analyzing a program using the PIN Tool, and records the name, parameter, return value, and return address information of the API executed by the program.

본 발명에서의 API 로깅모듈(200)은 프로그램에서 자주 사용되는 Heap Allocation 관련 API를 로깅하고, 해당 API는 호출 빈도가 높기 때문에 실제 실행을 근접하게 표현할 수 있다. 또한, createfile, readfile 함수를 로깅하여 프로그램이 입력을 읽는 시점을 파악할 수 있는 것이다. The API logging module 200 in the present invention logs the Heap Allocation-related API frequently used in the program, and since the API has a high call frequency, the actual execution can be approximated. Also, by logging the createfile and readfile functions, you can determine when the program reads the input.

상기 API 로깅 모듈(200)은 하나의 변형된 입력값을 실행하여 호출된 API를 시간순으로 기록하여 API 시퀀스를 생성하는 것이다. The API logging module 200 executes one modified input value and records the APIs called in chronological order to generate an API sequence.

즉, API 로깅 모듈(200)은 상기 비트플립 퍼징 모듈(100)으로부터 변경된 N개의 입력값을 실행된 프로그램이 호출하는 N개의 API 시퀀스를 프로토콜 분 모듈(300)로 제공하고, 입력되는 N 비트의 시드 역시 실행된 프로그램이 호출하는 1개의 API 시퀀스를 프로토콜 분석 모듈(300)로 각각 제공하는 것이다. That is, the API logging module 200 provides the N API sequences in which the executed program calls the N input values changed from the bit flip fuzzing module 100 to the protocol minutes module 300, and The seed also provides one API sequence called by the executed program to the protocol analysis module 300 , respectively.

상기 프로토콜 분석 모듈(300)은 상기 API 로깅 모듈(200)에서 제공되는 N개의 API 시퀀스와 1개의 시퀀스를 수신하여, N개의 시퀀스간 비교 및 1개의 시드 API 시퀀스를 비교하여 시드의 메시지 포맷을 분석하여 분석 결과 정보 즉, 메시지의 포맷 분석 결과 정보를 운용자에게 제공하는 것이다.The protocol analysis module 300 receives N API sequences and one sequence provided from the API logging module 200, and analyzes the message format of the seed by comparing N sequences and comparing one seed API sequence. Thus, the analysis result information, that is, the message format analysis result information is provided to the operator.

구체적으로 살펴보면, 프로토콜 분석 모듈(300)은 여러 개의 API 시퀀스들간의 관계를 분석하여 프로그램의 프로토콜을 분석하는 모듈이다. 시드와 변형된 입력값을 실행하였을 때에 변형된 bit가 어떠한 의미인지에 따라 API 시퀀스가 같을 수도 있고 다를 수도 있다. Specifically, the protocol analysis module 300 is a module for analyzing a protocol of a program by analyzing a relationship between several API sequences. When the seed and the modified input value are executed, the API sequence may be the same or different depending on the meaning of the modified bit.

두 시퀀스의 API이름, 파라미터, 리턴값이 같은지 비교하고, 다르다면 변경된 API시퀀스와 API이름, 파라미터, 리턴값이 어떠한 의미를 가지는지 분석하는 것이다. It compares whether the API names, parameters, and return values of the two sequences are the same, and if they are different, analyzes the meaning of the changed API sequence, API name, parameters, and return values.

먼저, 프로토콜 분석 모듈(300)은 API 로깅 모듈(200)로부터 제공되는 N 개의 API 시퀀스와 시드에 대한 1개의 API 시퀀스를 이용하여 필드를 식별하고, 필드 식별이 완료되면, 식별된 필드에 대한 용도를 분석하는 것이다. First, the protocol analysis module 300 identifies a field using N API sequences provided from the API logging module 200 and one API sequence for the seed, and when field identification is completed, the purpose of the identified field to analyze

먼저, 필드 식별 동작을 살펴보면, API 로깅 모듈(200)로부터 제공되는 API 시퀀스에서, 인접한 두 비트가 동일한 API 시퀀스를 가진다면, 두 비트는 하나의 필드를 구성한 것으로 판단한다. 이때 필드는 프로그램에서 하나의 시멘틱으로 인식하는 bit범위를 의미한다. 입력값에 대표적으로 존재하는 매직넘버, 체크섬 혹은 길이 정보 등 모든 필드 별 오류 처리 루틴이 다르다는 점에 착안한 것이다. First, looking at the field identification operation, in the API sequence provided from the API logging module 200, if two adjacent bits have the same API sequence, it is determined that the two bits constitute one field. In this case, the field means a bit range recognized as one semantic in the program. This is based on the fact that error handling routines for each field, such as magic number, checksum, or length information, which are representative of input values, are different.

예를 들어 0xa번째 비트부터 0xf번째 비트를 변경한 입력값들이 동일한 API 시퀀스를 가진다고 하자. 이를 통해 6개의 입력값을 변경하면, 동일한 오류 루틴이 실행됨을 통해 같은 필드라고 판단할 수 있다. For example, suppose that input values obtained by changing the 0xa-th bit to the 0xf-th bit have the same API sequence. If the six input values are changed through this, the same error routine is executed, so that it can be determined that they are the same field.

이와 같이 필드 식별이 완료된 후, 분석된 해당 필드의 용도 분석은, 상기 식별된 필드별로 시드 입력값의 API시퀀스와 변형된 입력값의 API 시퀀스를 비교하여, 해당 필드가 어떠한 용도인지 분석한다. After the field identification is completed in this way, in the analysis of the use of the analyzed field, the API sequence of the seed input value and the API sequence of the modified input value are compared for each identified field, and the purpose of the field is analyzed.

시드 입력값의 API 시퀀스 길이의 10% 미만의 길이를 가지는 필드는 프로그램 설정과 관련된 필드로 인식할 수 있다. 왜냐하면 프로그램의 magic number 등과 같은 설정 필드는 프로그램 초반에 검사하므로, 오류로 프로그램이 종료될 가능성이 높기 때문이다. A field having a length less than 10% of the API sequence length of the seed input value may be recognized as a field related to program setting. This is because setting fields such as magic number of the program are checked at the beginning of the program, so there is a high possibility that the program will be terminated due to an error.

또한 readfile API를 호출 직후 종료된 경우에는 입력의 무결성을 점검하는 과정에서 오류 핸들링 코드를 실행하고 프로그램이 종료될 가능성이 높다.Also, if the readfile API is terminated immediately after calling, the error handling code is executed in the process of checking the integrity of the input and the program is highly likely to be terminated.

한편, 시드 입력값의 API 시퀀스 길이의 10% 이상의 길이를 가지는 필드는 프로그램에서 인식하는 데이터와 관련된 필드로 인식한다. 왜냐하면 전송하고자 하는 데이터를 파싱하는 작업은 상대적으로 프로그램 실행 시간이 흐른 후에 처리되기 때문에 시드 입력 API 시퀀스와의 일치율이 높다.On the other hand, a field having a length of 10% or more of the API sequence length of the seed input value is recognized as a field related to data recognized by the program. Because the parsing of the data to be transmitted is processed after the program execution time has elapsed, the match rate with the seed input API sequence is high.

상기와 같은 본 발명에 따른 프로토콜 메시지 포맷 리버싱 장치의 동작에 상응하는 본 발명에 따른 프로토콜 메시지 포맷 리버싱 방법에 대하여 도 2를 참조하여 단계적으로 살펴보기로 한다. The protocol message format reversing method according to the present invention corresponding to the operation of the protocol message format reversing apparatus according to the present invention as described above will be described in stages with reference to FIG. 2 .

도 2는 본 발명에 따른 프로토콜 메시지 포맷 리버싱 방법에 대한 동작 흐름도이다. 2 is an operation flowchart of a protocol message format reversing method according to the present invention.

도 2를 참조하면, 먼저, 운용자로부터 N 비트의 크기를 가지는 시드가 비트플립 퍼징 모듈(100)과, API 로깅 모듈(200)로 각각 입력된다(S201, S202). Referring to FIG. 2 , first, a seed having a size of N bits is input from an operator to the bit flip fuzzing module 100 and the API logging module 200, respectively (S201 and S202).

이어, 상기 S202단계를 통해 운용자로부터 N 비트의 크기를 가지는 시드가 입력되면, 상기 비트플립 퍼징 모듈(100)은 퍼징 기법을 이용하여 입력된 시드를 1비트씩 순서대로 전환하여 총 N개의 변형된 입력값을 생성하여 N개의 변경된 입력값을 API 로깅 모듈(200)로 제공한다(S203). 여기서, 상기 시드는 파일 형태로 입력되는 것으로 예를 들면, PDF, 이미지, HWP 등과 같은 파일을 의미한다. Then, when a seed having a size of N bits is input from the operator through the step S202, the bit flip fuzzing module 100 converts the input seed 1 bit by bit in order using the fuzzing technique to obtain a total of N transformed The input values are generated and the N changed input values are provided to the API logging module 200 (S203). Here, the seed is input in the form of a file, and means a file such as PDF, image, HWP, and the like.

즉, 상기S203단계에서, 비트플립 퍼징 모듈(100)은, 운용자에 의해 입력되는 N 비트 크기의 시드를 1번째 비트(Bit)부터 N번째 비트까지 각각 1개 비트만 플립(Flip)하여 총 N개의 변형된 입력값을 생성한 후, 생성된 N개의 변형된 입력값을 API 로깅 모듈(200)로 제공(전송)하는 것이다(S204). That is, in step S203, the bit flip fuzzing module 100 flips the N-bit seed input by the operator by only one bit from the first bit to the N-th bit, so that a total of N After generating the transformed input values, the generated N transformed input values are provided (transmitted) to the API logging module 200 (S204).

이어, 상기 API 로깅 모듈(200)은 상기 S204단계를 통해 상기 비트플립 퍼징 모듈(100)으로부터 입력되는 변형된 N개의 입력값을 실행된 프로그램이 호출하는 N개의 API 시퀀스를 프로토콜 분석 모듈(300)로 제공하고, 상기 S201단계를 통해 입력되는 N 비트의 시드 역시 실행된 프로그램이 호출하는 1개의 API 시퀀스를 프로토콜 분석 모듈(300)로 각각 제공한다(S206). Next, the API logging module 200 converts the N API sequences in which the executed program calls the modified N input values input from the bit flip fuzzing module 100 through the step S204 to the protocol analysis module 300 . , and the N-bit seed input through the step S201 also provides one API sequence called by the executed program to the protocol analysis module 300, respectively (S206).

즉, S206 단계에서 상기 API 로깅 모듈(200)은 PIN Tool을 사용하여 프로그램을 분석하는 모듈로서, 프로그램이 실행한 API의 이름, 파라미터, 반환 값, 리턴 주소 정보를 기록한다. That is, in step S206, the API logging module 200 is a module that analyzes a program using the PIN Tool, and records the name, parameter, return value, and return address information of the API executed by the program.

상기 API 로깅모듈(200)은 프로그램에서 자주 사용되는 heap allocation 관련 API를 로깅하고, 해당 API는 호출 빈도가 높기 때문에 실제 실행을 근접하게 표현할 수 있다. 또한, createfile, readfile 함수를 로깅하여 프로그램이 입력을 읽는 시점을 파악할 수 있는 것이다. The API logging module 200 logs a heap allocation related API that is frequently used in a program, and since the API has a high frequency of calls, actual execution can be approximated. Also, by logging the createfile and readfile functions, you can determine when the program reads the input.

한편, 상기 API 로깅 모듈(200)은 하나의 변형된 입력값을 실행하여 호출된 API를 시간순으로 기록하여 API 시퀀스를 생성하는 것이다. 즉, API 로깅 모듈(200)은 상기 비트플립 퍼징 모듈(100)으로부터 변경된 N개의 입력값을 실행된 프로그램이 호출하는 N개의 API 시퀀스를 프로토콜 분 모듈(300)로 제공하고, 입력되는 N 비트의 시드 역시 실행된 프로그램이 호출하는 1개의 API 시퀀스를 프로토콜 분석 모듈(300)로 각각 제공하는 것이다. Meanwhile, the API logging module 200 executes one modified input value and records the APIs called in chronological order to generate an API sequence. That is, the API logging module 200 provides the N API sequences in which the executed program calls the N input values changed from the bit flip fuzzing module 100 to the protocol minutes module 300, and The seed also provides one API sequence called by the executed program to the protocol analysis module 300 , respectively.

이어, 프로토콜 분석 모듈(300)에서는, 상기 S206단계를 통해 API 로깅 모듈(200)에서 제공되는 N개의 API 시퀀스와 1개의 시퀀스를 수신하여, N개의 시퀀스간 비교 및 1개의 시드 API 시퀀스를 비교하여 시드의 메시지 포맷을 분석하여(S207) 분석 결과 정보 즉, 메시지의 포맷 분석 결과 정보를 운용자에게 제공하는 것이다(S208).Next, the protocol analysis module 300 receives N API sequences and one sequence provided from the API logging module 200 through the step S206, compares N sequences and compares one seed API sequence, By analyzing the message format of the seed (S207), the analysis result information, that is, the message format analysis result information is provided to the operator (S208).

여기서, 상기 S207단게에 대하여 좀 더 구체적으로 살펴보면, 프로토콜 분석 모듈(300)은 여러 개의 API 시퀀스들간의 관계를 분석하여 프로그램의 프로토콜을 분석하는 모듈이다. 시드와 변형된 입력값을 실행하였을 때에 변형된 bit가 어떠한 의미인지에 따라 API 시퀀스가 같을 수 도 있고 다를 수도 있다. Here, referring to step S207 in more detail, the protocol analysis module 300 is a module for analyzing the protocol of a program by analyzing the relationship between several API sequences. When the seed and the modified input value are executed, the API sequence may be the same or different depending on what the modified bit means.

두 시퀀스의 API이름, 파라미터, 리턴값이 같은지 비교하고, 다르다면 변경된 API시퀀스의 API이름, 파라미터, 리턴값이 어떠한 의미를 가지는지 분석하는 것이다. It compares whether the API names, parameters, and return values of the two sequences are the same, and if they are different, analyzes the meaning of the API names, parameters, and return values of the changed API sequence.

먼저, 프로토콜 분석 모듈(300)은 API 로깅 모듈(200)로부터 제공되는 N 개의 API 시퀀스와 시드에 대한 1개의 API 시퀀스를 이용하여 필드 식별하고, 필드 식별이 완료되면, 식별된 필드에 대한 용도를 분석하는 것이다. First, the protocol analysis module 300 identifies a field using N API sequences provided from the API logging module 200 and one API sequence for the seed, and when field identification is completed, the purpose of the identified field is determined to analyze

먼저, 필드 분석 동작을 살펴보면, API 로깅 모듈(200)로부터 제공되는 API 시퀀스에서, 인접한 두 비트가 동일한 API 시퀀스를 가진다면, 두 비트는 하나의 필드를 구성한 것으로 판단한다. 이때 필드는 프로그램에서 하나의 시멘틱으로 인식하는 bit범위를 의미한다. 입력값에 대표적으로 존재하는 매직넘버, 체크섬 혹은 길이 정보 등 모든 필드 별 오류 처리 루틴이 다르다는 점에 착안한 것이다. First, looking at the field analysis operation, in the API sequence provided from the API logging module 200, if two adjacent bits have the same API sequence, it is determined that the two bits constitute one field. In this case, the field means a bit range recognized as one semantic in the program. This is based on the fact that error handling routines for each field, such as magic number, checksum, or length information, which are representative of input values, are different.

예를 들어 0xa번째 비트부터 0xf번째 비트를 변경한 입력값들이 동일한 API 시퀀스를 가진다고 하자. 이를 통해 6개의 입력값을 변경하면, 동일한 오류 루틴이 실행됨을 통해 같은 필드라고 판단할 수 있다. For example, suppose that input values obtained by changing the 0xa-th bit to the 0xf-th bit have the same API sequence. If the six input values are changed through this, the same error routine is executed, so that it can be determined that they are the same field.

이와 같이 필드 분석이 완료된 후, 분석된 해당 필드의 용도 분석은, 상기 구분한 필드별로 시드 입력값의 API시퀀스와 변형된 입력값의 API 시퀀스를 비교하여, 해당 필드가 어떠한 용도인지 분석한다. In this way, after the field analysis is completed, the usage analysis of the analyzed corresponding field compares the API sequence of the seed input value with the API sequence of the modified input value for each divided field, and analyzes the use of the corresponding field.

시드 입력값의 API 시퀀스 길이의 10% 미만의 길이를 가지는 필드는 프로그램 설정과 관련된 필드로 인식할 수 있다. 왜냐하면 프로그램의 magic number 등과 같은 설정 필드는 프로그램 초반에 검사하므로, 오류로 프로그램이 종료될 가능성이 높기 때문이다. A field having a length less than 10% of the API sequence length of the seed input value may be recognized as a field related to program setting. This is because setting fields such as magic number of the program are checked at the beginning of the program, so there is a high possibility that the program will be terminated due to an error.

또한 readfile API를 호출한 직후 종료된 경우에는 입력의 무결성을 점검하는 과정에서 오류 핸들링 코드를 실행하고 프로그램이 종료될 가능성이 높다.Also, if it terminates immediately after calling the readfile API, the error handling code is executed in the process of checking the integrity of the input and the program is highly likely to terminate.

한편, 시드 입력값의 API 시퀀스 길이의 10% 이상의 길이를 가지는 필드는 프로그램에서 인식하는 데이터와 관련된 필드로 인식한다. 왜냐하면 전송하고자 하는 데이터를 파싱하는 작업은 상대적으로 프로그램 실행 시간이 흐른 후에 처리되기 때문에 시드 입력 API 시퀀스와의 일치율이 높은 것이다. On the other hand, a field having a length of 10% or more of the API sequence length of the seed input value is recognized as a field related to data recognized by the program. This is because the parsing of the data to be transmitted is processed after a relatively long program execution time, so the matching rate with the seed input API sequence is high.

상기한 본 발명에 따른 프로토콜 메시지 포멧 리버싱 장치 및 그 방법은, 소프트웨어 보안 테스트 기법인 퍼징(Fuzzing) 기술을 활용하여 메세지 포맷 리버싱을 하는 것으로서, 프로그램이 정상적으로 실행하는 입력값을 변형하여 프로그램의 오류를 찾는 것이다. 그리고, 본 발명은 퍼징으로 생성한 입력값을 실행하고 API 레벨에서 프로그램 분석을 수행하고, 정상적인 입력값을 실행했을 때의 API시퀀스와 변형된 입력값을 실행했을 때의 API 시퀀스를 비교하여, 변형한 bit가 어떠한 의미인지를 분석하여 프로토콜 메세지 포맷을 알아내는 것이다. The protocol message format reversing apparatus and method according to the present invention as described above perform message format reversing using a fuzzing technique, which is a software security test technique, and modify the input value normally executed by the program to to find the error. And, the present invention executes the input value generated by fuzzing, performs program analysis at the API level, compares the API sequence when the normal input value is executed and the API sequence when the modified input value is executed, It is to find out the protocol message format by analyzing what one bit means.

따라서, taint분석과 명령어 단위의 화이트 박스 분석을 하기 위하여 많은 메모리와 시간을 필요로 하여서 크기가 작은 프로그램만 분석할 수 있는 기존의 프로토콜 메세지 포맷 리버싱 방법의 한계를 개선한 것으로서, 본 발명은 퍼징 기법을 통해 입력값에 변화를 주고, 프로그램이 변형된 입력값이 반응하는 결과를 분석하는 방식으로 패러다임을 변경하였다. Therefore, the present invention improves the limit of the existing protocol message format reversing method that can analyze only a small program because it requires a lot of memory and time to perform taint analysis and white box analysis in units of commands. The paradigm was changed by changing the input value through the technique and analyzing the result of the program's response to the modified input value.

또한, 본 발명은 API레벨의 로깅 정보 분석을 통해 분석시간을 향상하고 적은 메모리를 요구함으로써 큰 용량의 프로그램에서 적용이 가능한 메세지 포맷 리버싱을 할 수 있는 것이다. In addition, the present invention improves the analysis time through the analysis of logging information at the API level and requires a small amount of memory, so that message format reversing that can be applied to a large-capacity program can be performed.

이상에서 설명한 본 발명의 실시 예를 구성하는 모든 구성요소들이 하나로 결합하거나 결합하여 동작하는 것으로 기재되어 있다고 해서, 본 발명이 반드시 이러한 실시 예에 한정되는 것은 아니다. 즉, 본 발명의 목적 범위 안에서라면, 그 모든 구성요소들이 하나 이상으로 선택적으로 결합하여 동작할 수도 있다. 또한, 그 모든 구성요소들이 각각 하나의 독립적인 하드웨어로 구현될 수 있지만, 각 구성요소들의 그 일부 또는 전부가 선택적으로 조합되어 하나 또는 복수 개의 하드웨어에서 조합된 일부 기능 혹은 모든 기능을 수행하는 프로그램 모듈을 갖는 컴퓨터 프로그램으로서 구현될 수도 있다. 또한, 이와 같은 컴퓨터 프로그램은 USB 메모리, CD 디스크, 플래쉬 메모리 등과 같은 컴퓨터가 읽을 수 있는 기록매체(Computer Readable Media)에 저장되어 컴퓨터에 의하여 읽혀지고 실행됨으로써, 본 발명의 실시 예를 구현할 수 있다. 컴퓨터 프로그램의 기록매체로서는 자기 기록매체, 광 기록매체, 캐리어 웨이브 매체 등이 포함될 수 있다.Even though all the components constituting the embodiment of the present invention described above are described as being combined or operated in combination, the present invention is not necessarily limited to this embodiment. That is, within the scope of the object of the present invention, all of the components may operate by selectively combining one or more. In addition, although all the components may be implemented as one independent hardware, some or all of the components are selectively combined to perform some or all functions combined in one or a plurality of hardware program modules It may be implemented as a computer program having In addition, such a computer program is stored in a computer readable media such as a USB memory, a CD disk, a flash memory, etc., read and executed by a computer, thereby implementing an embodiment of the present invention. The computer program recording medium may include a magnetic recording medium, an optical recording medium, a carrier wave medium, and the like.

이상에서와 같이, 본 발명에 따른 프로토콜 메시지 포맷 리버싱 장치 및 그 방법을 실시 예에 따라 설명하였지만, 본 발명의 범위는 특정 실시 예에 한정되는 것은 아니며, 본 발명과 관련하여 통상의 지식을 가진 자에게 자명한 범위 내에서 여러 가지의 대안, 수정 및 변경하여 실시할 수 있다.As described above, the protocol message format reversing apparatus and method according to the present invention have been described according to embodiments, but the scope of the present invention is not limited to a specific embodiment, and those of ordinary skill in the art Various alternatives, modifications, and changes can be implemented within the range obvious to the person concerned.

따라서, 본 발명에 기재된 실시 예 및 첨부된 도면들은 본 발명의 기술 사상을 한정하기 위한 것이 아니라 설명하기 위한 것이고, 이러한 실시 예 및 첨부된 도면에 의하여 본 발명의 기술 사상의 범위가 한정되는 것은 아니다. 본 발명의 보호 범위는 청구범위에 의하여 해석되어야 하며, 그와 동등한 범위 내에 있는 모든 기술 사상은 본 발명의 권리 범위에 포함되는 것으로 해석되어야 할 것이다.Accordingly, the embodiments and the accompanying drawings described in the present invention are for explanation rather than limiting the technical spirit of the present invention, and the scope of the technical spirit of the present invention is not limited by these embodiments and the accompanying drawings. . The protection scope of the present invention should be construed by the claims, and all technical ideas within the scope equivalent thereto should be construed as being included in the scope of the present invention.

100 : 비트플립 퍼징 모듈
200 : API 로깅 모듈
300 : 프로토콜 분석 모듈
100: bit flip purging module
200 : API logging module
300: protocol analysis module

Claims (20)

프로토콜 메시지 포맷 리버싱 장치에 있어서,
N비트의 크기를 갖는 파일 형식의 시드가 입력되면, 입력된 N비트의 크기의 시드를 1비트씩 순서대로 전환하여 N개의 변형된 입력값을 생성하는 비트플립 퍼징 모듈;
상기 비트플립 퍼징 모듈로부터 생성된 N개의 변형된 입력값과, 상기 N비트 크기를 갖는 시드를 각각 수신하여 실행된 프로그램이 호출하는 API를 시간순으로 기록하여 N개의 API 시퀀스와 1개의 API 시퀀스를 출력하는 API로깅 모듈; 및
상기 API 로깅 모듈로부터 출력되는 N개의 API 시퀀스와 1개의 API 시퀀스를 각각 비교하여 입력되는 시드의 메시지 포맷을 분석하여 출력하는 프로토콜 분석 모듈을 포함하고,
상기 프로토콜 분석 모듈은,
상기 시드에 대한 API 시퀀스와 N개의 변형된 입력값을 실행하였을 때에 변형된 bit가 어떠한 의미인지를 분석하여 동일한 시퀀스인지를 분석하고, 두 시퀀스의 API이름, 파라미터, 리턴값이 같은지 비교한 후, 동일하지 않을 경우, 변형된 API시퀀스의 API이름, 파라미터, 리턴값에 따라 필드 식별 및 식별된 필드의 용도를 분석하는 것인 프로토콜 메시지 포맷 리버싱 장치.
A protocol message format reversing apparatus comprising:
a bit-flip fuzzing module for generating N modified input values by sequentially converting the input N-bit seed by bit by bit when a file format seed having an N-bit size is input;
The N modified input values generated from the bit-flip fuzzing module and the seed having the N-bit size are received, respectively, and the API called by the executed program is recorded in chronological order, and N API sequences and one API sequence are output. API logging module; and
Comprising a protocol analysis module that compares each of the N API sequences and one API sequence output from the API logging module, and analyzes and outputs the message format of the input seed,
The protocol analysis module,
When the API sequence for the seed and N transformed input values are executed, the meaning of the transformed bit is analyzed to analyze whether the sequence is the same, and after comparing whether the API names, parameters, and return values of the two sequences are the same, If they are not the same, the protocol message format reversing device that identifies the field and analyzes the use of the identified field according to the API name, parameter, and return value of the modified API sequence.
제1항에 있어서,
상기 비트플립 퍼징 모듈은,
퍼징 기법을 이용하여 입력되는N 비트 크기의 시드를 1번째 bit부터 N번째 bit까지 각각 1개 bit 만 flip하여 총 N개의 변형된 입력값을 생성하는 것인 프로토콜 메시지 포맷 리버싱 장치.
According to claim 1,
The bit flip purging module,
A protocol message format reversing device that generates a total of N modified input values by flipping the N-bit seed input using the fuzzing technique by only one bit each from the 1st bit to the Nth bit.
제1항에 있어서,
상기 API 로깅 모듈은,
PIN Tool을 사용하여 프로그램을 분석하는 것인 프로토콜 메시지 포맷 리버싱 장치.
According to claim 1,
The API logging module,
A protocol message format reversing device that uses the PIN Tool to parse the program.
제3항에 있어서,
상기 API 로깅 모듈은,
실행한 API의 이름, 파라미터, 반환 값, 리턴 주소 정보를 기록하고, Heap Allocation 관련 API를 로깅하는 것인 프로토콜 메시지 포맷 리버싱 장치.
4. The method of claim 3,
The API logging module,
A protocol message format reversing device that records the name, parameter, return value, and return address information of the executed API, and logs the Heap Allocation-related API.
제4항에 있어서,
상기 API 로깅 모듈은,
createfile, readfile 함수를 로깅하여 프로그램이 입력을 읽는 시점을 파악하고, 상기 1개의 변형된 입력값을 실행하여 호출된 API를 시간순으로 기록하여 API 시퀀스를 생성하는 것인 프로토콜 메시지 포맷 리버싱 장치.
5. The method of claim 4,
The API logging module,
A protocol message format reversing device that logs the createfile and readfile functions to determine when the program reads the input, executes the one modified input value, records the APIs called in chronological order, and creates an API sequence.
제1항에 있어서,
상기 프로토콜 분석 모듈은,
상기 시드에 대한 API 시퀀스와 N개의 변형된 입력값을 실행하였을 때에 변형된 bit가 어떠한 의미인지를 분석하여 동일한 시퀀스인지를 분석하고, 두 시퀀스의 API이름, 파라미터, 리턴값이 같은지 비교한 후, 동일하지 않을 경우, 변형된 API시퀀스의 API이름, 파라미터, 리턴값에 따라 필드 식별 및 식별된 필드의 용도를 분석하는 것인 프로토콜 메시지 포맷 리버싱 장치.
According to claim 1,
The protocol analysis module,
When the API sequence for the seed and N transformed input values are executed, the meaning of the transformed bit is analyzed to analyze whether the sequence is the same, and after comparing whether the API names, parameters, and return values of the two sequences are the same, If they are not the same, the protocol message format reversing device that identifies the field and analyzes the use of the identified field according to the API name, parameter, and return value of the modified API sequence.
제1항에 있어서,
상기 프로토콜 분석 모듈에서의 필드 식별은,
인접한 두 비트가 동일한 API 시퀀스를 가지는지 판단한 후, 동일한 API 시퀀스를 가지는 경우 하나의 필드로 식별하는 것인 프로토콜 메시지 포맷 리버싱 장치.
According to claim 1,
Field identification in the protocol analysis module,
A protocol message format reversing apparatus that determines whether two adjacent bits have the same API sequence and identifies as one field if they have the same API sequence.
제7항에 있어서,
상기 필드는 프로그램에서 하나의 시멘틱으로 인식하는 비트 범위를 의미하는 것인 프로토콜 메시지 포맷 리버싱 장치.
8. The method of claim 7,
The field is a protocol message format reversing device that means a bit range recognized as one semantic in a program.
제7항에 있어서,
상기 프로토콜 분석 모듈은,
상기 필드 식별이 완료되면, 식별된 필드별로 시드 입력값의 API시퀀스와 변형된 입력값의 API 시퀀스를 비교하여, 비교 결과에 따란 해당 필드의 용도를 분석하는 것인 프로토콜 메시지 포맷 리버싱 장치.
8. The method of claim 7,
The protocol analysis module,
When the field identification is completed, the API sequence of the seed input value and the API sequence of the modified input value are compared for each identified field, and the use of the corresponding field is analyzed according to the comparison result.
제9항에 있어서,
상기 프로토콜 분석 모듈은,
상기 시드 입력값의 API 시퀀스 길이의 10% 미만의 길이를 가지는 필드는 프로그램 설정과 관련된 필드로 인식하고,
상기 시드 입력값의 API 시퀀스 길이의 10% 이상의 길이를 가지는 필드는 프로그램에서 인식하는 데이터와 관련된 필드로 인식하는 것인 프로토콜 메시지 포맷 리버싱 장치.
10. The method of claim 9,
The protocol analysis module,
A field having a length less than 10% of the API sequence length of the seed input value is recognized as a field related to program setting,
A protocol message format reversing apparatus in which a field having a length of 10% or more of the API sequence length of the seed input value is recognized as a field related to data recognized by the program.
프로토콜 메시지 포맷 리버싱 방법에 있어서,
비트플립 퍼징 모듈에서, N비트의 크기를 갖는 파일 형식의 시드가 입력되면, 입력된 N비트의 크기의 시드를 1비트씩 순서대로 전환하여 N개의 변형된 입력값을 생성하는 단계;
API 로깅 모듈에서, 상기 비트플립 퍼징 모듈로부터 생성된 N개의 변형된 입력값과, 상기 N비트 크기를 갖는 시드를 각각 수신하여 실행된 프로그램이 호출하는 API를 시간순으로 기록하여 N개의 API 시퀀스와 1개의 API 시퀀스를 출력하는 단계; 및
프로토콜 분석 모듈에서, 상기 API 로깅 모듈로부터 출력되는 N개의 API 시퀀스와 1개의 API 시퀀스를 각각 비교하여 입력되는 시드의 메시지 포맷을 분석하여 출력하는 단계를 포함하고,
상기 포맷을 분석하여 출력하는 단계는,
상기 시드에 대한 API 시퀀스와 N개의 변형된 입력값을 실행하였을 때에 변형된 bit가 어떠한 의미인지를 분석하여 동일한 시퀀스인지를 분석하고, 두 시퀀스의 API이름, 파라미터, 리턴값이 같은지 비교한 후, 동일하지 않을 경우, 변형된 API시퀀스의 API이름, 파라미터, 리턴값에 따라 필드 식별 및 식별된 필드의 용도를 분석하는 것인 프로토콜 메시지 포맷 리버싱 방법.
A protocol message format reversing method comprising:
In the bit flip fuzzing module, when a file format seed having an N-bit size is input, generating N modified input values by sequentially converting the input N-bit seed size by 1 bit;
In the API logging module, the N modified input values generated from the bit flip fuzzing module and the N number of API sequences and the 1 outputting API sequences; and
Comprising, in the protocol analysis module, analyzing and outputting the message format of the input seed by comparing each of N API sequences and one API sequence output from the API logging module,
The step of analyzing and outputting the format is,
When the API sequence for the seed and N transformed input values are executed, the meaning of the transformed bit is analyzed to analyze whether the sequence is the same, and after comparing whether the API names, parameters, and return values of the two sequences are the same, If they are not the same, the protocol message format reversing method of identifying a field and analyzing the purpose of the identified field according to the API name, parameter, and return value of the modified API sequence.
제11항에 있어서,
상기 N개의 변형된 입력값을 생성하는 단계는,
퍼징 기법을 이용하여 입력되는N 비트 크기의 시드를 1번째 bit부터 N번째 bit까지 각각 1개 bit 만 flip하여 총 N개의 변형된 입력값을 생성하는 것인 프로토콜 메시지 포맷 리버싱 방법.
12. The method of claim 11,
The step of generating the N transformed input values includes:
A protocol message format reversing method in which a total of N modified input values are generated by flipping an N-bit seed input using a fuzzing technique by only one bit each from the 1st bit to the Nth bit.
제11항에 있어서,
상기 시퀀스를 출력하는 단계는,
PIN Tool을 사용하여 프로그램을 분석하는 것인 프로토콜 메시지 포맷 리버싱 방법.
12. The method of claim 11,
Outputting the sequence comprises:
A method of reversing the protocol message format by using the PIN Tool to parse the program.
제13항에 있어서,
상기 시퀀스를 출력하는 단계는,
실행한 API의 이름, 파라미터, 반환 값, 리턴 주소 정보를 기록하고, Heap Allocation 관련 API를 로깅하는 것인 프로토콜 메시지 포맷 리버싱 방법.
14. The method of claim 13,
Outputting the sequence comprises:
A protocol message format reversing method that records the name, parameter, return value, and return address information of the executed API, and logs the Heap Allocation-related API.
제14항에 있어서,
상기 시퀀스를 출력하는 단계는,
createfile, readfile 함수를 로깅하여 프로그램이 입력을 읽는 시점을 파악하고, 상기 1개의 변형된 입력값을 실행하여 호출된 API를 시간순으로 기록하여 API 시퀀스를 생성하는 것인 프로토콜 메시지 포맷 리버싱 방법.
15. The method of claim 14,
Outputting the sequence comprises:
A protocol message format reversing method that logs the createfile and readfile functions to determine when the program reads the input, executes the one modified input value, records the APIs called in chronological order, and creates an API sequence.
삭제delete 제11항에 있어서,
상기 포맷을 분석하여 출력하는 단계에서의 필드 식별은,
인접한 두 비트가 동일한 API 시퀀스를 가지는지 판단한 후, 동일한 API 시퀀스를 가지는 경우 하나의 필드로 식별하는 것인 프로토콜 메시지 포맷 리버싱 방법.
12. The method of claim 11,
Field identification in the step of analyzing and outputting the format is,
After determining whether two adjacent bits have the same API sequence, if they have the same API sequence, they are identified as one field.
제17항에 있어서,
상기 필드는 프로그램에서 하나의 시멘틱으로 인식하는 비트 범위를 의미하는 것인 프로토콜 메시지 포맷 리버싱 방법.
18. The method of claim 17,
The field is a protocol message format reversing method that means a bit range recognized as one semantic in a program.
제17항에 있어서,
상기 포맷을 분석하여 출력하는 단계에서의 필드 용도 식별은,
상기 필드 식별이 완료되면, 식별된 필드별로 시드 입력값의 API시퀀스와 변형된 입력값의 API 시퀀스를 비교하여, 비교 결과에 따란 해당 필드의 용도를 분석하는 것인 프로토콜 메시지 포맷 리버싱 방법.
18. The method of claim 17,
Field usage identification in the step of analyzing and outputting the format is,
When the field identification is completed, the API sequence of the seed input value and the API sequence of the modified input value are compared for each identified field, and the use of the corresponding field is analyzed according to the comparison result.
제19항에 있어서,
상기 포맷을 분석하여 출력하는 단계에서의 필드 용도 식별은,
상기 시드 입력값의 API 시퀀스 길이의 10% 미만의 길이를 가지는 필드는 프로그램 설정과 관련된 필드로 인식하고,
상기 시드 입력값의 API 시퀀스 길이의 10% 이상의 길이를 가지는 필드는 프로그램에서 인식하는 데이터와 관련된 필드로 인식하는 것인 프로토콜 메시지 포맷 리버싱 방법.
20. The method of claim 19,
Field usage identification in the step of analyzing and outputting the format is,
A field having a length less than 10% of the API sequence length of the seed input value is recognized as a field related to program setting,
A method for reversing a protocol message format, wherein a field having a length of 10% or more of the API sequence length of the seed input value is recognized as a field related to data recognized by the program.
KR1020200173233A 2020-12-11 2020-12-11 Protocol message format reversing apparatus and method thereof KR102436522B1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
KR1020200173233A KR102436522B1 (en) 2020-12-11 2020-12-11 Protocol message format reversing apparatus and method thereof

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
KR1020200173233A KR102436522B1 (en) 2020-12-11 2020-12-11 Protocol message format reversing apparatus and method thereof

Publications (2)

Publication Number Publication Date
KR20220083214A KR20220083214A (en) 2022-06-20
KR102436522B1 true KR102436522B1 (en) 2022-08-25

Family

ID=82249968

Family Applications (1)

Application Number Title Priority Date Filing Date
KR1020200173233A KR102436522B1 (en) 2020-12-11 2020-12-11 Protocol message format reversing apparatus and method thereof

Country Status (1)

Country Link
KR (1) KR102436522B1 (en)

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR102005107B1 (en) * 2019-01-29 2019-07-29 엘아이지넥스원 주식회사 Method and Apparatus for Analyzing Malicious Code Using API Call Sequence

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR102017756B1 (en) * 2014-01-13 2019-09-03 한국전자통신연구원 Apparatus and method for detecting abnormal behavior
KR20170079961A (en) * 2015-12-31 2017-07-10 단국대학교 산학협력단 Method for detectiing similarity of software and apparatus therefor

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR102005107B1 (en) * 2019-01-29 2019-07-29 엘아이지넥스원 주식회사 Method and Apparatus for Analyzing Malicious Code Using API Call Sequence

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
Juan Caballero 외 3명, "Polyglot: Automatic Extraction of Protocol Message Format using Dynamic Binary Analysis", CCS '07: Proceedings of the 14th ACM conference on Computer and communications security,(2007.10.28)*
VALENTIN J.M. MANES 외 6 명, "The Art, Science, and Engineering of Fuzzing: A Survey", https://arxiv.org/pdf/1812.00140.pdf,(2019.04.08)*
최지연 외 4명, "효율적인 악성코드 분류를 위한 최적의 API 시퀀스 길이 및 조합 도출에 관한 연구", 정보보호학회논문지 24(5), (2014.10.31)*

Also Published As

Publication number Publication date
KR20220083214A (en) 2022-06-20

Similar Documents

Publication Publication Date Title
US8010844B2 (en) File mutation method and system using file section information and mutation rules
CN112035359B (en) Program testing method and device, electronic equipment and storage medium
JP2011503721A (en) Generating automated test inputs for web applications
CN108182359B (en) Method, device and storage medium for testing API security in trusted environment
JP7287480B2 (en) Analysis function imparting device, analysis function imparting method and analysis function imparting program
US8707266B2 (en) Command line interface robustness testing
CN109857637B (en) Java language method coverage rate and method input and output statistical method based on annotation
CN111679979A (en) Destructive testing method and device
CA2811617C (en) Commit sensitive tests
CN112925524A (en) Method and device for detecting unsafe direct memory access in driver
CN110399304B (en) Script testing method and system
US20060080578A1 (en) Defect detection for integers
JP6544253B2 (en) Method and non-transitory computer readable medium for determining valid input for unknown binary modules
KR102436522B1 (en) Protocol message format reversing apparatus and method thereof
KR20190071571A (en) Apparutus and method for analyzing user process based on standard process
Copos et al. Inputfinder: Reverse engineering closed binaries using hardware performance counters
Makady et al. Validating pragmatic reuse tasks by leveraging existing test suites
CN114338850B (en) Message checking method, device, terminal equipment and computer readable storage medium
CN116226047A (en) Method and device for quickly reading MIR information of gzip compressed stdf file
US10481969B2 (en) Configurable system wide tests
US20060059457A1 (en) Method and apparatus for supporting functionality documentation
US8819645B2 (en) Application analysis device
CN115544518A (en) Vulnerability scanning engine implementation method and device, vulnerability scanning method and electronic equipment
KR100521147B1 (en) The method for log processing of application error information
JP6608569B1 (en) Security design apparatus, security design method, and security design program

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