JP5277825B2 - Program obfuscation device and obfuscation program - Google Patents
Program obfuscation device and obfuscation program Download PDFInfo
- Publication number
- JP5277825B2 JP5277825B2 JP2008239860A JP2008239860A JP5277825B2 JP 5277825 B2 JP5277825 B2 JP 5277825B2 JP 2008239860 A JP2008239860 A JP 2008239860A JP 2008239860 A JP2008239860 A JP 2008239860A JP 5277825 B2 JP5277825 B2 JP 5277825B2
- Authority
- JP
- Japan
- Prior art keywords
- program
- obfuscation
- subroutine
- subroutines
- branch
- 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.)
- Expired - Fee Related
Links
Images
Description
本発明は、プログラム難読化装置及び難読化プログラムに関する。 The present invention relates to a program obfuscation apparatus and an obfuscation program.
プログラムを悪意あるリバースエンジニアリングから守るために、様々なプログラム難読化技術が提案されている。プログラム難読化とは、プログラムの実行時動作を変えない限りにおいて、プログラムを人間にとって理解しづらくなるように変換する技術である。プログラムに難読化を施すことにより、リバースエンジニアリングにかかる費用や時間を大きくすることができる。ここで、リバースエンジニアリングとは、プログラムを解析し、モジュール間の関係の解明やシステムの基本仕様の分析をすることをいう。 Various program obfuscation techniques have been proposed to protect programs from malicious reverse engineering. Program obfuscation is a technique for converting a program so that it is difficult for humans to understand unless the runtime behavior of the program is changed. By obfuscating the program, the cost and time for reverse engineering can be increased. Here, reverse engineering means analyzing a program, elucidating the relationship between modules, and analyzing the basic specifications of the system.
特許文献1は、プログラムのソースコードに対して関数へのポインタ変数を新たに複数個導入し、関数ポインタ変数のいずれかに関数のアドレスを代入する命令文を複数個挿入し、プログラムにおける関数の呼出を関数ポインタ変数の値に応じて関数を呼出すように変換する。
In
特許文献2は、プログラムに含まれる繰り返し制御文を検出し、当該繰り返し制御文のインデックス変数に入力される値の順番を変更するようにプログラムの内容を変換する。
特許文献3は、アセンブリプログラムを構成する複数の命令コードを偽の命令コードYで偽装するとともに、偽の命令コードYを元の正しい命令コードyに戻すルーチンXと、ルーチンXが戻した正しい命令コードyを再度偽の命令コードYで偽装するルーチンZとを生成し、生成したルーチンX及びZをアセンブリプログラム上の所定の位置に書き込み、自己書換えプログラムを生成する。
特許文献4は、プログラム中のデータを符号化規則C(a,b)=ax+bを用いて符号化し、符号化された符号化データを含む演算式の各演算子に演算子変換規則R(a,b)〜R10(a,b)を適用することにより演算式を符号化演算式に変換し、符号化演算式を復号化規則D(a,b)を用いて復号化演算式とする。さらに同様のプログラムの難読化を行う文献が非特許文献1ないし6に開示されている。
In
また、特許文献5では、プログラムの中から、複数の命令コードを含む関数を抽出し、抽出された関数に含まれる命令を非定型の関数呼出/復帰命令に変換する。したがって、逆コンパイラの異常終了や誤った出力結果を引き起こすことを可能にする実行形式の生成が可能となる。
In
本発明は、インライン展開を使用したプログラム解析に必要な計算量と記憶領域を増大させるプログラムを生成するプログラム難読化装置及び難読化プログラムを提供することを目的とする。 An object of the present invention is to provide a program obfuscation apparatus and an obfuscation program that generate a program that increases the amount of calculation and storage area required for program analysis using inline expansion.
かかる目的を達成するために本発明の請求項1記載のプログラム難読化装置は、難読化の度合いを示す難読化指数n(nは2以上の整数)を入力する入力手段と、少なくとも1つの命令文を含む難読化対象プログラムを選択する選択手段と、選択された難読化対象プログラムにn個の複数のサブルーチンを追加する追加手段と、前記選択された難読化対象プログラム中の少なくとも1つの命令文を追加された前記n個のサブルーチンの1つである第1のサブルーチンを呼び出す呼出命令に変換する変換手段とを有し、第1から第n−1のサブルーチンの各々は分岐構造を有し、該分岐構造の分岐節の少なくとも1つが別の1つのサブルーチンの呼出命令を含み、前記n個のサブルーチンは前記第1のサブルーチンから1つずつ順番に実行されるように関連付けられており、最後に実行される第nのサブルーチンは前記変換手段により前記第1のサブルーチンを呼び出す呼出命令に変換された命令文を実行することを特徴としている。
In order to achieve this object, the program obfuscation device according to
請求項2記載の発明は、請求項1記載の発明において、前記分岐構造の分岐節のいずれか一方は、他方とは異なる別の1つのサブルーチンの呼出命令を含むことを特徴としている。 According to a second aspect of the present invention, in the first aspect of the present invention, any one of the branching clauses of the branch structure includes a call instruction for another subroutine different from the other.
請求項3記載の発明は、請求項1または2に記載の発明において、前記分岐構造の分岐節のいずれもが、別の1つのサブルーチンの呼出命令を含むことを特徴としている。
The invention according to
請求項4記載の発明は、請求項1から3のいずれか一項記載の発明において、前記追加手段は、前記難読化対象のプログラムに複数のダミーのサブルーチンを追加し、前記複数のサブルーチンの前記分岐構造の少なくとも1つは、前記複数のダミーのサブルーチンの呼出命令を含むことを特徴としている。
The invention according to
請求項5記載の発明は、請求項1から4のいずれか一項記載の発明において、前記追加手段は、前記難読化対象のプログラムに含まれる変数を可逆的に操作する可逆関数を生成し、前記分岐構造の分岐節の少なくとも1つは、前記可逆関数に基づいて前記変数を可逆的に操作する命令文を含むことを特徴としている。
The invention according to
請求項6記載の発明は、請求項1から5のいずれか一項記載の発明において、前記分岐構造の条件式は、常に偽となる条件式であることを特徴としている。
The invention according to
請求項7記載の発明は、コンピュータに、難読化の度合いを示す難読化指数n(nは2以上の整数)を入力する入力手順と、少なくとも1つの命令文を含む難読化対象プログラムを選択する選択手順と、選択された難読化対象プログラムにn個の複数のサブルーチンを追加するプログラムに複数のサブルーチンを追加する追加手順と、前記選択された難読化対象プログラム中の少なくとも1つの命令文を追加された前記n個のサブルーチンの1つである第1のサブルーチンを呼び出す呼出命令に変換する変換手順とを実行させ、第1から第n−1のサブルーチンの各々は分岐構造を有し、該分岐構造の分岐節の少なくとも1つが別の1つのサブルーチンの呼出命令を含み、前記n個のサブルーチンは前記第1のサブルーチンから1つずつ順番に実行されるように関連付けられており、最後に実行される第nのサブルーチンは前記変換手段により前記第1のサブルーチンを呼び出す呼出命令に変換された命令文を実行することを実現させることを特徴としている。
The invention according to
請求項1の発明は、インライン展開によるプログラム解析に必要な計算量と記憶領域量を増大させるプログラムを生成する。
The invention of
請求項2の発明は、サブルーチンに含まれる分岐構造のいずれの分岐節も別のサブルーチン呼出を含み、インライン展開によるプログラム解析に必要な計算量と記憶領域量を増大させるプログラムを生成する。 According to the second aspect of the present invention, any branch clause of the branch structure included in the subroutine includes another subroutine call, and generates a program that increases the amount of calculation and storage area necessary for program analysis by inline expansion.
請求項3の発明は、サブルーチンに含まれる分岐構造のいずれの分岐節も別の同一のサブルーチン呼出を含み、インライン展開によるプログラム解析に必要な計算量と記憶領域量を増大させるプログラムを生成する。 According to another aspect of the present invention, any branch clause of the branch structure included in the subroutine includes another same subroutine call, and generates a program that increases the amount of calculation and storage area necessary for program analysis by inline expansion.
請求項4の発明は、任意の命令文を実行するダミーのサブルーチンを含み、インライン展開によるプログラム解析に必要な計算量と記憶領域量を増大させるプログラムを生成する。
The invention of
請求項5の発明は、可逆関数に基づいて変数を可逆的に操作するプログラム片を含み、インライン展開によるプログラム解析に必要な計算量と記憶領域量を増大させるプログラムを生成する。
The invention of
請求項6の発明は、常に偽となる条件式を含み、インライン展開によるプログラム解析に必要な計算量と記憶領域量を増大させるプログラムを生成する。
The invention of
請求項7の発明は、インライン展開によるプログラム解析に必要な計算量と記憶領域量を増大させるプログラムを生成する。
The invention of
以下、本発明の最良の実施形態について図面を参照して説明する。 DESCRIPTION OF EXEMPLARY EMBODIMENTS Hereinafter, exemplary embodiments of the invention will be described with reference to the drawings.
図1は、本発明の実施例に用いられるプログラム難読化装置の構成を示すブロック図である。プログラム難読化装置10は、入出力装置14、演算装置11、RAM12、外部記憶装置13を含む。入出力装置14は、難読化装置を使用するユーザから指示を受け付けたり、難読化処理の結果を表示したりする。外部記憶装置13は、難読化対象プログラムや難読化後のプログラムを格納する。RAM12は、難読化処理中のプログラムを一時的に保存する装置である。演算装置11は、RAM上の難読化対象プログラムに難読化を適用する装置である。
FIG. 1 is a block diagram showing a configuration of a program obfuscation apparatus used in an embodiment of the present invention. The
次に、本発明の第1の実施例のプログラム難読化方法について、図2ないし図16を参照して説明する。図2は任意の実行形式のプログラムを難読化する演算装置11の機能を示したブロック図である。演算装置11は、1個以上の難読化前のプログラムを入力する入力部21、入力されたプログラムの難読化処理を行う難読化処理部22、及び難読化されたプログラムを出力する出力部23から構成される。
Next, the program obfuscation method of the first embodiment of the present invention will be described with reference to FIGS. FIG. 2 is a block diagram showing the function of the
難読化処理部22は、入力手段221と選択手段222により、難読化処理に必要な初期条件を決定する。
The
まず、入力手段221について説明する。
難読化処理部22は、難読化の度合いを示す難読化指数nを入力する入力手段221を有する。難読化指数nは、予め定められていてもよいし、難読化指数nの指定に基づき定めてもよい。また、難読化指数nの指定は、演算装置11がランダムに指定するようにしてもよいし、入出力装置14を介してユーザが指定するようにしても良い。
First, the
The
次に、選択手段222について説明する。
難読化指数nが決定すると、難読化処理部22は、1個以上の難読化前プログラムから、難読化を行うプログラム(以下、難読化対象プログラムという)を選択する。難読化対象プログラムは、予め定められていてもよいし、難読化対象プログラムの指定に基づき定めてもよい。また、難読化対象プログラムの指定は、演算装置11がランダムに指定してもよいし、入出力装置14を介してユーザが指定しても良い。
Next, the
When the obfuscation index n is determined, the
次に、難読化処理部22は、選択された難読化対象プログラムに含まれるルーチンを選択する。ルーチンは、選択された難読化対象プログラムに含まれる全てのルーチンを選択しても良いし、特定の(1個以上の)ルーチンのみを選択しても良い。選択するルーチンは、予め定められていてもよいし、ルーチンの指定に基づき定めてもよい。また、ルーチンの指定は、演算装置11がランダムに指定してもよいし、入出力装置14を介してユーザが指定しても良い。
Next, the
次に、難読化処理部22は、選択したルーチンに含まれる1以上の連続する命令文をプログラム片として選択する。選択するプログラム片は、予め定められていてもよいし、プログラム片の指定により選択しても良い。また、プログラム片の指定は、演算装置11がランダムに指定しても良いし、入出力装置14を介してユーザが指定しても良い。
Next, the
難読化処理部22は、入力手段221と選択手段222により決定された初期条件と難読化処理規則に従い、追加手段223によって難読化対象のプログラムにサブルーチンを追加する。
そして、難読化処理部22は変換手段224によって、選択手段222で選択したプログラム片を、追加手段224により追加したサブルーチンの呼出しに変換する。
難読化処理部22は、追加手段223と変換手段224により、難読化対象プログラムの難読化を終了する。
The
Then, the
The
出力部23は、難読化処理部22により難読化の処理が終了したプログラムを受け取る。そのプログラムが難読化装置の全体としての出力となる。難読化されたプログラムは例えば外部記憶装置13に記憶される。
The
次に、難読化処理手順について説明する。
まず、本発明の第1の実施例に係るプログラム難読化装置の操作画面と操作例について、図3を用いて説明する。
Next, the obfuscation processing procedure will be described.
First, an operation screen and an operation example of the program obfuscation apparatus according to the first embodiment of the present invention will be described with reference to FIG.
図3は、難読化処理装置の操作画面の1例を示したものである。
操作画面30は、入力部21に入力された1個以上の難読化前のプログラムを、ソースファイルリスト31に表示する。
ユーザは、そのソースファイルリスト31の中から、難読化したいプログラムを選択する。 難読化したいプログラムの選択を行うと、ルーチンリスト32に、選択したプログラムに含まれるルーチンが表示される。
FIG. 3 shows an example of the operation screen of the obfuscation processing apparatus.
The
The user selects a program to be obfuscated from the
ユーザが、ルーチンリスト32から難読化を行うルーチンを選択すると、難読化前ルーチン欄33に選択したルーチンのソースコードが表示される。
図3では、mainというルーチンのソースコードが表示されている。 以上の操作により、ユーザは、難読化したいプログラムと、難読化対象のルーチンを選択する。
When the user selects a routine to be obfuscated from the
In FIG. 3, the source code of a routine called main is displayed. Through the above operation, the user selects a program to be obfuscated and a routine to be obfuscated.
次に、ユーザは、難読化の度合いを決定する難読化指数nを指定するため、パラメタ入力34に、2以上の整数を入力する。 図3では、例として15が入力されている。この難読化指数nにより、難読化処理部22の追加手段によって、追加されるサブルーチンの個数が決定される。
Next, the user inputs an integer of 2 or more in the
ユーザは、変換手段によってサブルーチンに変換されるプログラム片を指定するため、難読化前ルーチン欄33に表示されたサブルーチンに含まれるプログラム片を、マウスカーソル35で選択する。 図3では、a+=bの演算命令が、プログラム片として選択されている。
The user uses the
上記処理にて、難読化処理に必要な初期条件の設定が終了したので、ユーザは難読化実行ボタン36を押す。 すると、難読化処理が実行され、難読化適用後のプログラムが難読化適用後ルーチン欄37に表示される。 ユーザは、難読化結果を確認した上で難読化後プログラムの保存ボタン38を押し、難読化後のプログラムを保存することができる。
難読化処理を終了するには、ユーザは終了ボタン39を押せばよい。
Since the initial conditions necessary for the obfuscation process have been set in the above process, the user presses the
To end the obfuscation process, the user may press the
次に、上記操作による難読化処理を実現するために難読化処理部22が行う難読化処理手順を、図4を用いて説明する。
図4は、難読化処理部22が、1の難読化処理規則に従って行う難読化処理のフローチャートである。
Next, the obfuscation processing procedure performed by the
FIG. 4 is a flowchart of the obfuscation processing performed by the
まず、ユーザまたは演算装置11は、難読化の度合いを決定する難読化指数n(nは2以上)を指定する(ステップS61)。本ステップは、図3に示した操作画面の例では、パラメタ入力34に2以上の整数を入力することに対応する。
First, the user or the
次に、ユーザまたは演算装置11は、複数ある難読化対象のプログラムの中から、難読化を行うプログラムP、プログラムPに含まれるルーチンR及びルーチンR中のプログラム片Bを選択する(ステップS62)。本ステップは、図3に示した操作画面の例では、プログラムPの選択は、ソースファイルリスト31から難読化を行うプログラムを選択することに対応する。また、ルーチンRの選択は、ルーチンリスト32からルーチンRを選択することに対応し、プログラム片Bの選択は、難読化前ルーチン欄33から、マウスカーソル35で「a+=b」を選択することに対応する。
Next, the user or the
プログラム難読化装置10は、ルーチンRに含まれるプログラム片Bの実行時動作を変えることなく、難読化が終了したプログラムPをユーザに提供するように、難読化処理を行う。
The
本実施例では、任意のプログラムPに含まれる図5のメインルーチンmainをルーチンRとして選択し、mainに含まれる「a+=b」の演算命令をプログラム片Bとして選択した場合の難読化処理について説明する。 In this embodiment, the obfuscation process when the main routine main of FIG. 5 included in an arbitrary program P is selected as the routine R and the operation instruction “a + = b” included in main is selected as the program piece B. explain.
難読化処理部22は、プログラムPに、前処理(ステップS62)で選択されたプログラム片Bのソースコードを含むサブルーチンsubB(図6)と、任意のソースコードを含むダミーのサブルーチンsubDmmy(図7)を追加する(ステップS63)。従って、subBを呼出すと、選択されたプログラム片Bが実行されることになる。
The
次に、難読化処理部22は、プログラムPに、第1サブルーチンsub_1をプログラムPに追加する(ステップS64)。ただし、sub_1は、任意の常に偽となる条件式(以下、恒偽の条件式と略記する)を条件判定とし、かつ、真の条件節からsubDmmyを呼出し、偽の条件節からsubBを呼出す条件分岐から構成されるとする(図8)。ここで、図8中の「k*(k−1)%2!=0」は、常に偽となる条件式である。
本処理によって追加されたsub_1を呼出すと、subBが必ず呼出され、その結果、選択されたプログラム片Bが実行されることになる。
Next, the
When sub_1 added by this process is called, subB is always called, and as a result, the selected program piece B is executed.
難読化処理部22は、i=2、・・・、nに関して、iに対応するサブルーチンsub_i(i=2、・・・、n)をプログラムPに追加する(ステップS65)。
ただし、sub_iは、任意の恒偽の条件式を条件判定とし、かつ、真の条件節はsub_i−1の呼出しと、任意に作成した1以上の連続する命令文Dmmy_iから成り、偽の条件節はsub_i−1の呼出しからなる条件分岐、から構成されるとする(図9)。
The
However, sub_i uses an arbitrary false conditional expression as a condition determination, and a true conditional clause consists of a call of sub_i-1 and one or more consecutive command statements Dmmy_i created arbitrarily, and a false conditional clause Is composed of conditional branches consisting of calls to sub_i-1 (FIG. 9).
本処理の結果、1処理前に追加されたサブルーチンの呼出しを行うサブルーチンが追加されることになる。つまり、sub_2は、前処理で追加されたsub_1の呼出しを行い、sub_3はsub_2の呼出しを行うことになる。 As a result of this process, a subroutine for calling a subroutine added before one process is added. That is, sub_2 calls sub_1 added in the pre-processing, and sub_3 calls sub_2.
難読化処理部22は、プログラム片Bを、前処理(ステップS65)の最後に追加されたサブルーチンsub_nの呼出しに変換する(ステップS66)。
これにより、本実施例では、ユーザがメインルーチンを実行すると、sub_nの実行により、sub_n−1が呼出され、sub_n−1によってsub_n-2が呼出されることになる。
そして、n回のサブルーチン呼出しを経た後に、サブルーチンsubBが呼出され、選択されたプログラム片Bが実行されることとなる。
The
Thus, in this embodiment, when the user executes the main routine, sub_n-1 is called by executing sub_n, and sub_n-2 is called by sub_n-1.
After n times of subroutine calls, the subroutine subB is called, and the selected program piece B is executed.
上述の処理により、プログラムPの難読化が完了する。そこで、難読化処理部22は、難読化適用済みプログラムPを出力部23へ出力する(ステップS67)。
The obfuscation of the program P is completed by the above processing. Therefore, the
本実施例によれば、図5の難読化前のルーチンmainを含むプログラムPは、図10のように難読化される。 According to the present embodiment, the program P including the routine main before obfuscation in FIG. 5 is obfuscated as shown in FIG.
本実施例によって得られた難読化後のプログラムは、インライン展開に必要な記憶領域及び処理量を増大させるものである。
そこで、難読化後のプログラム図10に対して、インライン展開を行った場合のプログラムの変化を模式的に示した図11を用いて、その難読化の効果を説明する。
図11では、丸はサブルーチンを、丸から丸への矢印はサブルーチンの呼出しを表している。丸1から丸2にk本の矢印がある場合、丸1に対応する関数の中に、丸2に対応するサブルーチン呼出しがk箇所ある事を示す。
The obfuscated program obtained by the present embodiment increases the storage area and processing amount necessary for inline expansion.
Therefore, the obfuscation effect will be described with reference to FIG. 11 schematically showing changes in the program when inline expansion is performed on the obfuscated program FIG.
In FIG. 11, a circle represents a subroutine, and a circle-to-circle arrow represents a subroutine call. If there are k arrows from
難読化後プログラム41は、難読化後のプログラム図10を模式的に表したものである。難読化後プログラム41のsub_nをインライン展開すると、第1インライン展開42のようになる。第1インライン展開42は、mainの中にsub_nの中身が1つ展開されたことを模式的に表している。
The obfuscated
第1インライン展開42のsub_n−1をさらにインライン展開すると、第2インライン展開43のようになる。mainの中にsub_n−1の呼出が2箇所あったので、第2インライン展開43では、mainにsub_n−1の中身が2つ展開されている。第2インライン展開43のsub_n−2をさらにインライン展開すると、第3インライン展開44のようになる。
When sub_n−1 of the first
mainの中にsub_n−2の呼出が4箇所あったので、第3インライン展開44では、mainにsub_n−2の中身が4つ展開される。
以上に示したように、難読化後のプログラムにインライン展開を順次行っていくと、サブルーチンの展開数はnに関して指数関数的になる。そのため、難読化後のプログラムにインライン展開を適用すると、ルーチンmainのサイズがnに関して指数関数的に大きくなる。従って、nがある程度大きくなる(例えば、n=50)と、インライン展開は現実的に実行不可能となる。
Since there are four calls of sub_n-2 in main, in the third
As described above, when inline expansion is sequentially performed on the obfuscated program, the number of expansions of the subroutine becomes exponential with respect to n. Therefore, when inline expansion is applied to the obfuscated program, the size of the routine main increases exponentially with respect to n. Therefore, when n becomes large to some extent (for example, n = 50), inline expansion becomes practically impossible.
次に、図12を用いて、難読化処理部22が、上述の難読化処理規則とは別の難読化処理規則に従って行う難読化処理について説明する。
Next, an obfuscation process performed by the
まず、ユーザまたは演算装置11は、難読化を行うプログラムPと、難読化の度合いを決定する整数n(nは2以上)を指定する(ステップS131)。本ステップは、図3に示した操作画面の例では、パラメタ入力34に2以上の整数を入力することに対応する。
First, the user or the
次に、ユーザまたは演算装置11は、複数ある難読化プログラムの中から、難読化を行うプログラムP、プログラムPに含まれるルーチンR及びルーチンR中のプログラム片Bを選択する(ステップS132)。本ステップは、図3に示した操作画面の例では、プログラムPの選択は、ソースファイルリスト31から難読化を行うプログラムを選択することに対応する。また、ルーチンRの選択は、ルーチンリスト32からルーチンRを選択することに対応し、プログラム片Bの選択は、難読化前ルーチン欄33から、マウスカーソル35で「a+=b」を選択することに対応する。
Next, the user or the
プログラム難読化装置10は、ルーチンRに含まれるプログラム片Bの実行時動作を変えることなく、難読化が終了したプログラムPをユーザに提供するように、難読化処理を行う。
The
本実施例では、任意のプログラムPに含まれる図5のメインルーチンmainをルーチンRとして選択し、mainに含まれる「a+=b」の演算命令をプログラム片Bとして選択した場合の難読化処理について説明する。 In this embodiment, the obfuscation process when the main routine main of FIG. 5 included in an arbitrary program P is selected as the routine R and the operation instruction “a + = b” included in main is selected as the program piece B. explain.
難読化処理部22は、プログラムPに、前処理(ステップS132)で選択されたプログラム片Bのソースコードを含むサブルーチンsubB(図6)と、任意のソースコードを含むダミーのサブルーチン(図7)を追加する(ステップS133)。従って、subBを呼出すと、選択されたプログラム片Bが実行されることになる。
The
次に、難読化処理部22は、難読化対象のプログラムに、第1サブルーチンsub_1をプログラムPに追加する(ステップS134)。ただし、sub_1は、任意の恒偽の条件式を条件判定とし、かつ、真の条件節からsubDmmyを呼出し、偽の条件節からsubBを呼出す条件分岐から構成されるとする(図8)。ここで、図8中の「k*k−1%2!=0」は、常に偽となる条件式である。
本処理によって追加されたsub_1を呼出すと、subBが必ず呼出され、その結果、選択されたプログラム片Bが実行されることになる。
Next, the
When sub_1 added by this process is called, subB is always called, and as a result, the selected program piece B is executed.
次に、ユーザまたは演算装置11は、プログラムPから任意の整数変数xを選択し、難読化処理部22は選択された整数xを入出力とする可逆関数gを生成する(ステップS135)。本実施例では、可逆関数gとしてg(x)=2*x+3を生成したとする。
可逆関数gは、後述する処理で追加されるサブルーチン内で利用される。
Next, the user or the
The reversible function g is used in a subroutine added in the process described later.
難読化処理部22は、i=2、・・・、2n+1に関して、iに対応するサブルーチンsub_i(i=2、・・・、2n+1)をプログラムPに追加する(ステップS136)。ただし、i=3,5、・・・、2n+1に関して、sub_iは、任意の条件式を条件判定とし、かつ、真/偽の条件節ともにx=g(x)と同一の結果を返すプログラム片とsub_i−1との呼出しから成る(図13)。
また、i=2、4、・・・、2nに関して、sub_iは、任意の条件式を条件判定とし、かつ、真/偽の条件節とともにx=g〜(x)と同じ結果を返すプログラム片と、sub_i−1との呼出しから成る(図14)。ここで、g〜とは、gの逆関数である。つまり、g〜(x)=(x−3)/2である。
The
Also, for i = 2, 4,..., 2n, sub_i is a program fragment that uses an arbitrary conditional expression as a condition determination and returns the same result as x = g to (x) together with a true / false conditional clause. And a call of sub_i-1 (FIG. 14). Here, g˜ is an inverse function of g. That is, g to (x) = (x−3) / 2.
難読化処理部22は、プログラム片Bを、前処理(ステップS136)の最後に追加されたサブルーチンsub_2n+1の呼出しに変換する(ステップS137)。
これにより、本実施例では、ユーザがメインルーチンを実行すると、sub_2n+1の実行により、sub_2nが呼出され、sub_2nによって、sub_2(n−1)+1が呼出されることになる。
そして、2n+1回のサブルーチン呼出しを経た後に、サブルーチンsubBが呼出され、選択されたプログラム片Bが実行されることとなる。
The
Thereby, in this embodiment, when the user executes the main routine, sub_2n is called by executing
Then, after 2n + 1 subroutine calls, the subroutine subB is called, and the selected program piece B is executed.
上述した処理により、プログラムPの難読化処理は終了するため、難読化処理部22は、難読化適用済みプログラムPを出力部23へ出力する(ステップS138)
Since the obfuscation processing of the program P is completed by the above-described processing, the
本実施例によれば、図5の難読化前のルーチンmainを含むプログラムPは、図15のように難読化される。 According to the present embodiment, the program P including the routine main before obfuscation in FIG. 5 is obfuscated as shown in FIG.
本実施例によって得られた難読化後のプログラムは、インライン展開に必要な記憶領域及び処理量を増大させるものである。
そこで、難読化後のプログラム図15に対して、インライン展開を行った場合のプログラムの変化を模式的に示した図16を用いて、その難読化の効果を説明する。
図16では、丸はサブルーチンを、丸から丸への矢印はサブルーチンの呼出しを表している。丸1から丸2にk本の矢印がある場合、丸1に対応する関数の中に、丸2に対応するサブルーチン呼出しがk箇所ある事を示す。
The obfuscated program obtained by the present embodiment increases the storage area and processing amount necessary for inline expansion.
Therefore, the obfuscation effect will be described with reference to FIG. 16 schematically showing the change of the program when inline expansion is performed on the obfuscated program FIG.
In FIG. 16, a circle represents a subroutine, and a circle-to-circle arrow represents a subroutine call. If there are k arrows from
難読化後プログラム51は、難読化後のプログラム図15を模式的に表したものである。難読化後プログラム51のsub_2n+1をインライン展開すると、第1インライン展開52のようになる。第1インライン展開42は、mainの中にsub_2n+1の中身が1つ展開されたことを模式的に表している。
The obfuscated
第1インライン展開52のsub_2n+1をさらにインライン展開すると、第2インライン展開53のようになる。mainの中にsub_2nの呼出が2箇所あったので、第2インライン展開53では、mainにsub_2nの中身が2つ展開されている。第2インライン展開53のsub_2nをさらにインライン展開すると、第3インライン展開44のようになる。
When sub_2n + 1 of the first
mainの中にsub_2(n−1)+1の呼出が4箇所あったので、第3インライン展開44では、mainにsub_2(n−1)+1の中身が4つ展開される。
以上に示したように、難読化後のプログラムにインライン展開を順次行っていくと、サブルーチンの展開数はnに関して指数関数的になる。そのため、難読化後のプログラムにインライン展開を適用すると、ルーチンmainのサイズがnに関して指数関数的に大きくなる。従って、nがある程度大きくなる(例えば、n=50)と、インライン展開は現実的に実行不可能となる。
Since there are four calls of sub_2 (n−1) +1 in the main, in the third
As described above, when inline expansion is sequentially performed on the obfuscated program, the number of expansions of the subroutine becomes exponential with respect to n. Therefore, when inline expansion is applied to the obfuscated program, the size of the routine main increases exponentially with respect to n. Therefore, when n becomes large to some extent (for example, n = 50), inline expansion becomes practically impossible.
以上、本発明の好ましい実施の形態について詳述したが、本発明に係る特定の実施形態に限定されるものではなく、特許請求の範囲に記載された本発明の要旨の範囲内において、種々の変形・変更が可能である。 The preferred embodiments of the present invention have been described in detail above. However, the present invention is not limited to the specific embodiments according to the present invention, and various modifications can be made within the scope of the gist of the present invention described in the claims. Deformation / change is possible.
10…プログラム難読化装置
11…演算装置
12…RAM
13…外部記憶装置
14…入出力装置
21…入力部
22…難読化処理部
23…出力部
30…操作画面
31…ソースファイルリスト
32…ルーチンリスト
33…難読化前ルーチン欄
34…パラメタ入力欄
35…難読化実行ボタン
37…難読化後ルーチン欄
38…難読化後プログラムの保存
39…終了ボタン
41…難読化後プログラム
42…第1インライン展開
43…第2インライン展開
44…第3インライン展開
51…難読化後プログラム
52…第1インライン展開
53…第2インライン展開
54…第3インライン展開
221…入力手段
222…選択手段
223…追加手段
224…変換手段
10 ...
DESCRIPTION OF
Claims (7)
少なくとも1つの命令文を含む難読化対象プログラムを選択する選択手段と、
選択された難読化対象プログラムにn個の複数のサブルーチンを追加する追加手段と、
前記選択された難読化対象プログラム中の少なくとも1つの命令文を追加された前記n個のサブルーチンの1つである第1のサブルーチンを呼び出す呼出命令に変換する変換手段とを有し、
第1から第n−1のサブルーチンの各々は分岐構造を有し、該分岐構造の分岐節の少なくとも1つが別の1つのサブルーチンの呼出命令を含み、前記n個のサブルーチンは前記第1のサブルーチンから1つずつ順番に実行されるように関連付けられており、最後に実行される第nのサブルーチンは前記変換手段により前記第1のサブルーチンを呼び出す呼出命令に変換された命令文を実行することを特徴とするプログラム難読化装置。 An input means for inputting an obfuscation index n (n is an integer of 2 or more) indicating the degree of obfuscation,
Selecting means for selecting an obfuscation target program including at least one command statement;
An additional means for adding a plurality of n subroutines to the selected obfuscated program;
Conversion means for converting at least one instruction sentence in the selected obfuscation target program into a call instruction for calling a first subroutine which is one of the added n subroutines;
Each of the first to (n-1) -th subroutines has a branch structure, and at least one of the branch nodes of the branch structure includes a call instruction for another subroutine, and the n subroutines are the first subroutine. The n-th subroutine executed last is executed by the conversion means to execute the instruction sentence converted to a call instruction for calling the first subroutine. Feature program obfuscation device.
前記複数のサブルーチンの前記分岐構造の少なくとも1つは、前記複数のダミーのサブルーチンの呼出命令を含むことを特徴とする請求項1から3のいずれか一項記載のプログラム難読化装置。 The adding means adds a plurality of dummy subroutines to the obfuscated program,
4. The program obfuscation apparatus according to claim 1, wherein at least one of the branch structures of the plurality of subroutines includes a call instruction for the plurality of dummy subroutines. 5.
前記分岐構造の分岐節の少なくとも1つは、前記可逆関数に基づいて前記変数を可逆的に操作する命令文を含むことを特徴とする請求項1から4のいずれか一項記載のプログラム難読化装置。 The additional means generates a reversible function that reversibly manipulates variables included in the obfuscated program,
5. The program obfuscation according to claim 1, wherein at least one of the branch clauses of the branch structure includes a statement that reversibly manipulates the variable based on the reversible function. apparatus.
難読化の度合いを示す難読化指数n(nは2以上の整数)を入力する入力手順と、
少なくとも1つの命令文を含む難読化対象プログラムを選択する選択手順と、
選択された難読化対象プログラムにn個の複数のサブルーチンを追加するプログラムに複数のサブルーチンを追加する追加手順と、
前記選択された難読化対象プログラム中の少なくとも1つの命令文を追加された前記n個のサブルーチンの1つである第1のサブルーチンを呼び出す呼出命令に変換する変換手順とを実行させ、
第1から第n−1のサブルーチンの各々は分岐構造を有し、該分岐構造の分岐節の少なくとも1つが別の1つのサブルーチンの呼出命令を含み、前記n個のサブルーチンは前記第1のサブルーチンから1つずつ順番に実行されるように関連付けられており、最後に実行される第nのサブルーチンは前記変換手段により前記第1のサブルーチンを呼び出す呼出命令に変換された命令文を実行することを実現させるための難読化プログラム。 On the computer,
An input procedure for inputting an obfuscation index n (n is an integer of 2 or more) indicating the degree of obfuscation,
A selection procedure for selecting an obfuscated program including at least one statement;
An additional procedure for adding a plurality of subroutines to a program for adding a plurality of n subroutines to the selected obfuscation program;
A conversion procedure for converting at least one command statement in the selected obfuscation target program into a call command for calling a first subroutine that is one of the added n subroutines;
Each of the first to (n-1) -th subroutines has a branch structure, and at least one of the branch nodes of the branch structure includes a call instruction for another subroutine, and the n subroutines are the first subroutine. The n-th subroutine executed last is executed by the conversion means to execute the instruction sentence converted to a call instruction for calling the first subroutine. Obfuscation program to realize.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2008239860A JP5277825B2 (en) | 2008-09-18 | 2008-09-18 | Program obfuscation device and obfuscation program |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2008239860A JP5277825B2 (en) | 2008-09-18 | 2008-09-18 | Program obfuscation device and obfuscation program |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2010072958A JP2010072958A (en) | 2010-04-02 |
JP5277825B2 true JP5277825B2 (en) | 2013-08-28 |
Family
ID=42204673
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2008239860A Expired - Fee Related JP5277825B2 (en) | 2008-09-18 | 2008-09-18 | Program obfuscation device and obfuscation program |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP5277825B2 (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP5378055B2 (en) * | 2009-04-30 | 2013-12-25 | Kddi株式会社 | Program obfuscation apparatus, program obfuscation method, and program |
US9811666B2 (en) | 2011-03-24 | 2017-11-07 | Irdeto B.V. | System and method providing dependency networks throughout applications for attack resistance |
Family Cites Families (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2004185064A (en) * | 2002-11-29 | 2004-07-02 | Matsushita Electric Ind Co Ltd | Device and method for making program difficult to read |
JP4675642B2 (en) * | 2005-02-22 | 2011-04-27 | Kddi株式会社 | Program obfuscation apparatus, method and program |
JP4917861B2 (en) * | 2006-10-17 | 2012-04-18 | Kddi株式会社 | Program analysis method and program |
WO2008088073A1 (en) * | 2007-01-18 | 2008-07-24 | Panasonic Corporation | Obfuscation assisting apparatus |
-
2008
- 2008-09-18 JP JP2008239860A patent/JP5277825B2/en not_active Expired - Fee Related
Also Published As
Publication number | Publication date |
---|---|
JP2010072958A (en) | 2010-04-02 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11086502B2 (en) | Actionable business entity operating models to drive user interface behavior | |
US11106437B2 (en) | Lookup table optimization for programming languages that target synchronous digital circuits | |
CN107341374B (en) | Insertion method and device of opaque predicates | |
CN110309629B (en) | Webpage code reinforcement method, device and equipment | |
CN112839036B (en) | Software running environment generation method and system based on mimicry defense theory | |
RU2680761C1 (en) | Secure data transformations | |
JP2007304726A (en) | Program obfuscation device, obfuscation method and obfuscation program | |
JP5277825B2 (en) | Program obfuscation device and obfuscation program | |
JP4905480B2 (en) | Program obfuscation program and program obfuscation device | |
Kang et al. | Obfus: An obfuscation tool for software copyright and vulnerability protection | |
JP4667800B2 (en) | Encoding method and program thereof | |
Luckow et al. | Symbolic pathfinder v7 | |
CN105095698B (en) | Program code Fuzzy Processing based on the program code performed recently | |
Chrząszcz | Exploring state machine CECA model | |
CN113282892A (en) | Code obfuscation method, apparatus, computer device and storage medium | |
CN111126012A (en) | Method and device for generating expression in customization mode | |
JP5149061B2 (en) | Program obfuscation apparatus, program obfuscation method, and program | |
JP4924177B2 (en) | Program obfuscation device and program | |
CN113946804B (en) | Source code obfuscation method and device | |
JP5627444B2 (en) | Software obfuscation device, software obfuscation method and program | |
JP2011209801A (en) | Apparatus and method for obfuscating software, and program | |
JP2015035174A (en) | Control program division device, control program division method, and recording medium therefor | |
JP6810380B2 (en) | Source program conversion system, source program conversion method, and source program conversion program | |
US10949181B1 (en) | Computing performance for execution of functions called by function handles | |
KR102066022B1 (en) | Apparatus and method for generating function signature on executable code |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20110822 |
|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20130121 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20130212 |
|
A521 | Request for written amendment filed |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20130403 |
|
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: 20130423 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20130506 |
|
R150 | Certificate of patent or registration of utility model |
Free format text: JAPANESE INTERMEDIATE CODE: R150 Ref document number: 5277825 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 |
|
LAPS | Cancellation because of no payment of annual fees |