JP2018124850A - Program protection apparatus, program protection method, and program protection program - Google Patents

Program protection apparatus, program protection method, and program protection program Download PDF

Info

Publication number
JP2018124850A
JP2018124850A JP2017017402A JP2017017402A JP2018124850A JP 2018124850 A JP2018124850 A JP 2018124850A JP 2017017402 A JP2017017402 A JP 2017017402A JP 2017017402 A JP2017017402 A JP 2017017402A JP 2018124850 A JP2018124850 A JP 2018124850A
Authority
JP
Japan
Prior art keywords
program
loader
protection
unique
api
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
JP2017017402A
Other languages
Japanese (ja)
Other versions
JP6696918B2 (en
Inventor
裕平 川古谷
Yuhei Kawakoya
裕平 川古谷
誠 岩村
Makoto Iwamura
誠 岩村
健 矢田
Takeshi Yada
健 矢田
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.)
Nippon Telegraph and Telephone Corp
Original Assignee
Nippon Telegraph and Telephone Corp
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 Nippon Telegraph and Telephone Corp filed Critical Nippon Telegraph and Telephone Corp
Priority to JP2017017402A priority Critical patent/JP6696918B2/en
Publication of JP2018124850A publication Critical patent/JP2018124850A/en
Application granted granted Critical
Publication of JP6696918B2 publication Critical patent/JP6696918B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

PROBLEM TO BE SOLVED: To realize protection of programs from analysis while avoiding analysis on a library function to be used at the time of program execution.SOLUTION: A program providing apparatus 10 is a unique loader that operates independently of a program loading mechanism provided by an operation system at the time of program execution, and includes a loader embedding unit 151 configured to previously embed, in a protection target program, a unique loader for loading an executable file including a library function and putting the library function included in the executable file in a ready state, and an output unit 13 configured to output a protected program which is the protection target program in which the unique loader is embedded.SELECTED DRAWING: Figure 2

Description

本発明は、プログラム保護装置、プログラム保護方法及びプログラム保護プログラムに関する。   The present invention relates to a program protection device, a program protection method, and a program protection program.

インターネットの普及によりソフトウェアをインターネット上からダウンロードしコンピュータ上で実行するといったソフトウェア配布方法が一般化している。デジタルデータは、容易に複製が作成できる特性を生かし、ユーザからのリクエストに応じて、オリジナルのソフトウェアを複製し、配布することができる。ただし、不特定多数のユーザがオリジナルと同等のソフトウェアを持つことには問題もある。   With the spread of the Internet, software distribution methods such as downloading software from the Internet and executing it on a computer have become common. Digital data makes it possible to copy and distribute original software in response to a request from a user, taking advantage of the characteristics that can be easily duplicated. However, it is problematic that an unspecified number of users have the same software as the original.

ここで、Windows(登録商標)を例として、ソフトウェア実行の流れについて説明する。Windowsのプログラムローダは、PE(Portable Executable)形式の実行ファイルを読み込み、そのプログラムが実行可能になるように実行環境を整える。この実行環境を整える処理として、実行ファイルをメモリ上に展開する第1処理と、この実行ファイルが利用しているAPI(Application Programming Interface)を含むDLL(Dynamic Link Library)をメモリ上に展開する第2処理と、実行ファイルのコード部分から、DLLが提供するAPIを呼び出せるようにポインタの整合性を整える第3処理とがある。   Here, the flow of software execution will be described using Windows (registered trademark) as an example. A Windows program loader reads an executable file in PE (Portable Executable) format and prepares an execution environment so that the program can be executed. As a process for preparing the execution environment, a first process for expanding an execution file on a memory and a DLL (Dynamic Link Library) including an API (Application Programming Interface) used by the execution file are expanded on a memory. There are two processes and a third process for adjusting the consistency of the pointer so that the API provided by the DLL can be called from the code portion of the executable file.

まず、第1処理について説明する。第1処理では、Windowsのローダは、まず実行ファイルのPEヘッダを確認し、当該実行ファイルをロードするために必要なメモリ領域を確保する。次に、Windowsのローダは、その領域に対して、実行ファイルを確保したメモリ空間にマッピングする。このメモリ空間とマッピングされたファイルは、Windowsによって管理される。具体的には、VAD(Virtual Address Descriptor)という構造体が利用されているメモリ領域毎に作成され、マッピングされたファイルの情報もこのVADに格納される。   First, the first process will be described. In the first process, the Windows loader first checks the PE header of the execution file and secures a memory area necessary for loading the execution file. Next, the Windows loader maps the area to the memory space in which the execution file is secured. Files mapped to this memory space are managed by Windows. Specifically, information on a file created and mapped for each memory area where a structure called VAD (Virtual Address Descriptor) is used is also stored in this VAD.

次に、第2処理について説明する。第2処理では、Windowsのローダは、この実行ファイルが利用しているAPIを持つDLLを知るために、PEヘッダのインポートテーブルに格納されている情報を参照する。Windowsのローダは、インポートテーブルのデータ構造体をパース(解析)することにより、必要なDLLとAPIとを特定し、このDLLをメモリ上に展開(ロード)する。このDLLが配置されたメモリアドレスをベースアドレスという。ロードされたDLLの情報は、PEB(Process Environment Block)と呼ばれるデータ構造体の中にリンクリスト構造で保持される。このリストの各エントリは、ロードされた各DLLの情報が保持される。DLLのベースアドレスの情報もこのエントリの中に保存される。   Next, the second process will be described. In the second process, the Windows loader refers to the information stored in the import table of the PE header in order to know the DLL having the API used by the execution file. The Windows loader parses (analyzes) the data structure of the import table, identifies the necessary DLL and API, and expands (loads) the DLL onto the memory. The memory address where this DLL is arranged is called a base address. The loaded DLL information is held in a linked list structure in a data structure called PEB (Process Environment Block). Each entry of this list holds information on each loaded DLL. The DLL base address information is also stored in this entry.

そして、第3処理について説明する。第3処理では、実行ファイルは、ロードしたDLLのベースアドレスと、そのDLLのエクスポートテーブルが提供する各APIのオフセット情報とにより、対象とするAPIがメモリのどのアドレスに配置されたかを計算し、そのアドレスを自身のインポートアドレステーブルの中に格納する。実行ファイルは、APIを呼び出す際、このインポートアドレステーブルを経由して呼び出す。例えば、実行ファイルは、「call [0x10001000]」のような間接コール命令を利用し、「0x10001000」に格納されているアドレスを関数として呼び出すことでAPI呼び出しを実現する。   Then, the third process will be described. In the third process, the execution file calculates the address at which the target API is arranged in the memory based on the base address of the loaded DLL and the offset information of each API provided by the DLL export table. Store the address in its own import address table. The executable file is called via this import address table when calling the API. For example, the execution file uses an indirect call instruction such as “call [0x10001000]” and calls an address stored in “0x10001000” as a function to realize an API call.

また、実行ファイルは、インポートアドレステーブルを経由せずに、動的に目的のAPIが配置さえているアドレスを取得し、直接ジャンプする方法でAPIを呼び出すことができる。Windowsの場合、DLLのロードされているアドレスを知るLoadLibrary(DLLがまだロードされていない場合は、新たにDLLをロードする)と、このDLLが提供しているAPIのアドレスを取得するGetProcAddressを利用して動的にAPIのアドレスを知ることもできる。   In addition, the execution file can dynamically acquire the address where the target API is arranged without going through the import address table, and call the API by a method of jumping directly. In the case of Windows, use LoadLibrary to know the address where the DLL is loaded (if the DLL is not loaded yet, load a new DLL), and use GetProcAddress to obtain the API address provided by this DLL It is also possible to dynamically know the API address.

続いて、実行ファイルが確認を行うPEヘッダの構造について説明する。図9は、PEヘッダの構造を説明する図である。図9の(a)は、PEヘッダが存在するPEファイルフォーマットの一例を示す。図9(b)は、PEヘッダが有する情報から説明のために抜出した一部の情報を示す。図9に示すように、PEヘッダは、PEファイルフォーマットのファイルに存在するヘッダファイルで、ファイルに関する情報が格納されている。なお、PEファイルフォーマットは、Windowsの実行ファイルの標準フォーマットである。   Next, the structure of the PE header that the execution file confirms will be described. FIG. 9 is a diagram for explaining the structure of the PE header. FIG. 9A shows an example of a PE file format in which a PE header exists. FIG. 9B shows a part of information extracted for explanation from the information included in the PE header. As shown in FIG. 9, the PE header is a header file that exists in a PE file format file, and stores information related to the file. The PE file format is a standard format for Windows executable files.

通常、プログラムは、複数の外部ライブラリを利用する。Windowsの場合、APIが、この外部ライブラリ関数に該当する。そして、WindowsのシステムDLLが、これらのAPIを提供している。   Usually, a program uses a plurality of external libraries. In the case of Windows, the API corresponds to this external library function. The Windows system DLL provides these APIs.

PEヘッダには、その実行ファイルがどのAPIを必要とするかの情報がインポートテーブルに記載されている。インポートテーブルは、「IMAGE_DATA_DIRECTORY(IMAGE_DIRECTORY_ENTRY_IMPORT)」(図9の(a)の枠C1参照)からポイントされている「IMAGE_IMPORT_DESCRIPTOR」(図9の(b)の枠C2参照)である。インポートテーブルは、この実行ファイルが利用しているAPIとDLLとの名前の情報が格納されたインポートネームテーブルや当該DLLのメモリ上のアドレス情報が格納されたインポートアドレステーブルなどを含む(図9の(1)参照)。   In the PE header, information on which API the execution file requires is described in the import table. The import table is “IMAGE_IMPORT_DESCRIPTOR” (see frame C2 in FIG. 9B) pointed from “IMAGE_DATA_DIRECTORY (IMAGE_DIRECTORY_ENTRY_IMPORT)” (see frame C1 in FIG. 9A). The import table includes an import name table in which information on names of APIs and DLLs used by the execution file is stored, an import address table in which address information on the memory of the DLL is stored (FIG. 9). (See (1)).

また、実行ファイルが外部にインタフェースを公開している場合(例えばDLLの場合)、プログラム自身が提供しているAPIの情報をエクスポートテーブルに保持している。エクスポートテーブルは、「IMAGE_DATA_DIRECTORY(IMAGE_DIRECTORY_ENTRY_EXPORT)」(図9の(a)の枠C3参照)からポイントされている「IMAGE_EXPORT_DIRECOTRY」(図9の(b)の枠C4参照)である。エクスポートテーブルには、提供しているAPIの名前、及び、このAPIが配置している場所の情報が記載されている(図9の(2)参照)。APIを配置している場所の情報は、ベースアドレスからの相対アドレス(オフセット)として表現されている。   Further, when the execution file discloses an interface to the outside (for example, in the case of DLL), API information provided by the program itself is held in the export table. The export table is “IMAGE_EXPORT_DIRECOTRY” (see frame C4 in FIG. 9B) pointed from “IMAGE_DATA_DIRECTORY (IMAGE_DIRECTORY_ENTRY_EXPORT)” (see frame C3 in FIG. 9A). In the export table, the name of the API provided and information on the location where the API is arranged are described (see (2) in FIG. 9). The information on the location where the API is arranged is expressed as a relative address (offset) from the base address.

このような動作の仕組みは一般に公開されている。このため、攻撃者は、実行に関わるPE形式ファイルの構造や、APIの呼び出し等の挙動を基に、様々な解析技術を駆使することにより、ソフトウェアの内部構造を明らかにし、本来の機能の無効化、機能の追加、隠されている情報の入手等を実行することができる。   Such a mechanism of operation is open to the public. For this reason, the attacker uses various analysis techniques based on the structure of the PE format file related to execution and the behavior of API calls, etc., to clarify the internal structure of the software and invalidate the original function. , Adding functions, obtaining hidden information, etc.

すなわち、どのようなプログラムであっても、Windowsのローダによってロードされる限り、PEファイルフォーマットにしたがい、ローダに、適切にプログラムの構造情報を提供する必要がある。このため、攻撃者は、上記の構造から得られる情報を基に、例えば、有償ソフトウェアライセンスの認証に関わるコード部分を特定し、その部分をバイパスするようにプログラムを改変することによって、ライセンスなしに有償ソフトウェアを利用できてしまう。また、攻撃者に、ソフトウェアに潜む脆弱性を特定され、コンピュータウィルス等の感染に利用されてしまうといった事案も懸念される。   In other words, as long as any program is loaded by the Windows loader, it is necessary to appropriately provide the program structure information to the loader according to the PE file format. For this reason, the attacker can specify the code part related to the authentication of the paid software license based on the information obtained from the above structure and modify the program so that the part is bypassed without the license. Paid software can be used. There is also a concern that attackers may identify vulnerabilities in software and use them for infections such as computer viruses.

このため、解析からプログラムを保護するために様々な保護技術、コード難読化技術がある。例えば、近年では、リバースエンジニアリングを防止するためのコード難読化技術が提案されている(例えば、非特許文献1参照)。さらに、プログラムがインポートしているAPIを隠すため、PEヘッダに含まれる情報の一部、具体的には実行ファイルが利用しているAPIとDLLとの名前の情報が記載されたインポートネームテーブルの削除や、該DLLのメモリ上のアドレス情報が格納されたインポートアドレステーブルの位置を見つけにくくしてしまう方法が提案されている(例えば、非特許文献2参照)。   For this reason, there are various protection techniques and code obfuscation techniques for protecting programs from analysis. For example, in recent years, a code obfuscation technique for preventing reverse engineering has been proposed (see, for example, Non-Patent Document 1). Furthermore, in order to hide the API imported by the program, part of the information included in the PE header, specifically, the name of the API and DLL used by the executable file is described in the import name table. There has been proposed a method of deleting or making it difficult to find the position of the import address table in which the address information on the memory of the DLL is stored (see, for example, Non-Patent Document 2).

Andreas Moser, Christopher Kruegel, and Engin Kirda, “Limits of Static Analysis for Malware Detection”, in Proceedings of the 23rd Annual Computer Security Applications Conference (ACSAC) 2007.Andreas Moser, Christopher Kruegel, and Engin Kirda, “Limits of Static Analysis for Malware Detection”, in Proceedings of the 23rd Annual Computer Security Applications Conference (ACSAC) 2007. アナライジング・マルウェア ―フリーツールを使った感染事案対処 ―(Art Of Reversing),新井 悠 (著), 岩村 誠 (著), 川古谷 裕平 (著), 青木 一史 (著), 星澤 裕二 (著),オライリージャパン (2010/12/20)Analyzing Malware-Infection Case Management Using Free Tools (Art Of Reversing), Arai Satoshi (Author), Iwamura Makoto (Author), Kawafuruya Yuhei (Author), Aoki Kazufumi (Author), Hoshizawa Yuji (Author) ), O'Reilly Japan (2010/12/20)

しかしながら、非特許文献1記載の方法を用いて対策を施したとしても、実際にプログラムを動作させ、呼び出されるAPIコール列によりプログラムの挙動を攻撃者に解析されてしまうという問題があった。具体的には、攻撃者が、APIフックを重要なAPIに対して設定し、そのAPIの呼び出しを横取りする方法を実行することが考えられる。或いは、攻撃者が、戻り値を書き換えることによって解析対象プログラムをごまかし、攻撃者の意図した動作をさせてしまう方法や、各APIに渡されている引数を取り出し、プログラム内で使われている重要な情報を覗き見る(盗み出す)という方法を実行することが考えられる。   However, even if measures are taken using the method described in Non-Patent Document 1, there is a problem that the program is actually operated, and the behavior of the program is analyzed by an attacker by the API call sequence to be called. Specifically, it is conceivable that an attacker sets an API hook for an important API and executes a method of intercepting the API call. Or, it is important that the attacker deceives the analysis target program by rewriting the return value, and causes the attacker to perform the intended operation, or extracts the arguments passed to each API and is used in the program It is conceivable to execute a method of peeping out (stealing) various information.

また、実行時に復元した後のメモリダンプを取り、解析することによって隠蔽されたインポートネームテーブルを復元する方法などが確立している。したがって、非特許文献2記載の方法を用いてインポートネームテーブル等を削除したとしても、攻撃者が、APIの呼び出しやインポートしているAPIの解析が可能であるという問題がある。   In addition, a method has been established for restoring a hidden import name table by taking and analyzing a memory dump after restoration at the time of execution. Therefore, even if the import name table or the like is deleted using the method described in Non-Patent Document 2, there is a problem that an attacker can call an API or analyze an imported API.

このように、従来提案されているコード難読化技術やPEヘッダ書き換え技術を用いても、APIの呼び出しやインポートしているAPIの解析が可能となっており、プログラムの不正な改造等からプログラムを保護することができなかった。   In this way, even using the code obfuscation technology and PE header rewriting technology that have been proposed in the past, it is possible to call APIs and analyze imported APIs. Could not be protected.

本発明は、上記に鑑みてなされたものであって、プログラム実行時に利用するライブラリ関数の解析を回避し、解析からプログラムを保護することができるプログラム保護装置、プログラム保護方法及びプログラム保護プログラムを提供することを目的とする。   The present invention has been made in view of the above, and provides a program protection device, a program protection method, and a program protection program capable of avoiding analysis of library functions used during program execution and protecting the program from the analysis. The purpose is to do.

本発明のプログラム保護装置は、プログラムの実行時において、オペレーションシステムが提供するプログラムローディング機構とは独立して動作する独自ローダであって、ライブラリ関数を含む実行ファイルをロードし実行ファイルに含まれているライブラリ関数を呼び出し可能状態にする独自ローダを、予め保護対象プログラムに埋め込むローダ埋め込み部と、独自ローダが埋め込まれた保護対象プログラムである保護済みプログラムを出力する出力部と、を有することを特徴とする。   The program protection device according to the present invention is a unique loader that operates independently of the program loading mechanism provided by the operation system when executing a program. The program protection device loads an execution file including a library function and is included in the execution file. A loader embedding unit that embeds a unique loader that makes a callable library function into a protected program in advance, and an output unit that outputs a protected program that is a protected program in which the unique loader is embedded And

本発明によれば、プログラム実行時に利用するライブラリ関数の解析を回避し、解析からプログラムを保護することができる。   According to the present invention, it is possible to avoid the analysis of the library function used at the time of executing the program and protect the program from the analysis.

図1は、本実施の形態に係る情報システムの一例を模式的に示す図である。FIG. 1 is a diagram schematically illustrating an example of an information system according to the present embodiment. 図2は、図1に示すプログラム提供装置の構成を示すブロック図である。FIG. 2 is a block diagram showing a configuration of the program providing apparatus shown in FIG. 図3は、図2に示すローダ埋め込み部の処理を説明する図である。FIG. 3 is a diagram for explaining the processing of the loader embedding unit shown in FIG. 図4は、本実施の形態に係る独自ローダの構成を説明する図である。FIG. 4 is a diagram for explaining the configuration of the unique loader according to the present embodiment. 図5は、図2に示すプログラム提供装置が実行するプログラム保護処理の処理手順を示すフローチャートである。FIG. 5 is a flowchart showing the processing procedure of the program protection processing executed by the program providing apparatus shown in FIG. 図6は、保護済みプログラムが独自にローダを実行する処理の処理手順を示すフローチャートである。FIG. 6 is a flowchart showing a processing procedure of processing in which the protected program independently executes the loader. 図7は、保護済みプログラムが独自にローダを実行する処理の他の処理手順を示すフローチャートである。FIG. 7 is a flowchart showing another processing procedure for the protected program to independently execute the loader. 図8は、プログラムが実行されることによりプログラム保護装置が実現されるコンピュータの一例を示す図である。FIG. 8 is a diagram illustrating an example of a computer in which a program protection device is realized by executing a program. 図9は、PEヘッダの構造を説明する図である。FIG. 9 is a diagram for explaining the structure of the PE header.

以下、図面を参照して、本発明の一実施形態を詳細に説明する。なお、この実施形態により本発明が限定されるものではない。また、図面の記載において、同一部分には同一の符号を付して示している。   Hereinafter, an embodiment of the present invention will be described in detail with reference to the drawings. In addition, this invention is not limited by this embodiment. Moreover, in description of drawing, the same code | symbol is attached | subjected and shown to the same part.

[実施の形態]
本発明の実施の形態について説明する。本発明の実施の形態では、保護対象プログラムに対し、ライブラリ関数の解析を回避するための保護処理を行うプログラム保護装置、プログラム保護方法及びプログラム保護プログラムについて説明する。まず、実施の形態における情報システムの一例を説明する。
[Embodiment]
Embodiments of the present invention will be described. In the embodiment of the present invention, a program protection device, a program protection method, and a program protection program for performing protection processing for avoiding analysis of a library function for a protection target program will be described. First, an example of the information system in the embodiment will be described.

[情報システムの構成]
図1は、本発明の実施の形態における情報システムの構成の一例を模式的に示す図である。なお、本実施の形態に係る情報システムは、各装置が、各種オペレーションシステム(Operating System:OS)のうち、Windows上で動作処理を実行する場合を例に述べる。もちろん、OSとして、Linux(登録商標)やMacintosh(登録商標)を採用するOSであっても、同様の方法で、プログラム保護処理を実施することが可能である。
[Information system configuration]
FIG. 1 is a diagram schematically showing an example of the configuration of an information system according to an embodiment of the present invention. Note that the information system according to the present embodiment will be described by taking as an example the case where each device executes an operation process on Windows among various operating systems (OS). Of course, even if the OS adopts Linux (registered trademark) or Macintosh (registered trademark) as the OS, the program protection processing can be performed in the same manner.

図1に示す情報システムは、例えば、プログラム提供装置10(プログラム保護装置)と、情報処理装置100とが、インターネットや専用線等のネットワークNを介して接続する構成を有する。   The information system shown in FIG. 1 has a configuration in which, for example, a program providing apparatus 10 (program protection apparatus) and an information processing apparatus 100 are connected via a network N such as the Internet or a dedicated line.

プログラム提供装置10は、ネットワークNを介して、情報処理装置100にプログラムを提供する。プログラム提供装置10は、保護対象プログラムに対してライブラリ関数の解析を回避するためのプログラム保護処理を行った保護済みプログラムを、情報処理装置100に提供する。プログラム提供装置10は、プログラム保護処理として、保護対象プログラムの実行ファイルに対して、OSが提供するプログラムローディング機構とは独立して動作する独自ローダを予め埋め込む処理を行う。この独自ローダは、OSが提供するプログラムローディング機構とは独立して、ライブラリ関数を含む実行ファイルをロードし実行ファイルに含まれているライブラリ関数を呼び出し可能状態にするものである。   The program providing apparatus 10 provides a program to the information processing apparatus 100 via the network N. The program providing apparatus 10 provides the information processing apparatus 100 with a protected program obtained by performing a program protection process for avoiding the analysis of the library function for the protection target program. As the program protection process, the program providing apparatus 10 performs a process of pre-embedding a unique loader that operates independently of the program loading mechanism provided by the OS into the execution file of the protection target program. Independent of the program loading mechanism provided by the OS, this unique loader loads an execution file including a library function and makes the library function included in the execution file callable.

すなわち、プログラム提供装置10は、提供するプログラムに、独自ローダを埋め込むことによって、利用者による解析を防止した保護済みプログラムを生成する。そして、プログラム提供装置10は、保護済みプログラムを利用者に配布する。以降、保護対象プログラムは、独自ローダを埋め込まれる前のプログラムを示し、保護済みプログラムは、独自ローダ等が埋め込まれ、ライブラリ関数(例えば、API)の呼び出しが難読化されたプログラムを示す。   That is, the program providing apparatus 10 generates a protected program that prevents analysis by the user by embedding a unique loader in the provided program. Then, the program providing apparatus 10 distributes the protected program to the users. Hereinafter, the protection target program indicates a program before the unique loader is embedded, and the protected program indicates a program in which an original loader or the like is embedded and obfuscation of a library function (for example, API) is obfuscated.

なお、保護済みプログラムは、ネットワークNを介して他の装置(例えば、情報処理装置100)に提供される他、記憶媒体に記憶され、この記憶媒体の配布によって、他の装置に提供されてもよい。   The protected program may be provided to other devices (for example, the information processing device 100) via the network N, may be stored in a storage medium, and may be provided to other devices by distribution of the storage medium. Good.

情報処理装置100は、サーバ装置、PC(Personal Computer)、スマートフォン、等である。情報処理装置100では、プログラム提供装置10が提供する保護済みプログラムを取得すると、OSが提供するプログラムローディング機構により、保護済みプログラムをロードし、メモリに展開する。その後、ブートストラップコードに制御を移し、独自ローダの機能を使ってオリジナルコードを実行可能状態にする。情報処理装置100では、独自ローダが、実行ファイルに含まれているライブラリ関数を呼び出し可能状態にしている。言い換えると、利用者である情報処理装置100の環境では、保護済みプログラムが、OSが提供するプログラムローディング機構とは独立してロード処理を開始し、独自ローダにより秘密性を高めた方法で、APIの提供を行うDLLをロードすることによって、APIの難読化を行う。   The information processing apparatus 100 is a server apparatus, a PC (Personal Computer), a smartphone, or the like. In the information processing apparatus 100, when the protected program provided by the program providing apparatus 10 is acquired, the protected program is loaded by the program loading mechanism provided by the OS and developed in the memory. Thereafter, control is transferred to the bootstrap code, and the original code is made executable by using the function of the original loader. In the information processing apparatus 100, the unique loader is capable of calling library functions included in the execution file. In other words, in the environment of the information processing apparatus 100 that is the user, the protected program starts the loading process independently of the program loading mechanism provided by the OS, and the API is used to increase the confidentiality by the original loader. API is obfuscated by loading the DLL that provides the above.

[プログラム提供装置の構成]
続いて、プログラム提供装置10の構成について説明する。図2は、図1に示すプログラム提供装置10の構成を示すブロック図である。図2に示すように、プログラム提供装置10は、通信部11、入力部12、出力部13、記憶部14及び制御部15を有する。
[Configuration of Program Providing Device]
Next, the configuration of the program providing apparatus 10 will be described. FIG. 2 is a block diagram showing a configuration of the program providing apparatus 10 shown in FIG. As illustrated in FIG. 2, the program providing apparatus 10 includes a communication unit 11, an input unit 12, an output unit 13, a storage unit 14, and a control unit 15.

通信部11は、ネットワーク等を介して接続された他の装置との間で、各種情報を送受信する通信インタフェースである。通信部11は、NIC(Network Interface Card)等で実現され、LAN(Local Area Network)やインターネットなどの電気通信回線を介した他の装置と制御部15との間の通信を行う。例えば、通信部11は、ネットワークNなどを介して入力された保護対象プログラムを、制御部15に入力する。そして、通信部11は、プログラム保護処理が実行された保護済みプログラムを、ネットワークN等を介して、他の装置に送信する。   The communication unit 11 is a communication interface that transmits and receives various types of information to and from other devices connected via a network or the like. The communication unit 11 is realized by a NIC (Network Interface Card) or the like, and performs communication between another device and the control unit 15 via a telecommunication line such as a LAN (Local Area Network) or the Internet. For example, the communication unit 11 inputs a protection target program input via the network N or the like to the control unit 15. And the communication part 11 transmits the protected program by which the program protection process was performed to another apparatus via the network N etc.

入力部12は、プログラム提供装置10の操作者からの各種操作を受け付ける入力インタフェースである。例えば、入力部12は、タッチパネル、音声入力デバイス、キーボードやマウス等の入力デバイスによって構成される。   The input unit 12 is an input interface that accepts various operations from an operator of the program providing apparatus 10. For example, the input unit 12 includes an input device such as a touch panel, a voice input device, a keyboard, and a mouse.

出力部13は、例えば、液晶ディスプレイなどの表示装置、プリンター等の印刷装置、情報通信装置等によって実現される。出力部13は、プログラム保護処理の結果等を操作者に対して出力する。   The output unit 13 is realized by, for example, a display device such as a liquid crystal display, a printing device such as a printer, an information communication device, or the like. The output unit 13 outputs the result of the program protection process to the operator.

記憶部14は、RAM(Random Access Memory)、フラッシュメモリ(Flash Memory)等の半導体メモリ素子、又は、ハードディスク、光ディスク等の記憶装置によって実現され、プログラム提供装置10を動作させる処理プログラムや、処理プログラムの実行中に使用されるデータなどが記憶される。   The storage unit 14 is realized by a semiconductor memory device such as a RAM (Random Access Memory) or a flash memory, or a storage device such as a hard disk or an optical disk, and a processing program for operating the program providing device 10 or a processing program The data used during the execution of is stored.

制御部15は、各種の処理手順などを規定したプログラム及び所要データを格納するための内部メモリを有し、これらによって種々の処理を実行する。例えば、制御部15は、CPU(Central Processing Unit)やMPU(Micro Processing Unit)などの電子回路である。制御部15は、ローダ埋め込み部151を有する。   The control unit 15 has an internal memory for storing a program that defines various processing procedures and the necessary data, and executes various processes using these. For example, the control unit 15 is an electronic circuit such as a CPU (Central Processing Unit) or an MPU (Micro Processing Unit). The control unit 15 includes a loader embedding unit 151.

ローダ埋め込み部151は、独自ローダを予め保護対象プログラムに埋め込む。この独自ローダは、プログラムの実行時において、実行先の装置(例えば、情報処理装置100)のOSが提供するプログラムローディング機構とは独立して動作するものである。そして、この独自ローダは、APIを含む実行ファイルをロードし実行ファイルに含まれているAPIを呼び出し可能状態にする。ローダ埋め込み部151は、依存API列挙部152(依存ライブラリ関数列挙部)、データコード注入部153及びヘッダ修正部154を有する。   The loader embedding unit 151 embeds the unique loader in the protection target program in advance. This unique loader operates independently of the program loading mechanism provided by the OS of the execution destination apparatus (for example, the information processing apparatus 100) during execution of the program. Then, this unique loader loads an execution file including the API and makes the API included in the execution file callable. The loader embedding unit 151 includes a dependency API enumeration unit 152 (dependence library function enumeration unit), a data code injection unit 153, and a header correction unit 154.

依存API列挙部152は、保護対象プログラムが依存するDLLとAPIとを列挙し、列挙したライブラリ関数の名前を難読化する。データコード注入部153は、APIの名前を難読化した文字列のテーブル等の実行時に必要なデータ、独自ローダ及びブートストラップコードを保護対象プログラムに注入する。   The dependency API enumeration unit 152 enumerates DLLs and APIs on which the protection target program depends, and obfuscates the names of the enumerated library functions. The data code injection unit 153 injects data necessary for execution such as a character string table obfuscated with an API name, a unique loader, and a bootstrap code into the protection target program.

ヘッダ修正部154は、保護対象プログラムのオリジナルコードよりも前にブートストラップが実行されるように実行ファイルのヘッダであるPEヘッダを修正する。これによって、独自ローダは、情報処理装置100における保護済みプログラムの実行時において、保護済みプログラムのオリジナルコードが実行される前に動作することができる。なお、オリジナルコードは、保護対象プログラムのコード部である。   The header correction unit 154 corrects the PE header that is the header of the execution file so that the bootstrap is executed before the original code of the protection target program. Accordingly, the unique loader can operate before the original code of the protected program is executed when the protected program is executed in the information processing apparatus 100. The original code is a code part of the protection target program.

[ローダ埋め込み部の処理]
次に、ローダ埋め込み部151の処理について説明する。図3は、図2に示すローダ埋め込み部151の処理を説明する図である。
[Processing of loader embedding part]
Next, processing of the loader embedding unit 151 will be described. FIG. 3 is a diagram for explaining the processing of the loader embedding unit 151 shown in FIG.

ローダ埋め込み部151は、入力としてPEフォーマットの実行ファイルを保護対象プログラムPaとして受け取る。そして、ローダ埋め込み部151は、独自ローダDa、ブートストラップコードDb及び実行時に必要なデータDcを保護対象プログラムPaに埋め込む。さらに、ローダ埋め込み部151は、PEヘッダの情報を修正し、該PEヘッダを修正したプログラムを、保護済みプログラムPbとして出力する。   The loader embedding unit 151 receives an execution file in PE format as an input as a protection target program Pa. The loader embedding unit 151 embeds the original loader Da, the bootstrap code Db, and data Dc necessary for execution in the protection target program Pa. Further, the loader embedding unit 151 corrects the information of the PE header, and outputs the program with the corrected PE header as the protected program Pb.

ここで、データDcは、保護対象プログラムPaがインポートしているDLLやAPIの情報や、保護対象プログラムの元々の入り口(最初に実行される命令の先頭である。)を示すオリジナルエントリポイント、などである。エントリポイントは、PEファイルフォーマットの実行ファイルのPEヘッダに書かれている、その実行ファイルの入り口(一番最初に実行される命令の先頭)である。オリジナルエントリポイントは、保護対象プログラムの元々の入り口(一番最初に実行される命令の先頭)である。   Here, the data Dc is information on DLLs and APIs imported by the protection target program Pa, an original entry point indicating the original entry of the protection target program (the first instruction to be executed first), and the like. It is. The entry point is the entry of the executable file (the head of the first instruction to be executed) written in the PE header of the executable file in the PE file format. The original entry point is the original entrance (the head of the first instruction to be executed) of the protection target program.

続いて、ローダ埋め込み部151を構成する依存API列挙部152、データコード注入部153及びヘッダ修正部154が実行する各処理を説明する。   Next, each process executed by the dependency API listing unit 152, the data code injection unit 153, and the header correction unit 154 constituting the loader embedding unit 151 will be described.

まず、依存API列挙部152は、保護対象プログラムPaのPEヘッダを走査し、このプログラムが依存している外部DLLとAPIとを列挙する。列挙したAPI名は、後ほど、ブートストラップコードDbが、情報処理装置100における保護済みプログラムの実行時に利用する。このため、依存API列挙部152は、復元が可能なアルゴリズムを用いてAPI名を難読化し、データコード注入部153に依頼して、この難読化したAPI名を保護対象プログラムPaに注入する。   First, the dependency API enumeration unit 152 scans the PE header of the protection target program Pa, and enumerates external DLLs and APIs on which the program depends. The enumerated API names are used later by the bootstrap code Db when executing the protected program in the information processing apparatus 100. For this reason, the dependent API enumeration unit 152 obfuscates the API name using an algorithm that can be restored, and requests the data code injection unit 153 to inject the obfuscated API name into the protection target program Pa.

データコード注入部153は、渡されたデータまたはコードを保護対象プログラムPaの中に注入する。データコード注入部153は、注入のために、既存のセクションの中に適切なサイズの領域を見つけ出す方法、または、新たにセクションを追加して、追加したセクションにデータまたはコードを追加する方法を用いる。また、データコード注入部153は、注入の際、必要であれば、セクションに適切なパーミッションの変更を行う。   The data code injection unit 153 injects the passed data or code into the protection target program Pa. The data code injection unit 153 uses a method of finding an area of an appropriate size in an existing section for injection, or a method of adding a new section and adding data or code to the added section. . In addition, the data code injection unit 153 changes the appropriate permission for the section if necessary at the time of injection.

データコード注入部153が保護対象プログラムPaに埋め込むものは、保護対象APIが依存しているAPIの名前を難読化した文字列のテーブル等の実行時に必要なデータ、独自ローダ、及び、ブートストラップコード、の3つである。データコード注入部153は、ブートストラップコードを埋め込む際、オリジナルエントリポイントの情報をブートストラップコードの中に含めた形で、保護対象プログラムPaに埋め込む。または、オリジナルエントリポイントの情報はデータ(Dc)に格納し、ブートストラップコードはこれを参照してもよい。   What the data code injection unit 153 embeds in the protection target program Pa includes data necessary for execution such as a character string table obfuscated by the name of the API on which the protection target API depends, a unique loader, and a bootstrap code These are the three. When embedding the bootstrap code, the data code injection unit 153 embeds the original entry point information in the protection target program Pa in a form including the bootstrap code. Alternatively, the original entry point information may be stored in data (Dc), and the bootstrap code may refer to this.

そして、ヘッダ修正部154は、オリジナルコードよりも先に実行されるように、PEヘッダを修正する。具体的には、ヘッダ修正部154は、埋め込んだブートストラップコードを指すようにPEヘッダのエントリポイントを修正する。エントリポイントとは、PEファイルフォーマットの実行ファイルのPEヘッダに書かれている、その実行ファイルの入り口を示す情報である。または、ヘッダ修正部154は、TLS−callbackと呼ばれるスレッドの開始及び終了時に特定の処理を行う設定をすることによって、埋め込んだブートストラップコードをTLS−callbackのハンドラとして登録する方法を用いることもできる。また、ヘッダ修正部154は、保護済みプログラムの秘密性を高めるため、依存しているAPI情報やデバッグ情報等を削除する。   Then, the header correction unit 154 corrects the PE header so that it is executed before the original code. Specifically, the header correction unit 154 corrects the PE header entry point to point to the embedded bootstrap code. The entry point is information indicating the entry of the execution file written in the PE header of the execution file in the PE file format. Alternatively, the header correction unit 154 can use a method of registering the embedded bootstrap code as a handler for the TLS-callback by performing a specific process at the start and end of a thread called TLS-callback. . In addition, the header correction unit 154 deletes dependent API information, debug information, and the like in order to increase the confidentiality of the protected program.

[ブートストラップコード]
次に、ブートストラップコードDbについて説明する。ブートストラップコードDbは、保護済みプログラムPbが実行された際、保護対象プログラムPaのオリジナルコードが実行される前に処理が開始される。ブートストラップコードDbは、保護対象プログラムPaのコードが依存しているDLLを独自ローダDaの関数を利用してロードする。そして、ブートストラップコードDbは、APIの解決を行い、依存関係を解消する。ブートストラップコードが依存関係の解決を完了すると、オリジナルエントリポイントにジャンプして、オリジナルコードの実行を開始する。
[Bootstrap code]
Next, the bootstrap code Db will be described. The bootstrap code Db starts processing before the original code of the protection target program Pa is executed when the protected program Pb is executed. The bootstrap code Db loads the DLL on which the code of the protection target program Pa depends using the function of the unique loader Da. Then, the bootstrap code Db resolves the API and cancels the dependency. When the bootstrap code completes the dependency resolution, it jumps to the original entry point and starts executing the original code.

[独自ローダ]
次に、独自ローダDaについて説明する。独自ローダDaは、秘密性を高めた方法で指定されたDLLをロードする関数と、上記の方法でロードされたDLLがエクスポートしているAPIの名前解決(API名からそのAPIのメモリ上での配置アドレスを取得すること)を行う関数と、を提供する。
[Original loader]
Next, the unique loader Da will be described. The original loader Da has a function for loading a DLL specified by a method with increased confidentiality, and name resolution of an API exported by the DLL loaded by the above method (from the API name to the API memory). A function for obtaining a placement address).

図4は、本実施の形態に係る独自ローダDaの構成を説明する図である。図4に示すように、独自ローダDaは、ロードDLL管理用データ領域Ra、DLLロード用関数Rb及びAPI解決用関数Rcによって構成される。   FIG. 4 is a diagram illustrating the configuration of the unique loader Da according to the present embodiment. As shown in FIG. 4, the unique loader Da includes a load DLL management data area Ra, a DLL load function Rb, and an API resolution function Rc.

まず、ロードDLL管理用データ領域Raについて説明する。ロードDLL管理用データ領域Raは、独自ローダDaによってロードされたデータを管理する領域である。具体的には、ロードDLL管理用データ領域Raは、ロードされたベースアドレス、サイズ、初期化の有無、エクスポートされているAPI名とオフセット、インポートされているAPI名とオフセット、その他そのDLLに関連する情報が格納される。   First, the load DLL management data area Ra will be described. The load DLL management data area Ra is an area for managing data loaded by the unique loader Da. Specifically, the load DLL management data area Ra is related to the loaded base address, size, presence / absence of initialization, exported API name and offset, imported API name and offset, and the like. Information to be stored is stored.

これらの情報は、本来ならば、プログラムの提供を受ける情報処理装置100のWindowsが管理する、PEB(Process Environment Block)やTEB(Thread Environment Block)等のデータ領域において管理される情報である。   These pieces of information are information managed in a data area such as PEB (Process Environment Block) or TEB (Thread Environment Block) that is normally managed by Windows of the information processing apparatus 100 receiving the program.

本実施の形態では、ロードしたDLLの痕跡を、情報処理装置100のWindowsが管理する、これらのデータ領域に残さないように設計されている。このため、独自ローダDaは、ロードしたDLLに関する情報を、自身のロードDLL管理用データ領域Raで独自に管理する。したがって、独自ローダは、情報処理装置100における保護済みプログラムの実行時において、ロードした実行ファイルの情報を、情報処理装置100のOSが管理するデータ領域とは異なるデータ領域(ロードDLL管理用データ領域Ra)に保存する。   In the present embodiment, it is designed so that traces of the loaded DLL are not left in these data areas managed by Windows of the information processing apparatus 100. For this reason, the unique loader Da uniquely manages information on the loaded DLL in its own load DLL management data area Ra. Therefore, when the protected program is executed in the information processing apparatus 100, the unique loader stores the information on the loaded execution file in a data area (load DLL management data area different from the data area managed by the OS of the information processing apparatus 100). Save to Ra).

続いて、DLLロード用関数Rbについて説明する。DLLロード用関数Rbは、秘密性を高めた方法で指定されたDLLをロードするための関数である。DLLロード用関数Rbは、入力としてDLLのファイル名を受け取り、出力としてそのDLLのロードされたアドレスを返す。まず、DLLロード用関数Rbは、指定されたDLLが独自ローダDaによってロード済みかをチェックする。指定されたDLLが仮にロード済みだった場合、DLLロード用関数Rbは、そのDLLのベースアドレスを返す。一方、指定されたDLLがロードされていなかった場合、DLLロード用関数Rbは、そのDLLを秘密性を高めた方法でロードし、その新たにロードしたベースアドレスを返す。   Next, the DLL loading function Rb will be described. The DLL loading function Rb is a function for loading a DLL designated by a method with enhanced confidentiality. The DLL loading function Rb receives the DLL file name as an input and returns the loaded address of the DLL as an output. First, the DLL loading function Rb checks whether the specified DLL has been loaded by the unique loader Da. If the specified DLL has been loaded, the DLL loading function Rb returns the base address of the DLL. On the other hand, if the designated DLL has not been loaded, the DLL loading function Rb loads the DLL by a method with enhanced confidentiality, and returns the newly loaded base address.

ここで、秘密性を高める方法とは、具体的には、Windowsが管理するPEB等のデータ構造に痕跡を残さない方法や、マップ関数等を使わない方法でDLLファイルをメモリ上に実行可能状態にする方法、のことである。メモリ上にファイルの内容を展開する場合に使用するマップ関数を使うと、マップされたファイルを管理するためのデータ構造体がオペレーティングシステム側で生成される。Windowsでは、VAD(Virtual Address Descriptor)が、この構造体に該当する。この構造体は、解析の際、ロード済みDLLを特定するヒントになり得てしまう。   Here, the method of increasing the confidentiality specifically means that the DLL file can be executed on the memory by a method that does not leave a trace in a data structure such as PEB managed by Windows or a method that does not use a map function or the like. How to make it. When a map function used to expand the contents of a file on memory is used, a data structure for managing the mapped file is generated on the operating system side. In Windows, VAD (Virtual Address Descriptor) corresponds to this structure. This structure can be a hint for identifying the loaded DLL during analysis.

このため、独自ローダDaは、マップ関数等を使わない方法でDLLファイルをメモリ上に実行可能状態にしている。独自ローダDaは、情報処理装置100における保護済みプログラムの実行時において、マップ関数を用いずに、実行ファイルの内容を、予め確保したバッファ(ロードDLL管理用データ領域Ra)に読み込む。   Therefore, the unique loader Da makes the DLL file executable on the memory by a method that does not use a map function or the like. When executing the protected program in the information processing apparatus 100, the unique loader Da reads the contents of the execution file into a buffer (load DLL management data area Ra) secured in advance without using the map function.

さらに、独自ローダDaは、秘密性を高めるため、独自ロードしたDLLのPEヘッダの情報を一部削除する。PEヘッダの中にはロード時にのみ必要とされ、ロード完了後は必要がなくなる情報やデバッグ時にのみ用いる情報等が含まれている。具体的には、ロード完了後は必要がなくなる情報やデバッグ時にのみ必要な情報は、PEヘッダ内に含まれる「IMAGE_DEBUG_DRECTORY」や、インポート、エクスポートAPIに関する情報である。DLLロード用関数Rbは、ロード完了後、PEヘッダ内に含まれる「IMAGE_DEBUG_DRECTORY」や、インポート、エクスポートAPIに関する情報を削除する。   Further, the unique loader Da deletes a part of the information of the PE header of the uniquely loaded DLL in order to improve confidentiality. The PE header includes information that is required only at the time of loading and is unnecessary after loading, information that is used only during debugging, and the like. Specifically, information that is not necessary after loading is completed or information that is necessary only during debugging is information related to “IMAGE_DEBUG_DRECTORY” included in the PE header and import / export APIs. The DLL loading function Rb deletes “IMAGE_DEBUG_DRECTORY” included in the PE header and information related to the import / export API after the loading is completed.

なお、エクスポートしているAPIのネームテーブルを削除すると動的なAPI解決ができなくなってしまう。このような場合に備えて、DLLロード用関数Rbは、インポート、エクスポートしているAPIの情報は、ロードDLL管理用データ領域の対応するエントリに保持しておく。   If the name table of the API being exported is deleted, dynamic API resolution cannot be performed. In preparation for such a case, the DLL loading function Rb holds the API information being imported and exported in the corresponding entry in the load DLL management data area.

続いて、API解決用関数Rcについて説明する。API解決用関数Rcは、指定されたAPI名から独自ロードされたDLL内の対応するAPIのメモリ上のアドレスを返す関数である。API解決用関数Rcは、入力としてDLLがロードされたベースアドレスと、API名と、を受け取る。そして、API解決用関数Rcは、指定されたAPIのアドレスを返す。APIのアドレスは、そのAPIを含むDLLがロードされているベースアドレスと、指定されたAPIのベースアドレスからのオフセットと、を足し合わせて算出したものを出力する。API解決用関数Rcは、DLLのベースアドレスとして、入力値として指定されているものを利用する。APIのオフセットの取得方法として、以下に示す2つの方法が考えられる。   Next, the API solving function Rc will be described. The API resolution function Rc is a function that returns the address on the memory of the corresponding API in the DLL uniquely loaded from the specified API name. The API resolution function Rc receives as input the base address at which the DLL is loaded and the API name. Then, the API resolution function Rc returns the address of the designated API. As the API address, a value calculated by adding the base address at which the DLL including the API is loaded and the offset from the base address of the designated API is output. The API resolution function Rc uses a DLL base address specified as an input value. As an API offset acquisition method, the following two methods are conceivable.

まず、APIのオフセットの取得に関する第1の方法について説明する。この方法では、API解決用関数Rcは、指定されたベースアドレスから、対象とするDLLのヘッダにアクセスする。そして、API解決用関数Rcは、このDLLが外部にエクスポートしているAPIの一覧を管理するテーブルから、指定したAPI名と一致するエントリを探し出し、このテーブルによって管理されているオフセット情報を取得する。この挙動は、Windowsが提供するGetProcAddressと同じ挙動である。   First, a first method relating to API offset acquisition will be described. In this method, the API resolution function Rc accesses the header of the target DLL from the designated base address. Then, the API resolution function Rc finds an entry that matches the specified API name from a table that manages a list of APIs that this DLL exports to the outside, and acquires offset information managed by this table. . This behavior is the same behavior as GetProcAddress provided by Windows.

次に、APIのオフセットの取得に関する第2の方法について説明する。この方法では、API解決用関数Rcは、ロードDLL管理用データ領域Raから該当するDLLとAPIのオフセット情報を見つけ出し、取得する。ロードDLL管理用データ領域Raは、前述したように、エクスポートされているAPI及びAPIに一致するオフセットも管理する領域である。   Next, a second method relating to API offset acquisition will be described. In this method, the API resolution function Rc finds and acquires offset information of the corresponding DLL and API from the load DLL management data area Ra. As described above, the load DLL management data area Ra is an area for managing an API that is being exported and an offset that matches the API.

これらのDLLロード用関数RbとAPI解決用関数Rcとは、オリジナルコードが動的にAPI解決を行う場合にも有効である。例えば、何かしらの方法でオリジナルコードからDLLロード用関数とAPI解決用関数との呼び出しをフックし、独自ローダDaが提供するそれぞれに関数が実行されるようにしておく。この状態で、オリジナルコードが動的なAPI解決を行う際、独自ローダが提供するDLLロード用関数RbとAPI解決用関数Rcとが呼ばれるため、この対象APIも独自ローダDaにより難読化された形で解決される。   These DLL loading function Rb and API resolution function Rc are also effective when the original code dynamically performs API resolution. For example, a call to a DLL load function and an API resolution function is hooked from the original code by some method, and the function is executed for each of the original loaders Da provided. In this state, when the original code performs dynamic API resolution, the DLL load function Rb and API resolution function Rc provided by the original loader are called, so that the target API is also obfuscated by the original loader Da. Will be solved.

ここで、フックする方法としては、例えば、オリジナルコードのインポートアドレステーブルを書き換える方法や、本来のDLLロード用関数とAPI解決用関数との先頭にジャンプ命令を埋め込む方法などが考えられる。   Here, as a hooking method, for example, a method of rewriting the import address table of the original code, a method of embedding a jump instruction at the head of the original DLL loading function and API solving function, or the like can be considered.

なお、ローダ埋め込み部151は、独自ローダDaによりAPIの解決を行う際、難読化の対象とするAPIを選択してもよい。例えば、実装上の制限やユーザの意図により一部のAPIに対して独自ローダDaによる難読化を施したくない場合、通常のWindowsによるローディングによるAPI解決を行い、そのAPIを指すポインタをインポートアドレステーブルに格納できるようにしてもよい。   The loader embedding unit 151 may select an API to be obfuscated when the API is resolved by the unique loader Da. For example, when it is not desired to obfuscate some APIs by the original loader Da due to implementation restrictions or user intentions, API resolution is performed by loading with normal Windows, and a pointer indicating the API is set to the import address table. You may make it possible to store it.

[プログラム保護処理の処理手順]
本実施の形態においては、保護対象プログラムの保護を実現するために、プログラム提供装置10による独自ローダを埋め込んでプログラムを保護する処理と、情報処理装置100において独自ローダが独自にローダを実行する処理の二つの処理が必要である。以下、それぞれの処理に関して、動作フローを説明する。
[Program protection processing procedure]
In the present embodiment, in order to realize protection of the protection target program, a process for embedding a unique loader by the program providing apparatus 10 to protect the program, and a process for the information processing apparatus 100 to independently execute the loader in the information processing apparatus 100 Two processes are required. Hereinafter, an operation flow for each process will be described.

まず、プログラム提供装置10によるプログラム保護処理について説明する。プログラム提供装置10は、保護処理対象として指定された保護対象プログラムに対して、独自ローダとブートストラップコードと実行時に必要なデータを埋め込み、プログラム提供先の情報処理装置100においてオリジナルコードが実行される前にブートストラップコードが実行されるように、PEヘッダを修正する。   First, program protection processing by the program providing apparatus 10 will be described. The program providing apparatus 10 embeds an original loader, a bootstrap code, and data necessary for execution in the protection target program designated as the protection processing target, and the original code is executed in the information processing apparatus 100 that is the program providing destination. Modify the PE header so that the bootstrap code is executed before.

図5は、図2に示すプログラム提供装置10が実行するプログラム保護処理の処理手順を示すフローチャートである。図5に示すように、プログラム提供装置10に、保護処理対象として指定された保護対象プログラムが入力されると(ステップS1)、ローダ埋め込み部151は、渡された保護対象プログラムのPEヘッダを読み取り、インポートアドレステーブルとインポートネームテーブルを特定する(ステップS2)。   FIG. 5 is a flowchart showing the processing procedure of the program protection processing executed by the program providing apparatus 10 shown in FIG. As shown in FIG. 5, when the protection target program designated as the protection processing target is input to the program providing apparatus 10 (step S1), the loader embedding unit 151 reads the PE header of the passed protection target program. The import address table and the import name table are specified (step S2).

続いて、依存API列挙部152は、インポートネームテーブルの各エントリを読み取り、読み取った各エントリを保護対象プログラムに追加する(ステップS3)。この際、依存API列挙部152は、インポートしているAPI名にエンコードを施すこともある。また、依存API列挙部152は、名前に対応するアドレスの格納場所も合わせて保護対象プログラムに追加する。すなわち、依存API列挙部152は、保護対象APIが依存しているAPIの名前を難読化した文字列のテーブル等の実行時に必要なデータを、データコード注入部153に依頼して、保護対象プログラムPaに追加する。   Subsequently, the dependent API listing unit 152 reads each entry in the import name table, and adds each read entry to the protection target program (step S3). At this time, the dependent API enumeration unit 152 may encode the API name being imported. The dependent API enumeration unit 152 also adds the storage location of the address corresponding to the name to the protection target program. In other words, the dependency API enumeration unit 152 requests the data code injection unit 153 for data required at the time of execution, such as a character string table obtained by obfuscating the name of the API on which the protection target API depends, and the protection target program Add to Pa.

続いて、データコード注入部153は、独自ローダを保護対象プログラムに追加する(ステップS4)。データコード注入部153は、ブートストラップコードを保護対象プログラムに追加する(ステップS5)。   Subsequently, the data code injection unit 153 adds the unique loader to the protection target program (step S4). The data code injection unit 153 adds the bootstrap code to the protection target program (step S5).

そして、ヘッダ修正部154は、保護対象プログラムのPEヘッダを修正し、ブートストラップコードに向ける(ステップS6)。続いて、ヘッダ修正部154は、PEヘッダのインポートネームテーブルを削除する(ステップS7)。ヘッダ修正部154は、PEヘッダをさらに修正し、インポートネームテーブルやインポートアドレステーブルへのポインタを削除し(ステップS8)、保護済みプログラムを生成する。   Then, the header correction unit 154 corrects the PE header of the protection target program and directs it to the bootstrap code (step S6). Subsequently, the header correction unit 154 deletes the import name table of the PE header (step S7). The header correction unit 154 further corrects the PE header, deletes the pointer to the import name table and the import address table (step S8), and generates a protected program.

そして、プログラム提供装置10は、保護済みプログラムを、通信部11や記憶媒体を介して、他の装置に出力し(ステップS9)、プログラム保護処理を終了する。   And the program provision apparatus 10 outputs a protected program to another apparatus via the communication part 11 or a storage medium (step S9), and complete | finishes a program protection process.

[独自ロード実行処理の処理手順]
次に、情報処理装置100において保護済みプログラムが独自にロードする処理について説明する。情報処理装置100において独自ローダが独自にローダを実行する処理は、保護済みプログラム(EXEファイル)をロードする場合と、DLLをロードする場合とがある。まず、保護済みプログラムをロードする場合の処理について説明する。
[Procedure for the original load execution process]
Next, processing that the protected program loads independently in the information processing apparatus 100 will be described. In the information processing apparatus 100, the process in which the unique loader executes the loader independently includes loading a protected program (EXE file) and loading a DLL. First, processing when loading a protected program will be described.

図6は、保護済みプログラムが独自にローダを実行する処理の処理手順を示すフローチャートである。保護済みプログラムに埋め込まれたブートストラップコードは、まず、保護済みプログラムに埋め込まれた、保護対象プログラムが依存している外部DLLとAPIの情報を取得する(ステップS11)。   FIG. 6 is a flowchart showing a processing procedure of processing in which the protected program independently executes the loader. The bootstrap code embedded in the protected program first acquires information on the external DLL and API embedded in the protected program on which the protection target program depends (step S11).

そして、ブートストラップコードは、独自ローダのDLLロード用関数を利用して依存しているDLLをロードする(ステップS12)。続いて、ブートストラップコードは、独自ローダのAPI解決用関数を利用して依存しているAPIのアドレスを取得する(ステップS13)。   Then, the bootstrap code loads the dependent DLL using the DLL load function of the unique loader (step S12). Subsequently, the bootstrap code obtains the address of the dependent API using the API resolution function of the unique loader (step S13).

そして、ブートストラップコードは、取得したAPIのアドレスを保護済みプログラムのインポートアドレステーブルに書きこむ(ステップS14)。ブートストラップコードは、すべての依存しているDLLのロードと、依存しているAPIの名前解決とが完了したか否かを判断する(ステップS15)。   Then, the bootstrap code writes the acquired API address in the import address table of the protected program (step S14). The bootstrap code determines whether or not all dependent DLL loads and dependent API name resolution have been completed (step S15).

ブートストラップコードは、すべての依存しているDLLのロードと、依存しているAPIの名前解決とが完了していないと判断した場合(ステップS15:No)、ステップS12に戻り、DLLのロードを行う。これに対し、ブートストラップコードは、すべての依存しているDLLのロードと、依存しているAPIの名前解決が完了したと判断した場合(ステップS15:Yes)、オリジナルエントリポイントにジャンプし、実行を開始する(ステップS16)。   If the bootstrap code determines that all the dependent DLL loads and the dependent API name resolution have not been completed (step S15: No), the process returns to step S12 to load the DLL. Do. On the other hand, if the bootstrap code determines that the loading of all dependent DLLs and the name resolution of the dependent APIs are complete (step S15: Yes), the bootstrap code jumps to the original entry point and executes it. Is started (step S16).

[独自ロード実行処理の他の処理手順]
次に、独自ロード実行処理のうち、DLLをロードする場合について説明する。図7は、保護済みプログラムが独自にローダを実行する処理の他の処理手順を示すフローチャートである。
[Other processing procedures for original load execution processing]
Next, a description will be given of the case of loading a DLL in the unique load execution process. FIG. 7 is a flowchart showing another processing procedure for the protected program to independently execute the loader.

保護済みプログラムの独自ローダは、指定されたDLLをファイルとして開き、そのファイルをメモリ上に展開するのに必要なサイズを計算する(ステップS21)。保護済みプログラムの独自ローダは、ステップS21において計算したサイズに基づき、メモリをロードDLL管理用データ領域に確保する(ステップS22)。独自ローダは、開いたファイルからファイルの内容を、ステップS22において確保したメモリにコピーする(ステップS23)。   The protected loader of the protected program opens the designated DLL as a file, and calculates the size required to expand the file on the memory (step S21). The protected loader of the protected program secures the memory in the load DLL management data area based on the size calculated in step S21 (step S22). The unique loader copies the contents of the file from the opened file to the memory secured in step S22 (step S23).

独自ローダは、PEヘッダの再配置テーブルに基づき、DLLの再配置を行う(ステップS24)。なお、再配置テーブルは、DLLが配置されるメモリアドレスが仮決めされたものである際に、実際にロードされるアドレスが決定したときにプログラムの一部を書き換えて、現行のロードされたアドレスにアップデートするための情報が書かれたテーブルである。   The unique loader performs DLL relocation based on the PE header relocation table (step S24). When the memory address where the DLL is allocated is tentatively determined, the relocation table rewrites a part of the program when the actually loaded address is determined, and the current loaded address This is a table with information for updating.

そして、独自ローダは、指定されたDLLがインポートしているDLLをロードし、APIの解決を行い(ステップS25)、解決を行ったAPIのアドレスをDLLのインポートアドレステーブルに書き込む(ステップS26)。独自ローダは、各メモリ領域のパーミッションをヘッダの情報に基づき変更する(ステップS27)。そして、独自ローダは、DLLのエントリ関数を実行し、DLLを初期化する(ステップS28)。続いて、保護済みプログラムの独自ローダは、必要ないPEヘッダ内の情報を削除し(ステップS29)、処理を終了する。   Then, the unique loader loads the DLL imported by the designated DLL, resolves the API (step S25), and writes the address of the resolved API in the DLL import address table (step S26). The unique loader changes the permission of each memory area based on the header information (step S27). Then, the unique loader executes the DLL entry function to initialize the DLL (step S28). Subsequently, the protected loader of the protected program deletes unnecessary information in the PE header (step S29) and ends the process.

[実施の形態の効果] [Effect of the embodiment]

このように、本実施の形態に係るプログラム提供装置10は、独自ローダを、予め保護対象プログラムに埋め込んでから、この保護対象プログラムを他の装置に提供している。この独自ローダは、プログラムの実行時において、オペレーションシステムが提供するプログラムローディング機構とは独立して動作し、ライブラリ関数を含む実行ファイルをロードし実行ファイルに含まれているライブラリ関数を呼び出し可能状態にする。すなわち、独自ローダは、保護対象プログラムの実行時に、プログラム提供先の情報処理装置100のOSが提供するプログラムローダとは独立にDLLを読み込み、保護対象プログラムを実行可能な状態にセットアップする。   As described above, the program providing apparatus 10 according to the present embodiment embeds the unique loader in the protection target program in advance, and then provides the protection target program to other apparatuses. This unique loader operates independently of the program loading mechanism provided by the operation system during program execution, loads an executable file containing library functions, and makes the library functions included in the executable file callable. To do. That is, the unique loader reads the DLL independently of the program loader provided by the OS of the information processing apparatus 100 that is the program providing destination when executing the protection target program, and sets up the protection target program in an executable state.

したがって、本実施の形態によれば、プログラム提供先の情報処理装置100のOSが提供するプログラムローディング機構に頼らずに、ライブラリ関数を提供する実行ファイルを展開、初期化し、実行可能状態にすることができる。このため、本実施の形態では、オリジナルコードが使用しているライブラリ関数を、情報処理装置100における解析ツールに対して分からなくすることができる。この結果、本実施の形態によれば、独自ローダを埋め込むことによって、プログラム実行時に利用するライブラリ関数(API)の、他の装置による解析を回避し、解析から、保護対象プログラムを保護することができる。   Therefore, according to the present embodiment, the executable file providing the library function is expanded and initialized to be executable without depending on the program loading mechanism provided by the OS of the information processing apparatus 100 that is the program providing destination. Can do. For this reason, in this embodiment, the library function used by the original code can be made unknown to the analysis tool in the information processing apparatus 100. As a result, according to the present embodiment, by embedding a unique loader, analysis of the library function (API) used at the time of program execution by other devices can be avoided, and the protection target program can be protected from the analysis. it can.

また、本実施の形態によれば、独自ローダは、保護対象プログラムの実行時において、保護対象プログラムのオリジナルコードが実行される前に動作する。このため、本実施の形態によれば、情報処理装置100のOSが本来提供しているプログラムローダの機能に頼らずに、保護対象プログラムの実行ファイルをロードさせることができる。   Further, according to the present embodiment, the unique loader operates before the original code of the protection target program is executed when the protection target program is executed. Therefore, according to the present embodiment, it is possible to load the execution file of the protection target program without depending on the function of the program loader originally provided by the OS of the information processing apparatus 100.

そして、独自ローダは、保護対象プログラムの実行時において、マップ関数を用いずに、実行ファイルの内容を、予め確保したバッファに読み込んできる。そして、独自ローダは、保護対象プログラムの実行時において、ロードした実行ファイルの情報を、情報処理装置100のオペレーションシステムが管理するデータ領域とは異なるデータ領域に保存している。さらに、独自ローダは、実行ファイルの情報処理装置100へのロード後、実行ファイルのヘッダの情報のうち、ロード時にのみ用いる情報を削除する。これによって、本実施の形態では、秘密裏にAPIを含むDLLを読み込み、使用したAPIの秘密性を高めている。   Then, the unique loader can read the contents of the executable file into a buffer secured in advance without using the map function when executing the protection target program. The unique loader stores the information of the loaded execution file in a data area different from the data area managed by the operation system of the information processing apparatus 100 when the protection target program is executed. Further, the unique loader deletes information used only at the time of loading from the header information of the executable file after loading the executable file into the information processing apparatus 100. Thus, in the present embodiment, the DLL including the API is read secretly, and the confidentiality of the used API is enhanced.

すなわち、本実施の形態では、この独自ローダを使ってWindowsのシステムDLL(実行ファイル)を読み込み、各DLLの依存関係を独自に解決し、初期化を行う。これによって、本実施の形態では、独自ローダによってロードされたDLLが提供するAPIを、WindowsのローダによってロードされたDLLが提供するAPIと同じように、呼び出すことを可能にしながら、APIの秘密性を高めている。   That is, in this embodiment, the Windows system DLL (execution file) is read using this unique loader, the dependency of each DLL is uniquely resolved, and initialization is performed. Thus, in this embodiment, the API provided by the DLL loaded by the original loader can be called in the same manner as the API provided by the DLL loaded by the Windows loader, and the confidentiality of the API can be obtained. Is increasing.

したがって、本実施の形態では、ライブラリ関数の呼び出しやインポートしているライブラリ関数を難読化し、プログラム実行時に利用するライブラリ関数の、他の装置による解析を回避し、解析からプログラムを保護することができる。   Therefore, in this embodiment, it is possible to obfuscate library function calls and imported library functions, avoid analysis by other devices of library functions used during program execution, and protect the program from analysis. .

[システム構成等]
図示した各装置の各構成要素は機能概念的なものであり、必ずしも物理的に図示の如く構成されていることを要しない。すなわち、各装置の分散・統合の具体的形態は図示のものに限られず、その全部又は一部を、各種の負荷や使用状況等に応じて、任意の単位で機能的又は物理的に分散・統合して構成することができる。さらに、各装置にて行なわれる各処理機能は、その全部又は任意の一部が、CPU及び当該CPUにて解析実行されるプログラムにて実現され、あるいは、ワイヤードロジックによるハードウェアとして実現され得る。
[System configuration, etc.]
Each component of each illustrated device 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 the one shown in the figure, and all or a part of the distribution / integration is functionally or physically distributed in arbitrary units according to various loads or usage conditions. Can be integrated and configured. Further, all or a part of each processing function performed in each device can be realized by a CPU and a program that is analyzed and executed by the CPU, or can be realized as hardware by wired logic.

また、本実施形態において説明した各処理のうち、自動的に行われるものとして説明した処理の全部又は一部を手動的におこなうこともでき、あるいは、手動的におこなわれるものとして説明した処理の全部又は一部を公知の方法で自動的におこなうこともできる。この他、上記文書中や図面中で示した処理手順、制御手順、具体的名称、各種のデータやパラメータを含む情報については、特記する場合を除いて任意に変更することができる。   In addition, among the processes described in this embodiment, all or a part of the processes described as being automatically performed can be manually performed, or the processes described as being manually performed can be performed. All or a part can be automatically performed by a known method. In addition, the processing procedure, control procedure, specific name, and information including various data and parameters shown in the above-described document and drawings can be arbitrarily changed unless otherwise specified.

[プログラム]
図8は、プログラムが実行されることにより、プログラム提供装置10が実現されるコンピュータの一例を示す図である。コンピュータ1000は、例えば、メモリ1010、CPU1020を有する。また、コンピュータ1000は、ハードディスクドライブインタフェース1030、ディスクドライブインタフェース1040、シリアルポートインタフェース1050、ビデオアダプタ1060、ネットワークインタフェース1070を有する。これらの各部は、バス1080によって接続される。
[program]
FIG. 8 is a diagram illustrating an example of a computer in which the program providing apparatus 10 is realized by executing a program. The computer 1000 includes a memory 1010 and a CPU 1020, for example. The computer 1000 also includes a hard disk drive interface 1030, a disk drive interface 1040, a serial port interface 1050, a video adapter 1060, and a network interface 1070. These units are connected by a bus 1080.

メモリ1010は、ROM(Read Only Memory)1011及びRAM1012を含む。ROM1011は、例えば、BIOS(Basic Input Output System)等のブートプログラムを記憶する。ハードディスクドライブインタフェース1030は、ハードディスクドライブ1090に接続される。ディスクドライブインタフェース1040は、ディスクドライブ1100に接続される。例えば磁気ディスクや光ディスク等の着脱可能な記憶媒体が、ディスクドライブ1100に挿入される。シリアルポートインタフェース1050は、例えばマウス1110、キーボード1120に接続される。ビデオアダプタ1060は、例えばディスプレイ1130に接続される。   The memory 1010 includes a ROM (Read Only Memory) 1011 and a RAM 1012. The ROM 1011 stores a boot program such as BIOS (Basic Input Output System). The hard disk drive interface 1030 is connected to the hard disk drive 1090. The disk drive interface 1040 is connected to the disk drive 1100. For example, a removable storage medium such as a magnetic disk or an optical disk is inserted into the disk drive 1100. The serial port interface 1050 is connected to a mouse 1110 and a keyboard 1120, for example. The video adapter 1060 is connected to the display 1130, for example.

ハードディスクドライブ1090は、例えば、OS1091、アプリケーションプログラム1092、プログラムモジュール1093、プログラムデータ1094を記憶する。すなわち、プログラム提供装置10の各処理を規定するプログラムは、コンピュータ1000により実行可能なコードが記述されたプログラムモジュール1093として実装される。プログラムモジュール1093は、例えばハードディスクドライブ1090に記憶される。例えば、プログラム提供装置10における機能構成と同様の処理を実行するためのプログラムモジュール1093が、ハードディスクドライブ1090に記憶される。なお、ハードディスクドライブ1090は、SSD(Solid State Drive)により代替されてもよい。   The hard disk drive 1090 stores, for example, an OS 1091, an application program 1092, a program module 1093, and program data 1094. That is, a program that defines each process of the program providing apparatus 10 is implemented as a program module 1093 in which a code executable by the computer 1000 is described. The program module 1093 is stored in the hard disk drive 1090, for example. For example, a program module 1093 for executing processing similar to the functional configuration in the program providing apparatus 10 is stored in the hard disk drive 1090. The hard disk drive 1090 may be replaced by an SSD (Solid State Drive).

また、上述した実施の形態の処理で用いられる設定データは、プログラムデータ1094として、例えばメモリ1010やハードディスクドライブ1090に記憶される。そして、CPU1020が、メモリ1010やハードディスクドライブ1090に記憶されたプログラムモジュール1093やプログラムデータ1094を必要に応じてRAM1012に読み出して実行する。   The setting data used in the processing of the above-described embodiment is stored as program data 1094 in, for example, the memory 1010 or the hard disk drive 1090. Then, the CPU 1020 reads the program module 1093 and the program data 1094 stored in the memory 1010 and the hard disk drive 1090 to the RAM 1012 and executes them as necessary.

なお、プログラムモジュール1093やプログラムデータ1094は、ハードディスクドライブ1090に記憶される場合に限らず、例えば着脱可能な記憶媒体に記憶され、ディスクドライブ1100等を介してCPU1020によって読み出されてもよい。あるいは、プログラムモジュール1093及びプログラムデータ1094は、ネットワーク(LAN、WAN(wide area network)等)を介して接続された他のコンピュータに記憶されてもよい。そして、プログラムモジュール1093及びプログラムデータ1094は、他のコンピュータから、ネットワークインタフェース1070を介してCPU1020によって読み出されてもよい。   The program module 1093 and the program data 1094 are not limited to being stored in the hard disk drive 1090, but may be stored in, for example, a removable storage medium and read out by the CPU 1020 via the disk drive 1100 or the like. Alternatively, the program module 1093 and the program data 1094 may be stored in another computer connected via a network (LAN, wide area network (WAN), etc.). Then, the program module 1093 and the program data 1094 may be read by the CPU 1020 from another computer via the network interface 1070.

以上、本発明者によってなされた発明を適用した実施の形態について説明したが、本実施の形態による本発明の開示の一部をなす記述及び図面により本発明は限定されることはない。すなわち、本実施の形態に基づいて当業者等によりなされる他の実施の形態、実施例及び運用技術等は全て本発明の範疇に含まれる。   Although the embodiment to which the invention made by the present inventor is applied has been described above, the present invention is not limited by the description and the drawings that form part of the disclosure of the present invention according to this embodiment. That is, other embodiments, examples, operation techniques, and the like made by those skilled in the art based on the present embodiment are all included in the scope of the present invention.

10 プログラム提供装置
11 通信部
12 入力部
13 出力部
14 記憶部
15 制御部
100 情報処理装置
151 ローダ埋め込み部
152 依存API列挙部
153 データコード注入部
154 ヘッダ修正部
Da 独自ローダ
Db ブートストラップコード
Dc データ
Ra ロードDLL管理用データ領域
Rb DLLロード用関数
Rc API解決用関数
DESCRIPTION OF SYMBOLS 10 Program provision apparatus 11 Communication part 12 Input part 13 Output part 14 Storage part 15 Control part 100 Information processing apparatus 151 Loader embedding part 152 Dependent API enumeration part 153 Data code injection part 154 Header correction part Da Original loader Db Bootstrap code Dc Data Ra Load DLL management data area Rb DLL load function Rc API resolution function

Claims (8)

プログラムの実行時において、オペレーションシステムが提供するプログラムローディング機構とは独立して動作する独自ローダであって、ライブラリ関数を含む実行ファイルをロードし前記実行ファイルに含まれているライブラリ関数を呼び出し可能状態にする独自ローダを、予め保護対象プログラムに埋め込むローダ埋め込み部と、
前記独自ローダが埋め込まれた保護対象プログラムである保護済みプログラムを出力する出力部と、
を有することを特徴とするプログラム保護装置。
A unique loader that operates independently of the program loading mechanism provided by the operation system when executing a program, and can load an executable file containing library functions and call the library functions contained in the executable file A loader embedding unit that embeds the original loader to be protected in advance in the protection target program,
An output unit that outputs a protected program that is a protection target program in which the unique loader is embedded;
A program protection device comprising:
前記独自ローダは、前記保護対象プログラムの実行時において、前記保護対象プログラムのオリジナルコードが実行される前に動作することを特徴とする請求項1に記載のプログラム保護装置。   2. The program protection apparatus according to claim 1, wherein the unique loader operates before the original code of the protection target program is executed when the protection target program is executed. 前記独自ローダは、前記保護対象プログラムの実行時において、前記実行ファイルの内容を、予め確保したバッファに読み込むことを特徴とする請求項1または2に記載のプログラム保護装置。   3. The program protection apparatus according to claim 1, wherein the unique loader reads the contents of the execution file into a buffer secured in advance when the protection target program is executed. 前記独自ローダは、前記保護対象プログラムの実行時において、ロードした前記実行ファイルの情報を前記オペレーションシステムが管理するデータ領域とは異なるデータ領域に保存することを特徴とする請求項1〜3のいずれか一つに記載のプログラム保護装置。   The unique loader stores information on the loaded execution file in a data area different from a data area managed by the operation system when the protection target program is executed. The program protection device according to claim 1. 前記独自ローダは、前記実行ファイルのロード後、前記実行ファイルのヘッダの情報のうち、ロード時にのみ用いる情報を削除することを特徴とする請求項1〜4のいずれか一つに記載のプログラム保護装置。   5. The program protection according to claim 1, wherein after the execution file is loaded, the unique loader deletes information used only at the time of loading from the header information of the execution file. apparatus. 前記ローダ埋め込み部は、
前記保護対象プログラムが依存する実行ファイルとライブラリ関数を列挙し、列挙したライブラリ関数の名前を難読化する依存ライブラリ関数列挙部と、
前記ライブラリ関数の名前を難読化した文字列のテーブル、前記独自ローダ及びブートストラップコードを保護対象プログラムに注入するデータコード注入部と、
前記保護対象プログラムのオリジナルコードよりも前に前記独自ローダが実行されるように前記実行ファイルのヘッダの情報を修正するヘッダ修正部と、
を有することを特徴とする請求項1〜5のいずれか一つに記載のプログラム保護装置。
The loader embedding unit is
A dependent library function enumeration unit that enumerates executable files and library functions on which the protected program depends, and obfuscates the names of the enumerated library functions;
A table of character strings obfuscated by the name of the library function, a data code injection unit for injecting the unique loader and bootstrap code into the protection target program;
A header correcting unit that corrects header information of the executable file so that the unique loader is executed before the original code of the protection target program;
The program protection device according to claim 1, wherein the program protection device includes:
保護対象プログラムの保護を行うプログラム保護装置が実行するプログラム保護方法であって、
プログラムの実行時において、オペレーションシステムが提供するプログラムローディング機構とは独立して動作する独自ローダであって、ライブラリ関数を含む実行ファイルをロードし前記実行ファイルに含まれているライブラリ関数を呼び出し可能状態にする独自ローダを、予め保護対象プログラムに埋め込む工程と、
前記独自ローダが埋め込まれた保護対象プログラムである保護済みプログラムを出力する工程と、
を含んだことを特徴とする解析方法。
A program protection method executed by a program protection device for protecting a protection target program,
A unique loader that operates independently of the program loading mechanism provided by the operation system when executing a program, and can load an executable file containing library functions and call the library functions contained in the executable file Embedding the original loader to be protected in the program to be protected in advance,
Outputting a protected program that is a protection target program in which the unique loader is embedded;
The analysis method characterized by including.
コンピュータを、請求項1〜6のいずれか一つに記載のプログラム保護装置として機能させるためのプログラム保護プログラム。   The program protection program for functioning a computer as a program protection apparatus as described in any one of Claims 1-6.
JP2017017402A 2017-02-02 2017-02-02 Program protection device, program protection method, and program protection program Active JP6696918B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2017017402A JP6696918B2 (en) 2017-02-02 2017-02-02 Program protection device, program protection method, and program protection program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2017017402A JP6696918B2 (en) 2017-02-02 2017-02-02 Program protection device, program protection method, and program protection program

Publications (2)

Publication Number Publication Date
JP2018124850A true JP2018124850A (en) 2018-08-09
JP6696918B2 JP6696918B2 (en) 2020-05-20

Family

ID=63111367

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2017017402A Active JP6696918B2 (en) 2017-02-02 2017-02-02 Program protection device, program protection method, and program protection program

Country Status (1)

Country Link
JP (1) JP6696918B2 (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20200046363A (en) * 2018-10-24 2020-05-07 국방과학연구소 Apparatus and method for performing symbolic execution
WO2022054206A1 (en) * 2020-09-10 2022-03-17 日本電信電話株式会社 Obfuscation device, obfuscation method, and obfuscation program
CN115495794A (en) * 2022-11-17 2022-12-20 北京华云安信息技术有限公司 Anti-analytic file protection method and device based on file-free technology

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20200046363A (en) * 2018-10-24 2020-05-07 국방과학연구소 Apparatus and method for performing symbolic execution
KR102156845B1 (en) * 2018-10-24 2020-09-16 국방과학연구소 Apparatus and method for performing symbolic execution
WO2022054206A1 (en) * 2020-09-10 2022-03-17 日本電信電話株式会社 Obfuscation device, obfuscation method, and obfuscation program
CN115495794A (en) * 2022-11-17 2022-12-20 北京华云安信息技术有限公司 Anti-analytic file protection method and device based on file-free technology

Also Published As

Publication number Publication date
JP6696918B2 (en) 2020-05-20

Similar Documents

Publication Publication Date Title
US10402179B1 (en) Application randomization mechanism
US10691792B2 (en) System and method for process hollowing detection
EP3123311B1 (en) Malicious code protection for computer systems based on process modification
US10311227B2 (en) Obfuscation of an address space layout randomization mapping in a data processing system
JP5819535B2 (en) System and method for protecting against kernel rootkits in a hypervisor environment
AU2014348812B2 (en) Improved control flow integrity system and method
US7620987B2 (en) Obfuscating computer code to prevent an attack
Bojinov et al. Address space randomization for mobile devices
US11822654B2 (en) System and method for runtime detection, analysis and signature determination of obfuscated malicious code
CN106203006A (en) Android application reinforcement means based on dex Yu so file Dynamic Execution
US20160092675A1 (en) Fine-grained address space layout randomization
WO2016078130A1 (en) Dynamic loading method for preventing reverse of apk file
US11188681B2 (en) Malware resistant computer
US9600665B2 (en) Monitoring device and monitoring method
CN107430650B (en) Securing computer programs against reverse engineering
JPWO2016203759A1 (en) ANALYSIS SYSTEM, ANALYSIS METHOD, ANALYSIS DEVICE, AND RECORDING MEDIUM CONTAINING COMPUTER PROGRAM
JP6696918B2 (en) Program protection device, program protection method, and program protection program
EP2985716B1 (en) Information processing device and identifying method
Alendal et al. Forensics acquisition—Analysis and circumvention of samsung secure boot enforced common criteria mode
Danisevskis et al. Dark side of the shader: Mobile gpu-aided malware delivery
Thabet Stuxnet malware analysis paper
US10200401B1 (en) Evaluating results of multiple virtual machines that use application randomization mechanism
Bonfante et al. Analysis and diversion of Duqu's driver
WO2016126206A1 (en) Method for obfuscation of code using return oriented programming
US10200406B1 (en) Configuration of application randomization mechanism

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20190220

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20191226

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20200204

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20200403

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: 20200421

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20200423

R150 Certificate of patent or registration of utility model

Ref document number: 6696918

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150