KR20180060497A - Apparatus and method for analyzing embeded software vulnerability based on binary code - Google Patents

Apparatus and method for analyzing embeded software vulnerability based on binary code Download PDF

Info

Publication number
KR20180060497A
KR20180060497A KR1020160160035A KR20160160035A KR20180060497A KR 20180060497 A KR20180060497 A KR 20180060497A KR 1020160160035 A KR1020160160035 A KR 1020160160035A KR 20160160035 A KR20160160035 A KR 20160160035A KR 20180060497 A KR20180060497 A KR 20180060497A
Authority
KR
South Korea
Prior art keywords
vulnerability
code
function
information
intermediate representation
Prior art date
Application number
KR1020160160035A
Other languages
Korean (ko)
Other versions
KR101906004B1 (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 KR1020160160035A priority Critical patent/KR101906004B1/en
Priority to PCT/KR2017/008354 priority patent/WO2018101575A1/en
Publication of KR20180060497A publication Critical patent/KR20180060497A/en
Application granted granted Critical
Publication of KR101906004B1 publication Critical patent/KR101906004B1/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/57Certifying or maintaining trusted computer platforms, e.g. secure boots or power-downs, version controls, system software checks, secure updates or assessing vulnerabilities
    • G06F21/577Assessing vulnerabilities and evaluating computer system security
    • 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/57Certifying or maintaining trusted computer platforms, e.g. secure boots or power-downs, version controls, system software checks, secure updates or assessing vulnerabilities

Abstract

The present invention relates to an apparatus and a method for analyzing vulnerability of binary code-based embedded software. The apparatus according to one embodiment of the present invention includes: a binary analysis unit for confirming whether a binary code can be converted into an intermediate representation format by extracting architecture information from the binary code; an intermediate representation conversion unit for converting the binary code into an intermediate representation code according to the confirmation result; an intermediate representation analysis unit for selecting a function to be analyzed for vulnerability by extracting a function call graph and a control flow graph from the intermediate representation code; a static vulnerability analysis unit for generating a static vulnerability detection list by determining whether the function to be analyzed for vulnerability has security vulnerability corresponding to a common weakness enumeration (CWE) vulnerability list; and a dynamic vulnerability analysis unit for performing symbolic execution by generating a test case for a function having vulnerability selected from the static vulnerability detection list. Therefore, the precision of vulnerability detection can be improved.

Description

바이너리 코드 기반 임베디드 소프트웨어 취약점 분석 장치 및 그 방법{APPARATUS AND METHOD FOR ANALYZING EMBEDED SOFTWARE VULNERABILITY BASED ON BINARY CODE}[0001] APPARATUS AND METHOD FOR ANALYZING EMBEDDED SOFTWARE VULNERABILITY BASED ON BINARY CODE [0002]

본 발명은 바이너리 코드 기반 임베디드 소프트웨어 취약점 분석 장치 및 그 방법에 관한 것으로, 구체적으로는 바이너리 코드를 중간 표현 코드로 변환하여 분석한 후 정적 및 동적으로 취약점을 분석함으로써 임베디드 기기의 소프트웨어의 보안 취약점을 점검하기 위한, 바이너리 코드 기반 임베디드 소프트웨어 취약점 분석 장치 및 그 방법에 관한 것이다.The present invention relates to an apparatus and method for analyzing a vulnerability of an embedded software based on a binary code, and more particularly, to analyzing a security vulnerability of an embedded device by statically and dynamically analyzing a binary code after converting the binary code into an intermediate representation code The present invention relates to a binary code based embedded software vulnerability analyzing apparatus and method thereof.

최근에는 보안에 취약한 소프트웨어를 사용함으로 인해 해킹과 같은 사이버 공격에 노출되는 사례가 증가하고 있다. 이에, 소프트웨어 개발자들은 소프트웨어 개발단계에서부터 보안 취약점(vulnerability)을 줄이기 위한 다양한 연구들을 진행하고 있다. 이처럼 소프트웨어의 보안 취약점을 줄이는 것에 관한 중요성이 커지고 있다. 여기서, 정보시스템에서의 보안 취약점이란 정보시스템에 불법적인 사용자의 접근, 정상적인 정보시스템 서비스를 방해하는 위협, 그리고 정보시스템에서 관리되는 중요 데이터의 유출, 변조, 삭제 등에 대한 위협을 말한다.In recent years, the use of vulnerable software has increased the exposure to cyber attacks such as hacking. Therefore, software developers are carrying out various studies to reduce security vulnerabilities from software development stage. As such, the importance of reducing software security vulnerabilities is growing. Here, a security vulnerability in an information system refers to an illegal user access to an information system, a threat that interferes with a normal information system service, and a threat of leakage, alteration or deletion of important data managed by the information system.

일반적으로, 주요 정보통신기반시설 관리기관에서는 정보시스템에서의 비즈니스를 위협하는 소프트웨어의 취약점을 분석 및 관리하며 중대 위협의 발생시 이에 즉각 대응이 가능토록 하는 보안 취약점 관리 프로세스를 운영중에 있다.In general, major IT infrastructure management agencies analyze and manage software vulnerabilities that threaten business in information systems and operate a security vulnerability management process that enables immediate response when a serious threat occurs.

최근 스마트그리드와 전력 IoT(Internet of Things)와 같이 전력설비가 점차 지능화됨에 따라, 전력산업 부분에서도 정보수집과 제어에 필요한 임베디드 기기(embeded device)가 전력계통 운영 네트워크에 연결되고 있다. 그런데, 임베디드 기기는 보안에 취약한 소프트웨어를 사용하는 경우에, 사이버 공격 위협에 노출되기 쉽다. 이에 따라, 전력산업 관리기관은 임베디드 기기에 사용되는 소프트웨어에 대한 보안 취약점을 분석 및 관리하여 중대 위협에 대한 대응 프로세스를 마련할 필요가 있다.Recently, as power facilities have become more intelligent, such as the Smart Grid and the Power of the Internet (IoT), the power industry is also connecting to the power system operation network with the embedded devices necessary for information gathering and control. However, embedded devices are vulnerable to cyber attack threats when using vulnerable software. Accordingly, the electric power industry management agency needs to analyze and manage the security weaknesses of the software used in the embedded devices, and prepare a countermeasure process against the serious threats.

종래의 소프트웨어의 보안 취약점을 검출할 수 있는 방식에는 다음과 같다. The following are the methods that can detect security vulnerabilities of conventional software.

먼저, 소스코드 기반의 코딩 규칙 검사 방식은 대상이 되는 임베디드 기기 소프트웨어의 소스코드를 확보하고, 소스코드 상에 존재하는 보안 취약점과 관련이 있는 문제점들을 검출하는 방식이다. 소프트웨어의 보안 취약점은 개발단계에서 취약점을 줄이는 것이 가장 효과적이다. 하지만, 소스코드 기반의 코딩 규칙 검사 방식은 소스코드가 필수적으로 확보되어야 한다. 레거시 시스템(legacy system), 상용 시스템 등의 경우에는 소프트웨어의 소스코드를 확보할 수 없는 상황이거나, 개발 회사로부터 제공되지 않는다. 따라서, 이 경우에는 실행 파일인 바이너리 코드를 시중에 나와 있는 'IDA Pro'와 같은 바이너리 리버싱(binary reversing) 도구를 이용하여 소스코드로 리버싱한 후, 해당 소스코드에 대한 소프트웨어의 보안 취약점을 분석 및 검출해야 한다. 그런데, 이 경우에는 정부기관이나 보안업체가 보안에 취약한 부분을 발견하기 전까지 사전에 보안 패치를 요구할 수 없기 때문에 해당 디바이스에 대한 보안 사고가 발생하기 전까지는 소프트웨어의 보안 취약점에 대해 보안대책 수립 자체가 불가능하다. First, a coding rule checking method based on a source code is a method of obtaining a source code of a target embedded device software and detecting problems related to a security vulnerability existing in the source code. Software security vulnerabilities are most effective at reducing vulnerabilities at the development stage. However, the source code is essential for the coding rule checking method based on the source code. In the case of a legacy system or a commercial system, the source code of the software can not be obtained or is not provided by the development company. Therefore, in this case, the binary code of the executable file is reversed to the source code using a binary reversing tool such as 'IDA Pro' on the market, and the software security vulnerability of the source code is reversed Analysis and detection. However, in this case, since a security patch can not be requested in advance until a government agency or a security company finds a vulnerable portion, security measures against the security vulnerability of the software itself impossible.

다음으로, 바이너리 기반의 알려진 바이너리 패턴 비교 방식은 대상이 되는 바이너리를 스캔하고 패턴을 검사하여 알려진 형태의 바이너리 패턴이 존재하는 경우 문제점으로 발견하고 보고하는 방식이다. 대표적으로 백신 기술을 예로 들 수 있다. 바이너리 기반의 알려진 바이너리 패턴 비교 방식은 패턴 이외의 논리적인 수행 흐름 분석이 어려워 기존 바이너리 스캐너로는 알려진 바이너리 취약 패턴만 사용됨으로써 취약점 분석에 한계가 있다.Next, the known binary pattern comparison method based on the binary is a method of scanning the target binary and inspecting the pattern to find and report a known binary pattern as a problem. Typically, vaccine technology is an example. Known binary pattern comparison method based on binary is difficult to analyze logical execution flow other than pattern. Therefore, vulnerability analysis is limited because only binary vulnerability pattern known as existing binary scanner is used.

다음으로, 사람에 의한 바이너리 직접 분석 방식은 대상이 되는 임베디드 기기 소프트웨어의 바이너리 코드를 보안 전문인력이 IDA Pro와 같은 바이너리 리버싱 도구를 통해 직접 확인하고 문제가 되는 부분을 찾아내는 방식이다. Next, the binary direct analysis method by a human is a method for the security expert to directly check the binary code of the target embedded device software through the binary reversing tool such as IDA Pro and to find the problematic part.

마지막으로, '모의침투 시험을 통한 동적 블랙박스 테스팅 방식'은 대상이 되는 임베디드 기기가 실제로 구동하는 환경 하에서 정해진 침입 방법들을 시도하여 문제점 유무를 확인하는 방식이다. 모의침투 시험을 통한 동적 블랙박스 테스팅 방식은 실제 구동과 유사한 구동환경이 필요함은 물론, 실행 시나리오를 기반으로 하기 때문에, 시나리오 이외에 존재하는 보안 취약점을 검출하는데는 제한적이라는 한계를 가진다.Finally, 'dynamic black box testing method through simulation penetration test' is a method to check whether there is a problem by trying predetermined intrusion methods under the environment where the target embedded device actually operates. The dynamic black box testing method through simulation penetration test has a limit that it is limited to detecting security vulnerabilities existing in scenarios because it is based on execution scenarios as well as a driving environment similar to actual driving is required.

한편, 배전자동화 현장 단말장치(Feeder Remote Teminal Unit: FRTU), 원격 감시 제어 단말장치(Supervision Control And Data Acquisition RTU : SCADA RTU)와 같은 레거시 시스템 임베디드 디바이스(legacy system embeded device), 전자식 전력량계, 원격검침 데이터수집장치(DCU)와 같은 상용 임베디드 기기, 전력 IoT 센서는, 소프트웨어의 보안 취약점을 발견하기 위한 소스코드를 확보하기 어렵다. 이 경우에는 소프트웨어의 취약점을 발견하기 위해 실행파일인 바이너리 코드(binary code)로부터 보안 취약점을 분석할 수밖에 없다. On the other hand, legacy system embedded devices such as a Feeder Remote Teminal Unit (FRTU), a Supervision Control and Data Acquisition RTU (SCADA RTU), an electronic watt hour meter, Commercially available embedded devices, such as data acquisition devices (DCUs), power IoT sensors, are difficult to secure source code for detecting software vulnerabilities. In this case, in order to detect the vulnerability of the software, it is necessary to analyze the security vulnerability from the executable binary code.

종래에는 바이너리 코드 스캐너를 이용하여 알려진 악성 행위에 대한 바이너리 코드를 매칭하는 방법을 취하고 있다. 하지만, 임베디드 기기는 특성상 다양한 아키텍처가 존재하고 그에 따라 서로 다른 하드웨어 의존적인 명령어 코드 체계를 가진다. 따라서, 임베디드 기기는 종래의 바이너리 코드 스캐너를 이용하는 경우에, 서로 다른 아키텍처 별로 바이너리를 스캔하고 매칭하는 방법을 확보해야 한다.Conventionally, a binary code scanner is used to match a known malicious binary code. However, embedded devices have a variety of architectures due to their characteristics, and thus have different hardware-dependent instruction code systems. Therefore, when using a conventional binary code scanner, an embedded device must secure a method of scanning and matching binary by different architectures.

또한, 바이너리 코드로부터 보안 취약점을 분석하기 위해서는 전문 인력이 필요하다. 즉, 일반인들은 바이너리 코드에 대한 이해가 부족하며, 검사하고자 하는 아키텍처들을 모두 이해하고 분석할 수 없다. 설사 전문 인력을 확보하더라도 수작업으로 바이너리 파일별 보안 취약점을 검출하기 때문에 상당한 소요 시간과 작업 비용이 필요하다.In addition, specialized personnel are needed to analyze security vulnerabilities from binary code. In other words, the general public lacks understanding of the binary code and can not understand and analyze all the architectures to be examined. Even if a skilled workforce is secured, it takes a considerable amount of time and labor to manually detect security vulnerabilities per binary file.

본 발명의 목적은 바이너리 코드를 중간 표현 코드로 변환하여 분석한 후 정적 및 동적으로 취약점을 분석함으로써 임베디드 기기의 소프트웨어의 보안 취약점을 점검하기 위한, 바이너리 코드 기반 임베디드 소프트웨어 취약점 분석 장치 및 그 방법을 제공하는데 있다.An object of the present invention is to provide a binary code-based embedded software vulnerability analyzing apparatus and method for analyzing vulnerability of software of an embedded device by statically and dynamically analyzing a binary code after converting the binary code into an intermediate representation code .

또한, 본 발명의 목적은 바이너리에서 발생 가능한 취약점을 검출하고, 이 중 발생 가능성에 대한 추가적인 판단 정보를 더하는 정적 및 동적 복합 분석을 통해 취약점 검출의 정밀도를 향상시키는데 있다.It is another object of the present invention to improve the accuracy of vulnerability detection through static and dynamic combined analysis for detecting a vulnerability that can occur in a binary and adding additional judgment information about the probability of occurrence of the vulnerability.

본 발명의 일실시예에 따른 바이너리 코드 기반 임베디드 소프트웨어 취약점 분석 장치는, 바이너리 코드로부터 아키텍처 정보를 추출하여 중간 표현 형식으로 변환 가능한지를 확인하기 위한 바이너리 분석부; 상기 확인 결과에 따라, 상기 바이너리 코드를 중간 표현 코드로 변환하기 위한 중간 표현 변환부; 상기 중간 표현 코드로부터 함수 호출 그래프와 제어 흐름 그래프를 추출하여 취약점 분석대상 함수를 선별하기 위한 중간 표현 분석부; 상기 취약점 분석대상 함수에 대해, CWE(Common Weakness Enumeration) 취약점 목록에 해당되는 보안 취약점이 있는지를 판단하여 정적 취약점 검출 목록을 생성하기 위한 정적 취약점 분석부; 및 상기 정적 취약점 검출 목록으로부터 선별된 취약점을 갖는 함수에 대해 테스트 케이스를 생성하여 기호 수행을 실행하기 위한 동적 취약점 분석부;를 포함한다.A binary code-based embedded software vulnerability analyzing apparatus according to an embodiment of the present invention includes a binary analyzer for extracting architecture information from a binary code and checking whether the architecture information can be converted into an intermediate representation format; An intermediate representation conversion unit for converting the binary code into an intermediate representation code according to the check result; An intermediate expression analyzer for extracting a function call graph and a control flow graph from the intermediate representation code to select a function to be subjected to the vulnerability analysis; A static vulnerability analyzer for generating a static vulnerability detection list by determining whether there is a security vulnerability corresponding to the Common Weakness Enumeration (CWE) vulnerability list for the vulnerability analysis target function; And a dynamic vulnerability analyzer for generating a test case for a function having a vulnerability selected from the static vulnerability detection list and executing the preference operation.

상기 바이너리 분석부는, 상기 바이너리 코드로부터 바이너리 유형 정보인 문자열 정보와 심볼 정보를 추출하여 저장하는 것을 특징으로 한다.The binary analyzing unit extracts and stores character string information and symbol information, which are binary type information, from the binary code.

상기 중간 표현 변환부는, 상기 바이너리 코드에 대해 디스어셈블 과정을 거쳐 디스어셈블 코드를 생성한 후, 상기 디스어셈블 코드에 대응되는 상기 중간 표현 코드으로 변환하는 것을 특징으로 한다.The intermediate representation conversion unit may generate a disassembly code through a disassembly process on the binary code, and then convert the disassembly code into the intermediate representation code corresponding to the disassembly code.

상기 중간 표현 분석부는, 상기 중간 표현 코드를 파싱하여 추상 구문 트리를 생성한 후, 상기 추상 구문 트리를 순회하여 함수 호출 그래프와 제어 흐름 그래프를 생성하는 것을 특징으로 한다.The intermediate expression analyzing unit parses the intermediate representation code to generate an abstract syntax tree, and then traverses the abstract syntax tree to generate a function call graph and a control flow graph.

상기 중간 표현 분석부는, 함수 호출 그래프와 제어 흐름 그래프의 분석을 통해 보안 취약점 분석이 불필요한 함수목록을 제외하여 상기 취약점 분석대상 함수를 선별하는 것을 특징으로 한다.The intermediate expression analyzing unit may select the function to be subjected to the vulnerability analysis by excluding a function list that does not require a security vulnerability analysis through analysis of a function call graph and a control flow graph.

상기 정적 취약점 분석부는, 상기 취약점 분석대상 함수를 분석하여 이전에 알려진 형태의 취약점 정보와 동일한 유형의 중간 표현 코드를 확인하는 것을 특징으로 한다.The static vulnerability analysis unit analyzes the vulnerability analysis target function to identify an intermediate representation code of the same type as the previously known vulnerability information.

상기 정적 취약점 검출 목록은, 취약점 위치와 취약점 정보가 기록된 것을 특징으로 한다.The static vulnerability detection list is characterized in that the vulnerability location and the vulnerability information are recorded.

상기 동적 취약점 분석부는, 상기 정적 취약점 검출 목록으로부터 선별된 취약점을 가지는 함수의 인자정보, 분기정보, 호출 관계 정보를 분석하는 것을 특징으로 한다.The dynamic vulnerability analysis unit analyzes factor information, branch information, and call relationship information of a function having a selected vulnerability from the static vulnerability detection list.

또한, 본 발명의 일실시예에 따른 바이너리 코드 기반 임베디드 소프트웨어 취약점 분석 방법은, 바이너리 코드로부터 아키텍처 정보를 추출하여 중간 표현 형식으로 변환 가능한지를 확인하는 단계; 상기 확인 결과에 따라, 상기 바이너리 코드를 중간 표현 코드로 변환하는 단계; 상기 중간 표현 코드로부터 함수 호출 그래프와 제어 흐름 그래프를 추출하여 취약점 분석대상 함수를 선별하는 단계; 상기 취약점 분석대상 함수에 대해, CWE(Common Weakness Enumeration) 취약점 목록에 해당되는 보안 취약점이 있는지를 판단하여 정적 취약점 검출 목록을 생성하는 단계; 및 상기 정적 취약점 검출 목록으로부터 선별된 취약점을 갖는 함수에 대해 테스트 케이스를 생성하여 기호 수행을 실행하는 단계;를 포함한다.According to another aspect of the present invention, there is provided a method of analyzing an embedded software vulnerability of a binary code, the method comprising: extracting architecture information from a binary code and confirming whether the information can be converted into an intermediate representation format; Converting the binary code into an intermediate representation code according to the result of the checking; Extracting a function call graph and a control flow graph from the intermediate representation code to select a function to be subjected to the vulnerability analysis; Generating a static vulnerability detection list for the vulnerability analysis target function by determining whether there is a security vulnerability corresponding to the Common Weakness Enumeration (CWE) vulnerability list; And generating a test case for a function having a vulnerability selected from the static vulnerability detection list to execute the preference execution.

상기 정적 취약점 검출 목록의 분석결과와 상기 기호 수행이 실행된 결과를 종합하여 발생 가능한 취약점을 검출하는 단계;를 더 포함한다.Detecting a vulnerability that can be generated by combining the analysis result of the static vulnerability detection list and the result of performing the preference execution.

상기 검출 단계 이후에, 상기 검출 결과에 따라 보안 위협에 대응하는 보안 취약점 관리 프로세스를 운영하는 단계;를 더 포함한다.And operating the security vulnerability management process corresponding to the security threat according to the detection result after the detection step.

상기 확인 단계는, 상기 바이너리 코드로부터 바이너리 유형 정보인 문자열 정보와 심볼 정보를 추출하여 저장하는 것을 특징으로 한다.The checking step extracts and stores character string information and symbol information, which are binary type information, from the binary code.

상기 변환 단계는, 상기 바이너리 코드에 대해 디스어셈블 과정을 거쳐 디스어셈블 코드를 생성한 후, 상기 디스어셈블 코드에 대응되는 상기 중간 표현 코드으로 변환하는 것을 특징으로 한다.The transforming step may include disassembling the binary code to generate a disassembly code, and then converting the disassembled code to the intermediate representation code corresponding to the disassembly code.

상기 선별 단계는, 상기 중간 표현 코드를 파싱하여 추상 구문 트리를 생성한 후, 상기 추상 구문 트리를 순회하여 함수 호출 그래프와 제어 흐름 그래프를 생성하는 것을 특징으로 한다.The selecting step generates an abstract syntax tree by parsing the intermediate representation code, and then traverses the abstract syntax tree to generate a function call graph and a control flow graph.

상기 선별 단계는, 함수 호출 그래프와 제어 흐름 그래프의 분석을 통해 보안 취약점 분석이 불필요한 함수목록을 제외하여 상기 취약점 분석대상 함수를 선별하는 것을 특징으로 한다.The selecting step may include selecting a function to be subjected to the vulnerability analysis by excluding a function list that does not require a security vulnerability analysis through analysis of a function call graph and a control flow graph.

상기 생성 단계는, 상기 취약점 분석대상 함수를 분석하여 이전에 알려진 형태의 취약점 정보와 동일한 유형의 중간 표현 코드를 확인하는 것을 특징으로 한다.And the generating step analyzes the vulnerability analysis target function to identify an intermediate representation code of the same type as the previously known vulnerability information.

상기 실행 단계는, 상기 정적 취약점 검출 목록으로부터 선별된 취약점을 가지는 함수의 인자정보, 분기정보, 호출 관계 정보를 분석하는 것을 특징으로 한다.The execution step analyzes the argument information, the branch information, and the call relationship information of the function having the selected vulnerability from the static vulnerability detection list.

본 발명은 바이너리 코드를 중간 표현 코드로 변환하여 분석한 후 정적 및 동적으로 취약점을 분석함으로써 임베디드 기기의 소프트웨어의 보안 취약점을 점검할 수 있다.The present invention can check the vulnerability of the software of the embedded device by analyzing the binary code statically and dynamically after converting the binary code into the intermediate representation code and analyzing it.

또한, 본 발명은 바이너리 기반의 취약점 분석을 통해 소스 코드 없이 임베디드 기기의 실행 파일인 바이너리로부터 취약점을 검출할 수 있다.Also, the present invention can detect a vulnerability from a binary, which is an executable file of an embedded device, without source code through binary-based vulnerability analysis.

또한, 본 발명은 전력설비(RTU, FRTU)와 전력 IoT 센서와 같은 임베디드 기기에 대한 보안 취약성을 점검할 수 있다.In addition, the present invention can check security vulnerabilities for embedded devices such as power equipment (RTU, FRTU) and power IoT sensors.

또한, 본 발명은 바이너리에서 발생 가능한 취약점을 검출하고, 이 중 발생 가능성에 대한 추가적인 판단 정보를 더하는 정적 및 동적 복합 분석을 통해 취약점 검출의 정밀도를 향상시킬 수 있다.In addition, the present invention can improve vulnerability detection precision through static and dynamic combined analysis that detects a vulnerability that can occur in the binary and adds additional judgment information about the probability of occurrence of the vulnerability.

또한, 본 발명은 중간 표현 변환에 대해서 지속적인 대응이 필요하며, 중간 표현 기반의 방법이 바이너리 코드 스캔 방법에 비해 지속적으로 요구되는 비용을 최소화할 수 있다.Further, the present invention requires a continuous correspondence to the intermediate expression conversion, and the intermediate expression based method can minimize the cost that is continuously required as compared with the binary code scanning method.

도 1은 본 발명의 일실시예에 따른 바이너리 코드 기반 임베디드 소프트웨어 취약점 분석 장치에 대한 도면,
도 2는 상기 도 1의 취약점 분석 장치에서 취약점 분석을 설명하기 위한 소스코드의 예시를 나타낸 도면,
도 3은 상기 표 1 및 2의 중간 표현 코드로부터 함수 호출 그래프를 분석한 예시를 나타낸 도면,
도 4는 중간 표현 코드로부터 제어 흐름 그래프를 나타낸 도면,
도 5는 디스어셈블 도구(IDA Pro)를 활용한 제어 흐름 그래프를 나타낸 도면,
도 6은 중간 표현 코드의 정적 취약성 분석 예시를 나타낸 도면,
도 7은 동적 취약점 분석부의 상세 구성을 나타낸 도면,
도 8은 본 발명의 일실시예에 따른 바이너리 코드 기반 임베디드 소프트웨어 취약점 분석 방법에 대한 도면이다.
1 is a diagram of a binary code based embedded software vulnerability analyzing apparatus according to an embodiment of the present invention;
FIG. 2 is a diagram illustrating an example of source code for explaining vulnerability analysis in the vulnerability analysis apparatus of FIG. 1; FIG.
3 illustrates an example of analyzing a function call graph from intermediate representation codes in Tables 1 and 2,
4 shows a control flow graph from an intermediate representation code,
5 is a graph showing a control flow graph using a disassemble tool (IDA Pro)
6 is a diagram illustrating an example of a static vulnerability analysis of an intermediate representation code,
7 is a diagram showing a detailed configuration of a dynamic vulnerability analysis unit,
8 is a diagram illustrating a method of analyzing a vulnerability of an embedded software based on a binary code according to an embodiment of the present invention.

본 발명을 충분히 이해하기 위해서 본 발명의 바람직한 실시예를 첨부 도면을 참조하여 설명한다. 본 발명의 실시예는 여러 가지 형태로 변형될 수 있으며, 본 발명의 범위가 아래에서 상세히 설명하는 실시예로 한정되는 것으로 해석되어서는 안 된다. 본 실시예는 당업계에서 평균적인 지식을 가진 자에게 본 발명을 보다 완전하게 설명하기 위해서 제공 되어지는 것이다. 따라서 도면에서의 요소의 형상 등은 보다 명확한 설명을 강조하기 위해서 과장되어 표현될 수 있다. 각 도면에서 동일한 부재는 동일한 참조부호로 도시한 경우가 있음을 유의하여야 한다. 본 발명의 요지를 불필요하게 흐릴 수 있다고 판단되는 공지 기능 및 구성에 대한 상세한 기술은 생략된다.For a better understanding of the present invention, a preferred embodiment of the present invention will be described with reference to the accompanying drawings. The embodiments of the present invention may be modified into various forms, and the scope of the present invention should not be construed as being limited to the embodiments described in detail below. The present embodiments are provided to enable those skilled in the art to more fully understand the present invention. Therefore, the shapes and the like of the elements in the drawings can be exaggeratedly expressed to emphasize a clearer description. It should be noted that in the drawings, the same members are denoted by the same reference numerals. Detailed descriptions of well-known functions and constructions which may be unnecessarily obscured by the gist of the present invention are omitted.

도 1은 본 발명의 일실시예에 따른 바이너리 코드 기반 임베디드 소프트웨어 취약점 분석 장치에 대한 도면이다.BRIEF DESCRIPTION OF THE DRAWINGS FIG. 1 is a diagram of a binary code based embedded software vulnerability analysis apparatus according to an embodiment of the present invention.

도 1에 도시된 바와 같이, 본 발명의 일실시예에 따른 바이너리 코드 기반 임베디드 소프트웨어 취약점 분석 장치(이하 "취약점 분석 장치"라 함, 100)는, 소스코드가 아닌 실행파일인 바이너리 코드를 통해 취약점을 검출하여 임베디드 기기 소프트웨어의 보안 취약점을 분석하여 발견한다. 즉, 취약점 분석 장치(100)는 레거시 시스템, 상용 시스템 등에서 임베디드 기기의 소프트웨어에 대한 보안 취약점을 검출하기 위해 소스코드를 확보하기 어렵기 때문에, 실행파일인 바이너리 코드로부터 보안 취약점을 분석한다.1, a binary code-based embedded software vulnerability analyzing apparatus (hereinafter referred to as a "vulnerability analyzing apparatus") 100 according to an embodiment of the present invention detects a vulnerability To detect and detect security vulnerabilities of embedded device software. That is, since the vulnerability analysis apparatus 100 can not secure a source code for detecting a security vulnerability of software of an embedded device in a legacy system, a commercial system, or the like, the vulnerability analysis apparatus 100 analyzes a security vulnerability from binary code as an executable file.

이를 위해, 취약점 분석 장치(100)는 바이너리 분석부(110), 중간 표현 변환부(120), 중간 표현 분석부(130), 정적 취약점 분석부(140), 동적 취약점 분석부(150)를 포함한다. 부가적으로, 취약점 관리부(미도시)는 취약점 분석 장치(100)에 의해 분석된 취약점 분석 결과를 토대로, 중대 위협의 발생시 이에 즉각 대응이 가능토록 하는 보안 취약점 관리 프로세스를 운영한다.To this end, the vulnerability analysis apparatus 100 includes a binary analysis unit 110, an intermediate expression conversion unit 120, an intermediate expression analysis unit 130, a static vulnerability analysis unit 140, and a dynamic vulnerability analysis unit 150 do. In addition, the vulnerability management unit (not shown) operates a security vulnerability management process that allows the vulnerability analysis apparatus 100 to immediately respond to a serious threat based on the analysis result of the vulnerability analysis.

바이너리 분석부(110)는 분석 대상인 바이너리 코드로부터 임베디드 기기의 아키텍처(architecture) 정보를 추출하여 중간 표현 형식(Intermediate Representation)으로의 변환 작업이 가능한지를 확인한다. 여기서, 바이너리 분석부(110)는 바이너리 코드가 중간 표현 형식으로의 변환 작업이 가능한 경우에 바이너리 유형 정보(즉, 문자열 정보, 심볼 정보 등)를 추가로 추출한다. 바이너리 분석부(110)는 아키텍처 정보, 문자열 정보, 심볼 정보를 저장하여 관리한다.The binary analysis unit 110 extracts the architecture information of the embedded device from the binary code to be analyzed and confirms whether conversion into an intermediate representation format is possible. Here, the binary analyzer 110 further extracts binary type information (i.e., string information, symbol information, etc.) when the binary code can be converted into the intermediate representation format. The binary analysis unit 110 stores and manages architecture information, character string information, and symbol information.

중간 표현 변환부(120)는 분석 대상인 바이너리 코드에 대해, 디스어셈블(disassemble) 과정을 거쳐 중간 표현으로 변환하는 작업을 수행한다. 구체적으로, 중간 표현 변환부(120)는 바이너리 코드에 대해 디스어셈블 과정을 수행하여 디스어셈블 코드 정보를 생성한다. 이후, 중간 표현 변환부(120)는 디스어셈블 코드 정보에 대해 변환 가능한 중간 표현을 검색하고, 디스어셈블 코드 정보를 대응되는 중간 표현으로 변환한다. 이로써, 중간 표현 변환부(120)는 분석 대상인 바이너리 코드의 중간 표현을 생성한다.The intermediate representation conversion unit 120 performs a disassembling process on the binary code to be analyzed and converts the intermediate code into an intermediate representation. Specifically, the intermediate representation conversion unit 120 performs a disassembly process on the binary code to generate disassembly code information. Then, the intermediate representation conversion unit 120 searches for the intermediate representation that can be transformed with respect to the disassemble code information, and converts the disassemble code information into the corresponding intermediate representation. Thus, the intermediate representation conversion unit 120 generates an intermediate representation of the binary code to be analyzed.

중간 표현 분석부(130)는 변환된 중간 표현을 이용하여 소스코드에 준하는 논리적 분석을 수행한다. 즉, 중간 표현 분석부(130)는 변환된 중간 표현을 기반으로 후술할 정적 취약점 분석부(140)와 동적 취약점 분석부(150)의 취약점 분석 과정에 필요한 공용정보로서, 함수 호출 그래프(Fucntion Call Graph), 제어 흐름 그래프(Control Flow Graph: CFG) 및 함수목록을 추출한다. 여기서, 중간 표현 분석부(130)는 추출된 함수목록 중 함수호출 관계정보를 분석하여 취약점 분석대상 함수목록을 선별한다. 구체적으로, 중간 표현 분석부(130)는 변환된 중간 표현을 파싱(parsing)하여 추상 구문 트리(Abstract Syntax Tree: AST)를 생성한다. 그리고, 중간 표현 분석부(130)는 추상 구문 트리의 각 노드를 순회(traversal)하여 함수 호출 그래프와 제어 흐름 그래프를 생성한다. 이 경우, 중간 표현 분석부(130)는 추상 구문 트리의 노드들을 순회할 때, 전위 순회, 중위 순회, 후위 순회 등과 같이 어느 하나의 순회 방식을 이용할 수 있다.The intermediate representation analysis unit 130 performs a logical analysis based on the source code using the transformed intermediate representation. That is, the intermediate representation analysis unit 130 uses the function call graph (Fucntion Call) as the common information required for the vulnerability analysis process of the static vulnerability analysis unit 140 and the dynamic vulnerability analysis unit 150, Graph, Control Flow Graph (CFG), and Function List. Here, the intermediate expression analyzing unit 130 analyzes the function call relationship information among the extracted function lists, and selects a list of functions to be subjected to the vulnerability analysis. Specifically, the intermediate representation analysis unit 130 generates an abstract syntax tree (AST) by parsing the transformed intermediate representation. The intermediate expression analysis unit 130 traverses each node of the abstract syntax tree to generate a function call graph and a control flow graph. In this case, when the nodes of the abstract syntax tree are traversed, the intermediate expression analyzing unit 130 can use any one of the traversal methods such as dislocation traversal, middle traversal, and trailing traversal.

또한, 중간 표현 분석부(130)는 함수 호출 그래프와 제어 흐름 그래프를 분석하고, 이를 통해 보안 취약점 분석이 불필요한 함수목록을 제외하여 취약점 분석대상 함수목록을 생성한다.In addition, the intermediate expression analyzer 130 analyzes the function call graph and the control flow graph, and generates a list of functions to be subjected to the vulnerability analysis by excluding the function list that does not require the analysis of the security vulnerability.

정적 취약점 분석부(140)는 취약점 분석대상 함수목록을 순차적으로 순회하여 이전에 알려진 형태의 취약점 정보와 동일한 유형의 중간 표현 코드를 판단한다. 그리고, 정적 취약점 분석부(140)는 판단 결과에 따라 확인된 취약점 위치와 확인된 취약점 정보가 기록된 정적 취약점 검출 목록을 생성한다. The static vulnerability analysis unit 140 sequentially circulates the vulnerability analysis target function list to determine the intermediate representation code of the same type as that of the previously known vulnerability information. Then, the static vulnerability analysis unit 140 generates a static vulnerability detection list in which the identified vulnerability location and the identified vulnerability information are recorded according to the determination result.

구체적으로, 정적 취약점 분석부(140)는 취약점 분석대상 함수의 함수 호출 관계를 분석하여 함수 호출 관계 정보를 수집하고, 취약점 분석대상 함수의 제어 흐름 그래프를 분석하여 로직 흐름 정보를 수집한다. 정적 취약점 분석부(140)는 취약점 분석대상 함수에 대해, 정적 취약점 검출을 위한 CWE(Common Weakness Enumeration) 취약점 목록에서 동일한 유형의 보안 취약점이 있는지를 판단한다. 이를 통해, 정적 취약점 분석부(140)는 정적 취약점 검출 목록을 생성한다.Specifically, the static vulnerability analysis unit 140 analyzes the function call relationship of the vulnerability analysis target function, collects function call relationship information, and analyzes the control flow graph of the vulnerability analysis target function to collect logic flow information. The static vulnerability analysis unit 140 determines whether there is a security vulnerability of the same type in the CWE (Common Weakness Enumeration) vulnerability list for the static vulnerability detection for the vulnerability analysis target function. Thus, the static vulnerability analysis unit 140 generates a static vulnerability detection list.

동적 취약점 분석부(150)는 취약점 분석대상 함수들을 순차적으로 순회하고, 기호 수행(symbolic execution)이 가능한 함수를 판단하여 해당 함수에 대한 기호 수행을 실시한다. 동적 취약점 분석부(150)는 기호 수행된 함수들의 수행 흐름 정보를 기록한다.The dynamic vulnerability analysis unit 150 sequentially traverses the functions to be subjected to the vulnerability analysis, judges a function capable of symbolic execution, and performs a symbol operation on the function. The dynamic vulnerability analysis unit 150 records the execution flow information of the symbolically performed functions.

구체적으로, 동적 취약점 분석부(150)는 정적 취약점 검출 목록으로부터 취약점을 가지는 함수를 선별하고, 이들의 인자정보, 분기정보, 호출 관계 정보를 분석한다. 그리고, 동적 취약점 분석부(150)는 분석된 정보를 바탕으로 취약점을 가지는 함수들에 대한 테스트 케이스를 생성한다. 동적 취약점 분석부(150)는 테스트 케이스들의 기호 수행을 실행한다.Specifically, the dynamic vulnerability analysis unit 150 selects a function having a vulnerability from the static vulnerability detection list, and analyzes the factor information, the branch information, and the call relationship information. Then, the dynamic vulnerability analysis unit 150 generates a test case for the vulnerable functions based on the analyzed information. The dynamic vulnerability analysis unit 150 executes the symbol execution of the test cases.

정적 및 동적 취약점 분석부(140,150)는 중간 표현 분석을 진행하여 알려진 보안 취약점인 CWE 항목들로부터 임베디드 소프트웨어에서 발생할 가능성이 있는 항목(즉, 함수, 변수)들을 선별하기 위하여, 정적 취약점 분석과 동적 취약점 분석을 복합적으로 사용하여 취약점 검출의 폭과 정밀도를 향상시킬 수 있다. 이는 단일 취약점 검출 방법에 비해 검출할 수 있는 범위를 넓혀 주고, 검출된 취약점에 대해 동적 기호 수행에 따른 발생 가능성 가산을 통해 좀 더 신뢰도 높은 취약점 검출 정보를 제공할 수 있기 때문이다.The static and dynamic vulnerability analyzing units 140 and 150 conduct the intermediate expression analysis to analyze static vulnerability analysis and dynamic vulnerability analysis to select items likely to occur in the embedded software from the CWE items, The analysis can be used in combination to improve the breadth and accuracy of vulnerability detection. This is because the scope of detection is wider than that of the single vulnerability detection method, and more reliable vulnerability detection information can be provided through addition of possibility to be generated based on the dynamic symbol performance for the detected vulnerability.

이와 같이, 취약점 분석 장치(100)는 일련의 수행 흐름이 완료되면 정적 취약점에서 검출된 취약점 정보와 수행 흐름 정보 종합하여 취약점의 발생 가능성을 판별하여 발생 가능하다고 여겨지는 취약점만을 선별한다. 취약점 분석 장치(100)는 이러한 과정을 통해 바이너리에서 발생 가능한 취약점을 검출하고, 이 중 발생 가능성에 대한 추가적인 판단 정보를 더하는 정적 및 동적 복합 분석을 통해 취약점 검출의 정밀도를 높일 수 있다.In this way, when a series of execution flows is completed, the vulnerability analysis apparatus 100 discriminates the possibility of the vulnerability by synthesizing the vulnerability information and the execution flow information detected from the static vulnerability, and selects only the vulnerabilities considered to be possible. Through this process, the vulnerability analysis apparatus 100 can detect the vulnerability that can occur in the binary and increase the accuracy of the vulnerability detection through static and dynamic combined analysis that adds additional judgment information about the possibility of the occurrence.

전술한 바와 같이, 취약점 분석 장치(100)는 바이너리 기반의 취약점 분석을 통해 소스 코드 없이 임베디드 기기의 실행 파일인 바이너리로부터 취약점 검출이 가능하다. 즉, 취약점 분석 장치(100)는 임베디드 기기의 취약점 검출의 한계를 극복하기 위해 중간 표현 기반의 범용적인 바이너리 기반으로 취약점 분석을 가능하게 한다. 이를 통해, 취약점 분석 장치(100)는 전력설비(RTU, FRTU)와 전력 IoT 센서와 같은 임베디드 기기에 대한 보안 취약성을 점검할 수 있다.As described above, the vulnerability analysis apparatus 100 can detect a vulnerability from a binary, which is an executable file of an embedded device, without source code through a binary-based vulnerability analysis. That is, the vulnerability analysis apparatus 100 can perform vulnerability analysis based on a general binary based on an intermediate expression in order to overcome the limit of detecting the vulnerability of an embedded device. Accordingly, the vulnerability analysis apparatus 100 can check security vulnerabilities on embedded devices such as a power plant (RTU, FRTU) and a power IoT sensor.

도 2는 상기 도 1의 취약점 분석 장치에서 취약점 분석을 설명하기 위한 소스코드의 예시를 나타낸 도면이다.2 is a diagram illustrating an example of source code for explaining vulnerability analysis in the vulnerability analysis apparatus of FIG.

도 2의 소스코드는 소프트웨어 취약점 분석을 설명하기 위한 예시코드로서, 다음 2가지 취약점을 가진 소스코드를 제시하였다. The source code of FIG. 2 is an example code for explaining a software vulnerability analysis. The source code of the following two vulnerabilities is presented.

첫번째 취약점은 문자열 길이를 고려하지 않는 문자열 비교함수(strcmp)를 사용함에 따른 취약점이다. 여기서, strcmp 함수(1)는 2개의 문자열을 비교하는 함수이며, 문자열의 길이가 크고 작음을 비교하는 것이 아니라, 첫번째 문자부터 차례로 바이트의 크기를 비교한다. strcmp 함수(1)의 헤더는 'string.h'이다. strcmp 함수(1)의 형태는 'char* strcmp(const char* s1, const char* s2);'이다. 인수 'char* s1'는 비교할 대상 문자열을 나타내고, 인수 'char* s2'는 비교할 문자열을 나타낸다. 이러한 strcmp 함수(1)는 버퍼 오버플로우(buffer overflow)라는 취약점을 가지며, 인자로 받는 정보에 대해 메모리 크기를 비교하지 않음으로써 다른 영역의 메모리를 침범하여 프로그램의 오동작 및 루트 권한 탈취 등의 취약점을 가지는 함수이다. 여기서, 버퍼 오버플로우는 메모리 오류를 이용해 타겟 프로그램의 실행흐름을 제어하고 최종적으로는 공격자가 원하는 임의의 코드를 실행하는 것을 말한다. 따라서, strcmp 함수(1)는 취약점이 있기 때문에, strncmp 함수로 대체하는 것이 바람직하다.The first vulnerability is a vulnerability due to the use of the string comparison function (strcmp) which does not consider string length. Here, the strcmp function (1) is a function for comparing two strings, and compares the size of the bytes sequentially from the first character, not comparing the lengths of the strings with each other. The header of the strcmp function (1) is 'string.h'. The type of the strcmp function (1) is 'char * strcmp (const char * s1, const char * s2);'. The argument 'char * s1' represents the target string to be compared, and the argument 'char * s2' represents the string to be compared. This strcmp function (1) has a vulnerability called a buffer overflow. It does not compare the memory size with the information received as an argument, thereby violating the memory of another area, causing a malfunction such as program malfunction and root privilege hijacking Is a function. Here, the buffer overflow refers to controlling the execution flow of the target program using a memory error and finally executing an arbitrary code desired by the attacker. Therefore, since the strcmp function (1) is vulnerable, it is preferable to replace it with the strncmp function.

두번째 취약점은 패스워드(brilling)(2)가 하드 코딩되어 노출되는 취약점이다. 패스워드를 하드 코딩하는 경우에는 관리자 비밀번호가 노출되거나, 주기적인 관리자 변경 등 수정이 용이하지 않은 약점이 있다.The second vulnerability is a vulnerability in which the password (brilling) (2) is hard-coded and exposed. When the password is hard-coded, there is a weak point that the administrator's password is exposed, and it is not easy to modify the administrator periodically.

한편, 하기 표 1 및 2는 상기 도 2의 소스코드가 디스어셈블을 통해 중간 표현으로 변환된 예시코드를 나타낸다. 즉, 하기 표 1 및 2는 도 2의 소스코드가 컴파일된 후 실행파일인 바이너리 코드로 변환된 것을 중간 표현 코드로 변환한 예시코드를 나타낸다. 여기서, 하기 표 1 및 2는 예시코드는 LLVM 중간 표현을 사용한다.On the other hand, Tables 1 and 2 below show example codes in which the source code of FIG. 2 is transformed into an intermediate representation through disassembly. In other words, Tables 1 and 2 below show example codes obtained by converting the source code of FIG. 2 into binary code, which is an executable file after being compiled, into an intermediate representation code. Here, in the following Tables 1 and 2, the example code uses the LLVM intermediate representation.

1. ; ModuleID = 'test.c'
2. target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
3. target triple = "x86_64-apple-macosx10.11.0"
4.
5. @.str = private unnamed_addr constant [9 x i8] c"brilling\00", align 1
6. @.str1 = private unnamed_addr constant [8 x i8] c"Access\0A\00", align 1
7. @.str2 = private unnamed_addr constant [6 x i8] c"Deny\0A\00", align 1
8.
9. ; Function Attrs: nounwind uwtable
10.define i32 @check_auth(i8* %password) #0 {
11.entry:
12. %password.addr = alloca i8*, align 8
13. %auth_flag = alloca i32, align 4
14. store i8* %password, i8** %password.addr, align 8
15. store i32 0, i32* %auth_flag, align 4
16. %0 = load i8** %password.addr, align 8
17. %call = call i32 @strcmp(i8* %0, i8* getelementptr inbounds ([9 x i8]* @.str,i32
0, i32 0))
18. %cmp = icmp eq i32 %call, 0
19. br i1 %cmp, label %if.then, label %if.end
20.
21.if.then: ;preds = %entry
22. store i32 1, i32* %auth_flag, align 4
23. br label %if.end
24.
25.if.end: ;preds = %if.then, %entry
26. %1 = load i32* %auth_flag, align 4
27. ret i32 %1
28.}
29.
30.declare i32 @strcmp(i8*, i8*) #1
31.
32.; Function Attrs: nounwind uwtable
33.define i32 @main(i32 %argc, i8** %argv) #0 {
34.entry:
35. %retval = alloca i32, align 4
36. %argc.addr = alloca i32, align 4
37. %argv.addr = alloca i8**,align 8
38. store i32 0, i32* %retval
39. store i32 %argc, i32* %argc.addr, align 4
40. store i8** %argv, i8*** %argv.addr, align 8
41. %0 = load i32* %argc.addr, align 4
42. %cmp = icmp slt i32 %0, 2
43. br i1 %cmp, label %if.then, label %if.end
44.
45.if.then: ;preds = %entry
46. store i32 -1, i32* %retval
47. br label %return
48.
One. ; ModuleID = 'test.c'
2. target datalayout = "em: o-i64: 64-f80: 128-n8: 16: 32: 64-S128"
3. target triple = "x86_64-apple-macosx10.11.0"
4.
5. @ .str = private unnamed_addr constant [9 x i8] c "brilling \ 00", align 1
6. @. Str1 = private unnamed_addr constant [8 x i8] c "Access \ 0A \ 00", align 1
7. @ .str2 = private unnamed_addr constant [6 x i8] c "Deny \ 0A \ 00", align 1
8.
9.; Function Attrs: nounwind uwtable
10.define i32 @check_auth (i8 *% password) # 0 {
11.entry:
12.% password.addr = alloca i8 *, align 8
13.% auth_flag = alloca i32, align 4
14. store i8 *% password, i8 **% password.addr, align 8
15. store i32 0, i32 *% auth_flag, align 4
16.% 0 = load i8 **% password.addr, align 8
17. call = call i32 @ strcmp (i8 *% 0, i8 * getelementptr inbounds ([9 x i8] * @. Str, i32
0, i32 0))
18.% cmp = icmp eq i32% call, 0
19. br i1% cmp, label% if.then, label% if.end
20.
21.if.then:; preds =% entry
22. store i32 1, i32 *% auth_flag, align 4
23. br label% if.end
24.
25.if.end:; preds =% if.then,% entry
26.% 1 = load i32 *% auth_flag, align 4
27. ret i32% 1
28.}
29.
30.declare i32 @ strcmp (i8 *, i8 *) # 1
31.
32 .; Function Attrs: nounwind uwtable
33.define i32 @main (i32% argc, i8 **% argv) # 0 {
34.entry:
35.% retval = alloca i32, align 4
36.% argc.addr = alloca i32, align 4
37.% argv.addr = alloca i8 **, align 8
38. store i32 0, i32 *% retval
39. store i32% argc, i32 *% argc.addr, align 4
40. store i8 **% argv, i8 ***% argv.addr, align 8
41.% 0 = load i32 *% argc.addr, align 4
42.% cmp = icmp slt i32% 0, 2
43. br i1% cmp, label% if.then, label% if.end
44.
45.if.then:; preds =% entry
46. store i32 -1, i32 *% retval
47. br label% return
48.

49.if.end: ;preds = %entry
50. %1 = load i8*** %argv.addr, align 8
51. %arrayidx = getelementptr inbounds i8** %1, i64 1
52. %2 = load i8** %arrayidx, align 8
53. %call = call i32 @check_auth(i8* %2)
54. %tobool = icmp ne i32 %call, 0
55. br i1 %tobool, label %if.then1, label %if.else
56.
57.if.then1: ;preds = %if.end
58. %call2 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([8 x i8]*
@.str1, i32 0, i32 0))
59. br label %if.end4
60.
61.if.else: ;preds = %if.end
62. %call3 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([6 x i8]*
@.str2, i32 0, i32 0))
63. br label %if.end4
64.
65.if.end4: ;preds = %if.else, %if.then1
66. store i32 0, i32* %retval
67. br label %return
68.
69.return: ;preds = %if.end4, %if.then
70. %3 = load i32* %retval
71. ret i32 %3
72.}
73.
74.declare i32 @printf(i8*, ...) #1
75.
76.attributes #0 = { nounwind uwtable "less-precise-fpmad"="false"
"no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"
"no-infs-fp-math"="false" "no-nans-fp-math"="false"
"stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false"
}
77.attributes #1 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="true"
"no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false"
"no-nans-fp-math"="false" "stack-protector-buffer-size"="8"
"unsafe-fp-math"="false" "use-soft-float"="false" }
78.
79.!llvm.module.flags = !{!0}
80.!llvm.ident = !{!1}
81.
82.!0 = !{i32 1, !"PIC Level", i32 2}
83.!1 = !{!"clang version 3.6.2 (https://github.com/llvm-mirror/clang
c2e93b903ffee0e691757284c53e5f81615bdc55) (https://github.com/llvm-mirror/llvm
19ade095e8c3ea61f84b71074433309f0c7c7b3b)"}
49.if.end:; preds =% entry
50.% 1 = load i8 ***% argv.addr, align 8
51.% arrayidx = getelementptr inbounds i8 **% 1, i64 1
52.% 2 = load i8 **% arrayidx, align 8
53.% call = call i32 @check_auth (i8 *% 2)
54.% tobool = icmp ne i32% call, 0
55. br i1% tobool, label% if.then1, label% if.else
56.
57.if.then1:; preds =% if.end
58.% call2 = call i32 (i8 *, ...) * @printf (i8 * getelementptr inbounds ([8 x i8] *
@. str1, i32 0, i32 0))
59. br label% if.end4
60.
61.if.else:; preds =% if.end
62.% call3 = call i32 (i8 *, ...) * @printf (i8 * getelementptr inbounds ([6 x i8] *
@. str2, i32 0, i32 0))
63. br label% if.end4
64.
65.if.end4:; preds =% if.else,% if.then1
66. store i32 0, i32 *% retval
67. br label% return
68.
69.return:; preds =% if.end4,% if.then
70.% 3 = load i32 *% retval
71. ret i32% 3
72.}
73.
74.declare i32 @printf (i8 *, ...) # 1
75.
76.attributes # 0 = {nounwind uwtable "less-precise-fpmad" = "false"
"no-frame-pointer-elim" = "true""no-frame-pointer-elim-
"no-inf-fp-math" = "false""no-nans-fp-math"
"use-soft-float" = "false""unsafe-fp-math" = "
}
77.attributes # 1 = {"less-precise-fpmad" = "false""no-
"no-frame-pointer-elim-non-leaf""no-infs-fp-math"
"no-nans-fp-math" = "false""stack-protector-buffer-size"
"unsafe-fp-math" = "false""use-soft-float" = "false"
78.
79.! Llvm.module.flags =! {0}
80.! Llvm.ident =! {! 1}
81.
82.! 0 =! {I32 1,! "PIC Level", i32 2}
83.! 1 =! {"Clang version 3.6.2 (https://github.com/llvm-mirror/clang
c2e93b903ffee0e691757284c53e5f81615bdc55) (https://github.com/llvm-mirror/llvm
19ade095e8c3ea61f84b71074433309f0c7c7b3b) "}

도 3은 상기 표 1 및 2의 중간 표현 코드로부터 함수 호출 그래프를 분석한 예시를 나타낸 도면이다.FIG. 3 shows an example of analyzing a function call graph from the intermediate representation codes of Tables 1 and 2 above.

중간 표현 분석부(130)는 중간 표현 코드를 분석대상인 바이너리의 호출 관계 분석을 통해 정적/동적 분석에 활용하기 위한 함수 호출 관계를 분석하고, 불필요한 분석 대상 정보를 제거하여 취약점 분석대상 함수를 추출한다. 즉, 중간 표현 분석부(130)는 도 3과 같이 함수 호출 관계를 분석하여, 시스템 함수 등 불필요한 분석대상 정보(11)를 제거하고, 취약점 분석대상 함수(12)를 선별한다.The intermediate expression analyzing unit 130 analyzes the function call relation for utilizing the intermediate representation code for static / dynamic analysis through analysis of the call relation of the binary to be analyzed and extracts the function to be subjected to the vulnerability analysis by removing unnecessary analysis target information . That is, the intermediate expression analysis unit 130 analyzes the function call relationship as shown in FIG. 3, removes unnecessary analysis target information 11 such as a system function, and selects the vulnerability analysis target function 12. FIG.

도 4는 중간 표현 코드로부터 제어 흐름 그래프를 나타낸 도면이고, 도 5는 디스어셈블 도구(IDA Pro)를 활용한 제어 흐름 그래프를 나타낸 도면이다. 하기 표 3은 상기 도 4 및 도 5의 제어 흐름 그래프를 표현하기 위해 사용된 소스코드를 나타낸다. FIG. 4 is a graph showing a control flow graph from an intermediate representation code, and FIG. 5 is a graph showing a control flow graph using a disassemble tool (IDA Pro). Table 3 below shows the source codes used to express the control flow graphs of FIGS. 4 and 5.

1. int check_auth(char *password) {
2. int auth_flag=0;
3.
4. if(strcmp(password, "brilling") == 0)
5. auth_flag = 1;
6.
7. return auth_flag;
8. }
1. int check_auth (char * password) {
2. int auth_flag = 0;
3.
4. if (strcmp (password, "brilling") == 0)
5. auth_flag = 1;
6.
7. return auth_flag;
8. }

중간 표현 분석부(130)는 표 3의 소스코드로부터 변환된 중간 표현 코드에서 도 4에 도시된 바와 같은 제어 흐름 그래프를 추출할 수 있다. 즉, 중간 표현 분석부(130)는 중간 표현 코드로부터 취약점 분석대상 함수의 제어 흐름 그래프를 생성한다. 도 4에서는 'check_auth' 함수에 대한 제어 흐름 그래프를 생성한 경우에 대한 예를 나타낸다. 이와 같이, 중간 표현 분석부(130)는 취약점 분석대상 함수 내에서의 프로그램이 실행 중에 횡단할 수 있는 모든 경로에 대한 수행 흐름을 파악하여 제공할 수 있다.The intermediate expression analyzing unit 130 may extract the control flow graph as shown in FIG. 4 from the intermediate representation code converted from the source code of Table 3. [ That is, the intermediate expression analyzer 130 generates a control flow graph of the function to be subjected to the vulnerability analysis from the intermediate representation code. FIG. 4 shows an example of a case where the control flow graph for the 'check_auth' function is generated. As described above, the intermediate expression analysis unit 130 can grasp and provide the execution flow for all paths that the program in the vulnerability analysis target function can traverse during execution.

도 4 및 도 5에 도시된 바와 같이, 중간 표현 분석부(130)에 의해 생성된 제어 흐름 그래프(도 4 참조)는, 바이너리를 리버싱 도구인 IDA Pro를 사용하여 전문 인력이 분석한 제어 흐름 그래프(도 5 참조)와 비교할 때 동일한 흐름을 표현하고 있음을 알 수 있다. 이처럼 중간 표현 코드를 이용한 제어 흐름 그래프는 종래의 바이너리 리버싱을 통한 취약점 분석정보로 활용이 가능하다.4 and 5, the control flow graph (see FIG. 4) generated by the intermediate expression analysis unit 130 is a control flow graph obtained by analyzing a binary by a professional worker using the reversing tool IDA Pro It can be seen that the same flow is expressed when compared with the graph (see FIG. 5). The control flow graph using the intermediate representation code can be used as vulnerability analysis information through conventional binary reversing.

1. define i32 @check_auth(i8* %password) #0 {
2. entry:
3. %password.addr = alloca i8*, align 8
4. %auth_flag = alloca i32, align 4
5. store i8* %password, i8** %password.addr, align 8
6. store i32 0, i32* %auth_flag, align 4
7. %0 = load i8** %password.addr, align 8
8. %call = call i32 @strcmp(i8* %0, i8* getelementptr inbounds ([9 x i8]* @.str, i320, i32 0))
9. %cmp = icmp eq i32 %call, 0
10. br i1 %cmp, label %if.then, label %if.end
11.
12.if.then: ;preds = %entry
13. store i32 1, i32* %auth_flag, align 4
14. br label %if.end
15.
16.if.end: ;preds = %if.then, %entry
17. %1 = load i32* %auth_flag, align 4
18. ret i32 %1
19.}
1. define i32 @ check_auth (i8 *% password) # 0 {
2. entry:
3.% password.addr = alloca i8 *, align 8
4.% auth_flag = alloca i32, align 4
5. store i8 *% password, i8 **% password.addr, align 8
6. store i32 0, i32 *% auth_flag, align 4
7.% 0 = load i8 **% password.addr, align 8
I8 *% 0, i8 * getelementptr inbounds ([9 x i8] * @. Str, i320, i32 0)
9.% cmp = icmp eq i32% call, 0
10. br i1% cmp, label% if.then, label% if.end
11.
12.if.then:; preds =% entry
13. store i32 1, i32 *% auth_flag, align 4
14. br label% if.end
15.
16.if.end:; preds =% if.then,% entry
17.% 1 = load i32 *% auth_flag, align 4
18. ret i32% 1
19.}

표 4는 취약점 분석 대상이 되는 함수의 중간 표현 코드를 나타낸다. 중간 표현 분석부(130)는 표 4와 같은 중간 표현 코드에서 취약점 분석대상 함수를 선별한다. 구체적으로, 중간 표현 분석부(130)는 함수 호출 그래프와 제어 흐름 그래프를 바탕으로 불필요한 분석대상들을 제거하여 취약점 분석대상 함수들을 선별한다. 즉, 중간 표현 분석부(130)는 전체 중간 표현 코드 중 불필요한 분석대상들을 제거한 후, 나머지를 취약점 분석대상 함수로 선별한다.Table 4 shows the intermediate representation codes of the function subject to vulnerability analysis. The intermediate expression analyzing unit 130 selects a function to be subjected to the vulnerability analysis from the intermediate expression code as shown in Table 4. Specifically, the intermediate expression analyzer 130 removes unnecessary analysis objects based on the function call graph and the control flow graph, thereby selecting the functions to be subjected to the vulnerability analysis. That is, the intermediate expression analyzer 130 removes unnecessary analysis objects from all the intermediate representation codes, and then selects the remainder as a function to be analyzed.

표 4의 중간 표현 코드에 대해 설명하면 아래와 같다.The intermediate representation codes in Table 4 are described below.

먼저, 코드라인 3번 내지 6번은 함수 내에서 사용하는 변수 또는 중간표현 코드에서 사용하는 변수들의 타입(즉, i8, i32 등), 얼라인 정보(즉, align 8, align 4 등) 등에 대한 선언(즉, %password.addr, %auth_flag) 및 초기화 작업의 수행(store)을 나타낸다.First, the code lines 3 to 6 include declarations for the variables used in the function or the intermediate expression codes (i.e., i8, i32, etc.), the alignment information (i.e., align 8, align 4, (That is,% password.addr,% auth_flag) and the execution of the initialization operation (store).

또한, 코드라인 7번 내지 19번은 실제 문자열 비교 함수 호출과 그 결과에 따른 조건 분기를 나타낸다.In addition, the code lines 7 to 19 show the actual string comparison function call and the conditional branch according to the result.

구체적으로, 코드라인 7번은 패스워드(password)의 값을 '%0' 레지스터에 로드하는 것을 나타낸다. 여기서, load 명령은 해당 변수가 가리키는 주소의 값을 읽어오는 명령이다. 코드라인 8번은 문자열 비교 함수(strcmp)를 호출하는 것을 나타내며, 반환값을 '%call'에 입력하는 것을 나타낸다. 코드라인 9번은 '%call'와 상수 '0'의 값에 대한 비교 결과를 '%cmp'에 입력하는 것을 나타낸다. 여기서, icmp 명령은 비교 명령으로 조건이 'eq(즉, equal)'이다. 즉, '%call'와 상수 '0'의 값이 같을 경우 1, 아닌 경우 0을 '%cmp'에 입력된다. 코드라인 10번 내지 19번은 '%cmp'의 입력값에 따라 분기 명령을 수행한다. 여기서, br 명령은 분기 명령으로 위에서 입력받은 %cmp의 입력값에 따라 분기를 수행한다. 즉, %cmp의 입력값이 '1'인 경우 'label %if.then'으로 분기되고, 아닌 경우에 'label %if.end'로 분기된다.Specifically, code line 7 indicates loading the value of the password into the '0%' register. Here, the load command reads the value of the address indicated by the variable. Code line 8 indicates that the string comparison function (strcmp) is called, and the return value is entered in '% call'. Code line 9 indicates that the comparison results for '% call' and '0' are entered into '% cmp'. Here, the icmp instruction is a comparison instruction and the condition is 'eq (ie, equal)'. That is, 1 is entered if '% call' is equal to the constant '0', and 0 is entered into '% cmp'. Code lines 10 through 19 execute the branch instruction according to the input value of '% cmp'. Here, the br command is a branch instruction and branches according to the input value of% cmp inputted above. That is, if the input value of% cmp is '1', it branches to 'label% if.then', otherwise it branches to 'label% if.end'.

도 6은 중간 표현 코드의 정적 취약성 분석 예시를 나타낸 도면이다.6 is a diagram illustrating an example of static vulnerability analysis of the intermediate representation code.

정적 취약점 분석부(140)는 중간 표현 분석부(130)를 통해 선별된 대상 중간 표현 코드에 대하여 정적 취약점을 분석한다. 즉, 정적 취약점 분석부(140)는 중간 표현 분석부(130)를 통해 선별된 취약점 분석대상 함수에 대해, 정적 취약점 검출을 위한 CWE(Common Weakness Enumeration) 취약점 목록에서 동일한 유형의 보안 취약점이 있는지를 판단한다. The static vulnerability analysis unit 140 analyzes the static vulnerability of the selected intermediate representation code through the intermediate expression analysis unit 130. [ That is, the static vulnerability analysis unit 140 determines whether there is a security vulnerability of the same type in the CWE (Common Weakness Enumeration) vulnerability list for the static vulnerability detection for the selected vulnerability analysis target function through the intermediate expression analysis unit 130 .

코드라인 1번의 '@.str'(31)은 전역 상수 선언으로 인증에 관련된 문자열 'brilling\00'(32)을 나타낸다. 코드라인 13번에서는 '@strcmp'(33)를 호출하고 있다. strcmp 함수는 취약점을 가지는 함수이다. 또한, strcmp 함수는 전역 상수 '@.str'(35)와 '%0' 레지스터(36)를 인자로 받아 수행된다. 여기서, 두 인자에 대한 버퍼 오버플로우 취약점이 발생하는지에 대한 확인은 동적 취약점 분석부(150)에 의한 동적 취약점 분석을 통해 수행된다.The '@. Str' (31) line of code line 1 represents the string 'brilling \ 00' (32) related to authentication in the global constant declaration. Code line 13 calls '@ strcmp' (33). The strcmp function is a vulnerable function. The strcmp function is also executed by taking the global constant '@. Str' (35) and '% 0' register (36) as arguments. Here, the confirmation of whether a buffer overflow vulnerability occurs for the two factors is performed through dynamic vulnerability analysis by the dynamic vulnerability analysis unit 150. [

도 7은 동적 취약점 분석부의 상세 구성을 나타낸 도면이다.7 is a diagram showing a detailed configuration of a dynamic vulnerability analysis unit.

동적 취약점 분석부(150)는 취약점 함수 분석부(151), 기호 수행 테스트 생성부(152), 기호수행부(153), 기호 수행 결과 분석부(154)를 포함한다. 취약점 함수 분석부(151)는 기호 수행을 위한 테스트 케이스 생성을 위해 정적 취약점 분석부(140)로부터 정적 취약점 분석 결과를 입력받는다. 취약점 함수 분석부(151)는 정적 취약점 분석 결과로부터 취약점을 가지는 함수에 대한 분석을 수행한다. 기호 수행 테스트 생성부(152)는 대상 함수의 인자 정보, 분기 정보, 호출 관계 정보를 분석하여 기호 수행 테스트 케이스를 생성한다. 기호 수행부(153)는 생성된 기호 수행 테스트 케이스 정보를 이용하여 기호 수행(symbolic execution)을 실행한다. 기호 수행 결과 분석부(154)는 수행된 수행 결과를 분석하여 취약점을 가지는 정보에 대해 결과 분석을 수행하고 보고한다.The dynamic vulnerability analysis unit 150 includes a weak point function analysis unit 151, a symbol execution test generation unit 152, a symbol execution unit 153, and a symbol execution result analysis unit 154. The vulnerability function analysis unit 151 receives a static vulnerability analysis result from the static vulnerability analysis unit 140 to generate a test case for symbol execution. The vulnerability function analysis unit 151 analyzes the function having the vulnerability from the static vulnerability analysis result. The preference test generation unit 152 analyzes the argument information, the branch information, and the call relationship information of the object function to generate a preference test case. The symbol performing unit 153 executes symbolic execution using the generated symbol execution test case information. The symbol execution result analyzing unit 154 analyzes the executed execution result and analyzes and reports the information having the weakness.

도 8은 본 발명의 일실시예에 따른 바이너리 코드 기반 임베디드 소프트웨어 취약점 분석 방법에 대한 도면이다.8 is a diagram illustrating a method of analyzing a vulnerability of an embedded software based on a binary code according to an embodiment of the present invention.

취약점 분석 장치(100)는 분석 대상인 바이너리 코드로부터 임베디드 기기의 아키텍처 정보를 추출하여 중간 표현 형식으로의 변환 작업이 가능한지를 확인한다(S201,S202). 이때, 취약점 분석 장치(100)는 분석이 가능한 경우, 바이너리 유형 정보(즉, 문자열 정보, 심볼 정보 등)를 추가로 추출한다. 또한, 취약점 분석 장치(100)는 추출된 아키텍처 정보, 문자열 정보, 심볼 정보를 저장한다. S201 단계 및 S202 단계는 취약점 분석 장치(100)의 바이너리 분석부(110)에 의해 수행된다.The vulnerability analysis apparatus 100 extracts the architecture information of the embedded device from the binary code to be analyzed and confirms whether conversion into the intermediate expression format is possible (S201, S202). At this time, the vulnerability analysis apparatus 100 further extracts binary type information (i.e., string information, symbol information, etc.) when analysis is possible. In addition, the vulnerability analysis apparatus 100 stores extracted architecture information, character string information, and symbol information. Steps S201 and S202 are performed by the binary analysis unit 110 of the vulnerability analysis apparatus 100. [

이후, 취약점 분석 장치(100)는 입력 바이너리 코드에 대해 디스어셈블을 수행하여 중간 표현으로 변환한다(S203). 이때, 취약점 분석 장치(100)는 입력 바이너리 코드에 대해 디스어셈블을 수행하여 디스어셈블 코드 정보를 생성한 후, 디스어셈블 코드에 변환 가능한 중간 표현을 검색한다. 그런 다음, 취약점 분석 장치(100)는 디스어셈블 코드에 대응되는 중간 표현 코드로 변환한다. S203 단계는 취약점 분석 장치(100)의 중간표현 변환부(120)에 의해 수행된다.Thereafter, the vulnerability analysis apparatus 100 disassembles the input binary code and converts it into an intermediate representation (S203). At this time, the vulnerability analysis apparatus 100 disassembles the input binary code to generate disassembly code information, and then searches the disassembly code for a convertible intermediate expression. Then, the vulnerability analysis apparatus 100 converts the intermediate representation code corresponding to the disassembly code. Step S203 is performed by the intermediate expression conversion unit 120 of the vulnerability analysis apparatus 100. [

그런 다음, 취약점 분석 장치(100)는 중간 표현 코드를 파싱하여 추상 구문 트리(AST)를 생성한다(S204). 이후, 취약점 분석 장치(100)는 추상 구문 트리를 순회하여 함수 호출 그래프 및 제어 흐름 그래프를 추출하여 분석한 후(S205), 취약점 분석대상 함수목록을 선별한다(S206). S204 단계 내지 S206 단계는 취약점 분석 장치(100)의 중간표현 분석부(130)에 의해 수행된다.Then, the vulnerability analysis apparatus 100 generates an abstract syntax tree (AST) by parsing the intermediate representation code (S204). Then, the vulnerability analysis apparatus 100 traverses the abstract syntax tree to extract and analyze a function call graph and a control flow graph (S205), and then selects a vulnerability analysis target function list (S206). The steps S204 to S206 are performed by the intermediate expression analyzing unit 130 of the vulnerability analysis apparatus 100.

이후, 취약점 분석 장치(100)는 취약점 분석대상 함수의 함수 호출 관계와 제어 흐름 관계를 분석하여 CWE 취약점 목록에 해당되는 취약점이 있는지를 확인한다(S207,S208). 이때, 취약점 분석 장치(100)는 정적 취약점 검출 목록을 생성한다(S209). S207 단계 내지 S209 단계는 취약점 분석 장치(100)의 정적 취약점 분석부(140)에 의해 수행된다.Then, the vulnerability analysis apparatus 100 analyzes the function call relationship and the control flow relationship of the vulnerability analysis target function to check whether there is a vulnerability corresponding to the CWE vulnerability list (S207, S208). At this time, the vulnerability analysis apparatus 100 generates a static vulnerability detection list (S209). The steps S207 through S209 are performed by the static vulnerability analysis unit 140 of the vulnerability analysis apparatus 100. FIG.

그런 다음, 취약점 분석 장치(100)는 정적 취약점 검출 목록 중 취약점을 갖는 함수를 선별한다(S210). 그리고 취약점 분석 장치(100)는 취약점을 갖는 함수를 분석하여 테스트 케이스를 생성한다(S211). 이때, 취약점 분석 장치(100)는 취약점을 갖는 함수의 인자정보, 분기정보, 호출관계를 분석한다. 또한, 취약점 분석 장치(100)는 테스트 케이스에 대한 기호 수행을 실행하여 취약점을 갖는 정보에 대해 결과 분석을 보고한다(S212). 이후, 취약점 분석 장치(100)는 정적/동적 취약점 분석 결과를 종합하여 발생 가능한 취약점을 검출한다(S213).Then, the vulnerability analysis apparatus 100 selects a function having a vulnerability among the static vulnerability detection lists (S210). Then, the vulnerability analysis apparatus 100 analyzes the function having the vulnerability and generates a test case (S211). At this time, the vulnerability analysis apparatus 100 analyzes the argument information, the branch information, and the call relation of the function having the vulnerability. In addition, the vulnerability analysis apparatus 100 performs a preference operation on the test case to report a result analysis on information having a vulnerability (S212). Then, the vulnerability analysis apparatus 100 synthesizes the static / dynamic vulnerability analysis results and detects possible vulnerabilities (S213).

S210 단계 내지 S213 단계는 취약점 분석 장치(100)의 동적 취약점 분석부(150)에 의해 수행된다.The steps S210 to S213 are performed by the dynamic vulnerability analysis unit 150 of the vulnerability analysis apparatus 100.

이상에서 설명된 본 발명의 실시예는 예시적인 것에 불과하며, 본 발명이 속한 기술분야의 통상의 지식을 가진 자라면 이로부터 다양한 변형 및 균등한 타 실시예가 가능하다는 점을 잘 알 수 있을 것이다. 그럼으로 본 발명은 상기의 상세한 설명에서 언급되는 형태로만 한정되는 것은 아님을 잘 이해할 수 있을 것이다. 따라서 본 발명의 진정한 기술적 보호 범위는 첨부된 특허청구범위의 기술적 사상에 의해 정해져야 할 것이다. 또한, 본 발명은 첨부된 청구범위에 의해 정의되는 본 발명의 정신과 그 범위 내에 있는 모든 변형물과 균등물 및 대체물을 포함하는 것으로 이해되어야 한다.It will be apparent to those skilled in the art that various modifications and variations may be made in the present invention. Accordingly, it is to be understood that the present invention is not limited to the above-described embodiments. Accordingly, the true scope of the present invention should be determined by the technical idea of the appended claims. It is also to be understood that the invention includes all modifications, equivalents, and alternatives falling within the spirit and scope of the invention as defined by the appended claims.

110 : 바이너리 분석부 120 : 중간 표현 변환부
130 : 중간 표현 분석부 140 : 정적 취약점 분석부
150 : 동적 취약점 분석부 151 : 취약점 함수 분석부
152 : 기호 수행 테스트 생성부 153 : 기호 수행부
154 : 기호 수행 결과 분석부
110: Binary analysis unit 120: Intermediate expression conversion unit
130: intermediate expression analysis unit 140: static vulnerability analysis unit
150: dynamic vulnerability analysis unit 151: vulnerability function analysis unit
152: Symbol performance test generation unit 153: Symbol performance unit
154: Symbol execution result analysis section

Claims (17)

바이너리 코드로부터 아키텍처 정보를 추출하여 중간 표현 형식으로 변환 가능한지를 확인하기 위한 바이너리 분석부;
상기 확인 결과에 따라, 상기 바이너리 코드를 중간 표현 코드로 변환하기 위한 중간 표현 변환부;
상기 중간 표현 코드로부터 함수 호출 그래프와 제어 흐름 그래프를 추출하여 취약점 분석대상 함수를 선별하기 위한 중간 표현 분석부;
상기 취약점 분석대상 함수에 대해, CWE(Common Weakness Enumeration) 취약점 목록에 해당되는 보안 취약점이 있는지를 판단하여 정적 취약점 검출 목록을 생성하기 위한 정적 취약점 분석부; 및
상기 정적 취약점 검출 목록으로부터 선별된 취약점을 갖는 함수에 대해 테스트 케이스를 생성하여 기호 수행을 실행하기 위한 동적 취약점 분석부;
를 포함하는 바이너리 코드 기반 임베디드 소프트웨어 취약점 분석 장치.
A binary analysis unit for extracting the architecture information from the binary code and checking whether the architecture information can be converted into the intermediate representation format;
An intermediate representation conversion unit for converting the binary code into an intermediate representation code according to the check result;
An intermediate expression analyzer for extracting a function call graph and a control flow graph from the intermediate representation code to select a function to be subjected to the vulnerability analysis;
A static vulnerability analyzer for generating a static vulnerability detection list by determining whether there is a security vulnerability corresponding to the Common Weakness Enumeration (CWE) vulnerability list for the vulnerability analysis target function; And
A dynamic vulnerability analysis unit for generating a test case for a function having a vulnerability selected from the static vulnerability detection list and executing a preference operation;
Based embedded software vulnerability analysis apparatus.
제 1 항에 있어서,
상기 바이너리 분석부는,
상기 바이너리 코드로부터 바이너리 유형 정보인 문자열 정보와 심볼 정보를 추출하여 저장하는 것을 특징으로 하는 바이너리 코드 기반 임베디드 소프트웨어 취약점 분석 장치.
The method according to claim 1,
Wherein the binary analyzer comprises:
And extracting and storing the string information and the symbol information as the binary type information from the binary code.
제 1 항에 있어서,
상기 중간 표현 변환부는,
상기 바이너리 코드에 대해 디스어셈블 과정을 거쳐 디스어셈블 코드를 생성한 후, 상기 디스어셈블 코드에 대응되는 상기 중간 표현 코드으로 변환하는 것을 특징으로 하는 바이너리 코드 기반 임베디드 소프트웨어 취약점 분석 장치.
The method according to claim 1,
Wherein the intermediate expression conversion unit comprises:
Wherein the disassembly process is performed on the binary code to generate a disassembly code, and the disassembly code is converted into the intermediate representation code corresponding to the disassembly code.
제 1 항에 있어서,
상기 중간 표현 분석부는,
상기 중간 표현 코드를 파싱하여 추상 구문 트리를 생성한 후, 상기 추상 구문 트리를 순회하여 함수 호출 그래프와 제어 흐름 그래프를 생성하는 것을 특징으로 하는 바이너리 코드 기반 임베디드 소프트웨어 취약점 분석 장치.
The method according to claim 1,
The intermediate expression analyzing unit,
Generating an abstract syntax tree by parsing the intermediate representation code, and then traversing the abstract syntax tree to generate a function call graph and a control flow graph.
제 1 항에 있어서,
상기 중간 표현 분석부는,
함수 호출 그래프와 제어 흐름 그래프의 분석을 통해 보안 취약점 분석이 불필요한 함수목록을 제외하여 상기 취약점 분석대상 함수를 선별하는 것을 특징으로 하는 바이너리 코드 기반 임베디드 소프트웨어 취약점 분석 장치.
The method according to claim 1,
The intermediate expression analyzing unit,
Wherein the vulnerability analysis target function is selected by excluding a function list that does not require a security vulnerability analysis through analysis of a function call graph and a control flow graph.
제 1 항에 있어서,
상기 정적 취약점 분석부는,
상기 취약점 분석대상 함수를 분석하여 이전에 알려진 형태의 취약점 정보와 동일한 유형의 중간 표현 코드를 확인하는 것을 특징으로 하는 바이너리 코드 기반 임베디드 소프트웨어 취약점 분석 장치.
The method according to claim 1,
The static vulnerability analysis unit,
And analyzing the vulnerability analysis target function to identify an intermediate representation code of the same type as the vulnerability information of a previously known type.
제 1 항에 있어서,
상기 정적 취약점 검출 목록은, 취약점 위치와 취약점 정보가 기록된 것을 특징으로 하는 바이너리 코드 기반 임베디드 소프트웨어 취약점 분석 장치.
The method according to claim 1,
Wherein the static vulnerability detection list includes a vulnerability location and vulnerability information recorded in the static vulnerability detection list.
제 1 항에 있어서,
상기 동적 취약점 분석부는,
상기 정적 취약점 검출 목록으로부터 선별된 취약점을 가지는 함수의 인자정보, 분기정보, 호출 관계 정보를 분석하는 것을 특징으로 하는 바이너리 코드 기반 임베디드 소프트웨어 취약점 분석 장치.
The method according to claim 1,
Wherein the dynamic vulnerability analysis unit comprises:
And analyzing factor information, branch information, and call relationship information of a function having a selected vulnerability from the static vulnerability detection list.
바이너리 코드로부터 아키텍처 정보를 추출하여 중간 표현 형식으로 변환 가능한지를 확인하는 단계;
상기 확인 결과에 따라, 상기 바이너리 코드를 중간 표현 코드로 변환하는 단계;
상기 중간 표현 코드로부터 함수 호출 그래프와 제어 흐름 그래프를 추출하여 취약점 분석대상 함수를 선별하는 단계;
상기 취약점 분석대상 함수에 대해, CWE(Common Weakness Enumeration) 취약점 목록에 해당되는 보안 취약점이 있는지를 판단하여 정적 취약점 검출 목록을 생성하는 단계; 및
상기 정적 취약점 검출 목록으로부터 선별된 취약점을 갖는 함수에 대해 테스트 케이스를 생성하여 기호 수행을 실행하는 단계;
를 포함하는 바이너리 코드 기반 임베디드 소프트웨어 취약점 분석 방법.
Extracting the architecture information from the binary code and confirming whether the architecture information can be converted into the intermediate representation format;
Converting the binary code into an intermediate representation code according to the result of the checking;
Extracting a function call graph and a control flow graph from the intermediate representation code to select a function to be subjected to the vulnerability analysis;
Generating a static vulnerability detection list for the vulnerability analysis target function by determining whether there is a security vulnerability corresponding to the Common Weakness Enumeration (CWE) vulnerability list; And
Generating a test case for a function having a vulnerability selected from the static vulnerability detection list and executing a preference operation;
A method for analyzing an embedded software vulnerability based on binary code.
제 9 항에 있어서,
상기 정적 취약점 검출 목록의 분석결과와 상기 기호 수행이 실행된 결과를 종합하여 발생 가능한 취약점을 검출하는 단계;
를 더 포함하는 바이너리 코드 기반 임베디드 소프트웨어 취약점 분석 방법.
10. The method of claim 9,
Detecting a possible vulnerability by synthesizing an analysis result of the static vulnerability detection list and a result of executing the preference execution;
A method for analyzing an embedded software vulnerability based on binary code.
제 10 항에 있어서,
상기 검출 단계 이후에,
상기 검출 결과에 따라 보안 위협에 대응하는 보안 취약점 관리 프로세스를 운영하는 단계;
를 더 포함하는 바이너리 코드 기반 임베디드 소프트웨어 취약점 분석 방법.
11. The method of claim 10,
After the detecting step,
Operating a security vulnerability management process corresponding to a security threat according to the detection result;
A method for analyzing an embedded software vulnerability based on binary code.
제 9 항에 있어서,
상기 확인 단계는,
상기 바이너리 코드로부터 바이너리 유형 정보인 문자열 정보와 심볼 정보를 추출하여 저장하는 것을 특징으로 하는 바이너리 코드 기반 임베디드 소프트웨어 취약점 분석 방법.
10. The method of claim 9,
Wherein,
And extracting and storing the string information and the symbol information as the binary type information from the binary code.
제 9 항에 있어서,
상기 변환 단계는,
상기 바이너리 코드에 대해 디스어셈블 과정을 거쳐 디스어셈블 코드를 생성한 후, 상기 디스어셈블 코드에 대응되는 상기 중간 표현 코드으로 변환하는 것을 특징으로 하는 바이너리 코드 기반 임베디드 소프트웨어 취약점 분석 방법.
10. The method of claim 9,
Wherein,
Generating a disassembly code through a disassembly process on the binary code, and converting the disassembled code into the intermediate representation code corresponding to the disassembly code.
제 9 항에 있어서,
상기 선별 단계는,
상기 중간 표현 코드를 파싱하여 추상 구문 트리를 생성한 후, 상기 추상 구문 트리를 순회하여 함수 호출 그래프와 제어 흐름 그래프를 생성하는 것을 특징으로 하는 바이너리 코드 기반 임베디드 소프트웨어 취약점 분석 방법.
10. The method of claim 9,
In the selecting step,
Generating an abstract syntax tree by parsing the intermediate representation code and then traversing the abstract syntax tree to generate a function call graph and a control flow graph.
제 9 항에 있어서,
상기 선별 단계는,
함수 호출 그래프와 제어 흐름 그래프의 분석을 통해 보안 취약점 분석이 불필요한 함수목록을 제외하여 상기 취약점 분석대상 함수를 선별하는 것을 특징으로 하는 바이너리 코드 기반 임베디드 소프트웨어 취약점 분석 방법.
10. The method of claim 9,
In the selecting step,
Wherein the vulnerability analysis target function is selected by excluding a function list that does not require a security vulnerability analysis through analysis of a function call graph and a control flow graph.
제 9 항에 있어서,
상기 생성 단계는,
상기 취약점 분석대상 함수를 분석하여 이전에 알려진 형태의 취약점 정보와 동일한 유형의 중간 표현 코드를 확인하는 것을 특징으로 하는 바이너리 코드 기반 임베디드 소프트웨어 취약점 분석 방법.
10. The method of claim 9,
Wherein the generating comprises:
And analyzing the vulnerability analysis target function to identify an intermediate representation code of the same type as the vulnerability information of a previously known type.
제 9 항에 있어서,
상기 실행 단계는,
상기 정적 취약점 검출 목록으로부터 선별된 취약점을 가지는 함수의 인자정보, 분기정보, 호출 관계 정보를 분석하는 것을 특징으로 하는 바이너리 코드 기반 임베디드 소프트웨어 취약점 분석 방법.
10. The method of claim 9,
Wherein,
And analyzing the argument information, the branch information, and the call relationship information of the function having the selected vulnerability from the static vulnerability detection list.
KR1020160160035A 2016-11-29 2016-11-29 Apparatus and method for analyzing embeded software vulnerability based on binary code KR101906004B1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
KR1020160160035A KR101906004B1 (en) 2016-11-29 2016-11-29 Apparatus and method for analyzing embeded software vulnerability based on binary code
PCT/KR2017/008354 WO2018101575A1 (en) 2016-11-29 2017-08-02 Binary code-based embedded software vulnerability analysis device and method therefor

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
KR1020160160035A KR101906004B1 (en) 2016-11-29 2016-11-29 Apparatus and method for analyzing embeded software vulnerability based on binary code

Publications (2)

Publication Number Publication Date
KR20180060497A true KR20180060497A (en) 2018-06-07
KR101906004B1 KR101906004B1 (en) 2018-10-10

Family

ID=62242896

Family Applications (1)

Application Number Title Priority Date Filing Date
KR1020160160035A KR101906004B1 (en) 2016-11-29 2016-11-29 Apparatus and method for analyzing embeded software vulnerability based on binary code

Country Status (2)

Country Link
KR (1) KR101906004B1 (en)
WO (1) WO2018101575A1 (en)

Cited By (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109525556A (en) * 2018-10-18 2019-03-26 中国电力科学研究院有限公司 It is a kind of for determining the light weight method and system of protocol bug in embedded system firmware
KR101963752B1 (en) * 2018-11-02 2019-03-29 세종대학교산학협력단 Apparatus and method for analyzing software vulnerability
KR101963756B1 (en) * 2018-11-19 2019-03-29 세종대학교산학협력단 Apparatus and method for learning software vulnerability prediction model, apparatus and method for analyzing software vulnerability
KR101972825B1 (en) * 2019-01-18 2019-04-30 한국과학기술원 Method and apparatus for automatically analyzing vulnerable point of embedded appliance by using hybrid analysis technology, and computer program for executing the method
KR102130945B1 (en) * 2019-11-05 2020-07-07 한국인터넷진흥원 Method and device for identifying variable types from a binary
CN112784290A (en) * 2021-01-28 2021-05-11 湖北宸威玺链信息技术有限公司 Data export tool security analysis method and system and data export method
CN112800423A (en) * 2021-01-26 2021-05-14 北京航空航天大学 Binary code authorization vulnerability detection method
KR102265937B1 (en) * 2020-12-21 2021-06-17 주식회사 모비젠 Method for analyzing sequence data and apparatus thereof
KR102314829B1 (en) * 2021-01-29 2021-10-18 숭실대학교산학협력단 Method for evaluating risk of data leakage in application, recording medium and device for performing the method
WO2022097798A1 (en) * 2020-11-09 2022-05-12 동국대학교 산학협력단 Intermediate language-based code conversion method and electronic device comprising same
WO2022231748A1 (en) * 2020-05-06 2022-11-03 Deepbits Technology Inc. High throughput disassembly system for executable code and applications
US11928220B2 (en) 2021-01-29 2024-03-12 Foundation Of Soongsil University-Industry Cooperation Method for evaluating risk of data leakage in application, recording medium and device for performing the method

Families Citing this family (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110096764B (en) * 2019-04-12 2020-10-20 浙江大学 Method for identifying and optimizing fragile line of electric-gas coupling system
CN110909358A (en) * 2019-10-22 2020-03-24 上海安智信息科技有限公司 Shaping vulnerability detection method based on dynamic and static analysis
CN111310178B (en) * 2020-01-20 2024-01-23 武汉理工大学 Firmware vulnerability detection method and system in cross-platform scene
CN111752586B (en) * 2020-06-23 2024-04-02 上海交通大学 Cross-architecture embedded device firmware unrepaired vulnerability detection method and system
CN114417343A (en) * 2020-10-28 2022-04-29 上海交通大学 Operating system kernel information leakage vulnerability detection method under binary file
WO2022097799A1 (en) * 2020-11-09 2022-05-12 동국대학교 산학협력단 Security vulnerability analysis method for generating function abstract information and electronic device including same
CN112632563B (en) * 2020-12-29 2023-11-21 北京梆梆安全科技有限公司 Vulnerability detection method and device, storage medium and electronic equipment
CN114666134B (en) * 2022-03-23 2023-06-16 南昌大学 Intelligent network vulnerability discovery and mining method
KR102598691B1 (en) * 2022-12-15 2023-11-06 이화여자대학교 산학협력단 Detection method for variable vulnerability in software using machine learning
CN116049835B (en) * 2023-03-08 2023-06-23 中汽智联技术有限公司 Method, device and storage medium for detecting security hole of automobile firmware

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7849509B2 (en) * 2005-10-07 2010-12-07 Microsoft Corporation Detection of security vulnerabilities in computer programs
CN101551773B (en) * 2009-03-12 2012-04-25 南京大学 Binary vulnerability detection location device for symbol error and assignment truncation
US9507945B2 (en) * 2013-04-01 2016-11-29 The Johns Hopkins University Method and apparatus for automated vulnerability detection
US9454659B1 (en) * 2014-08-15 2016-09-27 Securisea, Inc. Software vulnerabilities detection system and methods
KR101640479B1 (en) * 2015-08-28 2016-07-18 (주)엔키소프트 Software vulnerability attack behavior analysis system based on the source code

Cited By (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109525556A (en) * 2018-10-18 2019-03-26 中国电力科学研究院有限公司 It is a kind of for determining the light weight method and system of protocol bug in embedded system firmware
CN109525556B (en) * 2018-10-18 2022-01-11 中国电力科学研究院有限公司 Lightweight method and system for determining protocol bugs in embedded system firmware
KR101963752B1 (en) * 2018-11-02 2019-03-29 세종대학교산학협력단 Apparatus and method for analyzing software vulnerability
KR101963756B1 (en) * 2018-11-19 2019-03-29 세종대학교산학협력단 Apparatus and method for learning software vulnerability prediction model, apparatus and method for analyzing software vulnerability
KR101972825B1 (en) * 2019-01-18 2019-04-30 한국과학기술원 Method and apparatus for automatically analyzing vulnerable point of embedded appliance by using hybrid analysis technology, and computer program for executing the method
KR102130945B1 (en) * 2019-11-05 2020-07-07 한국인터넷진흥원 Method and device for identifying variable types from a binary
US11262994B2 (en) 2019-11-05 2022-03-01 Korea Internet & Security Agency Method and device for identifying type of variable in binary
WO2022231748A1 (en) * 2020-05-06 2022-11-03 Deepbits Technology Inc. High throughput disassembly system for executable code and applications
WO2022097798A1 (en) * 2020-11-09 2022-05-12 동국대학교 산학협력단 Intermediate language-based code conversion method and electronic device comprising same
KR102265937B1 (en) * 2020-12-21 2021-06-17 주식회사 모비젠 Method for analyzing sequence data and apparatus thereof
CN112800423A (en) * 2021-01-26 2021-05-14 北京航空航天大学 Binary code authorization vulnerability detection method
CN112800423B (en) * 2021-01-26 2022-10-11 北京航空航天大学 Binary code authorization vulnerability detection method
CN112784290A (en) * 2021-01-28 2021-05-11 湖北宸威玺链信息技术有限公司 Data export tool security analysis method and system and data export method
KR102314829B1 (en) * 2021-01-29 2021-10-18 숭실대학교산학협력단 Method for evaluating risk of data leakage in application, recording medium and device for performing the method
WO2022163908A1 (en) * 2021-01-29 2022-08-04 숭실대학교 산학협력단 Method for assessing data leakage risk within application, and recording medium and device for performing same
US11928220B2 (en) 2021-01-29 2024-03-12 Foundation Of Soongsil University-Industry Cooperation Method for evaluating risk of data leakage in application, recording medium and device for performing the method

Also Published As

Publication number Publication date
KR101906004B1 (en) 2018-10-10
WO2018101575A1 (en) 2018-06-07

Similar Documents

Publication Publication Date Title
KR101906004B1 (en) Apparatus and method for analyzing embeded software vulnerability based on binary code
US10581879B1 (en) Enhanced malware detection for generated objects
US9081961B2 (en) System and method for analyzing malicious code using a static analyzer
ES2640191T3 (en) Systems and methods for automated computer support
CN111859375B (en) Vulnerability detection method and device, electronic equipment and storage medium
Agosta et al. Automated security analysis of dynamic web applications through symbolic code execution
EP2881877A1 (en) Program execution device and program analysis device
CN111783096B (en) Method and device for detecting security hole
EP3232359B1 (en) Identification device, identification method, and identification program
CN104077531A (en) Open vulnerability assessment language based system vulnerability assessment method, device and system
KR101640479B1 (en) Software vulnerability attack behavior analysis system based on the source code
KR102120200B1 (en) Malware Crawling Method and System
CN114386032A (en) Firmware detection system and method for power Internet of things equipment
CN108959936B (en) Automatic utilization method of buffer overflow vulnerability based on path analysis
CN103400077A (en) Penetration testing method based on BackTrack
CN115208634A (en) Supervision engine of network assets
CN116383833A (en) Method and device for testing software program code, electronic equipment and storage medium
CN115168847A (en) Application patch generation method and device, computer equipment and readable storage medium
Takata et al. Minespider: Extracting urls from environment-dependent drive-by download attacks
Shi et al. Backporting security patches of web applications: A prototype design and implementation on injection vulnerability patches
Ablahd Using python to detect web application vulnerability
CN111291377A (en) Application vulnerability detection method and system
Inamdar et al. A survey on web application security
Sayed et al. If-transpiler: Inlining of hybrid flow-sensitive security monitor for JavaScript
US11283836B2 (en) Automatic decoy derivation through patch transformation

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
GRNT Written decision to grant