JP2022048593A - Audit device, audit method, audit program. and audit system - Google Patents

Audit device, audit method, audit program. and audit system Download PDF

Info

Publication number
JP2022048593A
JP2022048593A JP2020154489A JP2020154489A JP2022048593A JP 2022048593 A JP2022048593 A JP 2022048593A JP 2020154489 A JP2020154489 A JP 2020154489A JP 2020154489 A JP2020154489 A JP 2020154489A JP 2022048593 A JP2022048593 A JP 2022048593A
Authority
JP
Japan
Prior art keywords
audit
function
identification information
beginning
program
Prior art date
Legal status (The legal status 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 status listed.)
Granted
Application number
JP2020154489A
Other languages
Japanese (ja)
Other versions
JP6827244B1 (en
Inventor
昌展 平
Masanobu Taira
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Attc Co Ltd
Original Assignee
Attc Co Ltd
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 Attc Co Ltd filed Critical Attc Co Ltd
Priority to JP2020154489A priority Critical patent/JP6827244B1/en
Application granted granted Critical
Publication of JP6827244B1 publication Critical patent/JP6827244B1/en
Publication of JP2022048593A publication Critical patent/JP2022048593A/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

To provide an audit device, an audit method and an audit program for preventing the execution of an unauthorized program altered by an attack using a software vulnerability.SOLUTION: An audit device 1 executes a second process of an audit target program that can be connected to a first process included in an audit program. A monitoring device inserts an instruction statement into the audit target program to acquire common identification information that the first process and the second process can acquire, respectively. Further, the monitoring device inserts a statement to be connected to the first process at the beginning and the end of a predetermined function of the audit target program. The first process of the monitoring device acquires address information at the beginning and the end of the function when determining that identification information acquired in the first process and the second process match. When it is determining that the address information at the beginning of the function and the address information at the end of the function do not match, the processing of the second process is stopped.SELECTED DRAWING: Figure 1

Description

本発明は、ソフトウェアの脆弱性を利用した攻撃により改ざんされた不正なプログラムの実行を防止する技術に関する。 The present invention relates to a technique for preventing the execution of a malicious program tampered with by an attack using a software vulnerability.

ソフトウェアの脆弱性を利用した攻撃の代表としてバッファオーバーフロー攻撃が知られている。プログラムの動作において関数を呼び出す際に、元の動作に戻るためにリターンアドレスが、メモリ領域に格納される。このリターンアドレスが改ざんされることで、プログラムが不正な動作を起こす問題が生じている。 A buffer overflow attack is known as a representative of attacks that utilize software vulnerabilities. When calling a function in the operation of a program, the return address is stored in the memory area in order to return to the original operation. By tampering with this return address, there is a problem that the program behaves illegally.

特許文献1において、バッファオーバーフローの発生を防ぐためにプログラムを変換する変換装置に関する技術が開示されている。 Patent Document 1 discloses a technique relating to a conversion device that converts a program in order to prevent the occurrence of a buffer overflow.

特許文献2において、プログラム開発者によるプログラム修正作業を行うことなく、プログラムに使用される高級言語に依存することなく、バッファオーバーフローによる不正なプログラムの実行を防止する技術が開示されている。 Patent Document 2 discloses a technique for preventing the execution of an illegal program due to a buffer overflow without performing program modification work by a program developer and without depending on a high-level language used for the program.

特開2013-196512号公報Japanese Unexamined Patent Publication No. 2013-196512 特許5777843号公報Japanese Patent No. 5777843

しかしながら、特許文献1や特許文献2に記載の技術は、何れもアドレス情報がメモリ領域の範囲かを判定することで、プログラムが不正に書き換えられたとしてプログラムの実行を停止させることが開示されている。一方、このような手法において、所定のメモリ領域におけるプログラムの書き換えを検知し防止できるものの、その精度において改善の余地があった。 However, it is disclosed that the techniques described in Patent Document 1 and Patent Document 2 both stop the execution of the program as if the program was illegally rewritten by determining whether the address information is within the range of the memory area. There is. On the other hand, although such a method can detect and prevent rewriting of a program in a predetermined memory area, there is room for improvement in its accuracy.

また、プログラム処理によりバッファオーバーフローを防止する技術は、当該プログラムを直接に攻撃されるリスクが存在する点において、十分な安全性は保証されておらず、改善の余地があった。 In addition, the technology for preventing buffer overflow by program processing is not guaranteed to be sufficiently safe in that there is a risk of being directly attacked by the program, and there is room for improvement.

上述したような実状に鑑みて、本発明は、ソフトウェアの脆弱性を利用した攻撃により改ざんされた不正なプログラムの実行を防止する監査装置、監査方法、監査システムおよび、監査プログラムを提供することを解決すべき課題とする。 In view of the above-mentioned circumstances, the present invention provides an audit device, an audit method, an audit system, and an audit program for preventing the execution of an unauthorized program tampered with by an attack utilizing a software vulnerability. It is an issue to be solved.

上述した課題を解決するために、本発明は、監査対象プログラムにおける改ざんを検知する処理を実行する第1のプロセスと、前記監査対象プログラムを実行し、前記第1のプロセスに接続可能な第2のプロセスと、を実行する監査装置であって、前記監査対象プログラムに、前記第1のプロセスおよび前記第2のプロセスにおいてそれぞれ取得可能な共通の識別情報を取得させる命令文を挿入する識別情報取得命令挿入部と、前記監査対象プログラムに含まれる所定の関数の冒頭部および末尾部に、前記第1のプロセスに接続させる命令文を挿入する接続命令挿入部と、前記第2のプロセスから接続される前記第1のプロセスにおいて、前記第1のプロセスおよび前記第2のプロセスにおいて取得される前記識別情報が一致することを判定する場合、前記関数の冒頭部および末尾部におけるアドレス情報を少なくとも取得し、前記関数の冒頭部におけるアドレス情報と前記関数の末尾部におけるアドレス情報が一致しないと判定する場合、前記第2のプロセスの処理を停止させる判定部と、を備える。 In order to solve the above-mentioned problems, the present invention has a first process for executing a process for detecting tampering in the audited program and a second process for executing the audited program and being able to connect to the first process. Identification information acquisition, which is an audit device that executes the process, and inserts a command statement into the audit target program to acquire common identification information that can be acquired in the first process and the second process, respectively. The instruction insertion unit, the connection instruction insertion unit that inserts the instruction statement to be connected to the first process, and the connection instruction insertion unit that inserts the instruction statement to be connected to the first process are connected to the beginning and end of the predetermined function included in the audit target program from the second process. In the first process, when it is determined that the identification information acquired in the first process and the identification information in the second process match, at least the address information at the beginning and the end of the function is acquired. When it is determined that the address information at the beginning of the function and the address information at the end of the function do not match, a determination unit for stopping the processing of the second process is provided.

このような構成とすることで、監査対象プログラムに、監査対象プログラムにおける第2のプロセスとは別の第1のプロセスに接続させることで、第2のプロセスを中断し、第1のプロセスにおいてプログラムの改ざんを検知することができるため、監査対象プログラムにおいて不正なプログラムが実行されることを未然に防ぐことができる。接続された第1のプロセスは、監査対象プログラムから独立したプログラムが実行するプロセスであるため、直接的に攻撃を受けるリスクを低減することができる。また、関数の冒頭部および末尾部のアドレスを比較する判定手法とすることで、確度の高い改ざんの検知を可能とする。 With such a configuration, the audited program is connected to the first process different from the second process in the audited program, thereby interrupting the second process and programming in the first process. Since the tampering can be detected, it is possible to prevent an unauthorized program from being executed in the audited program. Since the connected first process is a process executed by a program independent of the audited program, the risk of being directly attacked can be reduced. In addition, by using a judgment method that compares the addresses at the beginning and end of the function, it is possible to detect falsification with high accuracy.

本発明の好ましい形態では、前記識別情報取得命令挿入部は、予め指定された特定のファイルパスを前記第2のプロセスに割り当てられるプロセス空間にマッピングさせ、前記ファイルパスに対応する先頭アドレスを前記識別情報として取得させる命令文を挿入する。
このような構成とすることで、第1のプロセスおよび第2のプロセスにおいて共通で取得することができ、且つランダム性を有する識別情報を取得することができる。
In a preferred embodiment of the present invention, the identification information acquisition command insertion unit maps a specific file path specified in advance to the process space assigned to the second process, and identifies the start address corresponding to the file path. Insert a statement to be acquired as information.
With such a configuration, identification information that can be acquired in common in the first process and the second process and has randomness can be acquired.

本発明の好ましい形態では、前記第2のプロセスから接続される前記第1のプロセスにおいて、前記第1のプロセスおよび前記第2のプロセスにおいて取得される前記識別情報が一致することを判定した場合、前記関数の末尾部において取得されるアドレス情報を、前記関数の冒頭部において取得されるアドレス情報に更新する更新部を備える。
このような構成とすることで、関数末尾部におけるアドレス情報が関数冒頭部におけるアドレス情報に更新されるため、不正に改ざんされたアドレス情報を用いたプログラムの処理の実行を防止することができる。
In a preferred embodiment of the present invention, when it is determined in the first process connected from the second process that the identification information acquired in the first process and the second process match. It is provided with an update unit that updates the address information acquired at the end of the function with the address information acquired at the beginning of the function.
With such a configuration, the address information at the end of the function is updated to the address information at the beginning of the function, so that it is possible to prevent the execution of program processing using the address information that has been tampered with illegally.

本発明は、監査対象プログラムにおける改ざんを検知する処理を実行する第1のプロセスと、前記監査対象プログラムを実行し、前記第1のプロセスに接続可能な第2のプロセスと、をコンピュータが実行する監査方法であって、前記監査対象プログラムに、前記第1のプロセスおよび前記第2のプロセスにおいてそれぞれ取得可能な共通の識別情報を取得させる命令文を挿入する識別情報取得命令挿入ステップと、前記監査対象プログラムに含まれる所定の関数の冒頭部および末尾部に、前記第1のプロセスに接続させる接続命令文を挿入する接続命令挿入ステップと、前記第2のプロセスから接続される前記第1のプロセスにおいて、前記第1のプロセスおよび前記第2のプロセスにおいて取得される前記識別情報が一致することを判定した場合、前記関数の冒頭部および末尾部におけるアドレス情報を少なくとも取得し、前記関数の冒頭部におけるアドレス情報と前記関数の末尾部におけるアドレス情報が一致しないと判定する場合、前記第2のプロセスの処理を停止させる判定ステップと、をコンピュータが実行する。 In the present invention, the computer executes a first process for executing a process for detecting tampering in the audit target program and a second process for executing the audit target program and being able to connect to the first process. The audit method includes an identification information acquisition command insertion step for inserting a command statement for acquiring common identification information that can be acquired in the first process and the second process into the audit target program, and the audit. A connection command insertion step for inserting a connection command statement to be connected to the first process at the beginning and end of a predetermined function included in the target program, and the first process connected from the second process. When it is determined that the identification information acquired in the first process and the identification information in the second process match, at least the address information at the beginning and the end of the function is acquired, and the beginning of the function. When it is determined that the address information in the above and the address information at the end of the function do not match, the computer executes a determination step of stopping the processing of the second process.

第2のプロセスを動作させる監査対象プログラムにおける改ざんを検知する処理を実行する第1のプロセスを動作させる監査プログラムであって、コンピュータを、前記監査対象プログラムに、前記第1のプロセスおよび前記第2のプロセスにおいてそれぞれ取得可能な共通の識別情報を取得させる命令文を挿入する識別情報取得命令挿入部と、前記監査対象プログラムに含まれる所定の関数の冒頭部および末尾部に、前記第1のプロセスに接続させる接続命令文を挿入する接続命令挿入部と、前記第2のプロセスから接続される前記第1のプロセスにおいて、前記第1のプロセスおよび前記第2のプロセスにおいて取得される前記識別情報が一致することを判定した場合、前記関数の冒頭部および末尾部におけるアドレス情報を少なくとも取得し、前記関数の冒頭部におけるアドレス情報と前記関数の末尾部におけるアドレス情報が一致しないと判定する場合、前記第2のプロセスの処理を停止させる判定部と、として機能させる。 An audit program that operates a first process that executes a process for detecting tampering in an audit target program that operates a second process, and is a computer, the audit target program, the first process, and the second process. The first process is at the beginning and end of the identification information acquisition instruction insertion unit that inserts the instruction statement to acquire the common identification information that can be acquired in each of the processes, and the predetermined function included in the audit target program. In the connection command insertion unit that inserts the connection command statement to be connected to the second process, and the identification information acquired in the first process and the second process in the first process connected from the second process. When it is determined that they match, at least the address information at the beginning and the end of the function is acquired, and when it is determined that the address information at the beginning of the function and the address information at the end of the function do not match, the above It functions as a determination unit for stopping the processing of the second process.

監査対象プログラムにおける改ざんを検知する処理を実行する第1のプロセスを動作させる監査装置と、前記監査対象プログラムを実行し、前記第1のプロセスとプロセス間通信により接続可能な第2のプロセスを動作させる監査対象装置と、を備える監査システムであって、前記監査装置は、前記監査対象プログラムに、前記第1のプロセスおよび前記第2のプロセスにおいてそれぞれ取得可能な共通の識別情報を取得させる命令文を挿入する識別情報取得命令挿入部と、前記監査対象プログラムに含まれる所定の関数の冒頭部および末尾部に、前記第1のプロセスに接続させる命令文を挿入する接続命令挿入部と、前記第2のプロセスから接続される前記第1のプロセスにおいて、前記第1のプロセスおよび前記第2のプロセスにおいて取得される前記識別情報が一致することを判定する場合、前記関数の冒頭部および末尾部におけるアドレス情報を少なくとも取得し、前記関数の冒頭部におけるアドレス情報と前記関数の末尾部におけるアドレス情報が一致しないと判定する場合、前記第2のプロセスの処理を停止させる判定部と、を備える。 An audit device that operates a first process that executes a process for detecting tampering in the audit target program, and a second process that executes the audit target program and can be connected to the first process by inter-process communication. An audit system including an audit target device to be operated, wherein the audit device causes the audit target program to acquire common identification information that can be acquired in the first process and the second process, respectively. The identification information acquisition command insertion section for inserting the above, the connection command insertion section for inserting the instruction statement to be connected to the first process at the beginning and the end of the predetermined function included in the audit target program, and the first. In the first process connected from the second process, when it is determined that the identification information acquired in the first process and the second process match, at the beginning and the end of the function. When at least the address information is acquired and it is determined that the address information at the beginning of the function and the address information at the end of the function do not match, a determination unit for stopping the processing of the second process is provided.

本発明によれば、ソフトウェアの脆弱性を利用した攻撃により改ざんされた不正なプログラムの実行を防止する監査装置、監査方法、監査プログラムおよび、監査システムを提供することができる。 INDUSTRIAL APPLICABILITY According to the present invention, it is possible to provide an audit device, an audit method, an audit program, and an audit system that prevent the execution of an unauthorized program tampered with by an attack utilizing a software vulnerability.

本発明の実施形態における、監査装置のハードウェア構成例を示す。An example of the hardware configuration of the audit device according to the embodiment of the present invention is shown. 本発明の実施形態における、識別情報取得命令挿入部の処理フローチャートを示す。The processing flowchart of the identification information acquisition command insertion part in embodiment of this invention is shown. 本発明の実施形態における、接続命令挿入部の処理フローチャートを示す。The processing flowchart of the connection command insertion part in the Embodiment of this invention is shown. 本発明の実施形態における、関数冒頭部の接続命令挿入部の処理を示す。In the embodiment of the present invention, the processing of the connection command insertion portion at the beginning of the function is shown. 本発明の実施形態における、関数末尾部の接続命令挿入部の処理を示す。In the embodiment of the present invention, the processing of the connection command insertion portion at the end of the function is shown. 本発明の実施形態における、第1のプロセスの処理フローチャートを示す。The processing flowchart of the 1st process in embodiment of this invention is shown. 本発明の実施形態における、スタックの一例を示す。An example of the stack in the embodiment of the present invention is shown.

以下、図面を用いて、本発明の実施形態に関する監査装置について説明する。なお、以下に示す実施形態は本発明の一例であり、本発明を以下の実施形態に限定するものではなく、様々な構成を採用することもできる。 Hereinafter, the auditing apparatus according to the embodiment of the present invention will be described with reference to the drawings. The embodiments shown below are examples of the present invention, and the present invention is not limited to the following embodiments, and various configurations can be adopted.

本実施形態では、監査装置の構成、動作等について説明するが、同様の構成の監査方法、監査プログラムおよび、監査プログラム記録媒体、監査システム等も、同様の作用効果を奏することができる。この監査プログラム記録媒体を用いれば、例えばコンピュータに前述の監査プログラムをインストールすることができる。以下で説明する本実施形態にかかる一連の処理は、コンピュータで実行可能なプログラムとして提供され、CD-ROMやフレキシブルディスクなどの非一時的コンピュータ可読記録媒体、さらには通信回線を経て提供可能である。 In the present embodiment, the configuration, operation, and the like of the audit device will be described, but an audit method, an audit program, an audit program recording medium, an audit system, and the like having the same configuration can also exert the same effects. By using this audit program recording medium, for example, the above-mentioned audit program can be installed on a computer. The series of processes according to the present embodiment described below are provided as a program that can be executed by a computer, and can be provided via a non-temporary computer-readable recording medium such as a CD-ROM or a flexible disk, and further via a communication line. ..

バッファオーバーフローは、例えば、プログラムにおいて、変数に文字列をコピーする場合などで、データを格納するために確保されたバッファ領域の上限を超えてデータが書き込まれることで、隣接するバッファ領域外のデータが上書きされることで生じる。 A buffer overflow is data outside the adjacent buffer area when data is written in excess of the upper limit of the buffer area reserved for storing data, for example, when copying a character string to a variable in a program. Is overwritten.

このバッファオーバーフローを意図的に生じさせるバッファオーバーフロー攻撃は、バッファ領域外に記憶されるリターンアドレスを書き換えることで、不正なプログラムを実行させる。例えば、プログラムにおける関数の被演算子として入力されるデータによりバッファオーバーフローが生じる場合、関数の実行前後においてリターンアドレスが書き換えられる。 A buffer overflow attack that intentionally causes this buffer overflow causes a malicious program to be executed by rewriting the return address stored outside the buffer area. For example, if a buffer overflow occurs due to the data input as the operand of the function in the program, the return address is rewritten before and after the execution of the function.

本実施形態において、監査装置1は、監査対象プログラムに含まれる関数の冒頭部および末尾部において、それぞれのリターンアドレスを取得するための命令を挿入することで、関数の実行前後におけるリターンアドレスを取得し、更に取得したリターンアドレスが一致するか否かを判定することで、不正なプログラムの書き換えを検知することができる。なお、詳しくは後述するが、第1のプロセスにおける、第2のプロセスの関数の冒頭部および末尾部の判定は、特定のシステムコール番号と識別情報との組み合わせによって行う。これにより、関数本体のロジックで、万一、同じシステムコール番号が使用されたとしても、識別情報が合致していない限り、関数の冒頭部および末尾部ではないと判断することができ、誤検知を大幅に減らすことが可能となる。 In the present embodiment, the audit device 1 acquires the return address before and after the execution of the function by inserting an instruction for acquiring the respective return addresses at the beginning and the end of the function included in the audit target program. Further, by determining whether or not the acquired return addresses match, it is possible to detect unauthorized rewriting of the program. As will be described in detail later, in the first process, the determination of the beginning and the end of the function of the second process is performed by the combination of the specific system call number and the identification information. As a result, even if the same system call number is used in the logic of the function body, it can be determined that it is not the beginning and end of the function unless the identification information matches, and false positives are detected. Can be significantly reduced.

本実施形態における、監査装置1は、図1に示すようにハードウェア構成要素として、演算装置(CPU)101、主記憶装置(RAM)102、入力装置103、表示装置104、通信装置105および、補助記憶装置110などを備える。また、補助記憶装置110は、オペレーティングシステム(OS)111と、OS111と協働してその機能を発揮する監査プログラム112と、監査対象プログラム113と、各種データなどと、を記憶している。なお、監査対象プログラム113は、監査装置1とデータ通信可能に構成された監査対象装置(図示せず)の補助記憶装置に記憶されてもよい。また、CPU101は、一時的な記憶回路として複数のレジスタ106を備える。本実施形態において、CPU101はARMプロセッサであり、レジスタ106は、r0からr15の16本の32ビットレジスタである例を説明する。なお、本実施形態において、OS111は、Linux(登録商標)である例を示すが、メモリマップを取得可能な他のOSであってもよい。 As shown in FIG. 1, the audit device 1 in the present embodiment has, as hardware components, an arithmetic unit (CPU) 101, a main storage device (RAM) 102, an input device 103, a display device 104, a communication device 105, and the like. Auxiliary storage device 110 and the like are provided. Further, the auxiliary storage device 110 stores an operating system (OS) 111, an audit program 112 that cooperates with the OS 111 to exert its function, an audit target program 113, various data, and the like. The audit target program 113 may be stored in an auxiliary storage device of an audit target device (not shown) configured to enable data communication with the audit device 1. Further, the CPU 101 includes a plurality of registers 106 as a temporary storage circuit. In this embodiment, an example will be described in which the CPU 101 is an ARM processor and the registers 106 are 16 32-bit registers r0 to r15. Although the OS 111 is an example of Linux (registered trademark) in the present embodiment, it may be another OS capable of acquiring a memory map.

本実施形態において、監査プログラム112は、各命令文の挿入処理や改ざんの判定処理などを含む第1のプロセスをCPU101に実行させる。監査対象プログラム113は、プログラムが改ざんされているか否かの判定の対象とされるプログラムであり、ソースコードにより記述された一連の処理を含む第2のプロセスをCPU101に実行させる。なお、第2のプロセスは、第1のプロセスの子プロセスとして生成される。また、本実施形態では、第1のプロセスと第2のプロセスの間で行われるプロセス間通信は、同一の監査装置1内で行われるローカル通信の実施例を説明するが、第1のプロセスと第2のプロセスがそれぞれ異なるコンピュータで実行され、ネットワークを介してデータ通信を行うシステムとして構成されてもよい。また、以下の説明において、不明確とならない限りCPU101の介在を省略する。 In the present embodiment, the audit program 112 causes the CPU 101 to execute a first process including an insertion process of each instruction statement and a falsification determination process. The audit target program 113 is a program that is a target for determining whether or not the program has been tampered with, and causes the CPU 101 to execute a second process including a series of processes described by the source code. The second process is generated as a child process of the first process. Further, in the present embodiment, the interprocess communication performed between the first process and the second process will be described as an example of local communication performed in the same audit device 1, but the first process and the same. The second process may be executed on different computers and configured as a system for data communication via a network. Further, in the following description, the intervention of the CPU 101 will be omitted unless it is unclear.

本実施形態において、監査対象プログラム113は、C言語により記述される例を説明するが、メモリ操作が可能な他の言語により記述されてもよい。また、本実施形態において、監査プログラム112は、アセンブリ言語により記述される。本実施形態において、監査プログラム112における処理は、第1のプロセスとして実行され、RAM102のメモリ上にプロセス空間が確保される。なお、監査対象プログラム113における処理では、異なるプロセス空間が割り当てられる。プロセス空間は、アドレス空間のうちCPU101でのOS111の処理によって各プロセスに割り当てられた仮想的なアドレス空間をいう。アドレス空間とは、メモリアドレスによってアクセス可能なメモリ空間をいう。各プロセスは、一意な識別子としてプロセスIDをそれぞれ有する。 In the present embodiment, the audit target program 113 will be described in an example described in C language, but may be described in another language capable of memory operation. Further, in the present embodiment, the audit program 112 is described in assembly language. In the present embodiment, the process in the audit program 112 is executed as the first process, and the process space is secured on the memory of the RAM 102. In the process of the audit target program 113, a different process space is allocated. The process space refers to a virtual address space assigned to each process by the processing of the OS 111 by the CPU 101 in the address space. The address space is a memory space that can be accessed by a memory address. Each process has its own process ID as a unique identifier.

監査装置1は、機能構成要素として、識別情報取得命令挿入部201と、接続命令挿入部202と、判定部203と、更新部204と、を備える。本実施形態において、識別情報取得命令挿入部201および接続命令挿入部202は、監査対象プログラム113におけるアプリケーションプログラムの実行ファイルが実行される前の事前処理を実行する。本実施形態において、識別情報取得命令挿入部201および接続命令挿入部202が挿入する命令文は、1以上のコードにより構成されるものとする。 The audit device 1 includes an identification information acquisition command insertion unit 201, a connection command insertion unit 202, a determination unit 203, and an update unit 204 as functional components. In the present embodiment, the identification information acquisition command insertion unit 201 and the connection command insertion unit 202 execute preprocessing before the execution file of the application program in the audit target program 113 is executed. In the present embodiment, the instruction statement inserted by the identification information acquisition instruction insertion unit 201 and the connection instruction insertion unit 202 is composed of one or more codes.

はじめに、本実施形態における事前処理について説明する。事前処理は、監査対象プログラム113に対して実行される。図2は、監査装置1において識別情報取得命令挿入部201が監査対象プログラム113に識別情報を取得するための命令文を挿入する処理の流れを示すフローチャートである。 First, the pretreatment in the present embodiment will be described. The preprocessing is executed for the audit target program 113. FIG. 2 is a flowchart showing a flow of a process in which the identification information acquisition command insertion unit 201 inserts an instruction statement for acquiring identification information into the audit target program 113 in the audit device 1.

監査装置1は、監査対象プログラム113のソースプログラムを冒頭から終端まで順に読み込む(ステップS101)。識別情報取得命令挿入部201は、読み込まれたソースプログラムの関数の冒頭部を判定する(ステップS102)。本実施形態において、判定する関数はmain関数とする。関数の冒頭部が判定された場合(ステップS102においてY)、識別情報取得命令挿入部201は、識別情報を格納するための静的変数の宣言文を、当該関数の冒頭部に挿入する(ステップS103)。これにより、後に取得される識別情報を格納するメモリ領域が確保される。識別情報取得命令挿入部201は、予め指定された特定のファイルパスを第2のプロセスに割り当てられるプロセス空間にマッピングさせるための命令文を挿入する(ステップS104)。マッピングの命令文は、例えば、mmap関数を使用できる。上述の命令文の実行によりプロセス空間にマップされるメモリマップは、OSのカーネルにおいてプロセスの状態を示すデータ構造の情報をマップしたファイルを指し、プロセスIDにより識別されるプロセス別に存在する。メモリマップは、プロセス空間の各領域の開始アドレスおよび終了アドレス並びに、ファイルパスなどを示す。識別情報取得命令挿入部201は、マップされた特定のファイルパスに基づいて、対応する先頭アドレス(開始アドレス)を識別情報として取得し、ステップS103において宣言された静的変数に格納する命令文を挿入する(ステップS105)。例えば、第2のプロセスのプロセスIDをPID2とすると、第2のプロセスにおいて実行されるファイルは、/var/bin/PID2.binというファイルパスを有する。識別情報取得命令挿入部201は、予め指定されたPID2を含むファイルパスに対応する先頭アドレスを取得するような命令文を挿入する。なお、識別情報取得命令挿入部201は、先頭アドレスに代えて終了アドレスを識別情報として取得する命令文を挿入してもよい。監査装置1は、ステップS105までの処理を実行すると、次のコードを読み込み(ステップS106)、ステップS102からステップS105までの処理をソースプログラムの終端まで繰り返す。 The audit device 1 reads the source program of the audit target program 113 in order from the beginning to the end (step S101). The identification information acquisition command insertion unit 201 determines the beginning of the function of the read source program (step S102). In the present embodiment, the determination function is a main function. When the beginning of the function is determined (Y in step S102), the identification information acquisition command insertion unit 201 inserts a static variable declaration statement for storing the identification information at the beginning of the function (step). S103). As a result, a memory area for storing the identification information acquired later is secured. The identification information acquisition command insertion unit 201 inserts a command statement for mapping a specific file path specified in advance to the process space assigned to the second process (step S104). For example, the mmap function can be used as the mapping statement. The memory map mapped to the process space by executing the above-mentioned statement refers to a file that maps the information of the data structure indicating the process state in the OS kernel, and exists for each process identified by the process ID. The memory map shows the start address and end address of each area of the process space, the file path, and the like. The identification information acquisition command insertion unit 201 acquires a corresponding start address (start address) as identification information based on a specific mapped file path, and stores an instruction statement to be stored in a static variable declared in step S103. Insert (step S105). For example, assuming that the process ID of the second process is PID2, the file executed in the second process has a file path of /var/bin/PID2.bin. The identification information acquisition command insertion unit 201 inserts a command statement for acquiring the start address corresponding to the file path including the PID 2 specified in advance. The identification information acquisition command insertion unit 201 may insert a command statement to acquire the end address as identification information instead of the start address. When the audit device 1 executes the process up to step S105, it reads the next code (step S106) and repeats the process from step S102 to step S105 until the end of the source program.

ステップS101からステップS106までの処理によって、各命令文が挿入された監査対象プログラム113が実行されることで、監査装置1は、第2のプロセスにおいて識別情報を取得できる。また、本実施形態において取得される識別情報は、第2のプロセスのプロセスIDによって特定されるため、親プロセスである第1のプロセスでも同様の手法により、共通の識別情報を取得可能であり、更にランダム性を有するという特徴がある。なお、上述した特徴を有する識別情報であれば、本実施形態と異なる手法により識別情報が取得されてもよく、例えば、第1のプロセスにおいて、事前に共通の識別情報を第2のプロセスに受け渡す処理を実行する等、様々な手法を採用することができる。このとき、識別情報は、プロセス空間のメモリアドレスとして用いられる偶数ではなく、所定の奇数による固定値を用いる構成とすることが好ましい。 By executing the audit target program 113 into which each instruction statement is inserted by the processes from step S101 to step S106, the audit device 1 can acquire the identification information in the second process. Further, since the identification information acquired in the present embodiment is specified by the process ID of the second process, common identification information can be acquired by the same method in the first process, which is the parent process. Furthermore, it is characterized by having randomness. If the identification information has the above-mentioned characteristics, the identification information may be acquired by a method different from that of the present embodiment. For example, in the first process, the common identification information is received in advance by the second process. Various methods can be adopted, such as executing the process of passing. At this time, it is preferable that the identification information uses a fixed value of a predetermined odd number instead of an even number used as a memory address in the process space.

識別情報を取得するための処理について異なる実施形態の例を説明する。異なる実施形態において識別情報は、第2のプロセスのプロセスID(PID2)のハッシュ値とする。識別情報取得命令挿入部201は、ステップS103において静的変数の宣言文を挿入後、PID2を取得する命令文を挿入する。更に、識別情報取得命令挿入部201は、ハッシュ関数に取得したPID2を引数として入力する命令文を挿入する。識別情報取得命令挿入部201は、上述のハッシュ関数の戻り値として得られるハッシュ値を識別情報として取得し、ステップS103において宣言された静的変数に格納する命令文を挿入する。これら挿入された命令文が実行されることで、監査装置1は、第2のプロセスにおいて識別情報を取得できる。なお、ハッシュ値の文字列は任意の長さとしてよいが、データ量と強度の観点から8文字(32bit)程度の長さとすることが好ましい。 Examples of different embodiments of the process for acquiring the identification information will be described. In different embodiments, the identification information is a hash value of the process ID (PID2) of the second process. The identification information acquisition command insertion unit 201 inserts a command statement for acquiring PID 2 after inserting a static variable declaration statement in step S103. Further, the identification information acquisition command insertion unit 201 inserts an instruction statement for inputting the acquired PID 2 as an argument to the hash function. The identification information acquisition instruction insertion unit 201 acquires the hash value obtained as the return value of the above-mentioned hash function as identification information, and inserts an instruction statement to be stored in the static variable declared in step S103. By executing these inserted statements, the auditing apparatus 1 can acquire the identification information in the second process. The character string of the hash value may have an arbitrary length, but it is preferably about 8 characters (32 bits) from the viewpoint of the amount of data and the strength.

図3は、監査装置1において接続命令挿入部202が監査対象プログラム113に、監査対象プログラム113における改ざんを検知するための第1のプロセスに接続させるための処理を示す命令文を挿入する処理の流れを示すフローチャートである。 FIG. 3 shows a process of inserting a command statement indicating a process for connecting the connection command insertion unit 202 in the audit device 1 to the audit target program 113 to connect to the first process for detecting tampering in the audit target program 113. It is a flowchart which shows the flow.

監査装置1は、監査対象プログラム113のソースファイル格納ディレクトリを冒頭から読み込み(ステップS201)、ディレクトリに格納されるソースファイルをディレクトリの冒頭から読み込む(ステップS202)。監査装置1は、高級言語により記述されたソースコードをアセンブリコードに変換し(ステップS203)、変換されたアセンブリコードを冒頭から読み込む(ステップS204)。接続命令挿入部202は、読み込まれたアセンブリコードにおける関数の冒頭部を判定する(ステップS205)。関数の冒頭部が判定された場合(ステップS205においてY)、接続命令挿入部202は、監査プログラム112における第1のプロセスに接続する処理を実行する命令文を挿入する(ステップS206)。接続命令挿入部202は、アセンブリコードにおける関数の末尾部を判定する(ステップS207)。関数の末尾部が判定された場合(ステップS207においてY)、接続命令挿入部202は、監査プログラム112の第1のプロセスに接続するための処理を実行する命令文を挿入する(ステップS208)。 The audit device 1 reads the source file storage directory of the audit target program 113 from the beginning (step S201), and reads the source file stored in the directory from the beginning of the directory (step S202). The audit device 1 converts the source code written in the high-level language into assembly code (step S203), and reads the converted assembly code from the beginning (step S204). The connection command insertion unit 202 determines the beginning of the function in the read assembly code (step S205). When the beginning of the function is determined (Y in step S205), the connection instruction insertion unit 202 inserts an instruction statement that executes a process of connecting to the first process in the audit program 112 (step S206). The connection instruction insertion unit 202 determines the end of the function in the assembly code (step S207). When the end of the function is determined (Y in step S207), the connection instruction insertion unit 202 inserts an instruction statement that executes a process for connecting to the first process of the audit program 112 (step S208).

本実施形態において、関数の冒頭部に命令文を挿入するための詳細な処理(ステップS206)について、図4を参照し、説明する。図4(a)は、ステップS205において関数の冒頭部が判定された場合の続く処理に関するフローチャートを示す。図4(b)は、関数の冒頭部および冒頭部に挿入する命令文の一例を示す。接続命令挿入部202は、関数の冒頭部を示す所定のコードC1の指定を予め受け付け、コードC1を判定した次の行において、コードC2(命令文)を挿入する。なお、コードC3は、リターンアドレスをスタックに格納する命令を含むコードであり、コードC1は、コードC3より上の行に記述されるコードであれば任意のものが指定されてよい。なお、図4(b)におけるコードC2は、命令文の一部のみを示す。 In the present embodiment, a detailed process (step S206) for inserting a command statement at the beginning of the function will be described with reference to FIG. FIG. 4A shows a flowchart regarding the subsequent processing when the beginning of the function is determined in step S205. FIG. 4B shows an example of a statement to be inserted at the beginning and the beginning of a function. The connection command insertion unit 202 receives the designation of the predetermined code C1 indicating the beginning of the function in advance, and inserts the code C2 (command statement) in the next line where the code C1 is determined. The code C3 is a code including an instruction for storing the return address on the stack, and the code C1 may be any code as long as it is a code described in a line above the code C3. The code C2 in FIG. 4B shows only a part of the instruction statement.

はじめに、接続命令挿入部202は、所定のレジスタ106(r0,r1,r7,r9,r10)に格納されるデータをプッシュする命令文を挿入する(ステップS301)。プッシュとは、データをスタック領域に一時的にスタックする処理を示す。ステップS301で挿入された命令文が実行されることで、関数の本体処理で必要なレジスタに格納されている情報をスタックに退避させることができる。接続命令挿入部202は、コードC3が実行されることでリターンアドレスが格納されるリンクレジスタ(lr)の位置をスタック格納順としてレジスタr9に格納する命令文を挿入する(ステップS302)。図7(a)は、コードC3は実行されることで、格納されるスタックの例を示す。フレームポインタ(fp)は、フレーム中の特定の位置を示すレジスタであり、図7(a)では、スタック格納順の基準となる位置(0)を示す。接続命令挿入部202は、ステップS103において宣言した識別情報の格納用静的変数のアドレスを取得し(ステップS303)、ステップS303において取得したアドレスを参照した結果をレジスタr10にロードする命令文を挿入する(ステップS304)。接続命令挿入部202は、関数の冒頭部を示すコール番号(図4(b)の例では#199)を含む接続命令文を挿入する(ステップS305)。挿入された接続命令が実行されることで、第2のプロセスから第1のプロセスに処理が受け渡される。接続命令挿入部202は、ステップS301においてプッシュされたレジスタ106をポップする命令文を挿入し(ステップS306)、処理を完了する。ポップとは、スタックされたデータを順に取り出す処理を示す。これにより、関数本体で必要なレジスタ情報を復帰することができる。 First, the connection instruction insertion unit 202 inserts an instruction statement for pushing data stored in a predetermined register 106 (r0, r1, r7, r9, r10) (step S301). Push refers to the process of temporarily stacking data in the stack area. By executing the statement inserted in step S301, the information stored in the register required for the main body processing of the function can be saved in the stack. The connection instruction insertion unit 202 inserts an instruction statement to be stored in the register r9 with the position of the link register (ll) in which the return address is stored as the stack storage order when the code C3 is executed (step S302). FIG. 7A shows an example of a stack that is stored by executing the code C3. The frame pointer (fp) is a register indicating a specific position in the frame, and in FIG. 7A, it indicates a position (0) that is a reference of the stack storage order. The connection instruction insertion unit 202 acquires an address of the static variable for storing the identification information declared in step S103 (step S303), and inserts an instruction statement to load the result of referring to the address acquired in step S303 into the register r10. (Step S304). The connection instruction insertion unit 202 inserts a connection instruction statement including a call number indicating the beginning of the function (# 199 in the example of FIG. 4B) (step S305). By executing the inserted connection instruction, the process is passed from the second process to the first process. The connection command insertion unit 202 inserts a command statement to pop the register 106 pushed in step S301 (step S306), and completes the process. Pop refers to the process of fetching stacked data in order. As a result, the register information required by the function body can be restored.

ステップS301~ステップS306において挿入された命令文が実行されることで、第2のプロセスにおいて実行される関数の冒頭部におけるリターンアドレスを所定のレジスタに格納し、第1のプロセスに接続する処理が実行される。なお、本実施形態において、これらの命令文が実行されることで、第2のプロセスにおいてレジスタ106に格納される一連のデータをレジスタ情報と定義する。 By executing the statement inserted in steps S301 to S306, the process of storing the return address at the beginning of the function executed in the second process in a predetermined register and connecting to the first process is performed. Will be executed. In the present embodiment, by executing these instruction statements, a series of data stored in the register 106 in the second process is defined as register information.

本実施形態において、関数の末尾部に命令文を挿入するための詳細な処理(ステップS208)について、図5を参照し、説明する。図5(a)は、ステップS207において関数の末尾部が判定された場合の続く処理に関するフローチャートを示す。図5(b)は、関数の末尾部および末尾部に挿入する命令文の一例を示す。コード(C4-C6)は、図4(b)におけるコード(C1-C3)にそれぞれ対応する関数の末尾用コードをそれぞれ示す。 In the present embodiment, a detailed process (step S208) for inserting an instruction statement at the end of the function will be described with reference to FIG. FIG. 5A shows a flowchart regarding the subsequent processing when the end of the function is determined in step S207. FIG. 5B shows an example of a statement to be inserted at the end and the end of a function. The code (C4-C6) indicates the end code of the function corresponding to the code (C1-C3) in FIG. 4 (b).

接続命令挿入部202は、関数の戻り値であるレジスタr0に格納されるデータをレジスタr9に退避する命令文を挿入する(ステップS401)。接続命令挿入部202は、ステップS103において宣言した識別情報の格納用の静的変数のアドレスを取得し(ステップS402)、当該アドレスを参照した結果をレジスタr10にロードする命令文を挿入する(ステップS403)。接続命令挿入部202は、関数の末尾部を示すコール番号(図5(b)の例では#200)を含む接続命令文を挿入し(ステップS404)、処理を完了する。ステップS401~ステップS404において挿入された命令文が実行されることで、第2のプロセスにおいて実行される関数の末尾部におけるリターンアドレスを第1のプロセスに受け渡すことができる。 The connection instruction insertion unit 202 inserts an instruction statement for saving the data stored in the register r0, which is the return value of the function, to the register r9 (step S401). The connection instruction insertion unit 202 acquires the address of the static variable for storing the identification information declared in step S103 (step S402), and inserts an instruction statement to load the result of referring to the address into the register r10 (step). S403). The connection instruction insertion unit 202 inserts a connection instruction statement including a call number indicating the end of the function (# 200 in the example of FIG. 5B) (step S404), and completes the process. By executing the statement inserted in steps S401 to S404, the return address at the end of the function executed in the second process can be passed to the first process.

本実施形態において、上述したステップS305およびステップS404において挿入される接続命令文は、システムコール関数を含む命令文であり、実行されることで第2のプロセスから第1のプロセスにシステムコールし、処理を受け渡すために用いられる一連の処理を定義する。システムコール関数は、「getuid」「getpid」「getgid」等の関数本体のロジックに影響を与えない参照系の関数から任意のものを採用することができる。 In the present embodiment, the connection statement inserted in step S305 and step S404 described above is a statement including a system call function, and when executed, a system call is made from the second process to the first process. Defines a series of processes used to pass processes. As the system call function, any reference function such as "getuid", "getpid", "getgid", etc., which does not affect the logic of the function body can be adopted.

以上に示した事前処理によって、監査装置1は、監査対象プログラム113に各種命令文を挿入し、監査対象プログラム113は、挿入された命令文を実行することで、関数の冒頭部および末尾部の所定のポイントで処理を第1のプロセスに受け渡すことができるプログラムに変換された。続いて、図6を参照しながら、監査プログラム112における第1のプロセスの処理および、変換された監査対象プログラム113における第2のプロセスの処理について説明する。 By the preprocessing shown above, the audit device 1 inserts various instructions into the audit target program 113, and the audit target program 113 executes the inserted instructions to form the beginning and end of the function. It was converted into a program that can pass the process to the first process at a given point. Subsequently, with reference to FIG. 6, the processing of the first process in the audit program 112 and the processing of the second process in the converted audit target program 113 will be described.

はじめに、監査装置1は、第1のプロセスにおいて識別情報を取得する(ステップS501)。具体的には、監査装置1は、引数で指定された監査対象プログラム113の起動コマンドを取得し、更に、psコマンドを実行することで監査対象プログラム113における第2のプロセスのプロセスIDを取得する。続いて、監査装置1は、取得したプロセスIDのメモリマップを参照することで、当該プロセスIDを有する特定のファイルパスに対応する先頭アドレスを識別情報として取得することができる。これによって、第2のプロセスにおいて取得される識別情報と共通の識別情報が、第1のプロセスにおいて取得される。なお、識別情報としてハッシュ値を用いる実施形態において、監査装置1は、取得した第2のプロセスのプロセスID(PID2)を、共通のハッシュ関数の引数として入力することで、戻り値として得られたハッシュ値を識別情報として取得することができる。 First, the audit device 1 acquires the identification information in the first process (step S501). Specifically, the audit device 1 acquires the start command of the audit target program 113 specified by the argument, and further acquires the process ID of the second process in the audit target program 113 by executing the ps command. .. Subsequently, the audit device 1 can acquire the start address corresponding to the specific file path having the process ID as the identification information by referring to the memory map of the acquired process ID. As a result, the identification information common to the identification information acquired in the second process is acquired in the first process. In the embodiment in which the hash value is used as the identification information, the audit device 1 is obtained as a return value by inputting the acquired process ID (PID2) of the second process as an argument of the common hash function. The hash value can be acquired as identification information.

監査装置1は、識別情報を取得後、第2のプロセス(監査対象プログラム113)に接続し、処理を受け渡す(ステップS502)。監査装置1は、第2のプロセスにおいて、事前処理において挿入された命令文を実行し、識別情報の取得し、識別情報の格納用静的変数に識別情報を格納する。監査装置1は、第2のプロセスにおいて、関数の冒頭部に挿入された接続命令によって、第1のプロセスに接続する。これにより、第2のプロセスがシステムコールを行う直前で、第1のプロセスによって、第2のプロセスの処理を中断させることができるようになる。すなわち、不正な処理が実行される前に監査を行うことが可能となる。 After acquiring the identification information, the audit device 1 connects to the second process (audit target program 113) and hands over the process (step S502). In the second process, the audit device 1 executes the instruction statement inserted in the preprocessing, acquires the identification information, and stores the identification information in the static variable for storing the identification information. In the second process, the audit device 1 connects to the first process by the connection instruction inserted at the beginning of the function. As a result, the processing of the second process can be interrupted by the first process immediately before the second process makes a system call. That is, it is possible to perform an audit before an illegal process is executed.

監査装置1は、第1のプロセスにおいて、第2のプロセスに挿入された接続命令文によるシステムコールが実行されたことを確認し(ステップS503)、接続命令文に含まれるコール番号が関数の冒頭部を示すコール番号か否かを判定する(ステップS504)。監査装置1は、関数冒頭部を示すコール番号と判定した場合(ステップS504においてY)、第2のプロセスにおいてレジスタ106に格納されたレジスタ情報を取得する(ステップS505)。監査装置1は、ステップS501で第1のプロセスにおいて取得された識別情報と、ステップS505で第2のプロセスにおいて取得されたレジスタ情報に含まれる識別情報と、が一致するか否かを判定する(ステップS506)。識別情報が一致すると判定された場合(ステップS506においてY)、監査装置1は、所定のレジスタ106に格納されるデータを独自スタックとして格納する(ステップS507)。このときスタックされるデータは、図7(b)に示すように、スタック格納順(r9)、フレームポインタ(fp)および、リターンアドレス(lr)を少なくとも含む。これにより、第1のプロセスは、監査対象プログラム113における関数冒頭部のリターンアドレスを第1のプロセスにおけるリンクレジスタ(lr)として一時的に格納することができる。監査装置1は、続くステップS508において、関数末尾部を示すコール番号でないと判定し(ステップS508においてN)、システムコールによって中断していた第2のプロセスの元の処理を再開する(ステップS603)。 The audit device 1 confirms that the system call by the connection instruction inserted in the second process has been executed in the first process (step S503), and the call number included in the connection instruction is the beginning of the function. It is determined whether or not the call number indicates a unit (step S504). When the audit device 1 determines that the call number indicates the beginning of the function (Y in step S504), the audit device 1 acquires the register information stored in the register 106 in the second process (step S505). The auditing apparatus 1 determines whether or not the identification information acquired in the first process in step S501 and the identification information included in the register information acquired in the second process in step S505 match (. Step S506). When it is determined that the identification information matches (Y in step S506), the auditing apparatus 1 stores the data stored in the predetermined register 106 as an original stack (step S507). As shown in FIG. 7B, the data stacked at this time includes at least the stack storage order (r9), the frame pointer (fp), and the return address (ll). As a result, the first process can temporarily store the return address at the beginning of the function in the audit target program 113 as a link register (ll) in the first process. In the following step S508, the audit device 1 determines that the call number does not indicate the end of the function (N in step S508), and resumes the original processing of the second process interrupted by the system call (step S603). ..

処理を再開した第2のプロセスは、関数の末尾部に挿入された接続命令文が実行されることによって、第1のプロセスによって、再び処理を中断する。2回目の接続命令には関数の末尾部を示すコール番号が含まれ、監査装置1は、ステップS508において、関数の末尾部を示すコール番号であると判定し(ステップS508においてY)、第2のプロセスの関数末尾部までの処理においてレジスタ106に格納されたレジスタ情報を取得する(ステップS509)。監査装置1は、ステップS506と同様に、識別情報の一致を判定した場合(ステップS510)、ステップS507において独自スタックに一時的に格納されたデータ(スタック格納順、フレームポインタ、リターンアドレス)を取得する(ステップS511)。ここで、ステップS509においてレジスタ情報として取得された関数の末尾部におけるリターンアドレスをアドレス情報A1とし、ステップS511において取得された関数の冒頭部におけるリターンアドレスをアドレス情報A2とする。判定部203は、アドレス情報A1およびアドレス情報A2をそれぞれ取得し、アドレス情報が一致するか否かを判定し(ステップS512)、それらが一致すれば処理を続行し、一致しなければ処理を停止させる。 The second process that has resumed processing suspends processing again by the first process by executing the connection statement inserted at the end of the function. The second connection instruction includes a call number indicating the end of the function, and the auditing apparatus 1 determines in step S508 that the call number indicates the end of the function (Y in step S508), and the second is Acquires the register information stored in the register 106 in the process up to the end of the function of the process (step S509). Similar to step S506, when the audit device 1 determines that the identification information matches (step S510), the audit device 1 acquires the data (stack storage order, frame pointer, return address) temporarily stored in the original stack in step S507. (Step S511). Here, the return address at the end of the function acquired as register information in step S509 is referred to as address information A1, and the return address at the beginning of the function acquired in step S511 is referred to as address information A2. The determination unit 203 acquires the address information A1 and the address information A2, respectively, determines whether or not the address information matches (step S512), continues the process if they match, and stops the process if they do not match. Let me.

続いて、判定部203による判定処理(ステップS512)の詳細を説明する。判定部203は、レジスタ106のスタックポインタに格納されるアドレスから所定のデータ量のデータを取得する(ステップS601)。スタックポインタとは、スタック領域の一番上のアドレスを示す。判定部203は、例えば、1ワード分のデータと、スタック領域に格納されたスタック格納順と、を積算することで、スタックポインタからリターンアドレスが格納されるリンクレジスタまでのオフセットを算出する(ステップS602)。これによって、リターンアドレスのオフセットが算出される。判定部203は、算出されたオフセットに基づいて、当該オフセットの位置から所定のデータ量(例えば、1ワード分など)のデータを取得する(ステップS603)。取得されたデータは、関数の末尾部のリターンアドレスが含まれる。判定部203は、ステップS511において取得された関数の冒頭部のリターンアドレス(アドレス情報A2)および、ステップS603において取得された関数の末尾部のリターンアドレス(アドレス情報A1)が一致するか否かを判定する(ステップS604)。リターンアドレスが一致しない場合(ステップS604においてN)、判定部203は、リターンアドレスが改ざんされていると判定し、第2のプロセスによるプログラムの処理を停止させる(ステップS605)。リターンアドレスが一致する場合(ステップS604においてY)、判定部203は、リターンアドレスが改ざんされていないものと判定し、第2のプロセスによるプログラムの処理を続行させる(ステップS606)。 Subsequently, the details of the determination process (step S512) by the determination unit 203 will be described. The determination unit 203 acquires a predetermined amount of data from the address stored in the stack pointer of the register 106 (step S601). The stack pointer indicates the top address of the stack area. The determination unit 203 calculates the offset from the stack pointer to the link register in which the return address is stored by integrating, for example, the data for one word and the stack storage order stored in the stack area (step). S602). As a result, the offset of the return address is calculated. The determination unit 203 acquires data of a predetermined amount of data (for example, one word) from the position of the offset based on the calculated offset (step S603). The retrieved data contains the return address at the end of the function. The determination unit 203 determines whether or not the return address (address information A2) at the beginning of the function acquired in step S511 and the return address (address information A1) at the end of the function acquired in step S603 match. Determination (step S604). If the return addresses do not match (N in step S604), the determination unit 203 determines that the return address has been tampered with, and stops the processing of the program by the second process (step S605). When the return addresses match (Y in step S604), the determination unit 203 determines that the return addresses have not been tampered with, and continues the processing of the program by the second process (step S606).

ステップS512における判定処理の異なる実施形態について説明する。ステップS511において監査装置1が独自スタックよりデータを取得すると、更新部204は、独自スタックに格納されたデータに基づいて、第2のプロセスにおけるレジスタ106に格納されるデータを更新する。図7(c)は、本実施形態におけるレジスタ106のデータ更新の概要を示す。更新部204は、独自スタックのリターンアドレスを第1のプロセスのプログラムカウンタpcに、独自スタックのフレームポインタを、スタックポインタを格納する第1のプロセスのレジスタspに、それぞれ更新する。これによって、関数の冒頭部から末尾部までの処理において、リターンアドレスが改ざんされた場合であっても、改ざん前のリターンアドレスに更新されるため、不正なプログラムが実行されることを防止できる。 An embodiment of the determination process in step S512 will be described. When the audit device 1 acquires data from the original stack in step S511, the update unit 204 updates the data stored in the register 106 in the second process based on the data stored in the original stack. FIG. 7C shows an outline of data update of the register 106 in this embodiment. The update unit 204 updates the return address of the original stack to the program counter pc of the first process, and the frame pointer of the original stack to the register sp of the first process that stores the stack pointer. As a result, even if the return address is falsified in the processing from the beginning to the end of the function, the return address is updated to the return address before the falsification, so that it is possible to prevent an invalid program from being executed.

また、ステップS604における判定処理の異なる実施形態について説明する。異なる実施形態では、更新部204は、図7(d)に示すように、関数の冒頭部において独自スタックとして格納されたデータによって、関数の末尾部におけるスタックに格納されるデータを更新する。具体的には、更新部204は、第1のプロセスのスタックポインタ(sp)に格納される値と、ステップS602において算出されたオフセットを積算した値を算出する。更新部204は、算出した値のアドレスを独自スタックのリターンアドレスで更新し、「算出した値-1ワード」のアドレスを独自スタックのフレームポインタで更新する。これによって、関数の冒頭部から末尾部の間で、リターンアドレスが改ざんされた場合であっても、改ざん前のリターンアドレスに更新されるため、不正なプログラムが実行されることを防止できる。 Further, different embodiments of the determination process in step S604 will be described. In a different embodiment, the update unit 204 updates the data stored in the stack at the end of the function with the data stored as its own stack at the beginning of the function, as shown in FIG. 7 (d). Specifically, the update unit 204 calculates a value obtained by integrating the value stored in the stack pointer (sp) of the first process and the offset calculated in step S602. The update unit 204 updates the address of the calculated value with the return address of the original stack, and updates the address of "calculated value-1 word" with the frame pointer of the original stack. As a result, even if the return address is tampered with between the beginning and the end of the function, it is updated to the return address before the tampering, so that it is possible to prevent an unauthorized program from being executed.

本実施形態において、監査プログラム112は、監査対象プログラム113に命令文を挿入する事前処理と、監査対象プログラム113の改ざんを検知する処理(ステップS501-ステップS512)と、を実行可能に構成されるが、上述した2つの処理は、それぞれ事前処理を実行する事前処理プログラムと、改ざんを検知する処理を実行する検知処理プログラムと、として監査装置1にインストールされる構成であってもよい。 In the present embodiment, the audit program 112 is configured to be able to execute a pre-process for inserting an instruction statement into the audit target program 113 and a process for detecting alteration of the audit target program 113 (steps S501-step S512). However, the above-mentioned two processes may be configured to be installed in the audit device 1 as a pre-process program for executing the pre-process and a detection process program for executing the process for detecting tampering, respectively.

1 監査装置
101 演算装置(CPU)
102 主記憶装置(RAM)
103 入力装置
104 表示装置
105 通信装置
106 レジスタ
110 補助記憶装置
111 オペレーティングシステム(OS)
112 監査プログラム
113 監査対象プログラム
201 識別情報取得命令挿入部
202 接続命令挿入部
203 判定部
204 更新部
1 Audit device 101 Arithmetic logic unit (CPU)
102 Main memory (RAM)
103 Input device 104 Display device 105 Communication device 106 Register 110 Auxiliary storage device 111 Operating system (OS)
112 Audit program 113 Audit target program 201 Identification information acquisition command insertion section 202 Connection command insertion section 203 Judgment section 204 Update section

Claims (6)

監査対象プログラムにおける改ざんを検知する処理を実行する第1のプロセスと、前記監査対象プログラムを実行し、前記第1のプロセスに接続可能な第2のプロセスと、を実行する監査装置であって、
前記監査対象プログラムに、前記第1のプロセスおよび前記第2のプロセスにおいてそれぞれ取得可能な共通の識別情報を取得させる命令文を挿入する識別情報取得命令挿入部と、
前記監査対象プログラムに含まれる所定の関数の冒頭部および末尾部に、前記第1のプロセスに接続させる命令文を挿入する接続命令挿入部と、
前記第2のプロセスから接続される前記第1のプロセスにおいて、前記第1のプロセスおよび前記第2のプロセスにおいて取得される前記識別情報が一致することを判定する場合、前記関数の冒頭部および末尾部におけるアドレス情報を少なくとも取得し、前記関数の冒頭部におけるアドレス情報と前記関数の末尾部におけるアドレス情報が一致しないと判定する場合、前記第2のプロセスの処理を停止させる判定部と、を備える監査装置。
An audit device that executes a first process that executes a process for detecting tampering in an audit target program, and a second process that executes the audit target program and can be connected to the first process.
An identification information acquisition command insertion unit that inserts an instruction statement for acquiring common identification information that can be acquired in each of the first process and the second process into the audit target program.
At the beginning and end of a predetermined function included in the audit target program, a connection instruction insertion unit that inserts an instruction statement to be connected to the first process, and a connection instruction insertion unit.
In the first process connected from the second process, when it is determined that the identification information acquired in the first process and the second process match, the beginning and the end of the function. When at least the address information in the unit is acquired and it is determined that the address information at the beginning of the function and the address information at the end of the function do not match, a determination unit for stopping the processing of the second process is provided. Audit device.
前記識別情報取得命令挿入部は、予め指定された特定のファイルパスを前記第2のプロセスに割り当てられるプロセス空間にマッピングさせ、前記ファイルパスに対応する先頭アドレスを前記識別情報として取得させる命令文を挿入する請求項1に記載の監査装置。 The identification information acquisition command insertion unit maps a specific file path specified in advance to the process space assigned to the second process, and obtains a command statement corresponding to the file path as the identification information. The audit device according to claim 1 to be inserted. 前記第2のプロセスから接続される前記第1のプロセスにおいて、前記第1のプロセスおよび前記第2のプロセスにおいて取得される前記識別情報が一致することを判定した場合、前記関数の末尾部において取得される前記アドレス情報を、前記関数の冒頭部において取得される前記アドレス情報に更新する更新部を備える請求項1又は請求項2に記載の監査装置。 When it is determined in the first process connected from the second process that the identification information acquired in the first process and the second process match, it is acquired at the end of the function. The audit device according to claim 1 or 2, further comprising an update unit that updates the address information to be updated with the address information acquired at the beginning of the function. 監査対象プログラムにおける改ざんを検知する処理を実行する第1のプロセスと、前記監査対象プログラムを実行し、前記第1のプロセスに接続可能な第2のプロセスと、をコンピュータが実行する監査方法であって、
前記監査対象プログラムに、前記第1のプロセスおよび前記第2のプロセスにおいてそれぞれ取得可能な共通の識別情報を取得させる命令文を挿入する識別情報取得命令挿入ステップと、
前記監査対象プログラムに含まれる所定の関数の冒頭部および末尾部に、前記第1のプロセスに接続させる接続命令文を挿入する接続命令挿入ステップと、
前記第2のプロセスから接続される前記第1のプロセスにおいて、前記第1のプロセスおよび前記第2のプロセスにおいて取得される前記識別情報が一致することを判定した場合、前記関数の冒頭部および末尾部におけるアドレス情報を少なくとも取得し、前記関数の冒頭部におけるアドレス情報と前記関数の末尾部におけるアドレス情報が一致しないと判定する場合、前記第2のプロセスの処理を停止させる判定ステップと、をコンピュータが実行する監査方法。
It is an audit method in which a computer executes a first process that executes a process for detecting tampering in the audit target program and a second process that executes the audit target program and can be connected to the first process. hand,
An identification information acquisition command insertion step for inserting into the audit target program a statement for acquiring common identification information that can be acquired in the first process and the second process, respectively.
A connection instruction insertion step for inserting a connection instruction statement to be connected to the first process at the beginning and end of a predetermined function included in the audit target program.
When it is determined in the first process connected from the second process that the identification information acquired in the first process and the second process match, the beginning and the end of the function. When at least the address information in the unit is acquired and it is determined that the address information at the beginning of the function and the address information at the end of the function do not match, a determination step of stopping the processing of the second process is performed by the computer. The audit method that is performed.
第2のプロセスを動作させる監査対象プログラムにおける改ざんを検知する処理を実行する第1のプロセスを動作させる監査プログラムであって、
コンピュータを、前記監査対象プログラムに、前記第1のプロセスおよび前記第2のプロセスにおいてそれぞれ取得可能な共通の識別情報を取得させる命令文を挿入する識別情報取得命令挿入部と、
前記監査対象プログラムに含まれる所定の関数の冒頭部および末尾部に、前記第1のプロセスに接続させる接続命令文を挿入する接続命令挿入部と、
前記第2のプロセスから接続される前記第1のプロセスにおいて、前記第1のプロセスおよび前記第2のプロセスにおいて取得される前記識別情報が一致することを判定した場合、前記関数の冒頭部および末尾部におけるアドレス情報を少なくとも取得し、前記関数の冒頭部におけるアドレス情報と前記関数の末尾部におけるアドレス情報が一致しないと判定する場合、前記第2のプロセスの処理を停止させる判定部と、として機能させる監査プログラム。
It is an audit program that operates the first process that executes the process of detecting falsification in the audited program that operates the second process.
An identification information acquisition command insertion unit that inserts a statement into the audit target program to acquire common identification information that can be acquired in the first process and the second process, respectively.
A connection instruction insertion unit that inserts a connection instruction statement to be connected to the first process at the beginning and end of a predetermined function included in the audit target program.
When it is determined in the first process connected from the second process that the identification information acquired in the first process and the second process match, the beginning and the end of the function. When at least the address information in the unit is acquired and it is determined that the address information at the beginning of the function and the address information at the end of the function do not match, the function as a determination unit for stopping the processing of the second process. An audit program to let you.
監査対象プログラムにおける改ざんを検知する処理を実行する第1のプロセスを動作させる監査装置と、前記監査対象プログラムを実行し、前記第1のプロセスとプロセス間通信により接続可能な第2のプロセスを動作させる監査対象装置と、を備える監査システムであって、
前記監査装置は、前記監査対象プログラムに、前記第1のプロセスおよび前記第2のプロセスにおいてそれぞれ取得可能な共通の識別情報を取得させる命令文を挿入する識別情報取得命令挿入部と、
前記監査対象プログラムに含まれる所定の関数の冒頭部および末尾部に、前記第1のプロセスに接続させる命令文を挿入する接続命令挿入部と、
前記第2のプロセスから接続される前記第1のプロセスにおいて、前記第1のプロセスおよび前記第2のプロセスにおいて取得される前記識別情報が一致することを判定する場合、前記関数の冒頭部および末尾部におけるアドレス情報を少なくとも取得し、前記関数の冒頭部におけるアドレス情報と前記関数の末尾部におけるアドレス情報が一致しないと判定する場合、前記第2のプロセスの処理を停止させる判定部と、を備える監査システム。
An audit device that operates a first process that executes a process for detecting tampering in the audit target program, and a second process that executes the audit target program and can be connected to the first process by interprocess communication. It is an audit system equipped with an audit target device to be operated.
The audit device includes an identification information acquisition command insertion unit that inserts an instruction statement for acquiring common identification information that can be acquired in the first process and the second process into the audit target program.
At the beginning and end of a predetermined function included in the audit target program, a connection instruction insertion unit that inserts an instruction statement to be connected to the first process, and a connection instruction insertion unit.
In the first process connected from the second process, when it is determined that the identification information acquired in the first process and the second process match, the beginning and the end of the function. When at least the address information in the unit is acquired and it is determined that the address information at the beginning of the function and the address information at the end of the function do not match, a determination unit for stopping the processing of the second process is provided. Audit system.
JP2020154489A 2020-09-15 2020-09-15 Auditing equipment, auditing methods, auditing programs and auditing systems Active JP6827244B1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2020154489A JP6827244B1 (en) 2020-09-15 2020-09-15 Auditing equipment, auditing methods, auditing programs and auditing systems

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2020154489A JP6827244B1 (en) 2020-09-15 2020-09-15 Auditing equipment, auditing methods, auditing programs and auditing systems

Publications (2)

Publication Number Publication Date
JP6827244B1 JP6827244B1 (en) 2021-02-10
JP2022048593A true JP2022048593A (en) 2022-03-28

Family

ID=74529584

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2020154489A Active JP6827244B1 (en) 2020-09-15 2020-09-15 Auditing equipment, auditing methods, auditing programs and auditing systems

Country Status (1)

Country Link
JP (1) JP6827244B1 (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5732272A (en) * 1995-07-31 1998-03-24 Apple Computer, Inc. Subroutine execution time tracer
JP2010238228A (en) * 2009-03-30 2010-10-21 Samsung Electronics Co Ltd Method and device for dynamically analyzing program
JP2017505492A (en) * 2014-02-10 2017-02-16 エイアールエム リミテッド Area specification operation to specify the area of the memory attribute unit corresponding to the target memory address
US20190205190A1 (en) * 2016-05-24 2019-07-04 Orange Method for identifying at least one function of an operating system kernel
JP2019121203A (en) * 2018-01-09 2019-07-22 株式会社Attc Conversion device, conversion program, and program conversion method

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5732272A (en) * 1995-07-31 1998-03-24 Apple Computer, Inc. Subroutine execution time tracer
JP2010238228A (en) * 2009-03-30 2010-10-21 Samsung Electronics Co Ltd Method and device for dynamically analyzing program
JP2017505492A (en) * 2014-02-10 2017-02-16 エイアールエム リミテッド Area specification operation to specify the area of the memory attribute unit corresponding to the target memory address
US20190205190A1 (en) * 2016-05-24 2019-07-04 Orange Method for identifying at least one function of an operating system kernel
JP2019121203A (en) * 2018-01-09 2019-07-22 株式会社Attc Conversion device, conversion program, and program conversion method

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
八木 毅 TAKESHI YAGI 他, コンピュータネットワークセキュリティ COMPUTER NETWORK SECURITY, vol. 初版, JPN6020049468, 10 April 2015 (2015-04-10), pages 69 - 70, ISSN: 0004413841 *
木村 宏一 KOUICHI KIMURA, 情報セキュリティスペシャリスト完全攻略, vol. 第1版, JPN6020049470, 25 October 2008 (2008-10-25), pages 243 - 245, ISSN: 0004413842 *
齋藤 孝道 TAKAMICHI SAITO 他: "プログラムローダを用いたメモリ破壊攻撃群への対策技術の提案と実装 Safe Trans Loader: Mitigation and", SCIS2016 [USB] SCIS2016 2016 SYMPOSIUM ON CRYPTOGR, vol. 3B3-3, JPN6020049466, 22 January 2016 (2016-01-22), pages 1 - 8, ISSN: 0004413840 *

Also Published As

Publication number Publication date
JP6827244B1 (en) 2021-02-10

Similar Documents

Publication Publication Date Title
TW538376B (en) Analytical virtual machine
CN105980993B (en) Data processing apparatus and method
US7581089B1 (en) Method of protecting a computer stack
US11507669B1 (en) Characterizing, detecting and healing vulnerabilities in computer code
JP6189039B2 (en) Data processing apparatus and method using secure domain and low secure domain
TWI725059B (en) An apparatus and method for controlling use of bounded pointers
JP2008257735A (en) Protected function calling
JP7128206B2 (en) Apparatus and method for managing use of features
US11727110B2 (en) Verifying stack pointer
CN111400702A (en) Virtualized operating system kernel protection method
JP6435834B2 (en) Instruction execution control device and instruction execution control method
JP2023038361A (en) Apparatus and method for controlling change in instruction set
CN114902178A (en) Domain transfer disable configuration parameters
JP5777843B1 (en) Processor, processing device, and program creation method
JP6827244B1 (en) Auditing equipment, auditing methods, auditing programs and auditing systems
JP7349437B2 (en) Controlling protection tag checking on memory accesses
WO2018235858A1 (en) Information processing monitoring device, information processing monitoring method, program, recording medium and information processing device
US11256631B1 (en) Enhanced security via dynamic regions for memory protection units (MPUs)
US11216280B2 (en) Exception interception
JP2006106939A (en) Hacking detection method, hacking detection apparatus, and program
WO2023209323A1 (en) Exception return state lock parameter
CN113220412A (en) Virtual machine process detection method, system and medium
TW202131191A (en) An apparatus and method for controlling access to a set of memory mapped control registers
CN114902180A (en) Intermode call branch instructions
GB2485602A (en) Executing a program with a smaller address size than the processor on which it is executing

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20200915

A871 Explanation of circumstances concerning accelerated examination

Free format text: JAPANESE INTERMEDIATE CODE: A871

Effective date: 20200915

A975 Report on accelerated examination

Free format text: JAPANESE INTERMEDIATE CODE: A971005

Effective date: 20201112

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20201222

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20201228

R150 Certificate of patent or registration of utility model

Ref document number: 6827244

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250