JP5437913B2 - Code area identification device, code area identification method, and code area identification program - Google Patents
Code area identification device, code area identification method, and code area identification program Download PDFInfo
- Publication number
- JP5437913B2 JP5437913B2 JP2010121487A JP2010121487A JP5437913B2 JP 5437913 B2 JP5437913 B2 JP 5437913B2 JP 2010121487 A JP2010121487 A JP 2010121487A JP 2010121487 A JP2010121487 A JP 2010121487A JP 5437913 B2 JP5437913 B2 JP 5437913B2
- Authority
- JP
- Japan
- Prior art keywords
- program
- branch
- boundary
- program code
- memory
- 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.)
- Active
Links
Images
Description
本発明は、コード領域識別装置、コード領域識別方法及びコード領域識別プログラムに関する。 The present invention relates to a code area identification device, a code area identification method, and a code area identification program.
コンピュータウィルスやスパイウェアといった悪意のあるコンピュータプログラムが知られている。このような悪意のあるコンピュータプログラムは、「マルウェア」と呼ばれており、コンピュータの内部資源に悪影響を及ぼす。近年では、マルウェア対策として、マルウェアを形成するプログラムコードを解析することが一般に行われている。 Malicious computer programs such as computer viruses and spyware are known. Such a malicious computer program is called “malware” and adversely affects the internal resources of the computer. In recent years, as a countermeasure against malware, it is a common practice to analyze a program code that forms malware.
ところで、マルウェアは、プログラムコードの解析作業を困難にすることを目的として、ランタイムパッカーと呼ばれるツールによりパッキング処理が施され、プログラムコードが隠蔽されていることが多い。具体的に説明すると、ランタイムパッカーは、実行形式のマルウェアを入力された場合に、プログラムコードを隠蔽しつつ実行形式のファイルを生成する。ランタイムパッカーによってパッキング処理が施されたマルウェアは、実行時に、プログラムコードを復元するアンパッキング処理を行うとともに、通常はOS(Operating System)等のローダによって行われる動的リンクライブラリのリンク処理等を施した後に、エントリポイントへ処理を渡す。なお、以下では、パッキング処理が施される前のマルウェアを形成するプログラムコードを「オリジナルコード」と表記する場合がある。 By the way, in order to make it difficult to analyze the program code, malware is often packed by a tool called a runtime packer to conceal the program code. More specifically, when an executable malware is input, the runtime packer generates an executable file while hiding the program code. Malware that has been packed by the runtime packer performs unpacking that restores the program code at the time of execution, and link processing of a dynamic link library that is normally performed by a loader such as an OS (Operating System). After that, the process is passed to the entry point. In the following, the program code forming the malware before the packing process is performed may be referred to as “original code”.
すなわち、マルウェアを解析する場合には、ランタイムパッカーによってパッキング処理された後のマルウェアからオリジナルコードを抽出することになる。オリジナルコードの抽出手法としては、例えば、ランタイムパッカーに対応するアンパッカーを用いて、アンパッキング後のマルウェアからオリジナルコードを抽出することが考えられる。また、例えば、全てのメモリアクセスを監視した状態でマルウェアを実行し、書き込みアクセスが発生したメモリ領域に対して実行アクセスが発生した場合に、かかるメモリ領域内のデータを抽出することで、マルウェアのオリジナルコードを抽出することが考えられる。 That is, when analyzing the malware, the original code is extracted from the malware after being packed by the runtime packer. As an original code extraction method, for example, it is conceivable to extract an original code from unpacked malware using an unpacker corresponding to a runtime packer. In addition, for example, when malware is executed in a state where all memory accesses are monitored, and execution access occurs for a memory area where write access occurs, the data in the memory area is extracted to extract malware in the memory area. It is possible to extract the original code.
しかしながら、上記の従来技術には、オリジナルコードの解析工数が増大するという問題がある。具体的には、アンパッカーを用いる従来技術では、アンパッカーを開発する工数が増大するので、その結果、オリジナルコードの解析工数が増大する。具体的には、ランタイムパッカーの種類は非常に多いので、ランタイムパッカー毎にアンパッカーを開発するには、多大な開発工数や開発コストを要する。さらに、マルウェアの作成者が独自に開発したランタイムパッカー等の未公開であるランタイムパッカーも存在するので、そもそも全てのランタイムパッカーに対応するアンパッカーを開発することは現実的でない。 However, the above prior art has a problem that the man-hours for analyzing the original code increase. Specifically, in the conventional technique using an unpacker, the man-hour for developing the unpacker increases, and as a result, the man-hour for analyzing the original code increases. Specifically, since there are so many types of runtime packers, it takes a lot of development man-hours and development costs to develop an unpacker for each runtime packer. Furthermore, since there are undisclosed runtime packers such as a runtime packer originally developed by the malware creator, it is not realistic to develop unpackers that correspond to all runtime packers in the first place.
また、メモリに書き込まれたデータを抽出する従来技術では、オリジナルコード以外のプログラムコードも抽出する可能性が高い。例えば、かかる従来技術では、マルウェア実行後のメモリ確保時に特定されるメモリの基点アドレスと、基点アドレスからのサイズとを用いて、マルウェア実行時に確保されたメモリ領域からプログラムコードを抽出することが考えられる。なお、以下では、メモリ確保時の基点アドレスから確保されたサイズ分までの領域を「メモリリージョン」と表記する場合がある。また、以下では、マルウェア実行時にメモリ領域に書き込まれるコードを「動的生成コード」と表記する場合がある。 Further, in the conventional technique for extracting data written in the memory, there is a high possibility of extracting program codes other than the original code. For example, in such a conventional technique, it is considered that the program code is extracted from the memory area secured at the time of executing the malware using the base address of the memory specified at the time of securing the memory after executing the malware and the size from the base point address. It is done. In the following description, an area from the base address at the time of memory allocation to the allocated size may be referred to as “memory region”. In the following, the code written in the memory area when executing malware may be referred to as “dynamically generated code”.
ここで、ランタイムパッカーによっては、事前に連続する複数のメモリリージョンを確保し、確保した複数のメモリリージョンに動的生成コードを展開するように、マルウェアをパッキングするものがある。このような場合には、連続する複数のメモリリージョンから動的生成コードを抽出するべきであるが、抽出した動的生成コードには、オリジナルコード以外の動的リンクライブラリ等が含まれる可能性がある。これは、上述したように、ランタイムパッカーによってパッキング処理が施されたマルウェアは、実行時に、動的リンクライブラリのリンク処理等を施すからである。すなわち、オリジナルコードが格納されているメモリリージョンと、動的リンクライブラリが格納されているメモリリージョンとが隣接する場合には、連続する複数のメモリリージョンからオリジナルコードと動的リンクライブラリ等を抽出することになる。このようにオリジナルコードと動的リンクライブラリ等を抽出すると、オリジナルコードだけでなく、動的リンクライブラリ等についても解析対象となるので、オリジナルコードの解析工数が増大する。 Here, some runtime packers pack a malware so that a plurality of continuous memory regions are secured in advance, and dynamically generated code is expanded in the secured memory regions. In such a case, the dynamically generated code should be extracted from a plurality of consecutive memory regions. However, the extracted dynamically generated code may include a dynamic link library other than the original code. is there. This is because, as described above, malware that has been subjected to packing processing by the runtime packer performs link processing of the dynamic link library at the time of execution. That is, when the memory region storing the original code and the memory region storing the dynamic link library are adjacent to each other, the original code, the dynamic link library, etc. are extracted from a plurality of consecutive memory regions. It will be. If the original code and the dynamic link library are extracted in this way, not only the original code but also the dynamic link library and the like are to be analyzed, so the number of man-hours for analyzing the original code increases.
本発明は、上記に鑑みてなされたものであって、オリジナルコードの解析工数を低減することができるコード領域識別装置、コード領域識別方法及びコード領域識別プログラムを提供することを目的とする。 The present invention has been made in view of the above, and an object of the present invention is to provide a code area identification device, a code area identification method, and a code area identification program capable of reducing the man-hours for analyzing an original code.
上述した課題を解決し、目的を達成するために、本発明に係るコード領域識別装置は、所定の記憶空間毎に区切られた記憶領域のうちプログラム実行時に前記プログラムを形成するプログラムコードが展開される記憶空間を識別するコード領域識別装置であって、前記記憶領域に含まれる記憶空間に対する実行アクセスが行われるたびに、該記憶空間と連続して隣接し、かつ、使用中である記憶空間群に格納されているプログラムコードを取得する取得部と、前記取得部によって取得されたプログラムコードを解析することで、相対アドレスによって命令を指定する分岐命令を含む分岐元記憶空間と、該相対アドレスが示す命令を含む分岐先記憶空間とに挟まれる分岐区域を特定し、記憶空間の境界毎に前記分岐区域に該境界が含まれる頻度を算出する算出部と、前記算出部によって算出された頻度が所定の閾値以下である境界が前記プログラムを形成するプログラムコードと、該プログラムコードと異なるプログラムコードとが展開されているプログラム境界であると判定する判定部とを有することを特徴とする。 In order to solve the above-described problems and achieve the object, the code area identification device according to the present invention has a program code that develops the program at the time of program execution in a storage area divided for each predetermined storage space. A storage area group that is continuously adjacent to and in use each time execution access is made to a storage space included in the storage area. An acquisition unit that acquires the program code stored in the storage unit, a branch source storage space that includes a branch instruction that specifies an instruction by a relative address by analyzing the program code acquired by the acquisition unit, and the relative address is The frequency at which a branch area sandwiched between the branch destination storage space including the instruction to be specified is specified and the boundary is included in the branch area for each storage space boundary The calculation unit to calculate, and the boundary where the frequency calculated by the calculation unit is equal to or less than a predetermined threshold is a program boundary in which a program code forming the program and a program code different from the program code are expanded And a determination unit for determining.
また、本発明に係るコード領域識別方法は、所定の記憶空間毎に区切られた記憶領域のうちプログラム実行時に前記プログラムを形成するプログラムコードが展開される記憶空間を識別するコード領域識別方法であって、コンピュータが、前記記憶領域に含まれる記憶空間に対する実行アクセスが行われるたびに、該記憶空間と連続して隣接し、かつ、使用中である記憶空間群に格納されているプログラムコードを取得する取得工程と、前記取得工程によって取得されたプログラムコードを解析することで、相対アドレスによって命令を指定する分岐命令を含む分岐元記憶空間と、該相対アドレスが示す命令を含む分岐先記憶空間とに挟まれる分岐区域を特定し、記憶空間の境界毎に前記分岐区域に該境界が含まれる頻度を算出する算出工程と、前記算出工程によって算出された頻度が所定の閾値以下である境界が前記プログラムを形成するプログラムコードと、該プログラムコードと異なるプログラムコードとが展開されているプログラム境界であると判定する判定工程とを含むことを特徴とする。 The code area identification method according to the present invention is a code area identification method for identifying a storage space in which a program code forming the program is expanded during execution of a program among storage areas divided for each predetermined storage space. Each time execution access is made to the storage space included in the storage area, the computer obtains a program code stored in the storage space group that is continuously adjacent to the storage space and in use. An acquisition step, a branch source storage space including a branch instruction that specifies an instruction by a relative address by analyzing the program code acquired by the acquisition step, and a branch destination storage space including an instruction indicated by the relative address A calculation step of identifying a branching area sandwiched between the two and calculating a frequency at which the boundary is included in the branching area for each boundary of the storage space A determination step for determining that a boundary whose frequency calculated by the calculation step is equal to or less than a predetermined threshold is a program boundary in which a program code forming the program and a program code different from the program code are expanded; It is characterized by including.
また、本発明に係るコード領域識別プログラムは、コンピュータを上記のコード領域識別装置として機能させることを特徴とする。 A code area identification program according to the present invention causes a computer to function as the code area identification device.
本発明に係るコード領域識別装置、コード領域識別方法及びコード領域識別プログラムは、オリジナルコードの解析工数を低減することができるという効果を奏する。 The code area identification device, the code area identification method, and the code area identification program according to the present invention have an effect that the man-hours for analyzing the original code can be reduced.
以下に、本発明に係るコード領域識別装置、コード領域識別方法及びコード領域識別プログラムの実施例を図面に基づいて詳細に説明する。なお、この実施例により本発明が限定されるものではない。 Hereinafter, embodiments of a code area identification device, a code area identification method, and a code area identification program according to the present invention will be described in detail with reference to the drawings. In addition, this invention is not limited by this Example.
[実施例1に係るオリジナルコード抽出装置の概要]
まず、図1を用いて、実施例1に係るオリジナルコード抽出装置による処理の概要を説明する。図1は、実施例1に係るオリジナルコード抽出装置による処理の概要を説明するための図である。
[Outline of Original Code Extraction Apparatus According to Embodiment 1]
First, the outline of the process performed by the original code extraction apparatus according to the first embodiment will be described with reference to FIG. FIG. 1 is a diagram for explaining an overview of processing performed by the original code extraction apparatus according to the first embodiment.
実施例1に係るオリジナルコード抽出装置は、例えば検証環境等において、解析対象のマルウェアを実行する。なお、実行対象のマルウェアは、ランタイムパッカーによってパッキング処理が施されているものとする。また、かかるマルウェアは、実行された場合に、図1に示すように、複数のメモリリージョン11〜19が割り当てられるものとする。なお、図面に表記した「リージョンN」は、メモリリージョンNに対応する。 The original code extraction apparatus according to the first embodiment executes malware to be analyzed in, for example, a verification environment. It is assumed that the malware to be executed has been packed by the runtime packer. Further, when such malware is executed, a plurality of memory regions 11 to 19 are assigned as shown in FIG. Note that “region N” shown in the drawing corresponds to the memory region N.
ここで、マルウェアに割り当てられたメモリリージョン11〜19には、かかるマルウェアを形成するプログラムコード(オリジナルコード)だけが書き込みされるとは限らない。例えば、マルウェアのオリジナルコードは、メモリリージョン13〜15に書き込まれ、他のメモリリージョン11、12及び16〜19には、マルウェアのオリジナルコードによって呼び出される動的リンクライブラリ等が書き込まれる場合がある。すなわち、マルウェアに割り当てられたメモリリージョン11〜19に書き込まれた全ての動的生成コードを抽出した場合には、抽出した動的生成コードにオリジナルコード以外のプログラムコードが含まれる場合がある。マルウェアの解析作業においては、オリジナルコードだけを解析できればよいので、オリジナルコード以外のプログラムコードを抽出することは、解析工数が増大するという問題を招く。そこで、実施例1に係るオリジナルコード抽出装置は、マルウェア実行時に割り当てられたメモリリージョン11〜19から、オリジナルコードを抽出する処理を行う。
Here, only the program code (original code) forming the malware is not necessarily written in the memory regions 11 to 19 assigned to the malware. For example, the original code of the malware is written in the
具体的には、実施例1に係るオリジナルコード抽出装置は、マルウェア実行後に、マルウェアに割り当てられたメモリリージョン11〜19に書き込まれたプログラムコードを取得し、取得したプログラムコードを逆アセンブル等することで解析する。そして、実施例1に係るオリジナルコード抽出装置は、相対アドレスによって他の命令を呼び出す分岐命令が格納されているメモリリージョンと、かかる相対アドレスが示すメモリリージョンとを特定する。以下では、相対アドレス指定によって他の命令を呼び出す分岐命令が格納されているメモリリージョンを「分岐元メモリリージョン」と表記し、かかる相対アドレスが示すメモリリージョンを「分岐先メモリリージョン」と表記する場合がある。 Specifically, the original code extraction apparatus according to the first embodiment acquires the program code written in the memory regions 11 to 19 assigned to the malware after executing the malware, and disassembles the acquired program code. Analyze with. Then, the original code extraction apparatus according to the first embodiment specifies a memory region in which a branch instruction for calling another instruction is stored using a relative address, and a memory region indicated by the relative address. In the following, a memory region that stores a branch instruction that calls another instruction by specifying a relative address is referred to as a “branch source memory region”, and a memory region indicated by the relative address is referred to as a “branch destination memory region” There is.
そして、実施例1に係るオリジナルコード抽出装置は、相対アドレス指定による分岐命令ごとに、分岐元メモリリージョンと分岐先メモリリージョンとの組合せを特定し、分岐元メモリリージョンと分岐先メモリリージョンとに挟まれるメモリリージョンを「分岐区域」として保持する。例えば、図1に示した例において、相対アドレス指定による分岐命令が格納されている分岐元メモリリージョンがメモリリージョン13であり、かかる相対アドレスが示す分岐先メモリリージョンがメモリリージョン15である場合に、実施例1に係るオリジナルコード抽出装置は、メモリリージョン13〜15を1個の「分岐区域」として保持する。
Then, the original code extraction apparatus according to the first embodiment specifies a combination of a branch source memory region and a branch destination memory region for each branch instruction by relative address specification, and sandwiches between the branch source memory region and the branch destination memory region. Memory region to be stored as a “branch area”. For example, in the example shown in FIG. 1, when the branch source memory region in which the branch instruction by relative address designation is stored is the
そして、実施例1に係るオリジナルコード抽出装置は、相対アドレス指定による分岐命令ごとに分岐区域を特定した後に、メモリリージョン間の境界毎に、各境界が分岐区域に含まれる頻度を算出する。例えば、実施例1に係るオリジナルコード抽出装置は、メモリリージョン間の各境界が分岐区域に含まれる数を算出し、分岐区域に含まれる数が所定の閾値以下である境界が、異なるプログラムコードが格納される境界であると判定する。具体的には、実施例1に係るオリジナルコード抽出装置は、分岐区域に含まれる数が所定の閾値以下である境界が、オリジナルコードが格納されているメモリリージョンと、オリジナルコード以外のプログラムコードが格納されているメモリリージョンとの境界であると判定する。なお、以下では、異なるプログラムコードが格納される境界を「プログラム境界」と表記する場合がある。 Then, the original code extraction apparatus according to the first embodiment specifies the branch area for each branch instruction by relative address specification, and then calculates the frequency at which each boundary is included in the branch area for each boundary between memory regions. For example, the original code extraction apparatus according to the first embodiment calculates the number of each boundary between memory regions included in the branch area, and the program code having different boundaries where the number included in the branch area is equal to or less than a predetermined threshold is calculated. It is determined that the boundary is stored. Specifically, in the original code extraction apparatus according to the first embodiment, the boundary in which the number included in the branch area is equal to or less than a predetermined threshold includes a memory region in which the original code is stored and a program code other than the original code. Judged as the boundary with the stored memory region. In the following, a boundary where different program codes are stored may be referred to as a “program boundary”.
図1に示した例では、実施例1に係るオリジナルコード抽出装置は、メモリリージョン12とメモリリージョン13との境界が「プログラム境界」であると判定するとともに、メモリリージョン15とメモリリージョン16との境界が「プログラム境界」であると判定している。そして、実施例1に係るオリジナルコード抽出装置は、プログラム境界に挟まれるメモリリージョン13〜15からデータを抽出することで、マルウェアのオリジナルコードを取得する。なお、メモリリージョン13〜15にマルウェアのオリジナルコードが格納されていると判定する理由等については後述する。
In the example illustrated in FIG. 1, the original code extraction apparatus according to the first embodiment determines that the boundary between the
ここで、分岐区域に含まれる数が所定の閾値以下である境界がプログラム境界であると判定する理由について説明する。一般に、実行ファイルや動的リンクライブラリが、別の動的リンクライブラリ内の関数を呼び出す場合には、呼び出し先はコンパイルリンク時に決定できない。そのため、このような場合には、メモリ参照を用いた絶対アドレス指定の分岐命令が用いられる。一方、同じ実行ファイル内、もしくは、同じ動的リンクライブラリ内の関数を呼び出す場合には、コンパイルリンク時に呼び出し元から呼び出し対象までのオフセットが確定しているので、相対アドレス指定の分岐命令が用いられる。したがって、相対アドレス指定の分岐命令とかかる分岐命令の分岐先とは、同一の実行ファイル内に含まれると考えられる。言い換えれば、相対アドレス指定の分岐命令とかかる分岐命令の分岐先とは、異なる実行ファイルに分断されることはないと仮定できる。 Here, the reason why it is determined that a boundary whose number included in the branch area is equal to or less than a predetermined threshold is a program boundary. Generally, when an executable file or a dynamic link library calls a function in another dynamic link library, the call destination cannot be determined at the time of compile link. Therefore, in such a case, a branch instruction with absolute address specification using a memory reference is used. On the other hand, when calling a function in the same executable file or the same dynamic link library, the offset from the caller to the call target is fixed at the time of compile linking, so a branch instruction with a relative address is used. . Therefore, it is considered that the branch instruction with the relative address and the branch destination of the branch instruction are included in the same execution file. In other words, it can be assumed that the branch instruction with relative address and the branch destination of the branch instruction are not divided into different execution files.
このようなことから、実施例1に係るオリジナルコード抽出装置は、相対アドレス指定の分岐命令毎に分岐区域を特定し、メモリリージョン間の各境界のうち、分岐区域に含まれる数が所定の閾値以下である境界が「プログラム境界」であると判定する。言い換えれば、実施例1に係るオリジナルコード抽出装置は、分岐区域に含まれる数が所定の閾値よりも大きい境界の両端に位置するメモリリージョンには、同一のプログラムコードが格納されていると判定する。 For this reason, the original code extraction apparatus according to the first embodiment specifies a branch area for each branch instruction of relative address specification, and the number included in the branch area among the boundaries between the memory regions is a predetermined threshold value. It is determined that the following boundary is a “program boundary”. In other words, the original code extraction device according to the first embodiment determines that the same program code is stored in the memory regions located at both ends of the boundary where the number included in the branch area is larger than the predetermined threshold. .
このように、実施例1に係るオリジナルコード抽出装置は、相対アドレス指定による分岐命令に基づいて分岐区域を特定し、メモリリージョン間の境界毎に各境界が分岐区域に含まれる頻度を算出することで、プログラム境界を判定する。これにより、実施例1に係るオリジナルコード抽出装置は、異なるプログラムコードが格納されるメモリリージョンの境界を判定することができるので、マルウェア実行時に割り当てられたメモリリージョンから、オリジナルコードを抽出することができる。その結果、実施例1に係るオリジナルコード抽出装置は、オリジナルコードの解析工数を低減することができる。 As described above, the original code extracting apparatus according to the first embodiment specifies a branch area based on a branch instruction based on relative addressing, and calculates a frequency at which each boundary is included in the branch area for each boundary between memory regions. Then, the program boundary is determined. As a result, the original code extraction apparatus according to the first embodiment can determine the boundary between the memory regions in which different program codes are stored, so that the original code can be extracted from the memory region assigned at the time of executing the malware. it can. As a result, the original code extraction apparatus according to the first embodiment can reduce the man-hours for analyzing the original code.
[実施例1に係るオリジナルコード抽出装置の構成]
次に、図2を用いて、実施例1に係るオリジナルコード抽出装置について説明する。図2は、実施例1に係るオリジナルコード抽出装置の構成例を示すブロック図である。図2に示したプログラムコード抽出装置100は、本願の開示するコード領域識別装置が適用された装置であり、同一の実行ファイルを形成するプログラムコードが格納されているメモリ領域を識別するとともに、識別したメモリ領域からプログラムコードを抽出処理についても行う。
[Configuration of Original Code Extraction Device According to Embodiment 1]
Next, the original code extracting apparatus according to the first embodiment will be described with reference to FIG. FIG. 2 is a block diagram illustrating a configuration example of the original code extraction apparatus according to the first embodiment. The program code extraction apparatus 100 shown in FIG. 2 is an apparatus to which the code area identification apparatus disclosed in the present application is applied, and identifies and identifies a memory area in which program codes forming the same executable file are stored. The program code is also extracted from the memory area.
図2に示すように、実施例1に係るプログラムコード抽出装置100は、メモリ110と、実行モジュール記憶部121と、メモリリージョン群リスト記憶部122と、スコアリスト記憶部123と、プログラムコード記憶部124と、プログラム起動部131と、メモリアクセス監視部132と、プログラムコード候補決定部133と、プログラムコード抽出部134とを有する。
As shown in FIG. 2, the program code extracting apparatus 100 according to the first embodiment includes a
メモリ110は、例えば、RAM(Random Access Memory)等の記憶デバイスである。メモリ110は、例えば、プログラム実行時に各プロセスに所定の領域が割り当てられる。
The
実行モジュール記憶部121は、各種実行モジュールを記憶する。実施例1では、実行モジュール記憶部121は、ランタイムパッカーによってパッキング処理が施された実行形式のマルウェアを記憶するものとする。 The execution module storage unit 121 stores various execution modules. In the first embodiment, it is assumed that the execution module storage unit 121 stores executable malware that has been subjected to packing processing by the runtime packer.
メモリリージョン群リスト記憶部122、スコアリスト記憶部123、プログラムコード記憶部124は、後述するメモリアクセス監視部132等によって各種情報が格納されたり参照されたりする。これらのメモリリージョン群リスト記憶部122等については、メモリアクセス監視部132等とともに説明する。
In the memory region group list storage unit 122, the score
プログラム起動部131は、実行モジュール記憶部121に記憶されているマルウェアを起動することにより、監視対象のプロセスを生成する。そして、プログラム起動部131は、監視対象プロセスが起動した旨をメモリアクセス監視部132に通知する。
The
メモリアクセス監視部132は、メモリ110のうち、プログラム起動部131から通知された監視対象プロセスに割り当てられた全てのメモリリージョンに対するアクセスを監視する。そして、メモリアクセス監視部132は、書き込みアクセスが発生したメモリリージョンに対して実行アクセスが発生するたびに、アクセス対象のメモリリージョンと、アクセス対象のメモリリージョンと連続して隣接し、かつ、使用中であるメモリリージョンとを取得する。このとき、メモリアクセス監視部132は、メモリリージョンに格納されているデータ自体を取得する。なお、以下では、メモリアクセス監視部132によって取得される使用中のメモリリージョンを「メモリリージョン群」と表記する場合がある。そして、メモリアクセス監視部132は、メモリ110から取得したメモリリージョン群と、実行アクセス先のアドレスとをメモリリージョン群リスト記憶部122に格納する。
The memory access monitoring unit 132 monitors accesses to all the memory regions allocated to the monitoring target process notified from the
ここで、図3を用いて、メモリアクセス監視部132によるメモリ監視処理について説明する。図3は、メモリアクセス監視部132によるメモリ監視処理の一例を示す図である。図3に示した例において、メモリアクセス監視部132の監視対象は、メモリリージョン11〜19であるものとする。メモリアクセス監視部132は、まず、メモリリージョン11〜19に対して、書き込みアクセスが発生するか否かを監視する。 Here, the memory monitoring process by the memory access monitoring unit 132 will be described with reference to FIG. FIG. 3 is a diagram illustrating an example of a memory monitoring process performed by the memory access monitoring unit 132. In the example illustrated in FIG. 3, it is assumed that the monitoring target of the memory access monitoring unit 132 is the memory regions 11 to 19. First, the memory access monitoring unit 132 monitors whether or not a write access occurs for the memory regions 11 to 19.
続いて、図3の2段目に示すように、メモリリージョン13に対して、アクセス先アドレスが「A13」である書き込みアクセスが発生したものとする。かかる場合に、メモリアクセス監視部132は、書き込みアクセスが発生したメモリリージョン13を「書込監視対象」から「実行監視対象」に変更する。ここで、「書込監視対象」とは、書き込みアクセスが発生するか否かが監視されるメモリリージョンを示し、「実行監視対象」とは、実行アクセスが発生するか否かが監視されるメモリリージョンを示す。
Subsequently, as shown in the second row of FIG. 3, it is assumed that a write access having an access destination address “A13” occurs in the
そして、図3の3段目に示すように、実行監視対象のメモリリージョン13に対して実行アクセスが発生した場合に、メモリアクセス監視部132は、メモリリージョン13と、メモリリージョン13から連続して使用中であるメモリリージョンを取得する。例えば、図3の3段目に示すように、メモリリージョン11〜16及び19が使用中であり、メモリリージョン17及び18が使用中でないものとする。この例の場合、実行アクセス対象のメモリリージョン13と連続して隣接し、かつ、使用中であるメモリリージョンは、メモリリージョン11、12、14〜16である。メモリリージョン19は使用中であるが、メモリリージョン17が使用中でないため、メモリリージョン13から連続して使用中であるメモリリージョンに該当しない。
Then, as shown in the third row of FIG. 3, when an execution access occurs to the
したがって、図3の3段目に示した例では、メモリアクセス監視部132は、メモリリージョン11〜16を含むメモリリージョン群G10を取得する。そして、メモリアクセス監視部132は、取得したメモリリージョン群G10と、アクセス先アドレス「A13」とをメモリリージョン群リスト記憶部122に格納する。そして、メモリアクセス監視部132は、メモリリージョン13を「実行監視対象」から「書込監視対象」に戻す。
Therefore, in the example shown in the third row of FIG. 3, the memory access monitoring unit 132 acquires the memory region group G10 including the memory regions 11-16. Then, the memory access monitoring unit 132 stores the acquired memory region group G10 and the access destination address “A13” in the memory region group list storage unit 122. Then, the memory access monitoring unit 132 returns the
続いて、図3の4段目に示すように、書込監視対象のメモリリージョン18に対して、アクセス先アドレスが「A18」である書き込みアクセスが発生した場合に、メモリアクセス監視部132は、メモリリージョン18を「書込監視対象」から「実行監視対象」に変更する。そして、図3の5段目に示すように、実行監視対象のメモリリージョン18に対して実行アクセスが発生した場合に、メモリリージョン18と、メモリリージョン18から連続して使用中であるメモリリージョン19とを含むメモリリージョン群G20を取得する。そして、メモリアクセス監視部132は、取得したメモリリージョン群G20と、アクセス先アドレス「A18」とをメモリリージョン群リスト記憶部122に格納する。そして、メモリアクセス監視部132は、メモリリージョン18を「実行監視対象」から「書込監視対象」に戻す。 Subsequently, as shown in the fourth row of FIG. 3, when a write access having an access destination address “A18” occurs in the memory region 18 to be monitored for writing, the memory access monitoring unit 132 The memory region 18 is changed from “write monitoring target” to “execution monitoring target”. As shown in the fifth row of FIG. 3, when an execution access occurs to the memory region 18 subject to execution monitoring, the memory region 18 and the memory region 19 that is continuously used from the memory region 18 are displayed. A memory region group G20 including these is acquired. Then, the memory access monitoring unit 132 stores the acquired memory region group G20 and the access destination address “A18” in the memory region group list storage unit 122. Then, the memory access monitoring unit 132 returns the memory region 18 from “execution monitoring target” to “write monitoring target”.
このようにして、メモリアクセス監視部132は、監視対象のメモリリージョンに対して、書き込みアクセスが発生した後に実行アクセスが発生した場合に、メモリリージョン群を取得して、メモリリージョン群及びアクセス先アドレスをメモリリージョン群リスト記憶部122に格納する。 In this way, the memory access monitoring unit 132 acquires the memory region group and the memory region group and the access destination address when the execution access occurs after the write access occurs for the monitored memory region. Is stored in the memory region group list storage unit 122.
図2の説明に戻って、プログラムコード候補決定部133は、メモリリージョン群リスト記憶部122に記憶されている各メモリリージョン群を解析することで、同一の実行ファイルを形成するプログラムコードが格納されているメモリリージョンの候補を決定する。 Returning to the description of FIG. 2, the program code candidate determination unit 133 stores the program codes forming the same executable file by analyzing each memory region group stored in the memory region group list storage unit 122. Determine the candidate memory region.
具体的には、プログラムコード候補決定部133は、メモリリージョン群リスト記憶部122に記憶されているメモリリージョン群について1個ずつ以下の処理を行う。まず、プログラムコード候補決定部133は、メモリリージョン群リスト記憶部122から取り出した1個のメモリリージョン群全体を逆アセンブルし、相対アドレスによって他の命令を指定する分岐命令を特定する。そして、プログラムコード候補決定部133は、相対アドレス指定による分岐命令ごとに、分岐元メモリリージョンと分岐先メモリリージョンとに挟まれる分岐区域を決定する。 Specifically, the program code candidate determination unit 133 performs the following processing one by one for the memory region group stored in the memory region group list storage unit 122. First, the program code candidate determination unit 133 disassembles the entire memory region group extracted from the memory region group list storage unit 122, and specifies a branch instruction that designates another instruction using a relative address. Then, the program code candidate determination unit 133 determines a branch area sandwiched between the branch source memory region and the branch destination memory region for each branch instruction by relative address designation.
そして、プログラムコード候補決定部133は、メモリリージョン間の境界毎に、各境界が分岐区域に属する頻度を算出する。例えば、プログラムコード候補決定部133は、メモリリージョン間の境界毎に、かかる境界が分岐区域に含まれる数をカウントする。そして、プログラムコード候補決定部133は、メモリリージョン間の境界毎に、分岐区域に含まれる数をスコアリスト記憶部123に格納する。プログラムコード候補決定部133は、メモリリージョン群リスト記憶部122に記憶されている全てのメモリリージョン群に対して、上記の処理を行う。なお、以下では、メモリリージョン間の境界が分岐区域に含まれる数を「スコア」と表記する場合がある。
Then, the program code candidate determination unit 133 calculates the frequency with which each boundary belongs to the branch area for each boundary between the memory regions. For example, for each boundary between memory regions, the program code candidate determination unit 133 counts the number of such boundaries included in the branch area. Then, the program code candidate determination unit 133 stores the number included in the branch area in the score
ここで、図4を用いて、プログラムコード候補決定部133によるプログラムコード候補決定処理について説明する。図4は、プログラムコード候補決定部133によるプログラムコード候補決定処理の一例を示す図である。なお、図4では、プログラムコード候補決定部133が、メモリリージョン群リスト記憶部122からメモリリージョン11〜16を含むメモリリージョン群G10を取得する例を示す。 Here, the program code candidate determination process by the program code candidate determination unit 133 will be described with reference to FIG. FIG. 4 is a diagram illustrating an example of a program code candidate determination process performed by the program code candidate determination unit 133. 4 illustrates an example in which the program code candidate determination unit 133 acquires the memory region group G10 including the memory regions 11 to 16 from the memory region group list storage unit 122.
図4に示した例において、プログラムコード候補決定部133は、まず、メモリリージョン群G10全体を逆アセンブルする。そして、プログラムコード候補決定部133は、逆アセンブルの結果に基づいて、相対アドレス指定の分岐命令が含まれるメモリリージョンを特定する。図4に示した例では、メモリリージョン13に相対アドレス指定による分岐命令が2個格含まれ、メモリリージョン12に相対アドレス指定による分岐命令が1個格含まれる。具体的には、メモリリージョン13には、分岐先がメモリリージョン11である分岐命令と、分岐先がメモリリージョン15である分岐命令とが含まれる。また、メモリリージョン12には、分岐先がメモリリージョン11である分岐命令が含まれる。
In the example shown in FIG. 4, the program code candidate determining unit 133 first disassembles the entire memory region group G10. Then, the program code candidate determination unit 133 specifies a memory region including a branch instruction with relative address designation based on the result of the disassembly. In the example shown in FIG. 4, the
このような場合に、プログラムコード候補決定部133は、メモリリージョン11〜13を1個の分岐区域T11として特定する。また、プログラムコード候補決定部133は、メモリリージョン13〜15を分岐区域T12として特定し、メモリリージョン11〜12を分岐区域T13として特定する。
In such a case, the program code candidate determination unit 133 specifies the memory regions 11 to 13 as one branch section T11. Further, the program code candidate determination unit 133 specifies the
そして、プログラムコード候補決定部133は、メモリリージョン11とメモリリージョン12との境界B11が分岐区域T11に含まれるので、境界B11のスコアを「1」とする。同様に、プログラムコード候補決定部133は、メモリリージョン12とメモリリージョン13との境界B12が分岐区域T11に含まれるので、境界B12のスコアを「1」とする。また、プログラムコード候補決定部133は、メモリリージョン13とメモリリージョン14との境界B13が分岐区域T12に含まれるので、境界B13のスコアを「1」とする。同様に、プログラムコード候補決定部133は、メモリリージョン14とメモリリージョン15との境界B14が分岐区域T12に含まれるので、境界B14のスコアを「1」とする。また、プログラムコード候補決定部133は、境界B11が分岐区域T12に含まれるので、境界B11のスコアをインクリメントして「2」とする。このようにして、プログラムコード候補決定部133は、メモリリージョン間の境界毎にスコアを算出する。そして、プログラムコード候補決定部133は、算出したスコアをスコアリスト記憶部123に格納する。
The program code candidate determining unit 133 sets the score of the boundary B11 to “1” because the boundary B11 between the memory region 11 and the
図5に、スコアリスト記憶部123の一例を示す。図5に示した例では、スコアリスト記憶部123は、「境界」、「メモリリージョン情報」、「スコア」といった項目を有する。「境界」は、メモリリージョン間の境界を示す。なお、図5に示した例では、スコアリスト記憶部123の「境界」には、図4に示した境界に付した符号が記憶されるものとする。
FIG. 5 shows an example of the score
「メモリリージョン情報」は、境界を形成するメモリリージョンの情報を示す。なお、図5に示した例では、スコアリスト記憶部123の「メモリリージョン情報」には、図4に示したメモリリージョン等に付した符号が「N−M」形式によって記憶されるものとする。具体的には、「メモリリージョン情報」に「N−M」が記憶されている場合には、対応する境界がメモリリージョンNとメモリリージョンMとの境界であることを示す。「スコア」は、境界が分岐区域に属する数を示す。
“Memory region information” indicates information on memory regions forming a boundary. In the example illustrated in FIG. 5, the “memory region information” in the score
例えば、図5に例示したスコアリスト記憶部123は、メモリリージョン11とメモリリージョン12との境界B11のスコアが「4」であることを示している。また、例えば、図5に例示したスコアリスト記憶部123は、メモリリージョン12とメモリリージョン13との境界B12のスコアが「1」であることを示している。
For example, the score
図2の説明に戻って、プログラムコード抽出部134は、スコアリスト記憶部123に記憶されているスコアを参照して、オリジナルコードを抽出する。具体的には、プログラムコード抽出部134は、スコアリスト記憶部123に記憶されているスコアと所定の閾値とを比較する。そして、プログラムコード抽出部134は、スコアが所定の閾値以下である場合に、かかるスコアに対応する境界がプログラム境界であると判定する。
Returning to the description of FIG. 2, the program
続いて、プログラムコード抽出部134は、メモリリージョン群リスト記憶部122に記憶されているメモリリージョン群のうち、アクセス先アドレスからプログラム境界までに含まれるメモリリージョンに展開されている動的生成コードを抽出し、プログラムコード記憶部124に格納する。このようにして、プログラムコード抽出部134によって抽出されたプログラムコードは、同一の実行ファイルや動的リンクライブラリ等を形成するプログラムコードである可能性が高い。
Subsequently, the program
ここで、図6を用いて、プログラムコード抽出部134によるオリジナルコード抽出処理について説明する。図6は、プログラムコード抽出部134によるオリジナルコード抽出処理の一例を示す図である。なお、各境界のスコアは、図5に示したスコアリスト記憶部123のスコアに記憶されている値であるものとする。また、ここでは、スコアの閾値は、「1」であるものとする。
Here, the original code extraction processing by the program
図6に示した例において、プログラムコード抽出部134は、境界B11のスコアが「4」であり閾値「1」よりも大きいので、境界B11がプログラム境界でないと判定する。同様に、プログラムコード抽出部134は、境界B13及びB14がプログラム境界でないと判定する。一方、プログラムコード抽出部134は、境界B12のスコアが「1」であり閾値「1」以下であるので、境界B12がプログラム境界であると判定する。同様に、プログラムコード抽出部134は、境界B15がプログラム境界であると判定する。
In the example illustrated in FIG. 6, the program
ここで、図6に示した例において、アクセス先アドレス「A13」からプログラム境界までに含まれるメモリリージョンは、メモリリージョン13〜15である。したがって、プログラムコード抽出部134は、メモリリージョン13〜15から動的生成コードを取得することで、同一の実行ファイルや動的リンクライブラリ等を形成するプログラムコードを抽出する。そして、プログラムコード抽出部134は、抽出したプログラムコードをプログラムコード記憶部124に格納する。
Here, in the example illustrated in FIG. 6, the memory regions included from the access destination address “A13” to the program boundary are the
なお、図6に示した例において、境界B11がプログラム境界でないので、メモリリージョン11及び12には、同一の実行ファイルや動的リンクライブラリ等を形成するプログラムコードが格納されていると考えられる。しかし、境界B12がプログラム境界であるので、メモリリージョン12と、メモリリージョン13とには、同一の実行ファイルを形成するプログラムコードが格納されているとは考えにくい。したがって、プログラムコード抽出部134は、メモリリージョン13〜15からプログラムコードを取得する。
In the example shown in FIG. 6, since the boundary B11 is not a program boundary, the
[実施例1に係るプログラムコード抽出装置100による処理手順]
次に、図7を用いて、実施例1に係るプログラムコード抽出装置100による処理の手順について説明する。図7は、実施例1に係るプログラムコード抽出装置100による処理手順を示すフローチャートである。
[Processing Procedure by Program Code Extraction Apparatus 100 According to Embodiment 1]
Next, a processing procedure performed by the program code extraction apparatus 100 according to the first embodiment will be described with reference to FIG. FIG. 7 is a flowchart of a process procedure performed by the program code extracting apparatus 100 according to the first embodiment.
図7に示すように、プログラムコード抽出装置100のプログラム起動部131は、実行モジュール記憶部121に記憶されているマルウェアを起動することにより(ステップS101)、監視対象のプロセスを生成する(ステップS102)。
As illustrated in FIG. 7, the
続いて、メモリアクセス監視部132は、プログラム起動部131によって生成された監視対象プロセスに割り当てられた全てのメモリリージョンに対するアクセスを監視するメモリ監視処理を行う(ステップS103)。なお、メモリアクセス監視部132によるメモリ監視処理については、図8を用いて後述する。 Subsequently, the memory access monitoring unit 132 performs a memory monitoring process for monitoring accesses to all the memory regions assigned to the monitoring target process generated by the program activation unit 131 (step S103). The memory monitoring process performed by the memory access monitoring unit 132 will be described later with reference to FIG.
続いて、プログラムコード候補決定部133は、メモリリージョン群リスト記憶部122に記憶されている各メモリリージョン群から、同一の実行ファイルを形成するプログラムコードが格納されているメモリリージョンの候補を決定するプログラムコード候補決定処理を行う(ステップS104)。なお、プログラムコード候補決定部133によるプログラムコード候補決定処理については、図9を用いて後述する。 Subsequently, the program code candidate determination unit 133 determines a memory region candidate in which program codes forming the same executable file are stored from each memory region group stored in the memory region group list storage unit 122. Program code candidate determination processing is performed (step S104). The program code candidate determination process by the program code candidate determination unit 133 will be described later with reference to FIG.
続いて、プログラムコード抽出部134は、プログラムコード候補決定部133によるプログラムコード候補決定処理の結果に基づいて、同一の実行ファイルや動的リンクライブラリ等を形成するプログラムコードを抽出するプログラムコード抽出処理を行う(ステップS105)。なお、プログラムコード抽出部134によるプログラムコード抽出処理については、図10を用いて後述する。
Subsequently, the program
[メモリ監視処理]
次に、図8を用いて、図7に示したステップS103におけるメモリ監視処理について説明する。図8は、メモリアクセス監視部132によるメモリ監視処理手順を示すフローチャートである。
[Memory monitoring process]
Next, the memory monitoring process in step S103 shown in FIG. 7 will be described with reference to FIG. FIG. 8 is a flowchart showing a memory monitoring processing procedure by the memory access monitoring unit 132.
図8に示すように、メモリアクセス監視部132は、監視対象のメモリリージョンに対してアクセスが発生した場合に(ステップS201肯定)、かかるアクセスが読み込みアクセスであるか否かを判定する(ステップS202)。 As shown in FIG. 8, when an access occurs to the monitored memory region (Yes in step S201), the memory access monitoring unit 132 determines whether the access is a read access (step S202). ).
そして、メモリアクセス監視部132は、メモリリージョンに対するアクセスが読み込みアクセスである場合には(ステップS202肯定)、ステップS201に戻る。一方、メモリアクセス監視部132は、メモリリージョンに対するアクセスが読み込みアクセスでない場合には(ステップS202否定)、かかるアクセスが書き込みアクセスであるか否かを判定する(ステップS203)。 If the access to the memory region is a read access (Yes at Step S202), the memory access monitoring unit 132 returns to Step S201. On the other hand, if the access to the memory region is not a read access (No at Step S202), the memory access monitoring unit 132 determines whether the access is a write access (Step S203).
そして、メモリアクセス監視部132は、メモリリージョンに対するアクセスが書き込みアクセスである場合には(ステップS203肯定)、アクセス対象のメモリリージョンが書込監視対象であるか否かを判定する(ステップS204)。そして、メモリアクセス監視部132は、アクセス対象のメモリリージョンが書込監視対象である場合には(ステップS204肯定)、アクセス対象のメモリリージョンを実行監視対象とし(ステップS205)、ステップS201に戻る。一方、メモリアクセス監視部132は、アクセス対象のメモリリージョンが書込監視対象でない場合には(ステップS204否定)、ステップS201に戻る。 If the access to the memory region is a write access (Yes at Step S203), the memory access monitoring unit 132 determines whether the memory region to be accessed is a write monitoring target (Step S204). If the memory region to be accessed is a write monitoring target (Yes at step S204), the memory access monitoring unit 132 sets the memory region to be accessed as an execution monitoring target (step S205), and returns to step S201. On the other hand, when the memory region to be accessed is not the write monitoring target (No at Step S204), the memory access monitoring unit 132 returns to Step S201.
また、メモリアクセス監視部132は、メモリリージョンに対するアクセスが書き込みアクセスでない場合には(ステップS203否定)、かかるアクセスが実行アクセスであるので、アクセス対象のメモリリージョンが実行監視対象であるか否かを判定する(ステップS206)。そして、メモリアクセス監視部132は、アクセス対象のメモリリージョンが実行監視対象でない場合には(ステップS206否定)、ステップS201に戻る。 Further, if the access to the memory region is not a write access (No at Step S203), the memory access monitoring unit 132 determines whether or not the memory region to be accessed is an execution monitoring target because the access is an execution access. Determination is made (step S206). When the memory region to be accessed is not the execution monitoring target (No at Step S206), the memory access monitoring unit 132 returns to Step S201.
一方、メモリアクセス監視部132は、アクセス対象のメモリリージョンが実行監視対象である場合には(ステップS206肯定)、アクセス対象のメモリリージョンから連続して使用中であるメモリリージョン群を取得する(ステップS207)。そして、メモリアクセス監視部132は、アクセス対象のメモリリージョンを書込監視対象に戻して(ステップS208)、ステップS201に戻る。 On the other hand, when the memory region to be accessed is an execution monitoring target (Yes at Step S206), the memory access monitoring unit 132 acquires a memory region group that is continuously used from the memory region to be accessed (Step S206). S207). Then, the memory access monitoring unit 132 returns the memory region to be accessed to the write monitoring target (step S208), and returns to step S201.
[プログラムコード候補決定処理]
次に、図9を用いて、図7に示したステップS104におけるプログラムコード候補決定処理について説明する。図9は、プログラムコード候補決定部133によるプログラムコード候補決定処理手順を示すフローチャートである。
[Program code candidate decision processing]
Next, the program code candidate determination process in step S104 shown in FIG. 7 will be described with reference to FIG. FIG. 9 is a flowchart showing a program code candidate determination processing procedure by the program code candidate determination unit 133.
図9に示すように、プログラムコード候補決定部133は、メモリリージョン群リスト記憶部122からメモリリージョン群を1個取り出す(ステップS301)。続いて、プログラムコード候補決定部133は、メモリリージョン群リスト記憶部122から取り出したメモリリージョン群全体に対して逆アセンブルする(ステップS302)。 As shown in FIG. 9, the program code candidate determination unit 133 takes out one memory region group from the memory region group list storage unit 122 (step S301). Subsequently, the program code candidate determination unit 133 disassembles the entire memory region group extracted from the memory region group list storage unit 122 (step S302).
続いて、プログラムコード候補決定部133は、逆アセンブルの結果に基づいて、相対アドレス指定の分岐命令を特定する(ステップS303)。そして、プログラムコード候補決定部133は、相対アドレス指定の分岐命令ごとに、分岐元メモリリージョンと分岐先メモリリージョンとに挟まれる分岐区域を決定する(ステップS304)。 Subsequently, the program code candidate determination unit 133 specifies a branch instruction with a relative address based on the result of the disassembly (step S303). Then, the program code candidate determination unit 133 determines a branch area sandwiched between the branch source memory region and the branch destination memory region for each branch instruction with relative address designation (step S304).
続いて、プログラムコード候補決定部133は、メモリリージョン間の境界毎に、かかる境界が分岐区域に含まれる数(スコア)を算出する(ステップS305)。そしてプログラムコード候補決定部133は、メモリリージョン間の境界毎に、ステップS305において算出したスコアをスコアリスト記憶部123に格納する(ステップS306)。
Subsequently, the program code candidate determination unit 133 calculates, for each boundary between memory regions, the number (score) at which the boundary is included in the branch area (step S305). The program code candidate determination unit 133 stores the score calculated in step S305 in the score
プログラムコード候補決定部133は、メモリリージョン群リスト記憶部122に記憶されているメモリリージョン群のうち、未処理のメモリリージョン群が存在する場合には(ステップS307否定)、ステップS301に戻り、メモリリージョン群リスト記憶部122から未処理のメモリリージョン群を1個取り出す(ステップS301)。その後、プログラムコード候補決定部133は、ステップS302〜S306における処理を行う。そして、プログラムコード候補決定部133は、メモリリージョン群リスト記憶部122に記憶されている全てのメモリリージョン群に対して処理を行った場合には(ステップS307肯定)、処理を終了する。 When there is an unprocessed memory region group among the memory region groups stored in the memory region group list storage unit 122 (No in step S307), the program code candidate determination unit 133 returns to step S301, One unprocessed memory region group is extracted from the region group list storage unit 122 (step S301). Thereafter, the program code candidate determination unit 133 performs the processes in steps S302 to S306. If the program code candidate determination unit 133 has performed processing on all the memory region groups stored in the memory region group list storage unit 122 (Yes in step S307), the program code candidate determination unit 133 ends the processing.
[プログラムコード抽出処理]
次に、図10を用いて、図7に示したステップS105におけるプログラムコード抽出処理について説明する。図10は、プログラムコード抽出部134によるプログラムコード抽出処理手順を示すフローチャートである。
[Program code extraction processing]
Next, the program code extraction process in step S105 shown in FIG. 7 will be described with reference to FIG. FIG. 10 is a flowchart showing a program code extraction processing procedure by the program
図10に示すように、プログラムコード抽出部134は、スコアリスト記憶部123から各境界のスコアを取得し(ステップS401)、取得したスコアと所定の閾値とを比較する(ステップS402)。
As shown in FIG. 10, the program
そして、プログラムコード抽出部134は、スコアが所定の閾値よりも大きい場合に(ステップS402肯定)、かかるスコアに対応する境界がプログラム境界でないと判定する(ステップS403)。一方、プログラムコード抽出部134は、スコアが所定の閾値以下である場合に(ステップS402否定)、かかるスコアに対応する境界がプログラム境界であると判定する(ステップS404)。
When the score is larger than the predetermined threshold (Yes at Step S402), the program
そして、プログラムコード抽出部134は、メモリリージョン群リスト記憶部122に記憶されているメモリリージョン群のうち、アクセス先アドレスからプログラム境界までに含まれるメモリリージョンに展開されているプログラムコードを抽出する(ステップS405)。
Then, the program
[実施例1の効果]
上述してきたように、実施例1に係るプログラムコード抽出装置100は、所定の記憶空間であるメモリリージョン毎に区切られたメモリ110に対して実行アクセスが行われるたびに、実行アクセス先のメモリリージョンと連続して隣接し、かつ、使用中であるメモリリージョン群を取得する。そして、プログラムコード抽出装置100は、取得したメモリリージョン群のうち、相対アドレス指定による分岐命令を含む分岐元メモリリージョンと、かかる相対アドレスが示す分岐先メモリリージョンとに挟まれる分岐区域を特定し、メモリリージョン間の境界毎に、分岐区域に境界が含まれる頻度を算出する。そして、プログラムコード抽出装置100は、分岐区域に境界が含まれる頻度が所定の閾値以下である境界がプログラム境界であると判定する。
[Effect of Example 1]
As described above, the program code extraction apparatus 100 according to the first embodiment performs the execution access destination memory region each time execution access is performed to the
これにより、実施例1に係るプログラムコード抽出装置100は、同一の実行ファイルを形成するプログラムコードがどのメモリリージョン群に格納されているかを判定することができる。 Thereby, the program code extracting apparatus 100 according to the first embodiment can determine in which memory region group the program code forming the same executable file is stored.
そして、実施例1に係るプログラムコード抽出装置100は、アクセス先アドレスからプログラム境界までに含まれるメモリリージョンに展開されている動的生成コードを抽出する。これにより、実施例1に係るプログラムコード抽出装置100は、同一の実行ファイルや動的リンクライブラリ等を形成するプログラムコード毎に抽出することができる。すなわち、実施例1に係るプログラムコード抽出装置100は、利用者にマルウェアのオリジナルコードを提供することができるので、オリジナルコードの解析工数を低減することができる。 Then, the program code extracting apparatus 100 according to the first embodiment extracts the dynamically generated code developed in the memory region included from the access destination address to the program boundary. Thereby, the program code extracting apparatus 100 according to the first embodiment can extract each program code that forms the same executable file, dynamic link library, or the like. That is, since the program code extraction apparatus 100 according to the first embodiment can provide the original code of the malware to the user, the man-hour for analyzing the original code can be reduced.
上記実施例1では、メモリリージョン間の境界が分岐区域に含まれる数をスコアとして算出し、かかるスコアに基づいてプログラム境界を決定する例を示したが、プログラム境界を決定する方式はこれに限定されない。そこで、実施例2では、メモリに格納されているデータが命令である確率を算出し、かかる確率を用いてプログラム境界を決定する例について説明する。 In the first embodiment, an example is shown in which the number of boundaries between memory regions included in the branch area is calculated as a score, and the program boundary is determined based on the score. However, the method for determining the program boundary is limited to this. Not. Therefore, in the second embodiment, an example will be described in which the probability that the data stored in the memory is an instruction is calculated and the program boundary is determined using the probability.
[実施例2に係るオリジナルコード抽出装置の構成]
まず、図11を用いて、実施例2に係るオリジナルコード抽出装置について説明する。図11は、実施例2に係るオリジナルコード抽出装置の構成例を示すブロック図である。なお、以下では、図2に示した構成部位と同様の機能を有する部位には同一符号を付すこととして、その詳細な説明を省略する。
[Configuration of Original Code Extraction Apparatus According to Second Embodiment]
First, the original code extracting apparatus according to the second embodiment will be described with reference to FIG. FIG. 11 is a block diagram illustrating a configuration example of the original code extraction apparatus according to the second embodiment. In the following, parts having the same functions as the constituent parts shown in FIG. 2 are denoted by the same reference numerals, and detailed description thereof is omitted.
図11に示すように、実施例2に係るプログラムコード抽出装置200は、スコアリスト記憶部223と、分岐成立確率算出部233とを有する。スコアリスト記憶部223は、後述する分岐成立確率算出部233によって各種情報が格納されたり参照されたりする。スコアリスト記憶部223については、分岐成立確率算出部233とともに説明する。
As illustrated in FIG. 11, the program
分岐成立確率算出部233は、メモリリージョン群リスト記憶部122に記憶されているメモリリージョン群から、相対アドレス指定の分岐命令を特定するとともに、かかる分岐命令が機械語命令である確率と、相対アドレスが示す分岐先が機械語命令である確率とを算出する。
The branch establishment
具体的には、分岐成立確率算出部233は、メモリリージョン群リスト記憶部122に記憶されているメモリリージョン群について1個ずつ以下の処理を行う。まず、分岐成立確率算出部233は、メモリリージョン群リスト記憶部122から取り出した1個のメモリリージョン群全体に対して逆アセンブルする。
Specifically, the branch establishment
そして、分岐成立確率算出部233は、逆アセンブルの結果に基づいて、相対アドレスによって命令を指定する分岐命令を検出した場合に、かかる分岐命令が機械語命令の先頭である確率xを算出するとともに、かかる相対アドレスが示す命令が機械語命令の先頭である確率yを算出する。そして、分岐成立確率算出部233は、分岐元アドレスによって示される命令が機械語命令である確率xと、分岐先アドレスによって示される命令が機械語命令である確率yとを乗算した結果である分岐成立確率xyを算出する。そして、分岐成立確率算出部233は、境界毎に分岐成立確率xyの総和を算出し、算出した分岐成立確率xyの総和をスコアとしてスコアリスト記憶部223に格納する。
When the branch establishment
分岐成立確率を算出する理由について説明する。一般に、逆アセンブルされたプログラムコード内の各バイト値が機械語命令を示すか否かを確実に判定することは困難である。そこで、分岐成立確率算出部233は、例えば、隠れマルコフモデルにより実行ファイルをモデル化し、Forward/Backwardアルゴリズムを用いることで、逆アセンブルされたメモリリージョン群における各バイト値が機械語命令の先頭であるか確率を算出する(非特許文献3及び非特許文献4を参照)。そして、分岐成立確率算出部233は、相対アドレス指定の分岐命令毎に分岐成立確率を算出することで、かかる分岐命令が機械語命令であるか否かを示す期待値を算出する。言い換えれば、分岐成立確率算出部233は、各分岐命令について、分岐成立確率により重み付けすることができる。
The reason for calculating the branch establishment probability will be described. In general, it is difficult to reliably determine whether each byte value in the disassembled program code indicates a machine language instruction. Therefore, the branch establishment
ここで、図12を用いて、分岐成立確率算出部233による分岐成立確率算出処理について説明する。図12は、分岐成立確率算出部233による分岐成立確率算出処理の一例を示す図である。なお、図12では、分岐成立確率算出部233が、メモリリージョン群リスト記憶部122からメモリリージョン11〜16を含むメモリリージョン群G10を取得する例を示す。
Here, the branch establishment probability calculation processing by the branch establishment
図12に示した例において、分岐成立確率算出部233は、まず、メモリリージョン群G10全体に対して逆アセンブルする。ここでは、分岐成立確率算出部233は、逆アセンブルの結果に基づいて、メモリリージョン13内に、相対アドレス指定の分岐命令を2個検出し、メモリリージョン12内に、相対アドレス指定の分岐命令を1個検出する。
In the example shown in FIG. 12, the branch establishment
このような場合に、分岐成立確率算出部233は、メモリリージョン11〜13を1個の分岐区域T11として特定する。さらに、分岐成立確率算出部233は、分岐区域T11の分岐元アドレスによって示される命令が機械語命令である確率(x1)と、分岐先アドレスによって示される命令が機械語命令である確率(y1)とを乗算した結果である分岐成立確率(x1)・(y1)を算出する。同様にして、分岐成立確率算出部233は、分岐区域T12の分岐成立確率(x2)・(y2)を算出し、分岐区域T13の分岐成立確率(x3)・(y3)を算出する。
In such a case, the branch establishment
続いて、分岐成立確率算出部233は、分岐区域T11の分岐成立確率(x1)・(y1)と、分岐区域T13の分岐成立確率(x3)・(y3)とを加算することで、境界B11のスコアを算出する。そして、分岐成立確率算出部233は、算出したスコアを境界B11に対応付けてスコアリスト記憶部223に格納する。同様にして、分岐成立確率算出部233は、境界B12のスコアとして分岐成立確率(x1)・(y1)をスコアリスト記憶部223に格納し、境界B13のスコアとして分岐成立確率(x2)・(y2)をスコアリスト記憶部223に格納し、境界B14のスコアとして分岐成立確率(x2)・(y2)をスコアリスト記憶部223に格納する。
Subsequently, the branch establishment
図13に、スコアリスト記憶部223の一例を示す。図13に示した例では、スコアリスト記憶部223は、「境界」、「メモリリージョン情報」、「スコア」といった項目を有する。「境界」は、メモリリージョン間の境界を示し、「メモリリージョン情報」は、境界を形成するメモリリージョンの情報を示す。「スコア」は、対応する境界を跨ぐ分岐命令の分岐元アドレスによって示される命令が機械語命令である確率xと、分岐先アドレスによって示される命令が機械語命令である確率yとを乗算した結果である分岐成立確率xyの総和を示す。
FIG. 13 shows an example of the score
[実施例2の効果]
上述してきたように、実施例2に係るプログラムコード抽出装置200は、相対アドレス指定による分岐命令が機械語命令である分岐元確率と、かかる相対アドレスが示す命令が機械語命令である分岐先確率とを算出し、分岐元確率と分岐先確率との乗算結果である分岐成立確率に基づいて、メモリリージョン間の境界毎にかかる境界がプログラム境界であるか否かを判定する。
[Effect of Example 2]
As described above, the program
これにより、実施例2に係るプログラムコード抽出装置200は、分岐成立確率が高い分岐命令に属する境界ほど、プログラム境界でないと判定することができ、分岐成立確率が低い分岐命令に属する境界ほど、プログラム境界であると判定することができる。すなわち、実施例2に係るプログラムコード抽出装置200は、高精度のプログラム境界を判定することができる。
Thereby, the program
上記実施例2では、分岐成立確率を用いてメモリリージョン単位でプログラム境界を判定する例を示した。しかし、メモリリージョン群におけるバイト値単位でプログラム境界を判定してもよい。そこで、実施例3では、バイト値単位でプログラム境界を判定する例について説明する。 In the second embodiment, an example is shown in which the program boundary is determined in units of memory regions using the branch establishment probability. However, the program boundary may be determined in units of byte values in the memory region group. Therefore, in the third embodiment, an example in which a program boundary is determined in byte value units will be described.
まず、バイト値単位でプログラム境界を判定する理由について説明する。例えば、図2に示した例において、実行モジュール記憶部121に記憶されているマルウェアが起動され、メモリ110に展開されるプログラムコードの始点又は終点(プログラムコードの冒頭部分又は末尾部分)は、分岐区域内に収まらない場合がある。具体的には、オリジナルコードの始点又は終点には、他の関数を呼び出す処理が行われる確率が低く、分岐命令の分岐元又は分岐先となる確率が低い場合がある。すなわち、図6に示した例において、例えば、オリジナルコードの始点がメモリリージョン12に格納され、オリジナルコードの終点がメモリリージョン16に格納される可能性もある。そこで、実施例3では、メモリリージョン単位ではなく、バイト値単位でプログラム境界を判定することで、オリジナルコードの始点及び終点についても抽出することを実現する。
First, the reason for determining the program boundary in byte value units will be described. For example, in the example illustrated in FIG. 2, the malware stored in the execution module storage unit 121 is activated, and the start point or end point (the beginning or end portion of the program code) of the program code developed in the
図14を用いて、バイト値単位でプログラム境界を判定する例について説明する。図14は、実施例3に係るプログラムコード抽出装置300によるプログラム境界判定処理の一例を示す図である。なお、実施例3に係るプログラムコード抽出装置300の構成は、図11に示した例と同様であるので、ここでは説明を省略する。 An example of determining a program boundary in byte value units will be described with reference to FIG. FIG. 14 is a diagram illustrating an example of a program boundary determination process performed by the program code extraction device 300 according to the third embodiment. Note that the configuration of the program code extraction apparatus 300 according to the third embodiment is the same as that shown in FIG.
実施例3に係るプログラムコード抽出装置300は、実施例2に係るプログラムコード抽出装置200と同様に、メモリリージョン群リスト記憶部122に記憶されているメモリリージョン群から、相対アドレス指定の分岐命令を特定するとともに、かかる分岐命令が機械語命令である確率と、相対アドレスが示す命令が機械語命令である確率とを算出する。そして、プログラムコード抽出装置300は、バイト値毎に、かかるバイト値を跨ぐ分岐命令の分岐成立確率の総和を算出する。
Similar to the program
ここでは、プログラムコード抽出装置300は、図14に示した例のように、バイト値毎に分岐成立確率の総和を算出したものとする。図14に示した例において、縦軸Enは、分岐成立確率の総和であり、各バイト値が属する分岐区域数の期待値を示し、横軸は、メモリリージョン群におけるオフセットを示す。また、εは、実施例2において分岐成立確率の総和と比較した「所定の閾値」を示す。また、kは、実行アクセスが発生したアクセス先アドレス(例えば、「A13」等)である。 Here, it is assumed that the program code extracting apparatus 300 calculates the sum of branch establishment probabilities for each byte value as in the example shown in FIG. In the example shown in FIG. 14, the vertical axis En is the total sum of branch establishment probabilities, showing the expected value of the number of branch areas to which each byte value belongs, and the horizontal axis showing the offset in the memory region group. Further, ε represents a “predetermined threshold value” compared with the total sum of branch establishment probabilities in the second embodiment. Further, k is an access destination address (for example, “A13” or the like) where the execution access has occurred.
ここで、期待値Enが十分に大きい領域には、同一の実行ファイルを形成するプログラムコードが格納されていると考えられる。すなわち、図14に示した例では、メモリ領域「o」〜「q」に同一の実行ファイルを形成するプログラムコードが格納され、メモリ領域「p」〜「r」に同一の実行ファイルを形成するプログラムコードが格納され、メモリ領域「s」〜「t」に同一の実行ファイルを形成するプログラムコードが格納されていると考えられる。 Here, it is considered that the program code forming the same executable file is stored in an area where the expected value En is sufficiently large. That is, in the example shown in FIG. 14, program codes that form the same executable file are stored in the memory areas “o” to “q”, and the same executable file is formed in the memory areas “p” to “r”. It is considered that the program code is stored, and the program codes forming the same executable file are stored in the memory areas “s” to “t”.
一方、メモリ領域「q」〜「p」には、メモリ領域「o」〜「q」に格納されているプログラムコードの終点や、メモリ領域「p」〜「r」に格納されているプログラムコードの始点が格納されていると考えられる。同様に、メモリ領域「r」〜「s」には、メモリ領域「p」〜「r」に格納されているプログラムコードの終点や、メモリ領域「s」〜「t」に格納されているプログラムコードの始点が格納されていると考えられる。これは、上述したように、プログラムコードの始点又は終点では、他の関数と呼び出す処理を行う可能性が低いので、分岐区域内に収まらない可能性が高いからである。 On the other hand, in the memory areas “q” to “p”, the end points of the program codes stored in the memory areas “o” to “q” and the program codes stored in the memory areas “p” to “r” are stored. It is thought that the starting point of is stored. Similarly, the end points of the program codes stored in the memory areas “p” to “r” and the programs stored in the memory areas “s” to “t” are stored in the memory areas “r” to “s”. It is considered that the start point of the code is stored. This is because, as described above, at the start point or end point of the program code, since there is a low possibility of performing a process called with another function, there is a high possibility that the program code does not fall within the branch area.
そこで、実施例3に係るプログラムコード抽出装置300は、「q」と「p」との中間点の近傍「X」をプログラム境界とし、「r」と「s」との中間点の近傍「Y」をプログラム境界と判定する。そして、プログラムコード抽出装置300は、「X」〜「Y」の領域からオリジナルコードを抽出する。すなわち、プログラムコード抽出装置300は、メモリ領域「X」〜「p」やメモリ領域「r」〜「Y」には、オリジナルコードの始点又は終点が格納されていると判定する。 Therefore, the program code extracting apparatus 300 according to the third embodiment uses “X” near the midpoint between “q” and “p” as a program boundary, and “Y” near the midpoint between “r” and “s”. Is determined as a program boundary. Then, the program code extracting apparatus 300 extracts the original code from the region “X” to “Y”. That is, the program code extraction apparatus 300 determines that the start point or end point of the original code is stored in the memory areas “X” to “p” and the memory areas “r” to “Y”.
これにより、実施例3に係るプログラムコード抽出装置300は、オリジナルコードを漏れなく抽出することができる。具体的には、プログラムコード抽出装置300は、オリジナルコードの始点や終点に含まれるプログラムコードについても抽出することができる。 Thereby, the program code extracting apparatus 300 according to the third embodiment can extract the original code without omission. Specifically, the program code extraction apparatus 300 can also extract program codes included at the start point and end point of the original code.
ところで、本願の開示するコード領域識別装置、コード領域識別方法及びコード領域識別プログラムは、上述した実施例以外にも、種々の異なる形態にて実施されてよい。そこで、実施例4では、本願の開示するコード領域識別装置、コード領域識別方法及びコード領域識別プログラムの他の実施例について説明する。 By the way, the code area identification device, the code area identification method, and the code area identification program disclosed in the present application may be implemented in various different forms other than the above-described embodiments. Therefore, in the fourth embodiment, another embodiment of the code area identification device, the code area identification method, and the code area identification program disclosed in the present application will be described.
[メモリリージョン]
上記実施例1〜3では、メモリ110を区切る所定の記憶空間の例として、メモリリージョンやバイト値を示したが、メモリ110を区切る所定の記憶空間は、これに限らない。例えば、上記実施例1〜3におけるメモリアクセス監視部132は、メモリ110をページ単位、OSのメモリ管理機構が規定するセクション単位等によってメモリ110を監視してもよい。メモリアクセス監視部132は、例えば、CPU(Central Processing Unit)が規定するページ単位を用いて監視することで、メモリ監視処理を高速化することができる。
[Memory Region]
In the first to third embodiments, the memory region and the byte value are shown as examples of the predetermined storage space for dividing the
[システム構成等]
また、上記実施例において、図示した各装置の各構成要素は機能概念的なものであり、必ずしも物理的に図示の如く構成されていることを要しない。すなわち、各装置の分散・統合の具体的形態は図示のものに限られず、その全部または一部を、各種の負荷や使用状況などに応じて、任意の単位で機能的または物理的に分散・統合して構成することができる。例えば、図2に示したプログラムコード候補決定部133は、分岐区域を特定する処理部と、スコアを算出する処理部とに分散されてもよい。
[System configuration, etc.]
Further, in the above-described embodiment, each component of each illustrated apparatus is functionally conceptual and does not necessarily need to be physically configured as illustrated. In other words, the specific form of distribution / integration of each device is not limited to that shown in the figure, and all or a part thereof may be functionally or physically distributed or arbitrarily distributed in arbitrary units according to various loads or usage conditions. Can be integrated and configured. For example, the program code candidate determination unit 133 illustrated in FIG. 2 may be distributed to a processing unit that specifies a branch area and a processing unit that calculates a score.
[プログラム]
また、上記実施例で説明した各種の処理は、あらかじめ用意されたプログラムをパーソナルコンピュータやワークステーションなどのコンピュータで実行することによって実現することができる。そこで、以下では、図15を用いて、図2に示したプログラムコード抽出装置100と同様の機能を有するコード領域識別プログラムを実行するコンピュータの一例を説明する。
[program]
The various processes described in the above embodiments can be realized by executing a program prepared in advance on a computer such as a personal computer or a workstation. Therefore, in the following, an example of a computer that executes a code area identification program having the same function as that of the program code extraction apparatus 100 shown in FIG. 2 will be described with reference to FIG.
図15は、開示の技術に係るコード領域識別プログラムによる情報処理がコンピュータを用いて具体的に実現されることを示す図である。図15に例示するように、コンピュータ1000は、例えば、メモリ1010と、CPU1020と、ハードディスクドライブインタフェース1030と、ディスクドライブインタフェース1040と、シリアルポートインタフェース1050と、ビデオアダプタ1060と、ネットワークインタフェース1070とを有し、これらの各部はバス1080によって接続される。
FIG. 15 is a diagram illustrating that information processing by the code area identification program according to the disclosed technology is specifically realized using a computer. As illustrated in FIG. 15, the
メモリ1010は、図15に例示するように、ROM(Read Only Memory)1011及びRAM(Random Access Memory)1012を含む。ROM1011は、例えば、BIOS(Basic Input Output System)等のブートプログラムを記憶する。ハードディスクドライブインタフェース1030は、図15に例示するように、ハードディスクドライブ1031に接続される。ディスクドライブインタフェース1040は、図15に例示するように、ディスクドライブ1041に接続される。例えば磁気ディスクや光ディスク等の着脱可能な記憶媒体が、ディスクドライブに挿入される。シリアルポートインタフェース1050は、図15に例示するように、例えばマウス1051、キーボード1052に接続される。ビデオアダプタ1060は、図15に例示するように、例えばディスプレイ1061に接続される。
The memory 1010 includes a ROM (Read Only Memory) 1011 and a RAM (Random Access Memory) 1012 as illustrated in FIG. The ROM 1011 stores a boot program such as BIOS (Basic Input Output System). The hard disk drive interface 1030 is connected to the
ここで、図15に例示するように、ハードディスクドライブ1031は、例えば、OS、アプリケーションプログラム、プログラムモジュール、プログラムデータを記憶する。すなわち、開示の技術に係るコード領域識別プログラムは、コンピュータ1000によって実行される指令が記述されたプログラムモジュールとして、例えばハードディスクドライブ1031に記憶される。具体的には、上記実施例で説明したプログラム起動部131と同様の情報処理を実行するプログラム起動手順と、メモリアクセス監視部132と同様の情報処理を実行するメモリアクセス監視手順と、プログラムコード候補決定部133と同様の情報処理を実行するプログラムコード候補決定手順と、プログラムコード抽出部134と同様の情報処理を実行するプログラムコード抽出手順とが記述されたプログラムモジュールが、ハードディスクドライブ1031に記憶される。
Here, as illustrated in FIG. 15, the
また、上記実施例で説明した実行モジュール記憶部121、メモリリージョン群リスト記憶部122、スコアリスト記憶部123及びプログラムコード記憶部124に記憶されるデータのように、コード領域識別プログラムによる情報処理に用いられるデータは、プログラムデータとして、例えばハードディスクドライブ1031に記憶される。そして、CPU1020が、ハードディスクドライブ1031に記憶されたプログラムモジュールやプログラムデータを必要に応じてRAM1012に読み出し、プログラム起動手順、メモリアクセス監視手順、プログラムコード候補決定手順、プログラムコード抽出手順を実行する。
Further, like the data stored in the execution module storage unit 121, the memory region group list storage unit 122, the score
なお、コード領域識別プログラムに係るプログラムモジュールやプログラムデータは、ハードディスクドライブ1031に記憶される場合に限られず、例えば着脱可能な記憶媒体に記憶され、ディスクドライブ等を介してCPU1020によって読み出されてもよい。あるいは、転送プログラムに係るプログラムモジュールやプログラムデータは、ネットワーク(LAN(Local Area Network)、WAN(Wide Area Network)等)を介して接続された他のコンピュータに記憶され、ネットワークインタフェース1070を介してCPU1020によって読み出されてもよい。
Note that the program module and program data related to the code area identification program are not limited to being stored in the
100 プログラムコード抽出装置
110 メモリ
121 実行モジュール記憶部
122 メモリリージョン群リスト記憶部
123 スコアリスト記憶部
124 プログラムコード記憶部
131 プログラム起動部
132 メモリアクセス監視部
133 プログラムコード候補決定部
134 プログラムコード抽出部
200 プログラムコード抽出装置
223 スコアリスト記憶部
233 分岐成立確率算出部
300 プログラムコード抽出装置
DESCRIPTION OF SYMBOLS 100 Program
Claims (6)
前記記憶領域に含まれる記憶空間に対する実行アクセスが行われるたびに、該記憶空間と連続して隣接し、かつ、使用中である記憶空間群に格納されているプログラムコードを取得する取得部と、
前記取得部によって取得されたプログラムコードを解析することで、相対アドレスによって命令を指定する分岐命令を含む分岐元記憶空間と、該相対アドレスが示す命令を含む分岐先記憶空間とに挟まれる分岐区域を特定し、記憶空間の境界毎に前記分岐区域に該境界が含まれる頻度を算出する算出部と、
前記算出部によって算出された頻度が所定の閾値以下である境界が前記プログラムを形成するプログラムコードと、該プログラムコードと異なるプログラムコードとが展開されているプログラム境界であると判定する判定部と
を有することを特徴とするコード領域識別装置。 A code area identification device for identifying a storage space in which a program code forming the program is expanded during execution of a program among storage areas divided for each predetermined storage space,
An acquisition unit that obtains a program code stored in a storage space group that is continuously adjacent to the storage space and in use each time execution access is made to the storage space included in the storage area;
A branch area sandwiched between a branch source storage space including a branch instruction that specifies an instruction by a relative address and a branch destination storage space including an instruction indicated by the relative address by analyzing the program code acquired by the acquisition unit And calculating a frequency at which the boundary is included in the branch area for each boundary of the storage space;
A determination unit that determines that a boundary whose frequency calculated by the calculation unit is equal to or less than a predetermined threshold is a program code forming the program and a program boundary in which a program code different from the program code is expanded. A code area identification device comprising:
前記判定部は、前記算出部によって算出された分岐元確率と分岐先確率との乗算結果である分岐成立確率を算出し、境界を跨ぐ分岐に関する分岐成立確率の総和に基づいて、記憶空間の境界毎に該境界が前記プログラム境界であるか否かを判定する
ことを特徴とする請求項1に記載のコード領域識別装置。 The calculation unit analyzes the program code acquired by the acquisition unit, so that the branch source probability that the branch instruction is a machine language instruction, and the branch destination probability that the instruction indicated by the relative address is a machine language instruction, To calculate
The determination unit calculates a branch establishment probability that is a multiplication result of the branch source probability and the branch destination probability calculated by the calculation unit, and based on the sum of the branch establishment probabilities regarding the branch across the boundary, the boundary of the storage space The code area identification device according to claim 1, wherein it is determined whether or not the boundary is the program boundary every time.
ことを特徴とする請求項2に記載のコード領域識別装置。 The determination unit includes a storage space indicated by an address in the vicinity of the center between addresses in which the sum of the branch establishment probabilities is equal to or less than the threshold among storage spaces including a branch instruction in which the sum of the branch establishment probabilities is equal to or less than a predetermined threshold The code area identification device according to claim 2, wherein the code area is determined to be the program boundary.
さらに有することを特徴とする請求項1〜3のいずれか一つに記載のコード領域識別装置。 2. The method according to claim 1, further comprising: an extracting unit that extracts a program code expanded in the storage space from the storage space where the execution access has been made to a boundary determined to be a program boundary by the determination unit. The code area identification device according to any one of?
前記コンピュータが、前記記憶領域に含まれる記憶空間に対する実行アクセスが行われるたびに、該記憶空間と連続して隣接し、かつ、使用中である記憶空間群に格納されているプログラムコードを取得する取得工程と、
前記コンピュータが、前記取得工程によって取得されたプログラムコードを解析することで、相対アドレスによって命令を指定する分岐命令を含む分岐元記憶空間と、該相対アドレスが示す命令を含む分岐先記憶空間とに挟まれる分岐区域を特定し、記憶空間の境界毎に前記分岐区域に該境界が含まれる頻度を算出する算出工程と、
前記コンピュータが、前記算出工程によって算出された頻度が所定の閾値以下である境界が前記プログラムを形成するプログラムコードと、該プログラムコードと異なるプログラムコードとが展開されているプログラム境界であると判定する判定工程と
を含むことを特徴とするコード領域識別方法。 A code area identification method for identifying, by a computer, a storage space in which a program code forming the program is expanded during program execution among storage areas divided for each predetermined storage space,
Each time the computer performs execution access to the storage space included in the storage area , the computer obtains a program code stored in a storage space group that is continuously adjacent to the storage space and is in use. Acquisition process;
The computer analyzes the program code obtained by the obtaining step, so that a branch source storage space including a branch instruction specifying an instruction by a relative address and a branch destination storage space including an instruction indicated by the relative address A calculation step of identifying a branching area to be sandwiched and calculating a frequency at which the boundary is included in the branching area for each boundary of the storage space;
The computer determines that a boundary whose frequency calculated by the calculation step is equal to or less than a predetermined threshold is a program boundary in which a program code forming the program and a program code different from the program code are expanded A code region identification method comprising: a determination step.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2010121487A JP5437913B2 (en) | 2010-05-27 | 2010-05-27 | Code area identification device, code area identification method, and code area identification program |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2010121487A JP5437913B2 (en) | 2010-05-27 | 2010-05-27 | Code area identification device, code area identification method, and code area identification program |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| JP2011248650A JP2011248650A (en) | 2011-12-08 |
| JP5437913B2 true JP5437913B2 (en) | 2014-03-12 |
Family
ID=45413829
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP2010121487A Active JP5437913B2 (en) | 2010-05-27 | 2010-05-27 | Code area identification device, code area identification method, and code area identification program |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JP5437913B2 (en) |
Families Citing this family (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP7188208B2 (en) * | 2019-03-20 | 2022-12-13 | 日本電気株式会社 | MALWARE ANALYSIS DEVICE, MALWARE ANALYSIS METHOD, AND PROGRAM |
Family Cites Families (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP2009048370A (en) * | 2007-08-17 | 2009-03-05 | Ntt Docomo Inc | Code conversion apparatus and code conversion method |
| JP5133192B2 (en) * | 2008-10-06 | 2013-01-30 | 日本電信電話株式会社 | Original code extraction apparatus, extraction method, and extraction program |
-
2010
- 2010-05-27 JP JP2010121487A patent/JP5437913B2/en active Active
Also Published As
| Publication number | Publication date |
|---|---|
| JP2011248650A (en) | 2011-12-08 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| JP5832954B2 (en) | Tag assignment device and tag assignment method | |
| US9459989B2 (en) | Method and apparatus for reverse debugging source code using causal analysis | |
| JP5303795B2 (en) | Application analysis method, analysis system, and analysis program | |
| EP2988242B1 (en) | Information processing device, and information processing method | |
| JP5952218B2 (en) | Information processing apparatus and information processing method | |
| CN113721928A (en) | Binary analysis-based dynamic library clipping method | |
| JP5437913B2 (en) | Code area identification device, code area identification method, and code area identification program | |
| CN106407104A (en) | Method and system used for detecting defects related to memory space release | |
| US8209443B2 (en) | System and method for identifying lost/stale hardware in a computing system | |
| CN112434294A (en) | Malicious code detection method, terminal device and storage medium | |
| CN114329446B (en) | Operating system threat detection method, device, electronic device and storage medium | |
| JP5766650B2 (en) | Information processing apparatus, monitoring method, and monitoring program | |
| KR101052735B1 (en) | Method for detecting presence of memory operation and device using same | |
| JP7355211B2 (en) | Signature generation device, signature generation method, and signature generation program | |
| JP5989599B2 (en) | Information processing apparatus and information processing method | |
| JP5571035B2 (en) | Specific apparatus, specific method, and specific program | |
| JP5389733B2 (en) | Extraction apparatus and extraction method | |
| JP5389734B2 (en) | Extraction apparatus and extraction method | |
| CN114296794B (en) | A code relocation method and apparatus | |
| JP7420269B2 (en) | Bug detection support device, bug detection support method, and bug detection support program | |
| JP7501782B2 (en) | Activity trace extraction device, activity trace extraction method, and activity trace extraction program | |
| JP5464673B2 (en) | Compilation support device, compilation support method, and program | |
| JP5710547B2 (en) | Information processing apparatus, monitoring method, and monitoring program | |
| US20250217497A1 (en) | Information processing apparatus, information processing method, and computer-readable recording medium | |
| JP7322964B2 (en) | Test information extraction device, test information extraction method and program |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20120928 |
|
| A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20130930 |
|
| A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20131008 |
|
| A521 | Request for written amendment filed |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20131121 |
|
| 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: 20131210 |
|
| A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20131212 |
|
| R150 | Certificate of patent or registration of utility model |
Ref document number: 5437913 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 Free format text: JAPANESE INTERMEDIATE CODE: R150 |
|
| S531 | Written request for registration of change of domicile |
Free format text: JAPANESE INTERMEDIATE CODE: R313531 |
|
| R350 | Written notification of registration of transfer |
Free format text: JAPANESE INTERMEDIATE CODE: R350 |