KR102070010B1 - Binary fatching apparatus and method thereof for supplementing vulnerabilties casued from using vulnerable functions - Google Patents

Binary fatching apparatus and method thereof for supplementing vulnerabilties casued from using vulnerable functions Download PDF

Info

Publication number
KR102070010B1
KR102070010B1 KR1020190023742A KR20190023742A KR102070010B1 KR 102070010 B1 KR102070010 B1 KR 102070010B1 KR 1020190023742 A KR1020190023742 A KR 1020190023742A KR 20190023742 A KR20190023742 A KR 20190023742A KR 102070010 B1 KR102070010 B1 KR 102070010B1
Authority
KR
South Korea
Prior art keywords
binary
function
library
code
patch
Prior art date
Application number
KR1020190023742A
Other languages
Korean (ko)
Other versions
KR20190068495A (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 KR1020190023742A priority Critical patent/KR102070010B1/en
Publication of KR20190068495A publication Critical patent/KR20190068495A/en
Application granted granted Critical
Publication of KR102070010B1 publication Critical patent/KR102070010B1/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/52Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems during program execution, e.g. stack integrity ; Preventing unwanted data erasure; Buffer overflow
    • G06F21/54Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems during program execution, e.g. stack integrity ; Preventing unwanted data erasure; Buffer overflow by adding security routines or objects to programs

Abstract

운영 체제 등의 플랫폼에 의하여 기본적으로 제공 되는 기본 라이브러리의 몇몇 함수들에 존재하는 취약점을 보완하기 위한 방법 및 그 방법이 적용되기 위한 몇몇 장치들이 제공된다. 일 실시예에 따른 바이너리 취약점 보완 방법은 바이너리의 런타임(runtime) 시점에, 상기 바이너리의 GOT(Global Offset Table)에 안전 함수 테이블이 패치(patch)되는 단계와, 상기 바이너리의 인스트럭션에 의하여 기본 라이브러리의 목적 함수가 호출되면, 상기 안전 함수 테이블에 기재된 상기 목적 함수의 주소에 로드 된 중간 함수로 점프하는 단계와, 상기 중간 함수에 의하여 상기 기본 라이브러리의 함수가 호출되는 단계를 포함한다.Provided are methods for compensating for vulnerabilities in some functions of the basic library provided by the platform such as an operating system, and some devices for applying the methods. According to an embodiment of the present invention, a method for compensating a binary vulnerability includes patching a safety function table to a global offset table (GOT) of a binary at a runtime point of time, and instructing a basic library to be installed by an instruction of the binary. When an objective function is called, jumping to an intermediate function loaded at the address of the objective function described in the safety function table, and calling the function of the basic library by the intermediate function.

Description

취약 함수 사용에 의한 취약점을 보완하기 위한 바이너리 패치 장치 및 그 방법{BINARY FATCHING APPARATUS AND METHOD THEREOF FOR SUPPLEMENTING VULNERABILTIES CASUED FROM USING VULNERABLE FUNCTIONS}BINARY FATCHING APPARATUS AND METHOD THEREOF FOR SUPPLEMENTING VULNERABILTIES CASUED FROM USING VULNERABLE FUNCTIONS}

본 발명은 컴퓨팅 장치에 의하여 실행될 수 있는 파일인 바이너리에 대한 보안 패치 기술과 관련된 것이다. 보다 자세하게는 취약점이 알려져 있는 취약 함수가 사용된 바이너리에 대하여 상기 취약 함수의 취약점을 보완하되, 운영 체제 등 플랫폼 차원의 재배포, 업데이트 등이 없이도 취약점을 보완할 수 있는 기술과 관련된 것이다.The present invention relates to security patching techniques for binaries, which are files executable by a computing device. More specifically, it is related to a technology that can supplement the vulnerability of the vulnerable function with respect to a binary in which a vulnerable function known as a vulnerability is used, but without the redistribution and update of platform level such as an operating system.

소프트웨어는 컴파일이 완료된 후의 결과물인 실행 바이너리(이하, '바이너리'라 함)의 형태로 배포된다. 상기 바이너리가 스토리지 장치에서 메모리에 로드 되고, 상기 메모리에서 상기 바이너리의 일부 인스트럭션(instruction)이 프로세서에 페치(fetch) 됨으로써, 상기 소프트웨어가 실행된다.Software is distributed in the form of executable binaries (hereinafter referred to as binaries) that result after compilation is complete. The binary is loaded into a memory in a storage device, and some instructions of the binary in the memory are fetched to a processor to execute the software.

한편, 상기 바이너리에 존재하는 취약점(vulnerability)을 보완하기 위한 다양한 기술이 제공된다.On the other hand, various techniques are provided to compensate for the vulnerability (vulnerability) present in the binary.

한편, 프로그래밍을 잘못하여 발생된 바이너리 자체의 취약점도 존재하지만, 상기 바이너리가 사용하는 외부의 공유 라이브러리에 포함된 함수 자체에 내재된 취약점도 존재한다. 상기 공유 라이브러리가 널리 사용되는 것이 아니라면 상기 공유 라이브러리의 소스 코드에 대한 보완을 통하여 공유 라이브러리를 다시 빌드(build)하여 배포하는 것으로 문제가 해결 될 것이다. 또한, 상기 공유 라이브러리를 개발하여 배포한 회사 또는 개인도 소스 코드 보완 및 리빌드(rebuild)를 통하여 상기 문제를 해결할 수 있을 것이다.On the other hand, there are also vulnerabilities of the binaries themselves caused by incorrect programming, but there are also vulnerabilities inherent in functions themselves included in external shared libraries used by the binaries. If the shared library is not widely used, the problem may be solved by rebuilding and distributing the shared library through supplementation to the source code of the shared library. In addition, the company or individual who developed and distributed the shared library may solve the problem through source code supplement and rebuild.

그러나, 리눅스의 기본 공유 라이브러리(libc.so)에 포함되어 있는 함수에 취약점이 존재하는 경우라면, 리눅스의 정식 배포판의 업데이트 및 업데이트 된 리눅스의 광범위한 배포 모두 복잡한 문제를 수반한다.However, if there are vulnerabilities in the functions included in Linux's default shared library (libc.so), both the updating of the full distribution of Linux and the widespread distribution of updated Linux come with complex problems.

따라서, 바이너리 자체에 대한 보완 패치(patch) 적용을 통하여 기본 라이브러리에 포함된 함수의 취약점을 보완하기 위한 기술의 제공이 요청 된다.Therefore, it is required to provide a technique for compensating for the vulnerability of the functions included in the basic library by applying a supplementary patch to the binary itself.

한국공개특허 제2005-0009198호Korean Patent Publication No. 2005-0009198

본 발명이 해결하고자 하는 기술적 과제는, 바이너리 패치(patch)를 통해 기본 라이브러리에 포함된 범용 함수에 내재된 취약점을 보완하는 장치 및 그 방법을 제공하는 것이다.The technical problem to be solved by the present invention is to provide a device and a method for compensating the vulnerabilities inherent in general-purpose functions included in the basic library through a binary patch (patch).

본 발명이 해결하고자 하는 다른 기술적 과제는, 개발자에 의하여 업로드 된 소스 바이너리에 대하여 범용 함수의 취약점을 보완하기 위한 바이너리 패치를 수행하여 안전 바이너리를 생성한 후, 상기 안전 바이너리를 어플리케이션 다운로드 서비스 서버에 제공함으로써, 안전한 바이너리가 배포되도록 하는 자동화된 시스템을 제공하는 것이다.Another technical problem to be solved by the present invention is to generate a safety binary by performing a binary patch to supplement the vulnerability of the general-purpose function for the source binary uploaded by the developer, and then provide the safety binary to the application download service server This provides an automated system that allows secure binaries to be distributed.

본 발명의 기술적 과제들은 이상에서 언급한 기술적 과제로 제한되지 않으며, 언급되지 않은 또 다른 기술적 과제들은 아래의 기재로부터 본 발명의 기술분야에서의 통상의 기술자에게 명확하게 이해 될 수 있을 것이다.The technical problems of the present invention are not limited to the technical problems mentioned above, and other technical problems that are not mentioned will be clearly understood by those skilled in the art from the following description.

상기 기술적 과제를 해결하기 위한, 본 발명의 일 실시예에 따른 바이너리 취약점 보완 방법은, 바이너리의 런타임(runtime) 시점에, 상기 바이너리의 GOT(Global Offset Table)에 안전 함수 테이블이 패치(patch)되는 단계와, 상기 바이너리의 인스트럭션에 의하여 기본 라이브러리의 목적 함수가 호출되면, 상기 안전 함수 테이블에 기재된 상기 목적 함수의 주소에 로드 된 중간 함수로 점프하는 단계와, 상기 중간 함수에 의하여 상기 기본 라이브러리의 함수가 호출되는 단계를 포함한다.In order to solve the above technical problem, the binary vulnerability compensation method according to an embodiment of the present invention, the safety function table is patched to the global offset table (GOT) of the binary at runtime (binary time) And, if the objective function of the basic library is called by the instruction of the binary, jumping to an intermediate function loaded at the address of the objective function described in the safety function table, and the function of the basic library by the intermediate function. It includes the step that is called.

일 실시예에서, 상기 안전 함수 테이블은 하나 이상의 상기 중간 함수가 로드된 메모리 주소를 포함한다. 여기서, 상기 중간 함수는 상기 기본 라이브러리의 함수들 중 사전 정의된 취약 함수일 수 있다. 여기서, 상기 사전 정의된 취약 함수는 버퍼 오버플로우 취약 함수, 포맷 스트링 취약 함수, 레이스 컨디션 취약 함수 및 다중 명령 실행 취약 함수를 포함할 수 있다.In one embodiment, the safety function table includes a memory address into which one or more of the intermediate functions are loaded. Here, the intermediate function may be a predefined weak function among the functions of the basic library. Here, the predefined vulnerable function may include a buffer overflow vulnerable function, a format string vulnerable function, a race condition vulnerable function, and a multi-instruction execution vulnerable function.

일 실시예에서, 상기 바이너리의 GOT에 안전 함수 테이블이 패치되는 단계는 상기 바이너리의 컨스트럭터 코드의 실행을 통해, 상기 바이너리의 GOT에 안전 함수 테이블이 패치되는 단계를 포함할 수 있다. 여기서, 상기 컨스트럭터 코드는, 상기 컨스트럭터 코드에서 동적 라이브러리 로드 API를 탐색하는 인스트럭션과, 상기 탐색된 동적 라이브러리 로드 API를 이용하여 상기 중간 함수 및 GOT 패치 함수를 포함하는 보안 라이브러리를 로드하는 인스트럭션과, 상기 GOT 패치 함수를 호출하는 인스트럭션을 포함할 수 있다. 이 때, 상기 GOT 패치 함수는 상기 바이너리의 GOT에 상기 안전 함수 테이블을 패치하기 위한 인스트럭션으로 구성된 것이고, 또한 상기 안전 함수 테이블은 상기 기본 라이브러리의 취약 함수 각각에 대응되는 상기 중간 함수의 메모리 주소를 포함하는 것일 수 있다. 여기서, 상기 보안 라이브러리는 상기 바이너리의 인스톨 패키지에 상기 바이너리와 함께 포함된 공유 라이브러리이거나, 상기 바이너리에 포함 된 정적 라이브러리일 수 있다.In one embodiment, the step of patching the safety function table in the GOT of the binary may include the step of patching the safety function table in the GOT of the binary through the execution of the constructor code of the binary. Herein, the constructor code may include an instruction for searching for a dynamic library load API in the constructor code, an instruction for loading a security library including the intermediate function and a GOT patch function using the searched dynamic library load API, and the It may contain instructions to call GOT patch functions. In this case, the GOT patch function is composed of instructions for patching the safety function table in the GOT of the binary, and the safety function table includes a memory address of the intermediate function corresponding to each of the vulnerable functions of the basic library. It may be. Here, the security library may be a shared library included with the binary in the installation package of the binary, or may be a static library included in the binary.

본 발명의 다른 실시예에 따른 바이너리 패치 방법은, 컴파일 장치로부터 소스 바이너리를 수신하는 단계와, 상기 소스 바이너리의 컨스트럭터 코드(constructor code)에 보안 라이브러리 로드 코드가 패치된 안전 바이너리를 생성하는 단계와, 상기 안전 바이너리를 외부 장치에 송신하는 단계를 포함한다. 여기서, 상기 보안 라이브러리 로드 코드는, 상기 컴퓨팅 장치에 설치된 플랫폼의 기본 라이브러리에서 동적 라이브러리 로드 API를 탐색하는 인스트럭션과, 상기 탐색된 동적 라이브러리 로드 API를 이용하여 보안 라이브러리를 로드하는 인스트럭션과, 상기 보안 라이브러리 내의 GOT 패치 함수를 호출하는 인스트럭션을 포함한다. 여기서, 상기 GOT 패치 함수는 상기 안전 바이너리의 런타임(runtime) 시점에, 상기 바이너리의 GOT(Global Offset Table)에 안전 함수 테이블을 패치(patch)하기 위한 인스트럭션을 포함하는 것일 수 있다.According to another aspect of the present invention, there is provided a binary patch method, comprising: receiving a source binary from a compilation device, generating a secure binary in which a secure library load code is patched to a constructor code of the source binary; Transmitting the secure binary to an external device. The secure library loading code may include an instruction for searching for a dynamic library loading API in a basic library of a platform installed in the computing device, an instruction for loading a security library using the searched dynamic library loading API, and the security library. Contains instructions for calling GOT patch functions within a. Here, the GOT patch function may include an instruction for patching a safety function table to a global offset table (GOT) of the binary at a runtime point of time.

일 실시예에서, 상기 외부 장치는 어플리케이션 다운로드 서비스 서버일 수 있다.In one embodiment, the external device may be an application download service server.

일 실시예에서, 상기 안전 함수 테이블은 기본 라이브러리의 취약 함수 각각에 대응되는, 상기 보안 라이브러리의 중간 함수의 메모리 주소를 포함하는 것일 수 있다.In one embodiment, the safety function table may include a memory address of the intermediate function of the security library, corresponding to each of the weak function of the basic library.

일 실시예에서, 상기 안전 바이너리를 생성하는 단계는 상기 보안 라이브러리를 정적 라이브러리로서 상기 소스 바이너리에 삽입하는 단계를 포함할 수 있다.In one embodiment, generating the secure binary may include inserting the secure library into the source binary as a static library.

일 실시예에서, 상기 컨스트럭터 코드는 상기 소스 바이너리의 초기화 동작을 수행하는 코드로서, 상기 소스 바이너리가 메모리에 로드 된 후 main() 함수가 실행 되기 전에 실행되는 인스트럭션들을 포함하는 것일 수 있다. 여기서, 상기 소스 바이너리는 ELF 포맷으로 빌드 된 것이고 상기 컨스트럭터 코드는, text 섹션(.text)의 인스트럭션들을 포함하는 것일 수 있다.In one embodiment, the constructor code is a code for performing an initialization operation of the source binary, and may include instructions that are executed after the source binary is loaded into memory but before the main () function is executed. Here, the source binary may be built in an ELF format and the constructor code may include instructions of a text section (.text).

본 발명의 또 다른 실시예에 따른 컴퓨팅 장치는, 소스 바이너리를 수신하고, 상기 소스 바이너리에 대한 보안 강화 패치의 결과물인 안전 바이너리를 송신하는 네트워크 인터페이스와, 프로세서와, 상기 프로세서에 의하여 수행되는 복수의 인스트럭션을 저장하는 메모리를 포함한다. 여기서, 상기 복수의 인스트럭션은 상기 소스 바이너리의 컨스트럭터 코드(constructor code)에 보안 라이브러리 로드하는 코드를 패치하는 인스트럭션을 포함한다. 여기서, 상기 보안 라이브러리를 로드하는 코드는, 상기 컴퓨팅 장치에 설치된 플랫폼의 기본 라이브러리에서 동적 라이브러리 로드 API를 탐색하는 인스트럭션과, 상기 탐색된 동적 라이브러리 로드 API를 이용하여 보안 라이브러리를 로드하는 인스트럭션과, 상기 보안 라이브러리 내의 GOT(Global Offset Table) 패치 함수를 호출하는 인스트럭션을 포함한다.According to another embodiment of the present invention, a computing device includes a network interface for receiving a source binary and transmitting a safety binary that is a result of a security enhancement patch for the source binary, a processor, and a plurality of executions performed by the processor. It contains a memory for storing instructions. Here, the plurality of instructions includes instructions for patching code for loading a security library into the constructor code of the source binary. The code for loading the security library may include an instruction for searching for a dynamic library loading API in a basic library of a platform installed in the computing device, an instruction for loading a security library using the searched dynamic library loading API, and Contains instructions to call the Global Offset Table (GOT) patch function in the security library.

일 실시예에서, 상기 GOT 패치 함수는 상기 안전 바이너리의 런타임(runtime) 시점에, 상기 안전 바이너리의 GOT에 안전 함수 테이블을 패치하기 위한 인스트럭션을 포함한다. 여기서, 상기 안전 함수 테이블은 기본 라이브러리의 취약 함수 각각에 대응되는, 상기 보안 라이브러리의 중간 함수의 메모리 주소를 포함하는 것일 수 있다.In one embodiment, the GOT patch function includes instructions for patching a safety function table to a GOT of the safe binary at runtime. Here, the safety function table may include a memory address of the intermediate function of the security library, corresponding to each of the weak functions of the basic library.

일 실시예에서, 상기 컴퓨팅 장치는 상기 보안 라이브러리의 바이너리를 저장하는 스토리지를 더 포함하고, 상기 복수의 인스트럭션은 상기 보안 라이브러리의 바이너리 코드를 상기 소스 바이너리에 정적 라이브러리로서 링크하는 인스트럭션을 더 포함할 수 있다.In one embodiment, the computing device may further comprise storage for storing the binaries of the secure library, and the plurality of instructions may further include instructions to link the binary code of the secure library to the source binary as a static library. have.

도 1은 본 발명의 일 실시 예에 따른 바이너리 취약점 보완 시스템의 구조를 도시한 구성도이다.
도 2는 본 발명의 다른 실시예에 따른 어플리케이션 다운로드 서비스 시스템의 구조를 도시한 구성도이다.
도 3은 본 발명의 또 다른 실시예에 따른 어플리케이션 다운로드 서비스 시스템의 구조를 도시한 구성도이다.
도 4는 본 발명의 또 다른 실시예에 따른 바이너리 취약점 보완 방법의 순서도이다.
도 5는 도 4의 일부 동작을 자세히 설명하기 위한 제1 순서도이다.
도 6은 도 4의 일부 동작을 자세히 설명하기 위한 제2 순서도이다.
도 7은 본 발명의 몇몇 실시예들에 따른 소스 바이너리로부터의 안전 바이너리로의 변환 결과를 설명하기 위한 개념도이다.
도 8은 본 발명의 몇몇 실시예들에서 참조되는 컨스트럭터 코드(constructor code)의 개념을 리눅스 바이너리 포맷을 참조하여 설명하기 위한 도면이다.
도 9는 본 발명의 몇몇 실시예들에서 바이너리에 패치 되는 보안 라이브러리 로드 코드가 실행되면 어떤 동작이 수행되는지 설명하기 위한 개념도이다.
도 10은 도 4의 일부 동작을 자세히 설명하기 위한 제3 순서도이다.
도 11은 도 10의 일부 동작을 자세히 설명하기 위한 제3 순서도이다.
도 12 및 도 13은 기본 라이브러리의 함수가 호출 될 때 본 발명의 몇몇 실시예들의 수행 결과를 설명하기 위한 개념도이다.
도 14는 본 발명의 또 다른 실시예에 따른 바이너리 패치 장치의 하드웨어 구성도이다.
1 is a block diagram showing the structure of a binary vulnerability complement system according to an embodiment of the present invention.
2 is a block diagram showing the structure of an application download service system according to another embodiment of the present invention.
3 is a block diagram showing the structure of an application download service system according to another embodiment of the present invention.
Figure 4 is a flow chart of the binary vulnerability compensation method according to another embodiment of the present invention.
FIG. 5 is a first flowchart for describing in detail some operations of FIG. 4.
FIG. 6 is a second flowchart for describing in detail some operations of FIG. 4.
7 is a conceptual diagram illustrating a conversion result from a source binary to a safe binary according to some embodiments of the present invention.
8 is a view for explaining the concept of the constructor code (constructor code) referenced in some embodiments of the present invention with reference to the Linux binary format.
FIG. 9 is a conceptual diagram illustrating an operation performed when a security library load code fetched into a binary is executed in some embodiments of the present invention.
FIG. 10 is a third flowchart for describing in detail some operations of FIG. 4.
FIG. 11 is a third flowchart for describing in detail some operations of FIG. 10.
12 and 13 are conceptual views illustrating a result of performing some embodiments of the present invention when a function of a basic library is called.
14 is a hardware configuration diagram of a binary patch device according to another embodiment of the present invention.

이하, 첨부된 도면을 참조하여 본 발명의 바람직한 실시예들을 상세히 설명한다. 본 발명의 이점 및 특징, 그리고 그것들을 달성하는 방법은 첨부되는 도면과 함께 상세하게 후술되어 있는 실시 예들을 참조하면 명확해질 것이다. 그러나 본 발명은 이하에서 게시되는 실시 예들에 한정되는 것이 아니라 서로 다른 다양한 형태로 구현될 수 있으며, 단지 본 실시 예들은 본 발명의 게시가 완전하도록 하고, 본 발명이 속하는 기술분야에서 통상의 지식을 가진 자에게 발명의 범주를 완전하게 알려주기 위해 제공되는 것이며, 본 발명은 청구항의 범주에 의해 정의될 뿐이다. 명세서 전체에 걸쳐 동일 참조 부호는 동일 구성 요소를 지칭한다.Hereinafter, exemplary embodiments of the present invention will be described in detail with reference to the accompanying drawings. Advantages and features of the present invention, and methods for achieving them will be apparent with reference to the embodiments described below in detail in conjunction with the accompanying drawings. However, the present invention is not limited to the embodiments disclosed below, but can be implemented in various forms, and only the embodiments are intended to complete the disclosure of the present invention, and the general knowledge in the art to which the present invention pertains. It is provided to fully convey the scope of the invention to those skilled in the art, and the present invention is defined only by the scope of the claims. Like reference numerals refer to like elements throughout.

다른 정의가 없다면, 본 명세서에서 사용되는 모든 용어(기술 및 과학적 용어를 포함)는 본 발명이 속하는 기술분야에서 통상의 지식을 가진 자에게 공통적으로 이해될 수 있는 의미로 사용될 수 있다. 또 일반적으로 사용되는 사전에 정의되어 있는 용어들은 명백하게 특별히 정의되어 있지 않는 한 이상적으로 또는 과도하게 해석되지 않는다. 본 명세서에서 사용된 용어는 실시예들을 설명하기 위한 것이며 본 발명을 제한하고자 하는 것은 아니다. 본 명세서에서, 단수형은 문구에서 특별히 언급하지 않는 한 복수형도 포함한다.Unless otherwise defined, all terms used in the present specification (including technical and scientific terms) may be used as meanings that can be commonly understood by those skilled in the art. In addition, terms that are defined in a commonly used dictionary are not ideally or excessively interpreted unless they are specifically defined clearly. The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. In this specification, the singular also includes the plural unless specifically stated otherwise in the phrase.

먼저, 본 명세서에 대한 이해의 편의를 돕기 위하여 몇몇 용어들에 대하여 설명한다.First, some terms will be described in order to facilitate the understanding of the present specification.

소스 바이너리: 소프트웨어 개발자의 컴퓨팅 장치에 설치된 컴파일러 등에 의하여 빌드(build) 된 파일로서, 컴퓨팅 장치에 의하여 실행 가능한 파일(executable file)이다.Source Binary: A file built by a compiler installed on a computing device of a software developer, etc., which is an executable file by the computing device.

안전 바이너리: 본 발명의 몇몇 실시예들에 따른, 상기 소스 바이너리에 대한 보안 강화 패치의 결과로 생성된 실행 가능한 파일이다.Secure Binary: An executable file created as a result of a security hardening patch for the source binary, according to some embodiments of the invention.

기본 라이브러리: 범용 플랫폼에 의하여 제공되는 범용 함수들의 집합인 공유 라이브러리이다. 예를 들어, 리눅스의 libc.so를 들 수 있다.Base library: A shared library that is a set of general purpose functions provided by a general purpose platform. For example, libc.so on Linux.

PLT(Procedure Linkage Table): 바이너리의 내부 루틴에서 외부 함수를 호출할 때, 호출 된 외부 함수를 메모리 주소를 찾아가기 위하여 참조되는 테이블이다. 아래 설명되는 GOT에서 해당 함수명(심볼)에 따른 메모리 주소를 조회함으로써, 상기 외부 함수의 메모리 주소를 출력한다. 현재 실행 중인 바이너리에서 상기 외부 함수가 최초로 호출된 관계로, GOT에 해당 함수명의 메모리 주소가 존재하지 않는 경우 "_dll_runtime_resolve()"함수를 실행하여, GOT에 해당 함수의 메모리 주소를 기록해 둠으로써, 추후 해당 함수가 다시 실행 되면 GOT에서 그 메모리 주소를 바로 얻을 수 있도록 한다.PLT (Procedure Linkage Table): When calling an external function from a binary internal routine, this table is referenced to retrieve the memory address of the called external function. The memory address of the external function is output by inquiring the memory address according to the function name (symbol) in the GOT described below. If the memory address of the function name does not exist in the GOT because the external function is called for the first time in the currently executing binary, execute "_dll_runtime_resolve ()" function to record the memory address of the function in the GOT. When the function is executed again, the GOT can get the memory address immediately.

GOT(Global Offset Table): PLT에 의하여 조회되는, 함수명 심볼 별 메모리 주소의 매칭 테이블이다.GOT (Global Offset Table): This is a matching table of memory addresses for each function name symbol, searched by the PLT.

보안 라이브러리: 상기 안전 바이너리의 실행 과정에서 호출되는 GOT 패치 함수 및 복수의 중간 함수들을 포함하고 있는 라이브러리이다.Security library: A library containing a GOT patch function and a plurality of intermediate functions called during the execution of the safe binary.

컨스트럭터 코드(constructor code): 바이너리의 초기화 시 수행되는 코드이다. 자세한 설명은 후술한다.Constructor code: Code executed at initialization of the binary. Detailed description will be described later.

이하, 도면들을 참조하여 본 발명의 몇몇 실시예들을 설명한다.Hereinafter, some embodiments of the present invention will be described with reference to the drawings.

먼저, 본 발명의 몇몇 실시예들에 따른 시스템들을 설명한다. 도 1에는 본 발명의 일 실시예에 따른 바이너리 취약점 보완 시스템으로서, 컴파일 장치(10a, 10b, 10c)로부터 수신된 소스 바이너리에 대하여 보안 강화 패치를 수행하고, 그 결과물로서 안전 바이너리를 생성하는 바이너리 취약점 보완 서버(100)를 포함하는 시스템이 도시 되어 있다. 컴파일 장치는 개발자의 단말 장치(10a, 10b)일 수도 있지만, 서버 형태의 컴파일 장치(10c)일 수도 있다. 컴파일 장치(10a, 10b, 10c)는, 예를 들어 리눅스 플랫폼 기반의 컴파일러가 설치된 것일 수 있다. 바이너리 취약점 보완 서버(100)는 상기 안전 바이너리를 컴파일 장치(10a, 10b, 10c)에 송신할 수 있다. 바이너리 취약점 보완 서버(100)의 상세 구조 및 동작 등은 후술한다.First, systems in accordance with some embodiments of the present invention are described. 1 is a binary vulnerability supplement system according to an embodiment of the present invention, which performs a security hardening patch on source binaries received from the compilation devices 10a, 10b, and 10c, and generates a binary binary as a result thereof. A system that includes a supplemental server 100 is shown. The compilation device may be the developer's terminal devices 10a and 10b, but may also be a server-type compilation device 10c. Compiler (10a, 10b, 10c), for example, a Linux platform based compiler may be installed. The binary vulnerability supplement server 100 may transmit the safe binary to the compilation devices 10a, 10b, and 10c. Detailed structure and operation of the binary vulnerability supplement server 100 will be described later.

도 2에는 본 발명의 다른 실시예에 따른 어플리케이션 다운로드 서비스 시스템이 도시되어 있다. 본 시스템은 바이너리 취약점 보완 서버(100) 및 어플리케이션 다운로드 서비스 서버(200)를 포함한다. 취약점 보완 서버(100)는 상기 안전 바이너리를 어플리케이션 다운로드 서비스 서버(200)에 송신하는 것을 제외하고는, 도 1을 참조하여 설명한 것과 유사한 동작을 수행한다. 본 실시예에 따르면, 개발자에 의하여 빌드 된 소스 바이너리가, 사용자 단말(10d, 10e, 10f)에 의하여 다운로드 되고, 사용자 단말(10d, 10e, 10f)에 설치되기 전에, 자동으로 보안 강화 패치 되는 효과를 제공한다. 여기서 사용자 단말(10d, 10e, 10f)은 리눅스 운영 체제가 설치된 것일 수 있다. 스마트 폰(10f)의 경우 모바일 리눅스 운영 체제가 설치된 것일 수 있다.2 shows an application download service system according to another embodiment of the present invention. The system includes a binary vulnerability supplement server 100 and an application download service server 200. The vulnerability repair server 100 performs an operation similar to that described with reference to FIG. 1 except for transmitting the safety binary to the application download service server 200. According to the present embodiment, the source binary built by the developer is downloaded by the user terminals 10d, 10e, and 10f, and is automatically security-patched before being installed on the user terminals 10d, 10e, and 10f. To provide. Here, the user terminals 10d, 10e, and 10f may be installed with a Linux operating system. In the case of the smart phone 10f, the mobile Linux operating system may be installed.

여기서, 바이너리 취약점 보완 서버(100)는 사용자 단말(10d, 10e, 10f)에 대한 어떠한 보안 관련 소프트웨어적 조치에도 관여하지 않고, 바이너리 자체에 대하여만 보안 강화를 위한 조치를 수행한다. 따라서, 본 실시예는 소프트웨어가 실행 되는 환경에 대한 고려 없이 보안 취약점이 강화 될 수 있는 편리함과 시간/비용 차원의 부담 경감을 제공한다.Here, the binary vulnerability supplement server 100 does not participate in any security-related software measures for the user terminals 10d, 10e, and 10f, and performs measures for strengthening security only for the binaries themselves. Therefore, the present embodiment provides convenience and time / cost reduction in which security vulnerabilities can be enhanced without considering the environment in which the software is executed.

도 3에는 본 발명의 또 다른 실시예에 따른 어플리케이션 다운로드 서비스 시스템이 도시되어 있다. 도 3에 도시된 바와 같이, 본 실시예에 따른 시스템은 바이너리 취약점 보완 기능이 부가된 어플리케이션 다운로드 서비스 서버(200a)를 포함할 수 있다. 즉, 본 실시예에 따른 시스템은 바이너리 취약점 보완 서버(100)의 기능이 내장된 어플리케이션 서비스 서버(200a)를 통하여, 컴팩트 한 구조와, 비용 절감을 제공한다.3 shows an application download service system according to another embodiment of the present invention. As shown in FIG. 3, the system according to the present embodiment may include an application download service server 200a to which a binary vulnerability supplement function is added. That is, the system according to the present embodiment provides a compact structure and a cost reduction through the application service server 200a in which the functions of the binary vulnerability supplement server 100 are built.

다음으로, 도 4 내지 도 13을 참조하여, 본 발명의 몇몇 실시예들에 따른 컴퓨팅 장치 수행 방법들을 설명한다. 먼저 본 발명의 또 다른 실시예에 따른 바이너리 취약점 보완 방법을, 도 4를 참조하여 설명한다.Next, with reference to Figures 4 to 13, a method of performing a computing device according to some embodiments of the present invention will be described. First, a binary vulnerability complement method according to another embodiment of the present invention will be described with reference to FIG.

단계 S100에서, 소스 바이너리의 컴파일이 수행된다. 단계 S100은, 예를 들어 도 1 내지 도 3의 컴파일러 장치(10a, 10b, 10c)에 의하여 수행될 수 있다.In step S100, compilation of the source binary is performed. Step S100 may be performed by, for example, the compiler apparatuses 10a, 10b, and 10c of FIGS. 1 to 3.

단계 S200에서, 상기 소스 바이너리에 대하여 보안 강화 패치가 수행되고, 그 결과로 안전 바이너리가 생성된다. 단계 S200은, 예를 들어 바이너리 취약점 보완 서버(100) 또는 바이너리 취약점 보완 기능이 부가 된 어플리케이션 다운로드 서비스 서버(200a)에 의하여 수행될 수 있다.In step S200, a security hardening patch is performed on the source binary, and as a result, a safety binary is generated. Step S200 may be performed by, for example, the binary vulnerability supplement server 100 or the application download service server 200a to which the binary vulnerability supplement function is added.

단계 S300에서, 상기 안전 바이너리가 실행된다. 단계 S300은, 예를 들어 사용자 단말(10d, 10e, 10f)에 의하여 수행될 수 있다.In step S300, the safe binary is executed. Step S300 may be performed by, for example, the user terminals 10d, 10e, and 10f.

도 4의 단계 S200을 도 5 및 도 6을 참조하여 상세 설명한다. 이하 설명되는 단계 S200은 독자적으로 하나의 방법으로서 실시될 수도 있으며, 이 경우 본 발명의 또 다른 실시예를 구성한다. 본 실시예에 따르면, 단계 S202에서 소스 바이너리를 읽어 들이고, 단계 S204에서 소스 바이너리의 컨스트럭터 코드를 식별하며, 단계 S206에서 소스 바이너리의 컨스트럭터 코드에 보안 라이브러리 로드 코드가 패치됨으로써 안전 바이너리가 생성된다.Step S200 of FIG. 4 will be described in detail with reference to FIGS. 5 and 6. Step S200 described below may be implemented as a method independently, in this case constitutes another embodiment of the present invention. According to this embodiment, the safe binary is generated by reading the source binary in step S202, identifying the constructor code of the source binary in step S204, and patching the secure library load code to the constructor code of the source binary in step S206.

몇몇 실시예들에서, 상기 안전 바이너리와 상기 보안 바이너리가 함께 패키징 되어 인스톨 패키지로서 외부 장치에 송신될 수 있다. 상기 외부 장치는 컴파일러 장치(10a, 10b, 10c) 또는 어플리케이션 다운로드 서비스 서버(200)일 수 있다. 이 경우, 바이너리의 수정 범위를 최소화하고, 동시에 바이너리의 데이터 사이즈가 증가되는 것을 최소화 할 수 있는 효과가 있다.In some embodiments, the secure binary and the secure binary can be packaged together and sent to an external device as an installation package. The external device may be a compiler device 10a, 10b, or 10c or an application download service server 200. In this case, it is possible to minimize the modification range of the binary and at the same time minimize the increase in the data size of the binary.

또 다른 몇몇 실시예들에서, 도 6에 도시된 것과 같이 바이너리 취약점 보완 서버(100)에 미리 저장된 보안 라이브러리를 소스 바이너리에 정적 라이브러리(static library)로서 링크하는 방식으로 포함시키는 동작(S208)이 추가로 수행될 수 있다. 이 경우, 상기 보안 바이너리의 파일이 사용자 단말에서 훼손 되는 것에 의하여 안전 바이너리의 동작에 오류가 발생될 수 있는 가능성을 최소화할 수 있는 효과가 있다.In some other embodiments, an operation (S208) of including a security library pre-stored in the binary vulnerability supplement server 100 as a static library by linking the source binary as a static library as shown in FIG. 6 is added. May be performed. In this case, there is an effect of minimizing the possibility that an error may occur in the operation of the safety binary by corrupting the file of the security binary in the user terminal.

단계 S204와 관련하여, 상기 '컨스트럭터 코드'의 의미를 도 7을 참조하여 설명한다. 컨스트럭터 코드(301)는 바이너리(300, 400)의 초기화 단계 시 실행되는 코드이다. 컨스트럭터 코드(301)에 포함된 오퍼레이션은 main() 함수가 실행 되기 전에 실행된다. 즉, 컨스트럭터 코드(301)는 바이너리(300, 400)의 실행 시작 시점부터 main() 함수 호출 시점 직전까지의 인스트럭션들 중 적어도 일부를 포함하는 것으로 정의 된다. 예를 들어, 바이너리(300, 400)가 ELF(Executable and Linkable Format) 포맷으로 구성된 것인 경우, 컨스트럭터 코드(301)는 text 섹션(section)(301a)에 포함된 main() gkatn ghcnf tlwja 직전까지의 코드일 수 있다.Regarding step S204, the meaning of the 'constructor code' will be described with reference to FIG. The constructor code 301 is code executed at the initialization stage of the binaries 300 and 400. The operations included in the constructor code 301 are executed before the main () function is executed. That is, the constructor code 301 is defined to include at least some of the instructions from the start of execution of the binaries 300 and 400 to just before the call to the main () function. For example, if the binaries 300 and 400 are configured in the Executable and Linkable Format (ELF) format, the constructor code 301 is executed until the main () gkatn ghcnf tlwja contained in the text section 301a. May be the code of.

도 7을 참조하면, 안전 바이너리(400)에 보안 라이브러리 로드 코드(303)가 패치 된 것을 이해할 수 있다. 상기 보안 라이브러리가 공유 라이브러리 형태로 안전 바이너리(400)와 함께 배포된다면, 보안 라이브러리 로드 코드(303)를 컨스트럭터 코드(301)에 패치하는 것이 유일하게 소스 바이너리(300)를 수정하는 것이 된다. 본 발명의 몇몇 실시예들은, 이처럼 최소한의 바이너리 수정만으로 기본 라이브러리의 공용 함수에 존재하는 취약점을 보완하는 효과를 제공한다.Referring to FIG. 7, it can be understood that the secure library load code 303 is patched to the safe binary 400. If the secure library is distributed with the secure binary 400 in the form of a shared library, patching the secure library load code 303 to the constructor code 301 is the only modification of the source binary 300. Some embodiments of the present invention provide the effect of compensating for vulnerabilities in common functions of the base library with such minimal modifications.

이하, 도 9를 참조하여 보안 라이브러리 로드 코드(303)의 동작을 설명한다. 도 9는 사용자 단말에서 안전 바이너리(400)가 실행될 때의 프로세스를 도시한 개념도로 이해될 수 있을 것이다.Hereinafter, the operation of the secure library load code 303 will be described with reference to FIG. 9. 9 may be understood as a conceptual diagram illustrating a process when the safety binary 400 is executed in a user terminal.

보안 라이브러리 로드 코드(303)는, 상기 컴퓨팅 장치에 설치된 플랫폼의 기본 라이브러리에서 동적 라이브러리 로드 API(501)를 탐색하는 인스트럭션(502)을 포함한다. 상기 기본 라이브러리는, 예를 들어 리눅스의 libc.so를 가리키고, 동적 라이브러리 로드 API(501)는 dlopen() 함수를 가리킬 수 있다. 인스트럭션(502)은 상기 기본 라이브러리가 로드 되지 않았다면 상기 기본 라이브러리를 로드한 후 상기 동적 라이브러리 로드 API를 탐색할 수도 있을 것이다. 다만, 기본 라이브러리의 로드 후의 지점에 보안 라이브러리 로드 코드(303)를 패치함으로써, 보안 라이브러리 로드 코드(303)의 코드 사이즈를 최소화 시키는 것이 바람직할 것이다.The secure library load code 303 includes an instruction 502 that searches for the dynamic library load API 501 in the base library of the platform installed on the computing device. The base library may point to libc.so on Linux, for example, and the dynamic library loading API 501 may point to the dlopen () function. The instruction 502 may explore the dynamic library loading API after loading the base library if the base library is not loaded. However, it may be desirable to minimize the code size of the secure library load code 303 by patching the secure library load code 303 at a point after the loading of the basic library.

인스트럭션(502)은, 상기 탐색된 동적 라이브러리 로드 API를 이용하여 보안 라이브러리(503)를 로드하는 인스트럭션을 더 포함한다. 도 9는 보안 라이브러리(503)가 동적 라이브러리로서 컴파일 된 것으로 공유 라이브러리의 형태로 로드 될 수 있는 경우를 전제로 한 것이다. 보안 라이브러리(503)를 로드한 결과, 안전 바이너리의 프로세스에 의하여 점유 되는 메모리 영역에 보안 라이브러리(503)가 로드 되어 저장될 것이다.The instruction 502 further includes an instruction to load the secure library 503 using the searched dynamic library loading API. 9 assumes that the security library 503 is compiled as a dynamic library and can be loaded in the form of a shared library. As a result of loading the security library 503, the security library 503 will be loaded and stored in the memory area occupied by the process of the safe binary.

보안 라이브러리 로드 코드(303)는, 보안 라이브러리(503) 내의 GOT(Global Offset Table) 패치 함수(504)를 호출하는 인스트럭션을 더 포함한다.The secure library load code 303 further includes instructions for calling the Global Offset Table (GOT) patch function 504 in the secure library 503.

결과적으로, 보안 라이브러리 로드 코드(303)는 기본 라이브러리에서 dlopen() 함수를 찾고, dlopen() 함수를 이용하여 보안 라이브러리(503)를 호출하고, 상기 보안 라이브러리(503)의 GOT 패치 함수(504)를 호출하는 최소한의 코드 만을 포함함으로써, 소스 바이너리를 수정하는 것을 최소화한다.As a result, the secure library load code 303 finds the dlopen () function in the base library, calls the secure library 503 using the dlopen () function, and the GOT patch function 504 of the secure library 503 Minimize modifications to the source binary by including minimal code that calls.

이하, 도 10을 참조하여 사용자 단말에서 상기 안전 바이너리를 실행할 때 수행되는 동작을 설명한다. 도 10은, 상술한 컨스트럭터 코드 내의 보안 라이브러리 로드 코드(303)가 실행되는 런타임(runtime) 프로세스로 이해될 수 있을 것이다. 이하 설명되는 단계 S300은 독자적으로 하나의 방법으로서 실시될 수도 있으며, 이 경우 본 발명의 또 다른 실시예를 구성한다.Hereinafter, an operation performed when the safe binary is executed in a user terminal will be described with reference to FIG. 10. 10 may be understood as a runtime process in which secure library load code 303 in the constructor code described above is executed. Step S300 described below may be implemented as a method independently, in this case constitutes another embodiment of the present invention.

본 실시예에 따르면, 단계 S302에서, 기본 라이브러리(libc.so)에서 동적 라이브러리 로드 API(dlopen())가 탐색된다. 다음으로, 단계 S304에서 동적 라이브러리 로드 API를 이용하여 보안 라이브러리가 로드 된다. 다음으로, 단계 S306에서, 로드 된 보안 라이브러리의 GOT 패치 함수가 호출된다. 그 후 main () 함수가 실행된다(S308). 이하, GOT 패치 함수 내부 로직을 도 11을 참조하여 설명한다.According to this embodiment, in step S302, the dynamic library loading API (dlopen ()) is searched for in the basic library libc.so. Next, in step S304 the security library is loaded using the dynamic library loading API. Next, in step S306, the GOT patch function of the loaded security library is called. After that, the main () function is executed (S308). Hereinafter, the internal logic of the GOT patch function will be described with reference to FIG.

먼저, 단계 S360에서 로드된 보안 라이브러리에 포함된 각각의 중간 함수에 대하여 그 메모리 주소가 탐색된다. 상기 중간 함수는 기본 라이브러리의 공용 함수들 중, 취약점이 발견되어 사전에 정의된 취약 함수와 일대일 매칭된 것이다.First, the memory address is searched for each intermediate function included in the security library loaded in step S360. The intermediate function is a one-to-one match with a predefined vulnerable function in which a vulnerability is found among the public functions of the basic library.

상기 취약 함수는, 취약점의 타입에 따라 분류될 수 있다.The vulnerability function may be classified according to the type of vulnerability.

예를 들어, 상기 취약 함수는, 아래의 표 1과 같이, 버퍼 오버플로우 취약 함수, 포맷 스트링 취약 함수, 레이스 컨디션 취약 함수 및 다중 명령 실행 취약 함수를 포함할 수 있다. 몇몇 실시예들에서 버퍼 오버플로우 취약 함수, 포맷 스트링 취약 함수, 레이스 컨디션 취약 함수 및 다중 명령 실행 취약 함수 중 일부 타입의 취약 함수들에 대하여만 중간 함수가 제공 될 수도 있다. 다만, 취약점을 안전하게 보완하기 위하여 버퍼 오버플로우 취약 함수, 포맷 스트링 취약 함수, 레이스 컨디션 취약 함수 및 다중 명령 실행 취약 함수 모두에 대하여 중간 함수가 제공되는 것이 바람직하다.For example, the vulnerable function may include a buffer overflow vulnerable function, a format string vulnerable function, a race condition vulnerable function, and a multi-instruction execution vulnerable function, as shown in Table 1 below. In some embodiments, an intermediate function may be provided only for some types of vulnerable functions, such as buffer overflow vulnerable functions, format string vulnerable functions, race condition vulnerable functions, and multiple instruction execution vulnerable functions. However, in order to safely compensate for the vulnerability, it is desirable to provide an intermediate function for all of the buffer overflow vulnerable function, the format string vulnerable function, the race condition vulnerable function, and the multiple instruction execution vulnerable function.

유형type 함수function 버퍼 오버플로우 취약 유형Buffer Overflow Vulnerability Types strcpy, wcscpy, stpcpy, wcpcpy, strecpy, memcpy, strcat, wcscat, streadd, strtrns, sprintf, vsprintf, vprintf, vfprintf, gets, scanf, fscanf, vscanf, vsscanf, sscanf, vfscanf, getwd, realpathstrcpy, wcscpy, stpcpy, wcpcpy, strecpy, memcpy, strcat, wcscat, streadd, strtrns, sprintf, vsprintf, vprintf, vfprintf, gets, scanf, fscanf, vscanf, vsscanf, sscanf, vfscanf, getwd, realpath 포맷 스트링Format string
취약 유형 Vulnerable Type
syslog, vsyslog, fprintf, printf, sprintf, vfprintf, vprintf, vsprintf, snprintf, vsnprintf, vasprintf, asprintf, vdprintf, dprintfsyslog, vsyslog, fprintf, printf, sprintf, vfprintf, vprintf, vsprintf, snprintf, vsnprintf, vasprintf, asprintf, vdprintf, dprintf
레이스 컨디션Race condition
취약 유형 Vulnerable Type
tmpnam, tmpnam_r, mktemptmpnam, tmpnam_r, mktemp
다중 명령Multiple commands
실행 취약Running vulnerable
유형type
system, popen, execve, fexecve, execv, execle, execl, execvp, execlp, execvpesystem, popen, execve, fexecve, execv, execle, execl, execvp, execlp, execvpe

다음으로, 단계 S362에서, 탐색된 중간 함수 각각의 메모리 주소를 포함하는 안전 함수 테이블을 구성한다.Next, in step S362, a safety function table including a memory address of each searched intermediate function is constructed.

다음으로, 단계 S364에서 현재 실행 중인 바이너리의 GOT 세그먼트(segment)의 주소를 획득한다.Next, in step S364, the address of the GOT segment of the binary currently being executed is obtained.

다음으로, 단계 S366에서 획득된 GOT 주소를 이용하여 GOT 데이터 영역에 상기 안전 함수 테이블을 패치 한다.Next, the safety function table is patched to the GOT data area using the GOT address obtained in step S366.

도 12는 도 11의 방법이 실행 된 결과를 도시하는 도면이다. strcpy() 함수가 실행될 때, 버퍼 오버플로우 문제가 발생될 수 있는 취약점이 존재한다. 기존의 소스 바이너리 코드(303)는 상기 취약점이 있음에도 불구하고 기본 라이브러리(libc.so)의 strcpy() 함수를 그대로 사용한다.FIG. 12 is a diagram showing the result of executing the method of FIG. A vulnerability exists that could cause a buffer overflow problem when the strcpy () function is executed. The existing source binary code 303 uses the strcpy () function of the basic library libc.so despite the above vulnerability.

안전 바이너리의 소스 바이너리 코드와 소스 바이너리의 소스 바이너리 코드는 동일하다. 즉, strcpy()는 양쪽 바이너리 모두 동일하게 호출된다. 그러나, GOT 패치의 결과 안전 바이너리의 프로세스에서는 strcpy()가 호출될 때, 기본 라이브러리의 strcpy() 함수를 그대로 실행하지 않고, strcpy()에 매치된 중간 함수인 secure_strcpy() 함수를 실행한다. 이하, 도 13을 참조하여 이 과정을 자세히 설명한다.The source binary code of a safe binary and the source binary code of a source binary are identical. That is, strcpy () is called the same for both binaries. However, as a result of the GOT patch, the process of the safe binary does not execute the strcpy () function of the default library as it is when strcpy () is called, but executes the secure_strcpy () function, which is an intermediate function matched by strcpy (). Hereinafter, this process will be described in detail with reference to FIG. 13.

소스 바이너리 코드(303)에서 func 함수를 호출할 때, PLT 테이블의 func 함수 대응 영역의 코드가 호출된다. PLT 테이블의 func 함수 대응 영역의 코드는 GOT 테이블의 func 함수 대응 영역으로 점프 하여 func 함수의 메모리 주소를 얻는다. 그런데, 안전 바이너리의 컨스트럭터 코드에 패치 된 보안 라이브러리 로드 코드가 실행 된 결과 GOT 패치 함수가 호출 되어, 상기 GOT 테이블의 각 취약 함수 메모리 주소는 대응되는 중간 함수의 보안 라이브러리(503) 상 메모리 주소로 치환된 상태이다. 따라서, func 함수는 보안 라이브러리(503)의 함수가 실행되는 것이다.When calling the func function from the source binary code 303, the code of the func function corresponding area of the PLT table is called. The code in the func function mapping area of the PLT table jumps to the func function mapping area of the GOT table to obtain the memory address of the func function. However, as a result of executing the security library load code patched to the constructor code of the safe binary, the GOT patch function is called, and each vulnerable function memory address of the GOT table is replaced with a memory address on the security library 503 of the corresponding intermediate function. It is in a state. Thus, the func function is a function of the security library 503 to be executed.

보안 라이브러리(503)의 각 중간 함수는, 각 취약 함수의 취약점을 보완하기 위한 최소한의 사전 인스트럭션을 실행한 후, 소스 바이너리 코드에서 실행 된 취약 함수를 그대로 호출하거나, 상기 취약 함수를 그대로 호출할 필요가 없는 경우, 기본 라이브러리의 다른 함수를 호출한다. 도 12의 secure_strcpy() 함수는 기본 라이브러리의 strncpy() 함수를 호출하는 것으로 도시하였다.Each intermediate function of the security library 503 needs to call the vulnerable function executed in the source binary code as it is or execute the vulnerable function as it is after executing the minimum pre-instruction to compensate for the vulnerability of each vulnerable function. If does not exist, call another function in the default library. The secure_strcpy () function of FIG. 12 is illustrated as calling the strncpy () function of the basic library.

지금까지 설명된 본 발명의 실시예에 따른 방법들은 컴퓨터가 읽을 수 있는 코드로 구현된 컴퓨터프로그램의 실행에 의하여 수행될 수 있다. 상기 컴퓨터프로그램은 인터넷 등의 네트워크를 통하여 제1 컴퓨팅 장치로부터 제2 컴퓨팅 장치에 전송되어 상기 제2 컴퓨팅 장치에 설치될 수 있고, 이로써 상기 제2 컴퓨팅 장치에서 사용될 수 있다. 상기 제1 컴퓨팅 장치 및 상기 제2 컴퓨팅 장치는, 서버 장치, 클라우드 서비스를 위한 서버 풀에 속한 물리 서버, 데스크탑 피씨와 같은 고정식 컴퓨팅 장치를 모두 포함한다.The methods according to the embodiments of the present invention described so far may be performed by execution of a computer program implemented in computer readable code. The computer program may be transmitted from the first computing device to the second computing device via a network such as the Internet and installed in the second computing device, thereby being used in the second computing device. The first computing device and the second computing device include both a server device, a physical server belonging to a server pool for cloud services, and a stationary computing device such as a desktop PC.

상기 컴퓨터프로그램은 DVD-ROM, 플래시 메모리 장치 등의 기록매체에 저장된 것일 수도 있다.The computer program may be stored in a recording medium such as a DVD-ROM or a flash memory device.

다음으로, 도 14를 참조하여 본 발명의 또 다른 실시예에 따른 바이너리 패치 장치(100)의 구성 및 동작을 설명한다. 도 14에 도시된 바와 같이, 본 실시예에 따른 바이너리 패치 장치(100)는 프로세서(101), 메모리(102), 스토리지(103) 및 네트워크 인터페이스(105)를 포함할 수 있다. 메모리(102)에 로드 되어 저장되는 복수의 인스트럭션은 프로세서(101)를 통하여 실행된다. 본 실시예에 따른 바이너리 패치 장치(100)는 별도의 설명이 없더라도, 도 1 내지 도 13을 참조하여 설명한 바이너리 취약점 보완 서버의 동작을 수행할 수 있는 점을 유의한다.Next, the configuration and operation of the binary patch apparatus 100 according to another embodiment of the present invention will be described with reference to FIG. 14. As illustrated in FIG. 14, the binary patch apparatus 100 according to the present exemplary embodiment may include a processor 101, a memory 102, a storage 103, and a network interface 105. A plurality of instructions loaded and stored in the memory 102 are executed by the processor 101. Note that the binary patch device 100 according to the present embodiment may perform the operation of the binary vulnerability supplement server described with reference to FIGS.

스토리지(103)는 소스 바이너리(133), 보안 라이브러리 바이너리(131) 및 보안 라이브러리 로드 코드(132)를 저장할 수 있다.The storage 103 may store a source binary 133, a secure library binary 131, and a secure library load code 132.

네트워크 인터페이스(105)는 소스 바이너리(133)를 수신하고, 상기 소스 바이너리에 대한 보안 강화 패치의 결과물인 안전 바이너리를 송신한다.Network interface 105 receives source binaries 133 and transmits secure binaries that are the result of security enhancement patches to the source binaries.

상기 복수의 인스트럭션은 보안 강화 패치 인스트럭션(122)을 포함한다. 일 실시예에서, 상기 복수의 인스트럭션은 보안 라이브러리 바이너리(131)의 링크를 위한 링커(121)를 더 포함할 수 있다.The plurality of instructions includes a security enhancement patch instruction 122. In one embodiment, the plurality of instructions may further include a linker 121 for linking the secure library binary 131.

보안 강화 패치 인스트럭션(122)은, 상기 소스 바이너리의 컨스트럭터 코드(constructor code)에 보안 라이브러리 로드하는 코드를 패치하는 인스트럭션을 포함한다. 이 때, 상기 보안 라이브러리를 로드하는 코드는, 상기 컴퓨팅 장치에 설치된 플랫폼의 기본 라이브러리에서 동적 라이브러리 로드 API를 탐색하는 인스트럭션과, 상기 탐색된 동적 라이브러리 로드 API를 이용하여 보안 라이브러리를 로드하는 인스트럭션과, 상기 보안 라이브러리 내의 GOT(Global Offset Table) 패치 함수를 호출하는 인스트럭션을 포함할 수 있다.The security enhancement patch instruction 122 includes instructions for patching code for loading a security library into the constructor code of the source binary. In this case, the code for loading the secured library may include instructions for searching for a dynamic library load API in a basic library of a platform installed in the computing device, instructions for loading a secured library using the searched dynamic library load API, An instruction for calling a Global Offset Table (GOT) patch function in the security library may be included.

이상 첨부된 도면을 참조하여 본 발명의 실시예들을 설명하였지만, 본 발명이 속하는 기술분야에서 통상의 지식을 가진 자는 본 발명이 그 기술적 사상이나 필수적인 특징을 변경하지 않고서 다른 구체적인 형태로 실시될 수 있다는 것을 이해할 수 있다. 그러므로 이상에서 기술한 실시예들은 모든 면에서 예시적인 것이며 한정적인 것이 아닌 것으로 이해해야만 한다.Although the embodiments of the present invention have been described above with reference to the accompanying drawings, those skilled in the art to which the present invention pertains may implement the present invention in other specific forms without changing the technical spirit or essential features thereof. I can understand that. Therefore, it is to be understood that the embodiments described above are exemplary in all respects and not restrictive.

Claims (16)

컴퓨팅 장치에 의하여 수행되는 방법에 있어서,
소스 바이너리의 컨스트럭터 코드(constructor code)에 GOT 패치 함수를 호출하기 위한 코드가 삽입된 안전 바이너리를 생성하는 단계를 포함하되,
상기 GOT 패치 함수는,
상기 안전 바이너리의 런타임(runtime) 시점에, 상기 바이너리의 GOT(Global Offset Table)에 안전 함수 테이블을 패치(patch)하기 위한 인스트럭션을 포함하는 것인,
바이너리 패치 방법.
A method performed by a computing device,
Generating a secure binary in which the code for calling the GOT patch function is inserted into the constructor code of the source binary,
The GOT patch function,
At a runtime of the safe binary, including instructions for patching a safe function table to a global offset table (GOT) of the binary,
Binary patching method.
제1 항에 있어서,
상기 컨스트럭터 코드는,
상기 컨스트럭터 코드에서 동적 라이브러리 로드 API를 탐색하는 인스트럭션;
상기 탐색된 동적 라이브러리 로드 API를 이용하여 중간 함수 및 GOT 패치 함수를 포함하는 보안 라이브러리를 로드하는 인스트럭션; 및
상기 GOT 패치 함수를 호출하는 인스트럭션을 포함하는,
바이너리 패치 방법
According to claim 1,
The constructor code,
Instructions for searching for dynamic library loading APIs in the constructor code;
Instructions for loading a security library including an intermediate function and a GOT patch function using the searched dynamic library loading API; And
Including an instruction for calling the GOT patch function,
Binary Patch Method
제1 항에 있어서,
상기 안전 함수 테이블은,
기본 라이브러리의 취약 함수 각각에 대응되는, 보안 라이브러리의 중간 함수의 메모리 주소를 포함하는 것인,
바이너리 패치 방법.
According to claim 1,
The safety function table,
Contains the memory address of the intermediate function in the secure library, corresponding to each of the vulnerable functions in the base library
Binary patching method.
제1 항에 있어서,
상기 안전 바이너리의 런타임(runtime) 시점에, 상기 바이너리의 GOT(Global Offset Table)에 안전 함수 테이블을 패치(patch)하기 위한 인스트럭션은,
상기 바이너리의 컨스트럭터 코드의 실행을 통해, 상기 바이너리의 GOT에 안전 함수 테이블을 패치하기 위한 인스트럭션을 포함하는,
바이너리 패치 방법.
According to claim 1,
At runtime of the safe binary, an instruction for patching a safe function table to a global offset table (GOT) of the binary,
Instructions for patching a safety function table to the GOT of the binary through execution of the constructor code of the binary,
Binary patching method.
제4 항에 있어서,
상기 컨스트럭터 코드는,
상기 소스 바이너리의 초기화 동작을 수행하는 코드로서, 상기 소스 바이너리가 메모리에 로드 된 후 메인함수가 실행 되기 전에 실행되는 인스트럭션들을 포함하는 것인,
바이너리 패치 방법.
The method of claim 4, wherein
The constructor code,
Code for performing an initialization operation of the source binary, including instructions that are executed after the source binary is loaded into memory, but before the main function is executed,
Binary patching method.
제4 항에 있어서,
상기 소스 바이너리는 ELF 포맷으로 빌드 된 것이고,
상기 컨스트럭터 코드는, text 섹션(.text)에 포함된 메인함수 호출 시점 직전까지의 코드인,
바이너리 패치 방법.
The method of claim 4, wherein
The source binaries are built in ELF format,
The constructor code is a code up until immediately before the main function call included in the text section (.text).
Binary patching method.
삭제delete 삭제delete 삭제delete 삭제delete 삭제delete 삭제delete 삭제delete 삭제delete 삭제delete 삭제delete
KR1020190023742A 2019-02-28 2019-02-28 Binary fatching apparatus and method thereof for supplementing vulnerabilties casued from using vulnerable functions KR102070010B1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
KR1020190023742A KR102070010B1 (en) 2019-02-28 2019-02-28 Binary fatching apparatus and method thereof for supplementing vulnerabilties casued from using vulnerable functions

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
KR1020190023742A KR102070010B1 (en) 2019-02-28 2019-02-28 Binary fatching apparatus and method thereof for supplementing vulnerabilties casued from using vulnerable functions

Related Parent Applications (1)

Application Number Title Priority Date Filing Date
KR1020170168045A Division KR101955356B1 (en) 2017-12-08 2017-12-08 Binary fatching apparatus and method thereof for supplementing vulnerabilties casued from using vulnerable functions

Publications (2)

Publication Number Publication Date
KR20190068495A KR20190068495A (en) 2019-06-18
KR102070010B1 true KR102070010B1 (en) 2020-01-29

Family

ID=67103158

Family Applications (1)

Application Number Title Priority Date Filing Date
KR1020190023742A KR102070010B1 (en) 2019-02-28 2019-02-28 Binary fatching apparatus and method thereof for supplementing vulnerabilties casued from using vulnerable functions

Country Status (1)

Country Link
KR (1) KR102070010B1 (en)

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2011150716A (en) 2011-03-07 2011-08-04 Fujitsu Ltd Program, apparatus and method for auditing vulnerability

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7424706B2 (en) 2003-07-16 2008-09-09 Microsoft Corporation Automatic detection and patching of vulnerable files
KR100706176B1 (en) * 2005-07-12 2007-04-12 한국전자통신연구원 Method and system of processing kernel patch for prevention of kernel vulnerability
KR101052734B1 (en) * 2009-02-03 2011-07-29 주식회사 안철수연구소 Application patch device and method

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2011150716A (en) 2011-03-07 2011-08-04 Fujitsu Ltd Program, apparatus and method for auditing vulnerability

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
윤수진 외 2인, "바이너리 취약점 원인 분석 방법 연구", 한국통신학회 2017년도 추계종합학술발표회, 2017.11.30. pp.315-316.

Also Published As

Publication number Publication date
KR20190068495A (en) 2019-06-18

Similar Documents

Publication Publication Date Title
EP3128421B1 (en) Method, device, and system for achieving java application installation by cloud compilation
US10761867B2 (en) Nested emulation and dynamic linking environment
US11507362B1 (en) System and method for generating a binary patch file for live patching of an application
US8943486B2 (en) Multiple instruction execution mode resource-constrained device
US7418699B2 (en) Method and system for performing link-time code optimization without additional code analysis
CN108845841B (en) Method and device for changing terminal application behaviors and terminal
US6665671B2 (en) System and method for optimization of shared data
US9098355B2 (en) Method and apparatus for substituting compiler built-in helper functions with machine instructions
US9183021B2 (en) Runtime optimization of application bytecode via call transformations
CN110032425B (en) Dynamic link library file virtualization method, system and storage medium
US7472380B1 (en) Processing system with component architecture platform support
KR101955356B1 (en) Binary fatching apparatus and method thereof for supplementing vulnerabilties casued from using vulnerable functions
KR102070010B1 (en) Binary fatching apparatus and method thereof for supplementing vulnerabilties casued from using vulnerable functions
CN111625225A (en) Program specified data output method and device
CN108536444B (en) Plug-in compiling method and device, computer equipment and storage medium
CN113641389B (en) Software upgrading method, device and equipment based on OpenCPU
CN111949301A (en) Application program hot updating method and device, computer readable storage medium and computer equipment
CN114594981B (en) Method and device for solving generic compatibility problem during hot update
CN117075960B (en) Program reconstruction method, application cross-platform migration method, device and computing equipment
US20150052514A1 (en) Method and computer system of distributing a computer program product
CN115543486B (en) Server-free computing oriented cold start delay optimization method, device and equipment
US20230027823A1 (en) Anti-fragile software systems
CN113672238A (en) Operation method, device and equipment based on real-time operating system modular management
CN117744088A (en) Virtual machine trusted starting method based on TPCM under ARM architecture
CN115934123A (en) Client logic updating method and device, electronic equipment and storage medium

Legal Events

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