KR20200142754A - How to obfuscate return commands and how to execute obfuscated return commands - Google Patents

How to obfuscate return commands and how to execute obfuscated return commands Download PDF

Info

Publication number
KR20200142754A
KR20200142754A KR1020190070006A KR20190070006A KR20200142754A KR 20200142754 A KR20200142754 A KR 20200142754A KR 1020190070006 A KR1020190070006 A KR 1020190070006A KR 20190070006 A KR20190070006 A KR 20190070006A KR 20200142754 A KR20200142754 A KR 20200142754A
Authority
KR
South Korea
Prior art keywords
return
controller
encryption key
instruction
address
Prior art date
Application number
KR1020190070006A
Other languages
Korean (ko)
Other versions
KR102258408B1 (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 KR1020190070006A priority Critical patent/KR102258408B1/en
Publication of KR20200142754A publication Critical patent/KR20200142754A/en
Application granted granted Critical
Publication of KR102258408B1 publication Critical patent/KR102258408B1/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/60Protecting data
    • G06F21/62Protecting access to data via a platform, e.g. using keys or access control rules
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/602Providing cryptographic facilities or services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2221/00Indexing scheme relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F2221/21Indexing scheme relating to G06F21/00 and subgroups addressing additional information or applications relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F2221/2125Just-in-time application of countermeasures, e.g., on-the-fly decryption, just-in-time obfuscation or de-obfuscation

Abstract

The present invention relates to a return instruction obfuscation method and to an obfuscated return instruction execution method. The method is a return instruction obfuscation method in firmware performed by a controller, and comprises: a step of receiving an encryption key from a secure chip (SE) which exists separately from a controller in a device through an initialization module; a scanning step of searching for an address of an encrypted return instruction existing in a flash memory included in the controller through the initialization module after receiving the encryption key; and an address storage step of collecting the address searched in the scanning step, indexing and storing the address in a static memory (SRAM) included in the controller through the initialization module.

Description

반환 명령어 난독화 방법 및 난독화된 반환 명령어 실행방법{How to obfuscate return commands and how to execute obfuscated return commands}How to obfuscate return commands and how to execute obfuscated return commands}

본 발명은 반환 명령어 난독화 방법 및 난독화된 반환 명령어 실행방법에 관한 것으로, 더욱 상세하게는 초기화(Initialization) 모듈을 이용하여 반환 명령어를 난독화하는 방법 및 반환 제어 흐름(Return Control Flow) 모듈을 이용하여 난독화된 반환 명령어를 실행하는 방법에 관한 것이다.The present invention relates to a return instruction obfuscation method and an obfuscated return instruction execution method, and more particularly, a method of obfuscation of a return instruction using an initialization module and a Return Control Flow module. How to execute the obfuscated return command using.

사용자 중심의 지능형 서비스 제공의 선두주자로써 IoT 기술이 급성장 하고 있다. IoT 디바이스는 센서 네트워크 기술을 접목시켜 데이터를 수집하고 이를 기반으로 사용자에게 서비스를 제공하기 때문에 다양한 분야에서 활용되고 있으며 디바이스의 개체 수 또한 급증하고 있다. 이렇듯 IoT 디바이스는 사용자가 쉽게 접근할 수 있는 곳에 위치해 있지만 다른 관점에서 바라보면 공격자 또한 디바이스에 접근할 가능성을 제공한다. 따라서 공격자의 물리적 접근으로 인해 IoT 디바이스는 새로운 보안 취약점을 갖는다. IoT technology is rapidly growing as a leader in providing user-oriented intelligent services. IoT devices are used in various fields because they collect data by incorporating sensor network technology and provide services to users based on this, and the number of devices is also rapidly increasing. As such, IoT devices are located where users can easily access them, but from a different perspective, attackers also provide the possibility to access the device. Therefore, IoT devices have new security vulnerabilities due to the attacker's physical access.

공격자가 디바이스의 접근성을 악용하여 취할 수 있는 행위로는 펌웨어 추출이 있다. 공격자는 디바이스 내 MCU(Micro-Controller Unit) 칩을 추출하여 내부 펌웨어의 바이너리를 분석하여 서비스 어플리케이션의 제어 흐름을 파악할 수 있다. 공격자는 분석한 펌웨어를 기반으로 다양한 보안 위협을 수행할 수 있으며 대표적인 위협으로는 코드 재사용 공격(Code Reuse Attack)이 있다. Firmware extraction is an action that an attacker can take by exploiting the accessibility of the device. An attacker can extract the micro-controller unit (MCU) chip in the device and analyze the binary of the internal firmware to understand the control flow of the service application. An attacker can perform various security threats based on the analyzed firmware, and a representative threat is a code reuse attack.

기존 보안 솔루션은 데이터의 암/복호화를 통한 안전한 통신과 인증 및 검증 시스템을 도입하여 외부 위협으로부터 디바이스를 보호하는 데에 초점을 두었다. 하지만 코드 재사용 공격은 플래시 메모리에 저장된 적법한 펌웨어 바이너리만을 이용해 새로운 프로그래밍을 구현하기 때문에 기존 보안 솔루션만으로는 이를 해결할 수 없었다. Existing security solutions focus on protecting devices from external threats by introducing secure communication and authentication and verification systems through data encryption/decryption. However, since the code reuse attack implements new programming using only the legitimate firmware binary stored in the flash memory, the existing security solution alone could not solve this.

최근 CFI(Control Flow Integrity) 관련 연구들이 꾸준히 진행되어 코드 재사용 공격을 대비하고 있다. CFI(Control Flow Integrity)는 소프트웨어 실행이 사전에 CFG(Control Flow Graph)의 경로대로 흘러가게 지시하는 보안 정책을 의미한다. 그러나 저사양 IoT 디바이스라는 환경에서 하드웨어 기반의 암호화 방식은 제조 원가 비용을 증가시키고 여전히 펌웨어 추출 공격을 통해 해당 보호 기법에 취약하다. 공격자가 펌웨어를 추출하더라도 코드 재사용 공격을 막을 수 있을 뿐만 아니라 저사양 IoT 디바이스에 적합한 보안책을 마련할 필요가 있다. Recently, CFI (Control Flow Integrity) related studies have been steadily progressing to prepare for code reuse attacks. CFI (Control Flow Integrity) refers to a security policy that instructs software execution to flow along the path of the CFG (Control Flow Graph) in advance. However, in an environment of low-end IoT devices, hardware-based encryption methods increase manufacturing cost and are still vulnerable to corresponding protection techniques through firmware extraction attacks. Even if an attacker extracts the firmware, it is necessary not only to prevent code reuse attacks, but also to prepare appropriate security measures for low-end IoT devices.

본 발명은 상기와 같은 코드 재사용 공격을 막기 위하여 반환 명령어 난독화 방법 및 난독화된 반환 명령어 실행방법을 제시하고자 한다. The present invention proposes a method of obfuscation of a return instruction and a method of executing the obfuscated return instruction in order to prevent the code reuse attack as described above.

[특허문헌 1] 한국공개특허공보 제10-2017-0055933호[Patent Document 1] Korean Laid-Open Patent Publication No. 10-2017-0055933

본 발명은 전술한 문제점을 해결하기 위하여 창출된 것으로, 초기화(Initialization) 모듈을 이용하여 반환 명령어를 난독화하는 방법 및 반환 제어 흐름(Return Control Flow) 모듈을 이용하여 난독화된 반환 명령어를 실행하는 방법을 제공하는 것을 그 목적으로 한다.The present invention was created to solve the above-described problem, and a method of obfuscation of a return instruction using an initialization module and execution of an obfuscated return instruction using a return control flow module. Its purpose is to provide a method.

본 발명의 목적들은 이상에서 언급한 목적들로 제한되지 않으며, 언급되지 않은 또 다른 목적들은 아래의 기재로부터 명확하게 이해될 수 있을 것이다.The objects of the present invention are not limited to the objects mentioned above, and other objects not mentioned will be clearly understood from the following description.

상기한 목적들을 달성하기 위하여, 본 발명의 일 실시예에 따른 반환 명령어 난독화 방법 및 난독화된 반환 명령어 실행방법이 개시된다. 상기 방법은 컨트롤러가 수행하는 펌웨어 내 반환 명령어 난독화 방법에 있어서, 초기화(Initialization) 모듈을 통해 디바이스 내 컨트롤러(MCU)와 별도로 존재하는 보안칩(Secure Element: SE)으로부터 암호키를 수신하는 단계 및 암호키 수신하는 단계 이후, 초기화(Initialization) 모듈을 통해 컨트롤러(MCU)에 포함된 플래시 메모리에 존재하는 암호화된 반환 명령어의 어드레스를 탐색하는 스캐닝 단계를 포함할 수 있다. In order to achieve the above objects, a method of obfuscation of a return instruction and a method of executing an obfuscated return instruction according to an embodiment of the present invention are disclosed. The method is a method of obfuscation of a return command in firmware performed by a controller, the step of receiving an encryption key from a secure element (SE) separate from a controller (MCU) in a device through an initialization module, and After the step of receiving the encryption key, a scanning step of searching for an address of an encrypted return command existing in the flash memory included in the controller (MCU) through an initialization module may be included.

또한, 본 발명의 일 실시예에 따르면, 스캐닝 단계에서 탐색한 어드레스를 수집하고, 초기화(Initialization) 모듈을 통해 컨트롤러(MCU)에 포함된 정적 메모리(SRAM)내에 인덱스화하여 저장하는 어드레스 저장 단계를 더 포함할 수 있다. In addition, according to an embodiment of the present invention, the address storage step of collecting the address searched in the scanning step, indexing and storing it in a static memory (SRAM) included in the controller (MCU) through an initialization module is performed. It may contain more.

또한, 본 발명의 일 실시예에 따르면, 암호키를 수신하는 단계 이후, 수신한 암호키를 컨트롤러에 포함된 정적 메모리(SRAM)에 저장하는 단계를 더 포함할 수 있다. Further, according to an embodiment of the present invention, after the step of receiving the encryption key, the step of storing the received encryption key in a static memory (SRAM) included in the controller may be further included.

또한, 본 발명의 일 실시예에 따르면, 초기화(Initialization) 모듈은 코드 인스트루먼테이션 과정을 통해 소스 바이너리 파일에 삽입되며, 플래시 메모리에 독립적으로 존재하는 모듈일 수 있다. In addition, according to an embodiment of the present invention, the initialization module is inserted into a source binary file through a code instrumentation process, and may be a module independently existing in a flash memory.

또한, 본 발명의 일 실시예에 따르면, 반환 명령어 난독화 방법에 의해 난독화된 반환 명령어를 컨트롤러에서 실행하는 방법에 있어서, 플래시 메모리에 저장된 펌웨어를 실행할 때, 정적 메모리(SRAM)에 저장된 암호키를 이용하여 암호화된 반환 명령어를 복호화하고, 복호화된 반환 명령어를 실행하는 실행(Runtime) 단계를 포함할 수 있다. In addition, according to an embodiment of the present invention, in a method of executing a return instruction obfuscated by a return instruction obfuscation method in a controller, when executing firmware stored in a flash memory, an encryption key stored in a static memory (SRAM) It may include a runtime step of decrypting the encrypted return instruction by using and executing the decrypted return instruction.

또한, 본 발명의 일 실시예에 따르면, 실행(Runtime) 단계는 컨트롤러(MCU)가 암호화된 반환 명령어를 실행하기 이전에 반환 제어 흐름(Return Control Flow) 모듈을 실행하는 단계를 더 포함할 수 있다. In addition, according to an embodiment of the present invention, the runtime step may further include executing a Return Control Flow module before the controller (MCU) executes the encrypted return command. .

또한, 본 발명의 일 실시예에 따르면, 반환 제어 흐름(Return Control Flow) 모듈은 코드 인스트루먼테이션 과정을 통해 소스 바이너리 파일에 삽입되며, 암호화된 반환 명령어를 복호화하여 실행하는 모듈이며, 컨트롤러가 펌웨어 실행하여, 반환 제어 흐름(Return Control Flow) 모듈이 호출신호를 받으면, 정적 메모리(SRAM)에 저장된 어드레스를 로드하는 단계, 암호화된 반환 명령어를 암호키를 이용하여 복호화하며, 복호화된 명령어를 정적 메모리(SRAM)에 저장하는 단계 및 정적 메모리(SRAM)에 저장된 복호화된 명령어를 실행하는 단계를 포함할 수 있다. In addition, according to an embodiment of the present invention, the Return Control Flow module is inserted into the source binary file through a code instrumentation process, and is a module that decrypts and executes the encrypted return command, and the controller After executing, when the Return Control Flow module receives a call signal, the step of loading the address stored in the static memory (SRAM), decrypts the encrypted return command using the encryption key, and the decrypted command is stored in the static memory. It may include storing in (SRAM) and executing a decrypted instruction stored in static memory (SRAM).

상기한 목적들을 달성하기 위한 구체적인 사항들은 첨부된 도면과 함께 상세하게 후술될 실시예들을 참조하면 명확해질 것이다. Specific matters for achieving the above objects will become apparent with reference to embodiments to be described later in detail together with the accompanying drawings.

그러나, 본 발명은 이하에서 개시되는 실시예들에 한정되는 것이 아니라, 서로 다른 다양한 형태로 구성될 수 있으며, 본 발명의 개시가 완전하도록 하고 본 발명이 속하는 기술 분야에서 통상의 지식을 가진 자(이하, "통상의 기술자")에게 발명의 범주를 완전하게 알려주기 위해서 제공되는 것이다.However, the present invention is not limited to the embodiments disclosed below, but may be configured in various different forms, so that the disclosure of the present invention is complete and those of ordinary skill in the technical field to which the present invention pertains ( Hereinafter, it is provided in order to completely inform the scope of the invention to the "common engineer").

본 발명의 일 실시예에 의하면, 디바이스 내 플래시 메모리에 펌웨어를 저장할 때, 반환 명령어를 분기 명령을 가지는 일부 세그먼트만을 암호화하여 저장함으로써, 저사양 디바이스에서도 구동이 가능해진다. According to an embodiment of the present invention, when firmware is stored in a flash memory in a device, the return instruction is encrypted and stored in only some segments having a branch instruction, thereby enabling driving even in a low-end device.

또한, 코드 재사용 공격에 활용되는 일부 명령어만 암호화함으로써 전체 암호화로 인해 유발되는 디바이스의 성능 저하를 해결할 뿐만 아니라 보안성까지 강화시킬 수 있다.In addition, by encrypting only some commands used in code reuse attacks, it is possible to not only solve the performance degradation of the device caused by the entire encryption, but also enhance security.

또한, 디바이스 내의 별도로 존재하는 보안성이 강화된 하드웨어 보안칩(Secure Element: SE)을 삽입하여, 암호키를 별도로 보관함으로써 보안을 보다 강화시킬 수 있다. In addition, by inserting a hardware security chip (Secure Element: SE) with enhanced security that exists separately in the device, it is possible to further enhance security by storing the encryption key separately.

또한, 펌웨어 실행 시 복호화하는 과정에서 암호키의 저장은 휘발성이 있는 정적 메모리(SRAM)에 함으로써 보안을 강화 시킬 수 있다. In addition, when the firmware is executed, the encryption key is stored in a volatile static memory (SRAM) during the decryption process, thereby enhancing security.

상기의 방법을 통해 코드 재사용 공격의 일종인 반환 지향 프로그래밍을 방지할 수 있다. Through the above method, return-oriented programming, a kind of code reuse attack, can be prevented.

본 발명의 효과들은 상술된 효과들로 제한되지 않으며, 본 발명의 기술적 특징들에 의하여 기대되는 잠정적인 효과들은 아래의 기재로부터 명확하게 이해될 수 있을 것이다.The effects of the present invention are not limited to the above-described effects, and the potential effects expected by the technical features of the present invention will be clearly understood from the following description.

상기 언급된 본 발명 내용의 특징들이 상세하게, 보다 구체화된 설명으로, 이하의 실시예들을 참조하여 이해될 수 있도록, 실시예들 중 일부는 첨부되는 도면에서 도시된다. 또한, 도면과의 유사한 참조번호는 여러 측면에 걸쳐서 동일하거나 유사한 기능을 지칭하는 것으로 의도된다. 그러나 첨부된 도면들은 단지 본 발명 내용의 특정한 전형적인 실시예들만을 도시하는 것일 뿐, 본 발명의 범위를 한정하는 것으로 고려되지는 않으며, 동일한 효과를 갖는 다른 실시예들이 충분히 인식될 수 있다는 점을 유의하도록 한다.
도 1은 본 발명의 일 실시예에 따른 반환 명령어 난독화 방법을 도시한 순서도이다.
도 2는 본 발명의 일 실시예에 따른 반환 제어 흐름(Return Control Flow) 모듈의 과정을 도시한 순서도이다.
도 3은 본 발명의 일 실시예에 따른 반환 명령어 난독화 기법의 시스템 아키텍쳐를 도시한 도면이다.
도 4는 본 발명의 일 실시예에 따른 초기화(Initialization) 모듈을 통한 초기화(Initialization) 과정을 도시한 도면이다.
도 5는 본 발명의 일 실시예에 따른 반환 제어 흐름(Return Control Flow) 모듈이 포함된 실행(Runtime) 과정을 도시한 도면이다.
Some of the embodiments are shown in the accompanying drawings so that the features of the present disclosure mentioned above may be understood in detail, in a more detailed description, with reference to the following embodiments. In addition, like reference numbers in the drawings are intended to refer to the same or similar functions over several aspects. However, it should be noted that the accompanying drawings show only specific exemplary embodiments of the present invention, and are not considered to limit the scope of the present invention, and other embodiments having the same effect may be sufficiently recognized. Do it.
1 is a flow chart illustrating a method for obfuscation of a return instruction according to an embodiment of the present invention.
2 is a flowchart illustrating a process of a Return Control Flow module according to an embodiment of the present invention.
3 is a diagram illustrating a system architecture of a return instruction obfuscation technique according to an embodiment of the present invention.
4 is a diagram illustrating an initialization process through an initialization module according to an embodiment of the present invention.
5 is a diagram illustrating a runtime process including a return control flow module according to an embodiment of the present invention.

본 발명은 다양한 변경을 가할 수 있고, 여러 가지 실시예들을 가질 수 있는 바, 특정 실시예들을 도면에 예시하고 이를 상세히 설명하고자 한다. In the present invention, various modifications may be made and various embodiments may be provided, and specific embodiments will be illustrated in the drawings and described in detail.

청구범위에 개시된 발명의 다양한 특징들은 도면 및 상세한 설명을 고려하여 더 잘 이해될 수 있을 것이다. 명세서에 개시된 장치, 방법, 제법 및 다양한 실시예들은 예시를 위해서 제공되는 것이다. 개시된 구조 및 기능상의 특징들은 통상의 기술자로 하여금 다양한 실시예들을 구체적으로 실시할 수 있도록 하기 위한 것이고, 발명의 범위를 제한하기 위한 것이 아니다. 개시된 용어 및 문장들은 개시된 발명의 다양한 특징들을 이해하기 쉽게 설명하기 위한 것이고, 발명의 범위를 제한하기 위한 것이 아니다.The various features of the invention disclosed in the claims may be better understood in view of the drawings and detailed description. The apparatus, method, preparation method, and various embodiments disclosed in the specification are provided for illustration purposes. The disclosed structural and functional features are intended to enable a person skilled in the art to specifically implement various embodiments, and are not intended to limit the scope of the invention. The disclosed terms and sentences are intended to describe various features of the disclosed invention in an easy to understand manner, and are not intended to limit the scope of the invention.

본 발명을 설명함에 있어서, 관련된 공지기술에 대한 구체적인 설명이 본 발명의 요지를 불필요하게 흐릴 수 있다고 판단되는 경우, 그 상세한 설명을 생략한다. In describing the present invention, if it is determined that a detailed description of related known technologies may unnecessarily obscure the subject matter of the present invention, a detailed description thereof will be omitted.

이하, 본 발명의 일 실시예에 따른 반환 명령어 난독화 방법 및 난독화된 반환 명령어 실행방법을 설명한다. Hereinafter, a method of obfuscation of a return instruction and a method of executing an obfuscated return instruction according to an embodiment of the present invention will be described.

도 1은 본 발명의 일 실시예에 따른 반환 명령어 난독화 방법을 도시한 순서도이다. 1 is a flow chart illustrating a method for obfuscation of a return instruction according to an embodiment of the present invention.

도 1을 참조하면, 본 발명의 펌웨어 내 반환 명령어 난독화 방법(S10)에 있어서, 초기화(Initialization) 모듈을 통해 디바이스 내 컨트롤러(MCU)와 별도로 존재하는 보안칩(Secure Element: SE)으로부터 암호키를 수신하는 단계(S11), 암호키를 수신하는 단계 이후, 초기화(Initialization) 모듈을 통해 컨트롤러(MCU)에 포함된 플래시 메모리에 존재하는 암호화된 반환 명령어의 어드레스를 탐색하는 스캐닝 단계(S13) 및 스캐닝 단계에서 탐색한 어드레스를 수집하고, 초기화(Initialization) 모듈을 통해 컨트롤러(MCU)에 포함된 정적 메모리(SRAM)내에 인덱스화하여 저장하는 어드레스 저장 단계(S15)를 포함할 수 있다. Referring to FIG. 1, in the method (S10) of obfuscation of the return command in the firmware of the present invention, an encryption key from a security chip (Secure Element: SE) that exists separately from a controller (MCU) in a device through an initialization module. Receiving (S11), after the step of receiving the encryption key, a scanning step (S13) of searching for an address of an encrypted return instruction existing in the flash memory included in the controller (MCU) through an initialization module (S13) and An address storage step (S15) of collecting the address found in the scanning step, indexing and storing the address in the static memory (SRAM) included in the controller (MCU) through an initialization module (S15).

일 실시예에서, 반환 명령어 난독화 방법(S10)은 초기화(Initialization) 모듈을 통해 디바이스 내 컨트롤러(MCU)와 별도로 존재하는 보안칩(Secure Element: SE)으로부터 암호키를 수신하는 단계(S11)를 포함할 수 있다. In one embodiment, the return command obfuscation method (S10) includes a step (S11) of receiving an encryption key from a secure element (SE) that exists separately from a controller (MCU) in the device through an initialization module. Can include.

보다 구체적으로, 암호키를 수신하는 단계(S11)는 컨트롤러(MCU)가 플래시 메모리에 삽입된 초기화(Initialization) 모듈을 이용하여 보안칩(Secure Element: SE)으로부터 암호키를 수신할 수 있다. 암호키를 수신하는 단계 이후, 수신한 암호키를 컨트롤러 내에 포함된 정적 메모리(SRAM)에 저장하는 단계를 포함할 수 있다. More specifically, in the step of receiving the encryption key (S11), the controller (MCU) may receive the encryption key from a secure element (SE) using an initialization module inserted in the flash memory. After the step of receiving the encryption key, it may include storing the received encryption key in a static memory (SRAM) included in the controller.

일 실시예에서, 반환 명령어 난독화 방법(S10)은 암호키 수신하는 단계 이후, 상기 초기화(Initialization) 모듈을 통해 컨트롤러(MCU)에 포함된 플래시 메모리에 내 코드 세그먼트에 존재하는 암호화된 반환 명령어의 어드레스를 탐색하는 스캐닝 단계(S13)를 포함할 수 있다. 컨트롤러(MCU)는 어드레스 탐색을 위해서 암호화된 반환 명령어의 연산 부호값을 비교하여 주소 번지를 파악할 수 있다. In one embodiment, the return command obfuscation method (S10) is, after the step of receiving the encryption key, of the encrypted return command present in the code segment in the flash memory included in the controller (MCU) through the initialization module. A scanning step S13 of searching for an address may be included. The controller (MCU) can determine the address address by comparing the operation code value of the encrypted return instruction for address search.

일 실시예에서, 반환 명령어 난독화 방법(S10)은 스캐닝 단계에서 탐색한 어드레스를 수집하고, 초기화(Initialization) 모듈을 통해 컨트롤러(MCU)에 포함된 정적 메모리(SRAM)내에 인덱스화하여 저장하는 어드레스 저장 단계(S15)를 포함할 수 있다. 추후 펌웨어 실행 시, 복호화 과정에서 사용하기 위한 용도로, 정적 메모리(SRAM)내 리턴 테이블에 인덱스화하여 저장할 수 있다.In one embodiment, the return instruction obfuscation method (S10) collects the address found in the scanning step, and indexes and stores the address in a static memory (SRAM) included in the controller (MCU) through an initialization module. It may include a storage step (S15). When the firmware is executed later, it can be indexed and stored in the return table in the static memory (SRAM) for use in the decryption process.

코드 세그먼트는 소스 바이너리 파일 중에서 분기 명령을 포함하는 코드일 수 있다. 코드 전체를 암호화하는 것보다 분기 명령을 가지는 코드만 암호화함으로써 저사양 IoT 디바이스에서도 구동이 가능하며, 보안을 강화시킬 수 있다. The code segment may be a code including a branch instruction in the source binary file. By encrypting only the code with branch instructions rather than encrypting the entire code, it can run even on low-end IoT devices and enhance security.

하드웨어 보안칩(SE)(210)은 디바이스 내에서 컨트롤러(MCU)와 별도로 존재하는 하드웨어 보안칩(SE)으로써, 보안키를 별도의 하드웨어 보안칩(SE)에 보관함으로써 암호키의 유출의 위험성을 줄일 수 있다. The hardware security chip (SE) 210 is a hardware security chip (SE) that exists separately from the controller (MCU) in the device. By storing the security key in a separate hardware security chip (SE), the risk of leakage of the encryption key is reduced. Can be reduced.

초기화(Initialization) 모듈은 코드 인스트루먼테이션 과정을 통해 소스 바이너리 파일에 삽입되며, 플래시 메모리에 독립적으로 존재하는 모듈일 수 있다. The initialization module is inserted into the source binary file through a code instrumentation process, and may be a module that independently exists in the flash memory.

도 2는 본 발명의 일 실시예에 따른 반환 제어 흐름(Return Control Flow) 모듈의 과정을 도시한 순서도이다.2 is a flowchart illustrating a process of a Return Control Flow module according to an embodiment of the present invention.

도 2를 참조하면, 반환 명령어 난독화 방법에 의해 난독화된 반환 명령어를 실행하는 방법에 있어서, 플래시 메모리에 기저장된 펌웨어를 실행할 때, 정적 메모리(SRAM)에 저장된 암호키를 이용하여 암호화된 반환 명령어를 복호화하고, 복호화된 반환 명령어를 실행하는 실행(Runtime) 단계를 포함할 수 있다. 실행(Runtime) 단계는, 컨트롤러(MCU)가 암호화된 반환 명령어를 실행하기 이전에 반환 제어 흐름(Return Control Flow) 모듈(S20)을 실행하는 단계를 더 포함할 수 있다. Referring to FIG. 2, in the method of executing the return command obfuscated by the return command obfuscation method, when executing the firmware previously stored in the flash memory, an encrypted return using an encryption key stored in a static memory (SRAM) It may include a runtime step of decoding the command and executing the decoded return command. The runtime step may further include executing the return control flow module S20 before the controller (MCU) executes the encrypted return command.

보다 구체적으로, 실행(Runtime) 단계는 코드 세그먼트에 마지막 명령어가 암호화된 형태로 저장되며, 컨트롤러(MCU)가 코드 세그먼트에 암호화된 반환 명령어를 실행하기 이전에 반환 제어 흐름(Return Control Flow) 모듈(S20)을 실행할 수 있다. 반환 제어 흐름(Return Control Flow) 모듈(S20)은 소스 바이너리 파일에 삽입되어 암호화된 반환 명령어를 복호화하여 실행하는 모듈이며, 컨트롤러가 펌웨어 실행하여, 반환 제어 흐름(Return Control Flow) 모듈이 호출신호를 받으면, 컨트롤러(MCU)는 디바이스 내 정적 메모리(SRAM)에 저장된 리턴 테이블을 참조하여 복호화 하려는 암호화된 반환 명령어의 어드레스를 로드하는 단계(S21), 로드한 암호화된 반환 명령어를 초기화(Initialization) 과정에서 수신한 암호키를 이용하여 복호화하며, 복호화된 명령어를 정적 메모리(SRAM)에 저장하는 단계(S23) 및 정적 메모리(SRAM)에 저장된 복호화된 명령어를 실행하는 단계(S25)를 포함하는 모듈일 수 있다. More specifically, in the runtime phase, the last instruction is stored in encrypted form in the code segment, and the Return Control Flow module (return control flow) module (return control flow) before the controller (MCU) executes the encrypted return instruction in the code segment. S20) can be executed. The Return Control Flow module (S20) is a module that decrypts and executes the encrypted return command inserted in the source binary file, and the controller executes the firmware, and the Return Control Flow module sends a call signal. Upon receipt, the controller (MCU) loads the address of the encrypted return instruction to be decrypted by referring to the return table stored in the static memory (SRAM) in the device (S21), and initializes the loaded encrypted return instruction in the initialization process. Decryption using the received encryption key, and storing the decrypted command in static memory (SRAM) (S23), and executing the decrypted command stored in static memory (SRAM) (S25). have.

도 3은 본 발명의 일 실시예에 따른 반환 명령어 난독화 기법의 시스템 아키텍쳐를 도시한 도면이다. 3 is a diagram illustrating a system architecture of a return instruction obfuscation technique according to an embodiment of the present invention.

도 3을 참조하면, 시스템 아키텍쳐(100)는 초기화(Initialization) 모듈과 반환 제어 흐름(Return Control Flow) 모듈의 두 개의 모듈을 원본 소스 바이너리 파일에 삽입하는 코드 인스트루먼테이션 과정을 통해 인스트루먼테이션된 소스파일을 생성할 수 있다. 이후 반환 명령어를 암호화한 상태로 컨트롤러(MCU) 내 플래시 메모리 영역에 재작성하는 바이너리 수정 과정을 수행하여 최종적으로 재작성된 바이너리 파일을 생성할 수 있다. 3, the system architecture 100 is instrumented through a code instrumentation process of inserting two modules, an initialization module and a return control flow module, into an original source binary file. Source files can be created. Afterwards, a binary modification process in which the return command is encrypted and rewritten in the flash memory area in the controller (MCU) is performed to finally generate the rewritten binary file.

코드 인스트루먼테이션은 실행 파일의 오류를 진단하거나 추적 정보를 쓰기 위해 제품의 성능 정도를 모니터하거나 측정하는 기능을 말한다. 시스템에서 특정 구성 요소를 모니터링하는 코드 명령어 형태로 인스트러먼테이션을 구현할 수 있다. 그러나 IoT 디바이스는 대부분이 소형화, 저전력이라는 제약된 환경으로써 운영체제가 없는 형태로 제작되기 때문에 백도어를 활용하여 시스템의 오류를 체크하는 dynamic instrumentation 방식이 힘들다. 따라서, 본 특허에서는 코드 인스트러먼테이션을 하기 위해 반환 명령어가 실행되는 시점과 메인함수가 실행되는 시점에 삽입된 모듈을 직접 삽입하는 static 코드 인스트러먼테이션 방식을 활용할 수 있다. Code instrumentation refers to a function that monitors or measures the performance level of a product to diagnose errors in an executable file or write trace information. Instrumentation can be implemented in the form of code commands that monitor specific components in the system. However, since most IoT devices are manufactured in a form that does not have an operating system as a limited environment such as miniaturization and low power, it is difficult to use a dynamic instrumentation method to check system errors using a backdoor. Therefore, in this patent, in order to perform code instrumentation, it is possible to use a static code instrumentation method in which the inserted module is directly inserted at the time when the return instruction is executed and the time when the main function is executed.

링커 스크립터를 수정을 하여 삽입된 두 모듈은 분리된 섹션에 보관 및 관리할 수 있다. 따라서 링커 스크립터를 수정하여 독립된 영역을 생성하고 모듈의 소스 코드를 저장할 수 있다. By modifying the linker scripter, the two inserted modules can be stored and managed in separate sections. Therefore, you can modify the linker scripter to create an independent region and store the module's source code.

바이너리 수정의 목적은 IoT 디바이스 내의 플래시 메모리에 pop과 같은 반환 명령어를 암호화된 상태로 저장하는 것이다. 앞서 설명한대로 저사양 IoT 디바이스는 OS가 없는 환경이 대부분이기 때문에 백도어를 활용한 명령어 체크가 불가능하다. 따라서 펌웨어 바이너리에 직접 체크를 위한 바이너리 코드를 삽입할 필요가 있다. 바이너리 수정을 통해 암호화된 명령어는 추후에 초기화(Initialization) 모듈과 반환 제어 흐름(Return Control Flow) 모듈에 의해 안전하게 복호화 및 실행될 수 있다. The purpose of binary modification is to store the return instruction such as pop in the flash memory in the IoT device in an encrypted state. As described above, since most low-spec IoT devices do not have an OS, it is impossible to check commands using a backdoor. Therefore, it is necessary to insert the binary code for checking directly into the firmware binary. Commands encrypted through binary modification can be safely decrypted and executed later by the Initialization module and the Return Control Flow module.

코드 인스트러먼테이션을 통해 삽입할 두 모듈은 암호화된 명령어 정보를 수집하여 그 주소 번지를 정적 메모리(SRAM) 영역 내 테이블에 저장하는 초기화(Initialization) 모듈과 펌웨어의 런타임(Runtime) 시 암호화된 명령어를 안전하게 실행하는 반환 제어 흐름(Return Control Flow) 모듈로 구성된다. Two modules to be inserted through code instrumentation are an initialization module that collects encrypted instruction information and stores the address in a table in the static memory (SRAM) area, and an encrypted instruction at runtime of the firmware. It consists of a Return Control Flow module that safely executes the operation.

초기화(Initialization) 모듈을 통한 초기화(Initialization) 과정에 대한 설명 및 반환 제어 흐름(Return Control Flow) 모듈이 포함된 실행(Runtime) 과정에 대한 설명은 도 4 및 도 5에 대한 설명에서 각각 구체적으로 후술한다. A description of an initialization process through an initialization module and a description of a runtime process including a return control flow module will be described later in detail in the descriptions of FIGS. 4 and 5, respectively. do.

도 4는 본 발명의 일 실시예에 따른 초기화(Initialization) 모듈을 통한 초기화(Initialization) 과정을 도시한 도면이다. 4 is a diagram illustrating an initialization process through an initialization module according to an embodiment of the present invention.

도 4를 참조하면, 초기화(Initialization) 과정은 컨트롤러(MCU)가 플래시 메모리 내에 존재하는 초기화(Initialization) 모듈을 통해 디바이스 내의 별도로 존재하는 하드웨어 보안칩(SE)으로부터 암호키를 수신하여 반환 명령어를 암호화시키는 암호키 수신 단계, 플래시 메모리 내의 코드 세그먼트에 존재하는 암호화된 반환 명령어의 주소를 탐색하는 스캐닝 단계 및 탐색한 주소를 수집하여 정적 메모리(SRAM)내 리턴 테이블에 인덱스화 하여 저장하는 주소 저장 단계를 포함할 수 있다. Referring to FIG. 4, in the initialization process, the controller (MCU) receives an encryption key from a hardware security chip (SE) that exists separately in the device through an initialization module existing in the flash memory and encrypts the return command. The encryption key receiving step, the scanning step of searching for the address of the encrypted return instruction existing in the code segment in the flash memory, and the address storage step of collecting the searched address and indexing it in the return table in the static memory (SRAM) are performed. Can include.

보다 구체적으로, 암호키 수신하는 단계는 초기화(Initialization) 모듈이 실행되면, 컨트롤러(MCU)는 플래시 메모리 내에 존재하는 초기화(Initialization) 모듈 및 디바이스 내에 별도로 존재하는 하드웨어 보안 칩(SE)과의 통신을 통해 암호키를 수신하는 단계일 수 있다. 수신한 암호키는 AES128 암호 알고리즘을 활용하여 16바이트의 데이터 길이를 갖는다. 초기화(Initialization) 모듈과 하드웨어 보안칩(SE) 간의 교환메시지는 암호화된 상태로 통신하고, 암호화에 사용되는 암호키는 안전하게 생성하여 초기화(Initialization) 모듈과 하드웨어 보안칩(SE) 내에 저장될 수 있다. More specifically, in the step of receiving the encryption key, when the initialization module is executed, the controller (MCU) communicates with the initialization module existing in the flash memory and the hardware security chip SE separately existing in the device. It may be a step of receiving an encryption key through. The received encryption key has a data length of 16 bytes using the AES128 encryption algorithm. The exchange message between the initialization module and the hardware security chip (SE) communicates in an encrypted state, and the encryption key used for encryption can be safely generated and stored in the initialization module and the hardware security chip (SE). .

또한, 스캐닝 단계는 암호키를 수신하는 단계를 통해 암호키 수신이 완료되면, 플래시 메모리 내 코드 세그먼트에 존재하는 암호화된 반환 명령어의 주소를 탐색하는 단계일 수 있다. 탐색을 위해서 반환 명령어의 연산 부호값을 비교하여 주소 번지를 파악할 수 있다.Further, the scanning step may be a step of searching for an address of an encrypted return command existing in a code segment in the flash memory when the encryption key is received through the step of receiving the encryption key. For search, the address address can be determined by comparing the operation code value of the return instruction.

또한, 주소 저장 단계는 스캐닝 단계에서 탐색한 반환 명령어의 주소를 정적 메모리(SRAM) 내 리턴 테이블에 인덱스화하여 저장하는 단계일 수 있다. 이 테이블은 나중에 복화화를 하기 위한 용도로 활용될 수 있다. 이 리턴 테이블은 휘발성 메모리인 정적 메모리(SRAM) 영역에 존재하기 때문에 디바이스 부트 시, 그 흔적을 남기지 않게 되어 단순 펌웨어 추출만으로는 분석이 불가능 할 수 있다. In addition, the address storage step may be a step of indexing and storing the address of the return instruction searched in the scanning step in a return table in the static memory (SRAM). This table can be used later for demodulation. Since this return table exists in the static memory (SRAM) area, which is a volatile memory, it does not leave traces when the device is booted, and analysis may be impossible by simply extracting the firmware.

도 5는 본 발명의 일 실시예에 따른 반환 제어 흐름(Return Control Flow) 모듈이 포함된 실행(Runtime) 과정을 도시한 도면이다. 5 is a diagram illustrating a runtime process including a return control flow module according to an embodiment of the present invention.

도 5를 참조하면, 실행(Runtime) 단계는 코드 세그먼트에 마지막 명령어가 암호화된 형태로 저장되며, 컨트롤러(MCU)가 코드 세그먼트에 암호화된 반환 명령어를 실행하기 이전에 반환 제어 흐름(Return Control Flow) 모듈을 실행할 수 있다. 반환 제어 흐름(Return Control Flow) 모듈(S20)은 소스 바이너리 파일에 삽입되어 암호화된 반환 명령어를 복호화하여 실행하는 모듈이며, 컨트롤러가 펌웨어 실행하여, 반환 제어 흐름(Return Control Flow) 모듈(S20)이 호출신호를 받으면, 컨트롤러(MCU)는 디바이스 내 정적 메모리(SRAM)에 저장된 리턴 테이블을 참조하여 복호화 하려는 암호화된 반환 명령어의 주소를 로드하는 단계(S21), 로드한 암호화된 반환 명령어를 초기화(Initialization) 단계에서 수신한 암호키를 이용하여 복호화하며, 복호화된 명령어를 정적 메모리(SRAM)에 저장하는 단계(S23) 및 정적 메모리(SRAM)에 저장된 복호화된 명령어를 실행하는 단계(S25)를 포함하는 모듈일 수 있다. Referring to FIG. 5, in the runtime step, the last instruction is stored in an encrypted form in a code segment, and a return control flow is performed before the controller (MCU) executes the encrypted return instruction in the code segment. You can run the module. The Return Control Flow module (S20) is a module that decrypts and executes the encrypted return command inserted in the source binary file, and the controller executes the firmware, and the Return Control Flow module (S20) is Upon receiving the call signal, the controller (MCU) refers to the return table stored in the static memory (SRAM) in the device and loads the address of the encrypted return instruction to be decrypted (S21), and initializes the loaded encrypted return instruction (Initialization). Decrypting using the encryption key received in step ), storing the decrypted command in a static memory (SRAM) (S23) and executing the decrypted command stored in the static memory (SRAM) (S25) It can be a module.

보다 구체적으로, 도 5의 원본 코드 세그먼트의 경우, 원본 소소 코드에서 foo 함수는 일련의 명령어가 모두 수행되고 마지막 명령어인 pop 명령어가 나오면, 이전에 호출된 func 함수로 제어 흐림이 변경된다. More specifically, in the case of the original code segment of FIG. 5, when the foo function in the original source code executes all of a series of instructions and a pop instruction, which is the last instruction, is issued, the control blur is changed to the previously called func function.

반면에, 재작성(re-write)한 코드 세그먼트의 경우는, 마지막 명령어인 pop 명령어가 암호화된 형태(enc_ins)로 저장되어 있으며, 소스 코드에서 foo 함수의 명령어가 모두 수행되고 암호화된 pop 명령어(enc_ins)가 나오기 이전에 반환 제어 흐름(Return Control Flow) 모듈이 삽입되어 있다. 또한, 암호화된 pop명령어(enc_ins)가 실행되기 이전에 반환 제어 흐름(Return Control Flow) 모듈을 실행하는 명령어를 추가함으로써 하기와 같은 동작들이 순차적으로 진행될 수 있다. On the other hand, in the case of the re-written code segment, the last instruction, the pop instruction, is stored in an encrypted form (enc_ins), and all the instructions of the foo function are executed in the source code, and the encrypted pop instruction ( Before enc_ins) comes out, the Return Control Flow module is inserted. In addition, the following operations may be sequentially performed by adding a command to execute a Return Control Flow module before the encrypted pop command (enc_ins) is executed.

또한, 도 5를 참조하면, 실선으로 표시된 direct call은 단순히 이전 명령어 다음 순서의 명령어를 의미하므로 보호의 대상이 아니며, 파선으로 표시된 indirect call은 이전의 명령어를 참조해서 다음 순서의 명령어로 이동을 하는 것으로 보호의 필요성이 있는 명령어이다. In addition, referring to FIG. 5, the direct call indicated by a solid line simply means an instruction in the next order of the previous instruction, so it is not subject to protection, and the indirect call indicated by a broken line refers to the previous instruction and moves to the next instruction. It is a command that needs protection.

예를 들어, foo 함수에서 암호화된 pop명령어(enc_ins)가 나오기 이전에 개발자가 작성 및 삽입한 “b Ex_Ret_CF”는 반환 제어 흐름(Return Control Flow) 모듈을 호출할 수 있다. 호출된 반환 제어 흐름(Return Control Flow) 모듈은 기저장된 명령어들을 수행할 수 있다. 반환 제어 흐름(Return Control Flow) 모듈은 암호화된 반환 명령어의 주소 로드(load enc_ins), 복호화(decryption) 및 실행(execution)의 명령어를 포함할 수 있다. 암호화된 반환 명령어의 주소 로드(load enc_ins)는 반환 제어 흐름 모듈로 진입하면 정적 메모리(SRAM)에 저장된 리턴 테이블을 참조하여 현재 복호화 하려는 암호화된 명령어의 주소 번지를 로드할 수 있다. 복호화(decryption)는 로드한 enc_ins는 초기화(Initialization) 모듈에서 수신한 암호키로 복호화 할 수 있다. 실행(execution)은 정적 메모리(SRAM)에 저장된 복호화된 명령어를 실행하여 func 함수로 반환할 수 있다. 위와 같은 일련의 작업들을 통해 코드 세그먼트에 저장된 모든 반환 명령어를 난독화하고, 반환 제어 흐름(Return Control Flow) 모듈은 명령어를 실행할 때만 원본으로 복호화하여 실행할 수 있다. 상기 예시는 본 개시를 설명하기 위한 예시일 뿐, 본 개시는 이에 제한되지 않는다.For example, “b Ex_Ret_CF” written and inserted by the developer before the encrypted pop command (enc_ins) comes out in the foo function can call the Return Control Flow module. The called Return Control Flow module can execute pre-stored commands. The Return Control Flow module may include instructions of load enc_ins, decryption, and execution of an encrypted return instruction. When entering the return control flow module, the encrypted return instruction address load (load enc_ins) can load the address address of the currently encrypted instruction to be decrypted by referring to the return table stored in the static memory (SRAM). For decryption, the loaded enc_ins can be decrypted with the encryption key received from the Initialization module. Execution can be returned to the func function by executing the decoded instruction stored in static memory (SRAM). Through the above series of operations, all return instructions stored in the code segment are obfuscated, and the Return Control Flow module can be decrypted and executed only when the instruction is executed. The above example is only an example for describing the present disclosure, and the present disclosure is not limited thereto.

이상의 설명은 본 발명의 기술적 사상을 예시적으로 설명한 것에 불과한 것으로, 통상의 기술자라면 본 발명의 본질적인 특성이 벗어나지 않는 범위에서 다양한 변경 및 수정이 가능할 것이다. The above description is merely illustrative of the technical idea of the present invention, and various changes and modifications may be made to those skilled in the art without departing from the essential characteristics of the present invention.

따라서, 본 명세서에 개시된 실시예들은 본 발명의 기술적 사상을 한정하기 위한 것이 아니라, 설명하기 위한 것이고, 이러한 실시예들에 의하여 본 발명의 범위가 한정되는 것은 아니다. Accordingly, the embodiments disclosed in the present specification are not intended to limit the technical spirit of the present invention, but are intended to be described, and the scope of the present invention is not limited by these embodiments.

본 발명의 보호범위는 청구범위에 의하여 해석되어야 하며, 그와 동등한 범위 내에 있는 모든 기술 사상은 본 발명의 권리범위에 포함되는 것으로 이해되어야 한다. The scope of protection of the present invention should be interpreted by the claims, and all technical ideas within the scope equivalent thereto should be understood as being included in the scope of the present invention.

Claims (7)

컨트롤러가 수행하는 펌웨어 내 반환 명령어 난독화 방법에 있어서,
초기화(Initialization) 모듈을 통해 디바이스 내 상기 컨트롤러와 별도로 존재하는 보안칩(Secure Element: SE)으로부터 암호키를 수신하는 단계; 및
상기 암호키 수신하는 단계 이후, 상기 초기화(Initialization) 모듈을 통해 상기 컨트롤러에 포함된 플래시 메모리에 존재하는 암호화된 반환 명령어의 어드레스를 탐색하는 스캐닝 단계를 포함하는,
반환 명령어 난독화 방법.
In the method of obfuscation of the return command in the firmware performed by the controller,
Receiving an encryption key from a secure element (SE) that exists separately from the controller in the device through an initialization module; And
After the step of receiving the encryption key, a scanning step of searching for an address of an encrypted return command existing in a flash memory included in the controller through the initialization module,
How to obfuscate the return instruction.
제1항에 있어서,
상기 스캐닝 단계에서 탐색한 어드레스를 수집하고, 상기 초기화(Initialization) 모듈을 통해 상기 컨트롤러에 포함된 정적 메모리(SRAM)내에 인덱스화하여 저장하는 어드레스 저장 단계를 더 포함하는,
반환 명령어 난독화 방법.
The method of claim 1,
An address storage step of collecting the address searched in the scanning step, indexing and storing the address in the static memory (SRAM) included in the controller through the initialization module,
How to obfuscate the return instruction.
제1항에 있어서,
상기 암호키를 수신하는 단계 이후,
상기 수신한 암호키를 상기 컨트롤러에 포함된 정적 메모리(SRAM)에 저장하는 단계를 더 포함하는,
반환 명령어 난독화 방법.
The method of claim 1,
After the step of receiving the encryption key,
Further comprising the step of storing the received encryption key in a static memory (SRAM) included in the controller,
How to obfuscate the return instruction.
제1항에 있어서,
상기 초기화 모듈(Initialization Module)은,
코드 인스트루먼테이션 과정을 통해 소스 바이너리 파일에 삽입되며, 상기 플래시 메모리에 독립적으로 존재하는 모듈인,
반환 명령어 난독화 방법.
The method of claim 1,
The initialization module (Initialization Module),
A module that is inserted into a source binary file through a code instrumentation process and independently exists in the flash memory,
How to obfuscate the return instruction.
제1항 내지 제3항의 반환 명령어 난독화 방법에 의해 난독화된 반환 명령어를 컨트롤러에서 실행하는 방법에 있어서,
상기 플래시 메모리에 기저장된 펌웨어를 실행할 때, 정적 메모리(SRAM)에 저장된 암호키를 이용하여 상기 암호화된 반환 명령어를 복호화하고, 상기 복호화된 반환 명령어를 실행하는 실행(Runtime) 단계를 포함하는,
난독화된 반환 명령어 실행방법.
In the method of executing the return instruction obfuscated by the return instruction obfuscation method of claims 1 to 3 in a controller,
When executing the firmware previously stored in the flash memory, the encrypted return command is decrypted using an encryption key stored in a static memory (SRAM), and a runtime step of executing the decrypted return command,
How to execute obfuscated return command.
제5항에 있어서,
상기 실행(Runtime) 단계는,
상기 컨트롤러가 상기 암호화된 반환 명령어를 실행하기 이전에 반환 제어 흐름(Return Control Flow) 모듈을 실행하는 단계를 더 포함하는,
난독화된 반환 명령어 실행방법.
The method of claim 5,
The run (Runtime) step,
Further comprising the step of executing a Return Control Flow module before the controller executes the encrypted return command,
How to execute obfuscated return command.
제6항에 있어서,
상기 반환 제어 흐름(Return Control Flow) 모듈은,
코드 인스트루먼테이션 과정을 통해 소스 바이너리 파일에 삽입되며, 상기 암호화된 반환 명령어를 복호화하여 실행하는 모듈이며,
상기 컨트롤러가 펌웨어 실행하여, 상기 반환 제어 흐름(Return Control Flow) 모듈이 호출신호를 받으면,
상기 정적 메모리(SRAM)에 저장된 어드레스를 로드하는 단계;
상기 암호화된 반환 명령어를 상기 암호키를 이용하여 복호화하며, 상기 복호화된 명령어를 정적 메모리(SRAM)에 저장하는 단계; 및
상기 정적 메모리(SRAM)에 저장된 복호화된 명령어를 실행하는 단계를 포함하는,
난독화된 반환 명령어 실행방법.

The method of claim 6,
The return control flow module,
A module that is inserted into a source binary file through a code instrumentation process, and decrypts and executes the encrypted return command,
When the controller executes the firmware and the Return Control Flow module receives a call signal,
Loading an address stored in the static memory (SRAM);
Decrypting the encrypted return command using the encryption key and storing the decrypted command in a static memory (SRAM); And
Including the step of executing the decoded instruction stored in the static memory (SRAM),
How to execute obfuscated return command.

KR1020190070006A 2019-06-13 2019-06-13 How to obfuscate return commands and how to execute obfuscated return commands KR102258408B1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
KR1020190070006A KR102258408B1 (en) 2019-06-13 2019-06-13 How to obfuscate return commands and how to execute obfuscated return commands

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
KR1020190070006A KR102258408B1 (en) 2019-06-13 2019-06-13 How to obfuscate return commands and how to execute obfuscated return commands

Publications (2)

Publication Number Publication Date
KR20200142754A true KR20200142754A (en) 2020-12-23
KR102258408B1 KR102258408B1 (en) 2021-05-28

Family

ID=74089458

Family Applications (1)

Application Number Title Priority Date Filing Date
KR1020190070006A KR102258408B1 (en) 2019-06-13 2019-06-13 How to obfuscate return commands and how to execute obfuscated return commands

Country Status (1)

Country Link
KR (1) KR102258408B1 (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20120138582A (en) * 2011-06-15 2012-12-26 주식회사 터보테크 A device for software obfuscation and a system for software security treatment
KR101265099B1 (en) * 2011-06-15 2013-05-20 주식회사 터보테크 A Method For Software Security Treatment And A Storage Medium
KR20170055933A (en) 2015-11-12 2017-05-22 삼성전자주식회사 Method and apparatus for protecting kernel control-flow integrity using static binary instrumentaiton

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20120138582A (en) * 2011-06-15 2012-12-26 주식회사 터보테크 A device for software obfuscation and a system for software security treatment
KR101265099B1 (en) * 2011-06-15 2013-05-20 주식회사 터보테크 A Method For Software Security Treatment And A Storage Medium
KR20170055933A (en) 2015-11-12 2017-05-22 삼성전자주식회사 Method and apparatus for protecting kernel control-flow integrity using static binary instrumentaiton

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
김순곤, "가상화 기반 난독화 및 역난독화를 위한 코드 자동 분석 기술", 한국정보전자통신기술학회논문지 Vol.11 No.6, 2018.12.15. *

Also Published As

Publication number Publication date
KR102258408B1 (en) 2021-05-28

Similar Documents

Publication Publication Date Title
US10853270B2 (en) Cryptographic pointer address encoding
Braden et al. Leakage-Resilient Layout Randomization for Mobile Devices.
EP3779745B1 (en) Code pointer authentication for hardware flow control
US20160210216A1 (en) Application Control Flow Models
US20110191848A1 (en) Preventing malicious just-in-time spraying attacks
US20160275019A1 (en) Method and apparatus for protecting dynamic libraries
Zhang et al. Cryptographic key protection against FROST for mobile devices
US10528729B2 (en) Methods and systems for defending against cyber-attacks
EP3126973A1 (en) Method, apparatus, and computer-readable medium for obfuscating execution of application on virtual machine
Payer et al. String oriented programming: When ASLR is not enough
Morton et al. Security risks in asynchronous web servers: When performance optimizations amplify the impact of data-oriented attacks
Shi et al. InfoShield: A security architecture for protecting information usage in memory
WO2017218175A1 (en) Timely randomized memory protection
Aga et al. Smokestack: Thwarting DOP attacks with runtime stack layout randomization
Habibi et al. DisARM: mitigating buffer overflow attacks on embedded devices
Gupta et al. Marlin: Mitigating code reuse attacks using code randomization
Zhang et al. A code protection scheme by process memory relocation for android devices
EP3224759B1 (en) In-memory attack prevention
RU2467389C1 (en) Method of protecting software and dataware from unauthorised use
KR102258408B1 (en) How to obfuscate return commands and how to execute obfuscated return commands
de Assumpção et al. Forensic method for decrypting TPM-protected BitLocker volumes using Intel DCI
US11361070B1 (en) Protecting devices from remote code execution attacks
Zonouz et al. Dynamic memory protection via Intel SGX-supported heap allocation
Alouneh et al. A software approach for stack memory protection based on duplication and randomisation
Friedman et al. Chronomorphic programs: Runtime diversity prevents exploits and reconnaissance

Legal Events

Date Code Title Description
E701 Decision to grant or registration of patent right
GRNT Written decision to grant