JP5477994B2 - Self-rewriting processing device, self-rewriting processing method, and program - Google Patents
Self-rewriting processing device, self-rewriting processing method, and program Download PDFInfo
- Publication number
- JP5477994B2 JP5477994B2 JP2010092497A JP2010092497A JP5477994B2 JP 5477994 B2 JP5477994 B2 JP 5477994B2 JP 2010092497 A JP2010092497 A JP 2010092497A JP 2010092497 A JP2010092497 A JP 2010092497A JP 5477994 B2 JP5477994 B2 JP 5477994B2
- Authority
- JP
- Japan
- Prior art keywords
- instruction
- key
- target program
- protection target
- dummy
- 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
Landscapes
- Storage Device Security (AREA)
Description
本発明は、自己書き換え処理装置、自己書き換え処理方法、およびプログラムに関する。 The present invention relates to a self-rewriting processing device, a self-rewriting processing method, and a program.
従来より、保護対象プログラムの解析および改ざんを困難にする手法が提案されている(例えば、特許文献1参照)。特許文献1には、保護対象プログラムの解析および改ざんを困難にする手法として、自己書き換えの手法が示されている。
Conventionally, a method for making it difficult to analyze and falsify a protection target program has been proposed (see, for example, Patent Document 1).
特許文献1の自己書き換えでは、まず、保護対象プログラムに記述されている命令を偽の命令で偽装する。次に、偽の命令の前方に、この偽の命令を元の命令に置換する第1の処理を挿入するとともに、偽の命令の後方に、第1の処理の実行により置換された元の命令を偽の命令に置換する第2の処理を挿入する。
In the self-rewriting of
このため、特許文献1の自己書き換えを行った保護対象プログラムを実行すると、偽の命令が実行されるより前に、第1の処理が実行される。このため、偽の命令が元に戻った状態で実行されることとなる。また、偽の命令が元に戻った状態で実行された後に、第2の処理が実行される。このため、元に戻った命令が再度偽装されることとなる。したがって、偽装した命令は、実行前後の所定の期間でのみ元の命令に戻り、他の期間では偽装された状態となるので、保護対象プログラムの解析および改ざんが困難となる。
For this reason, when the protection target program that has been self-rewritten in
特許文献1の自己書き換えを行った保護対象プログラムでは、第1の処理を実行するために、元の命令が保護対象プログラムに記述される。このため、どのような置換が行われるのかが容易に推測できてしまい、保護対象プログラムの解析および改ざんの困難性を向上できなかった。
In the protection target program in which self-rewriting is performed in
そこで、保護対象プログラムに記述される元の命令を予め暗号化しておき、偽装した偽の命令を元に戻す際に復号する手法が考えられる。ところが、この暗号化する手法では、暗号化の際に用いる鍵を保護対象プログラムに記述を記述しなくてはならない。このため、鍵が容易に漏洩してしまい、保護対象プログラムの解析および改ざんの困難性を向上できなかった。 Therefore, a method is conceivable in which the original instruction described in the protection target program is encrypted in advance and decrypted when the fake fake instruction is restored. However, in this encryption method, it is necessary to describe the description of the key used for encryption in the protection target program. For this reason, the key is easily leaked, and the difficulty of analyzing and falsifying the program to be protected cannot be improved.
そこで、本発明は、上述の課題に鑑みてなされたものであり、保護対象プログラムの解析および改ざんの困難性を向上させることができる自己書き換え処理装置、自己書き換え処理方法、およびプログラムを提供することを目的とする。 Therefore, the present invention has been made in view of the above-described problems, and provides a self-rewriting processing device, a self-rewriting processing method, and a program capable of improving the difficulty of analyzing and falsifying a protection target program. With the goal.
本発明は、上記の課題を解決するために、以下の事項を提案している。 The present invention proposes the following matters in order to solve the above problems.
(1) 本発明は、保護対象プログラムを記憶する記憶手段(例えば、図1のキャッシュ20に相当)と、前記保護対象プログラムに記述されている命令を少なくとも1つ選択する選択手段(例えば、図1のCPU10に相当)と、前記選択手段により選択された命令を、鍵を用いて暗号化する命令暗号化手段(例えば、図1のCPU10に相当)と、前記命令暗号化手段により用いられた鍵を、ダミーの鍵に置換する鍵偽装手段(例えば、図1のCPU10に相当)と、前記鍵偽装手段により置換されたダミーの鍵を元の鍵に置換する鍵復元処理(例えば、図5の鍵復元処理55に相当)を、前記保護対象プログラムに挿入する鍵復元処理挿入手段(例えば、図1のCPU10に相当)と、前記命令暗号化手段により暗号化された命令を、前記鍵復元処理の実行により置換された元の鍵を用いて復号する命令復号処理(例えば、図5の命令復号処理52Aに相当)を、前記保護対象プログラムに挿入する命令復号処理挿入手段(例えば、図1のCPU10に相当)と、前記鍵復元処理の実行により置換された元の鍵をダミーの鍵に置換する鍵偽装処理(例えば、図5の鍵偽装処理56に相当)を、前記保護対象プログラムに挿入する鍵偽装処理挿入手段(例えば、図1のCPU10に相当)と、前記選択手段により選択された命令をダミーの命令に置換する命令偽装手段(例えば、図1のCPU10に相当)と、前記命令偽装手段により置換されたダミーの命令を、前記命令復号処理の実行により復号された元の命令に置換する命令復元処理(例えば、図5の命令復元処理53に相当)を、前記保護対象プログラムに挿入する命令復元処理挿入手段(例えば、図1のCPU10に相当)と、前記命令復元処理の実行により置換された元の命令をダミーの命令に置換する命令偽装処理(例えば、図5の命令偽装処理54に相当)を、前記保護対象プログラムに挿入する命令偽装処理挿入手段(例えば、図1のCPU10に相当)と、を備えることを特徴とする自己書き換え処理装置を提案している。
(1) The present invention provides a storage means for storing a protection target program (for example, equivalent to the
この発明によれば、自己書き換え処理装置に、記憶手段、選択手段、命令暗号化手段、鍵偽装手段、鍵復元処理挿入手段、命令復号処理挿入手段、鍵偽装処理挿入手段、命令偽装手段、命令復元処理挿入手段、および命令偽装処理挿入手段を設けた。そして、記憶手段により、保護対象プログラムを記憶することとした。また、選択手段により、保護対象プログラムに記述されている命令を少なくとも1つ選択することとした。また、命令暗号化手段により、選択手段により選択された命令を、鍵を用いて暗号化することとした。また、鍵偽装手段により、命令暗号化手段により用いられた鍵を、ダミーの鍵に置換することとした。また、鍵復元処理挿入手段により、鍵復元処理を保護対象プログラムに挿入することとした。ここで、鍵復元処理とは、鍵偽装手段により置換されたダミーの鍵を元の鍵に置換する処理のことである。また、命令復号処理挿入手段により、命令復号処理を保護対象プログラムに挿入することとした。ここで、命令復号処理とは、命令暗号化手段により暗号化された命令を、鍵復元処理の実行により置換された元の鍵を用いて復号する処理のことである。また、鍵偽装処理挿入手段により、鍵偽装処理を保護対象プログラムに挿入することとした。ここで、鍵偽装処理とは、鍵復元処理の実行により置換された元の鍵をダミーの鍵に置換する処理のことである。また、命令偽装手段により、選択手段により選択された命令をダミーの命令に置換することとした。また、命令復元処理挿入手段により、命令復元処理を保護対象プログラムに挿入することとした。ここで、命令復元処理とは、命令偽装手段により置換されたダミーの命令を、命令復号処理の実行により復号された元の命令に置換する処理のことである。また、命令偽装処理挿入手段により、命令偽装処理を保護対象プログラムに挿入することとした。ここで、命令偽装処理とは、命令復元処理の実行により置換された元の命令をダミーの命令に置換する処理のことである。 According to this invention, the self-rewriting processing device includes a storage means, a selection means, an instruction encryption means, a key impersonation means, a key restoration process insertion means, an instruction decryption process insertion means, a key impersonation processing insertion means, an instruction impersonation means, an instruction A restoration processing insertion means and an instruction spoofing processing insertion means are provided. Then, the storage target program is stored by the storage means. Further, at least one instruction described in the protection target program is selected by the selection means. In addition, the instruction encryption means encrypts the instruction selected by the selection means using a key. In addition, the key used by the instruction encryption unit is replaced with a dummy key by the key disguise unit. In addition, the key restoration processing insertion means inserts the key restoration processing into the protection target program. Here, the key restoration process is a process of replacing the dummy key replaced by the key disguising unit with the original key. Further, the instruction decoding process insertion means inserts the instruction decoding process into the protection target program. Here, the instruction decryption process is a process of decrypting the instruction encrypted by the instruction encryption unit using the original key replaced by the execution of the key recovery process. Further, the key impersonation process insertion means inserts the key impersonation process into the protection target program. Here, the key impersonation process is a process of replacing the original key replaced by the execution of the key restoration process with a dummy key. Further, the instruction disguised means replaces the instruction selected by the selecting means with a dummy instruction. Further, the instruction restoration processing insertion means inserts the instruction restoration processing into the protection target program. Here, the instruction restoration process is a process of replacing the dummy instruction replaced by the instruction disguising unit with the original instruction decoded by executing the instruction decoding process. Further, the instruction impersonation process insertion means inserts the instruction impersonation process into the protection target program. Here, the instruction disguise process is a process of replacing the original instruction replaced by the execution of the instruction restoration process with a dummy instruction.
このため、自己書き換え処理装置は、命令偽装手段により、保護対象プログラムに記述されている命令をダミーの命令に置換するとともに、命令暗号化手段により、元の命令を暗号化する。これによれば、ダミーに偽装された命令の元の命令は、暗号化された状態となる。 For this reason, the self-rewrite processing device replaces the instruction described in the protection target program with a dummy instruction by the instruction disguise means, and encrypts the original instruction by the instruction encryption means. According to this, the original instruction of the instruction disguised as a dummy is in an encrypted state.
また、自己書き換え処理装置は、鍵偽装処理により、命令暗号化手段により命令を暗号化する際に用いる鍵を、鍵偽装手段によりダミーの鍵に予め偽装する。 Further, the self-rewriting processing apparatus pre-disguises the key used when encrypting the instruction by the instruction encrypting means into a dummy key by the key disguising means by the key disguise process.
以上によれば、自己書き換え処理装置は、ダミーに偽装した命令の元の命令を暗号化するとともに、暗号化に用いる鍵を偽装するため、保護対象プログラムの解析および改ざんの困難性を向上させることができる。 According to the above, the self-rewriting processing device encrypts the original instruction of the dummy disguised instruction and impersonates the key used for encryption, thereby improving the difficulty of analyzing and falsifying the protection target program Can do.
(2) 本発明は、(1)の自己書き換え処理装置について、前記命令復号処理挿入手段は、前記命令復号処理を、前記保護対象プログラムのうち、前記命令偽装手段により置換されたダミーの命令(例えば、図5のダミーの第1命令セット51Aに相当)より前方に挿入し、前記命令復元処理挿入手段は、前記命令復元処理を、前記保護対象プログラムのうち、前記命令復号処理(例えば、図5の命令復号処理52Aに相当)と、前記命令偽装手段により置換されたダミーの命令(例えば、図5のダミーの第1命令セット51Aに相当)と、の間に挿入し、前記命令偽装処理挿入手段は、前記命令偽装処理を、前記保護対象プログラムのうち、前記命令偽装手段により置換されたダミーの命令(例えば、図5のダミーの第1命令セット51Aに相当)の後方に挿入し、前記鍵復元処理挿入手段は、前記鍵復元処理を、前記保護対象プログラムのうち前記命令復号処理(例えば、図5の命令復号処理52Aに相当)より前方に挿入し、前記鍵偽装処理挿入手段は、前記鍵偽装処理を、前記保護対象プログラムのうち前記命令復号処理(例えば、図5の命令復号処理52Aに相当)より後方に挿入することを特徴とする自己書き換え処理装置を提案している。
(2) The present invention relates to the self-rewriting processing device according to (1), wherein the instruction decoding process inserting means replaces the instruction decoding process with a dummy instruction (replaced by the instruction impersonating means in the protection target program). For example, the instruction restoration processing insertion means inserts the instruction restoration processing into the instruction decoding processing (for example, FIG. 5) of the protection target program. 5 and the dummy instruction replaced by the instruction disguising means (for example, equivalent to the dummy first instruction set 51A of FIG. 5), and the instruction disguising process The inserting unit replaces the instruction impersonation process with a dummy instruction (for example, the dummy first instruction set 51 of FIG. 5) replaced by the instruction impersonating unit in the protection target program. The key restoration processing inserting means inserts the key restoration processing ahead of the instruction decoding processing (for example, equivalent to the
この発明によれば、(1)の自己書き換え処理装置において、命令復号処理挿入手段は、命令復号処理を、保護対象プログラムのうち、命令偽装手段により置換されたダミーの命令より前方に挿入することとした。また、命令復元処理挿入手段は、命令復元処理を、保護対象プログラムのうち、命令復号処理と、命令偽装手段により置換されたダミーの命令と、の間に挿入することとした。また、命令偽装処理挿入手段は、命令偽装処理を、保護対象プログラムのうち、命令偽装手段により置換されたダミーの命令の後方に挿入することとした。また、鍵復元処理挿入手段は、鍵復元処理を、保護対象プログラムのうち命令復号処理より前方に挿入することとした。また、鍵偽装処理挿入手段は、鍵偽装処理を、保護対象プログラムのうち命令復号処理より後方に挿入することとした。 According to the present invention, in the self-rewriting processing device of (1), the instruction decoding process inserting means inserts the instruction decoding process ahead of the dummy instruction replaced by the instruction disguise means in the protection target program. It was. Further, the instruction restoration processing insertion means inserts the instruction restoration processing between the instruction decoding process and the dummy instruction replaced by the instruction disguise means in the protection target program. Further, the instruction impersonation process insertion means inserts the instruction impersonation process behind the dummy instruction replaced by the instruction impersonation means in the protection target program. Further, the key restoration processing insertion means inserts the key restoration processing ahead of the instruction decryption processing in the protection target program. Further, the key impersonation process insertion means inserts the key impersonation process behind the instruction decryption process in the protection target program.
このため、自己書き換え処理装置により上述の各処理が行われた後の保護対象プログラムを実行すると、まず、鍵復元処理が実行され、偽装されていた鍵が元に戻ることになる。次に、命令復号処理が実行され、元に戻った鍵を用いて命令が復号されることになる。次に、鍵偽装処理が実行され、復号に用いた鍵が再度偽装されるとともに、命令復元処理が実行され、偽装されていた命令が復号した命令に戻ることになる。次に、この命令が実行された後に、命令偽装処理が実行され、この命令が再度偽装されることになる。これによれば、上述した効果と同様の効果を奏することができる。 For this reason, when the protection target program after the above-described processing is performed by the self-rewriting processing device is executed, first, the key restoration processing is executed, and the forged key is restored. Next, an instruction decryption process is executed, and the instruction is decrypted using the restored key. Next, the key impersonation process is executed, the key used for decryption is impersonated again, and the instruction restoration process is executed, so that the instruction that has been impersonated returns to the decrypted instruction. Next, after this instruction is executed, an instruction impersonation process is executed, and this instruction is impersonated again. According to this, an effect similar to the effect mentioned above can be produced.
(3) 本発明は、(1)または(2)の自己書き換え処理装置について、前記選択手段による選択と、前記命令暗号化手段よる暗号化と、前記鍵偽装手段による置換と、前記鍵復元処理挿入手段による挿入と、前記命令復号処理挿入手段による挿入と、前記鍵偽装処理挿入手段による挿入と、前記命令偽装手段による置換と、前記命令復元処理挿入手段による挿入と、前記命令偽装処理挿入手段による挿入と、を予め定められた回数(例えば、図2および図3の反復回数Nに相当)だけ繰り返すことを特徴とする自己書き換え処理装置を提案している。 (3) The present invention relates to the self-rewriting processing device of (1) or (2), selection by the selection means, encryption by the instruction encryption means, replacement by the key impersonation means, and the key restoration processing. Insertion by insertion means, insertion by the instruction decryption processing insertion means, insertion by the key impersonation processing insertion means, replacement by the instruction impersonation means, insertion by the instruction restoration processing insertion means, and instruction impersonation processing insertion means The self-rewrite processing device is characterized by repeating the insertion by the predetermined number of times (for example, corresponding to the number of repetitions N in FIGS. 2 and 3).
この発明によれば、選択手段による選択と、命令暗号化手段よる暗号化と、鍵偽装手段による置換と、鍵復元処理挿入手段による挿入と、命令復号処理挿入手段による挿入と、鍵偽装処理挿入手段による挿入と、命令偽装手段による置換と、命令復元処理挿入手段による挿入と、命令偽装処理挿入手段による挿入と、を予め定められた回数だけ繰り返すこととした。 According to the present invention, selection by the selection means, encryption by the instruction encryption means, replacement by the key impersonation means, insertion by the key restoration processing insertion means, insertion by the instruction decryption processing insertion means, and key impersonation processing insertion The insertion by the means, the replacement by the instruction impersonation means, the insertion by the instruction restoration processing insertion means, and the insertion by the instruction impersonation processing insertion means are repeated a predetermined number of times.
このため、上述の予め定められた回数として、1以上の値を設定することで、ダミーに偽装した命令の元の命令の暗号化と、暗号化に用いる鍵の偽装と、を複数回行うことができ、保護対象プログラムの解析および改ざんの困難性をさらに向上させることができる。 For this reason, by setting a value of 1 or more as the above-mentioned predetermined number of times, encryption of the original instruction of the dummy disguised instruction and disguise of the key used for encryption are performed a plurality of times. It is possible to further improve the difficulty of analyzing and falsifying the program to be protected.
(4) 本発明は、選択手段(例えば、図1のCPU10に相当)、命令暗号化手段(例えば、図1のCPU10に相当)、鍵偽装手段(例えば、図1のCPU10に相当)、鍵復元処理挿入手段(例えば、図1のCPU10に相当)、命令復号処理挿入手段(例えば、図1のCPU10に相当)、鍵偽装処理挿入手段(例えば、図1のCPU10に相当)、命令偽装手段(例えば、図1のCPU10に相当)、命令復元処理挿入手段(例えば、図1のCPU10に相当)、および命令偽装処理挿入手段(例えば、図1のCPU10に相当)を備える自己書き換え処理装置における自己書き換え処理方法であって、前記選択手段が、保護対象プログラムに記述されている命令を少なくとも1つ選択する第1ステップ(例えば、図2のステップS6および図3のステップS22に相当)と、前記命令暗号化手段が、前記第1ステップにおいて選択した命令を、鍵を用いて暗号化する第2ステップ(例えば、図3のステップS23に相当)と、前記鍵偽装手段が、前記第2ステップにおいて用いた鍵を、ダミーの鍵に置換する第3ステップ(例えば、図3のステップS30に相当)と、前記鍵復元処理挿入手段が、前記第3ステップにおいて置換したダミーの鍵を元の鍵に置換する鍵復元処理(例えば、図5の鍵復元処理55に相当)を、前記保護対象プログラムに挿入する第4ステップ(例えば、図3のステップS31に相当)と、前記命令復号処理挿入手段が、前記第2ステップにおいて暗号化した命令を、前記鍵復元処理の実行により置換された元の鍵を用いて復号する命令復号処理(例えば、図5の命令復号処理52Aに相当)を、前記保護対象プログラムに挿入する第5ステップ(例えば、図2のステップS7および図3のステップS26に相当)と、前記鍵偽装処理挿入手段が、前記鍵復元処理の実行により置換された元の鍵をダミーの鍵に置換する鍵偽装処理(例えば、図5の鍵偽装処理56に相当)を、前記保護対象プログラムに挿入する第6ステップ(例えば、図3のステップS32に相当)と、前記命令偽装手段が、前記第1ステップにおいて選択した命令をダミーの命令に置換する第7ステップ(例えば、図3のステップS25に相当)と、前記命令復元処理挿入手段が、前記第7ステップにおいて置換したダミーの命令を、前記命令復号処理の実行により復号された元の命令に置換する命令復元処理(例えば、図5の命令復元処理53に相当)を、前記保護対象プログラムに挿入する第8ステップ(例えば、図3のステップS27に相当)と、前記命令偽装処理挿入手段が、前記命令復元処理の実行により置換された元の命令をダミーの命令に置換する命令偽装処理(例えば、図5の命令偽装処理54に相当)を、前記保護対象プログラムに挿入する第9ステップ(例えば、図3のステップS28に相当)と、を備えることを特徴とする自己書き換え処理方法を提案している。
(4) The present invention includes selection means (for example, equivalent to the
この発明によれば、保護対象プログラムに記述されている命令を少なくとも1つ選択する。そして、選択した命令を鍵を用いて暗号化し、この鍵をダミーの鍵に置換する。そして、ダミーの鍵を元の鍵に置換する鍵復元処理と、暗号化した命令を鍵復元処理の実行により置換された元の鍵を用いて復号する命令復号処理と、鍵復元処理の実行により置換された元の鍵をダミーの鍵に置換する鍵偽装処理と、を保護対象プログラムに挿入する。また、上述の選択した命令をダミーの命令に置換し、ダミーの命令を命令復号処理の実行により復号された元の命令に置換する命令復元処理と、命令復元処理の実行により置換された元の命令をダミーの命令に置換する命令偽装処理と、を保護対象プログラムに挿入する。以上によれば、上述した効果と同様の効果を奏することができる。 According to the present invention, at least one instruction described in the protection target program is selected. Then, the selected instruction is encrypted using a key, and this key is replaced with a dummy key. Then, a key restoration process that replaces the dummy key with the original key, an instruction decryption process that decrypts the encrypted instruction using the original key replaced by the execution of the key restoration process, and an execution of the key restoration process A key impersonation process for replacing the replaced original key with a dummy key is inserted into the protection target program. Further, the instruction selected above is replaced with a dummy instruction, the instruction restoration process for replacing the dummy instruction with the original instruction decoded by execution of the instruction decoding process, and the original instruction replaced by execution of the instruction restoration process Instruction impersonation processing for replacing an instruction with a dummy instruction is inserted into the protection target program. According to the above, an effect similar to the effect described above can be achieved.
(5) 本発明は、保護対象プログラムに記述されている命令を少なくとも1つ選択する第1ステップ(例えば、図2のステップS6および図3のステップS22に相当)と、前記第1ステップにおいて選択した命令を、鍵を用いて暗号化する第2ステップ(例えば、図3のステップS23に相当)と、前記第2ステップにおいて用いた鍵を、ダミーの鍵に置換する第3ステップ(例えば、図3のステップS30に相当)と、前記第3ステップにおいて置換したダミーの鍵を元の鍵に置換する鍵復元処理(例えば、図5の鍵復元処理55に相当)を、前記保護対象プログラムに挿入する第4ステップ(例えば、図3のステップS31に相当)と、前記第2ステップにおいて暗号化した命令を、前記鍵復元処理の実行により置換された元の鍵を用いて復号する命令復号処理(例えば、図5の命令復号処理52Aに相当)を、前記保護対象プログラムに挿入する第5ステップ(例えば、図2のステップS7および図3のステップS26に相当)と、前記鍵復元処理の実行により置換された元の鍵をダミーの鍵に置換する鍵偽装処理(例えば、図5の鍵偽装処理56に相当)を、前記保護対象プログラムに挿入する第6ステップ(例えば、図3のステップS32に相当)と、前記第1ステップにおいて選択した命令をダミーの命令に置換する第7ステップ(例えば、図3のステップS25に相当)と、前記第7ステップにおいて置換したダミーの命令を、前記命令復号処理の実行により復号された元の命令に置換する命令復元処理(例えば、図5の命令復元処理53に相当)を、前記保護対象プログラムに挿入する第8ステップ(例えば、図3のステップS27に相当)と、前記命令復元処理の実行により置換された元の命令をダミーの命令に置換する命令偽装処理(例えば、図5の命令偽装処理54に相当)を、前記保護対象プログラムに挿入する第9ステップ(例えば、図3のステップS28に相当)と、コンピュータに実行させるためのプログラムを提案している。
(5) The present invention selects a first step (for example, corresponding to step S6 in FIG. 2 and step S22 in FIG. 3) for selecting at least one instruction described in the protection target program, and selection in the first step. A second step (for example, corresponding to step S23 in FIG. 3) of encrypting the instruction using a key, and a third step (for example, FIG. 3) replacing the key used in the second step with a dummy key. 3) and a key restoration process (for example, equivalent to the
この発明によれば、プログラムをコンピュータに実行させることで、保護対象プログラムに記述されている命令を少なくとも1つ選択する。そして、選択した命令を鍵を用いて暗号化し、この鍵をダミーの鍵に置換する。そして、ダミーの鍵を元の鍵に置換する鍵復元処理と、暗号化した命令を鍵復元処理の実行により置換された元の鍵を用いて復号する命令復号処理と、鍵復元処理の実行により置換された元の鍵をダミーの鍵に置換する鍵偽装処理と、を保護対象プログラムに挿入する。また、上述の選択した命令をダミーの命令に置換し、ダミーの命令を命令復号処理の実行により復号された元の命令に置換する命令復元処理と、命令復元処理の実行により置換された元の命令をダミーの命令に置換する命令偽装処理と、を保護対象プログラムに挿入する。以上によれば、上述した効果と同様の効果を奏することができる。 According to the present invention, at least one instruction described in the protection target program is selected by causing the computer to execute the program. Then, the selected instruction is encrypted using a key, and this key is replaced with a dummy key. Then, a key restoration process that replaces the dummy key with the original key, an instruction decryption process that decrypts the encrypted instruction using the original key replaced by the execution of the key restoration process, and an execution of the key restoration process A key impersonation process for replacing the replaced original key with a dummy key is inserted into the protection target program. Further, the instruction selected above is replaced with a dummy instruction, the instruction restoration process for replacing the dummy instruction with the original instruction decoded by execution of the instruction decoding process, and the original instruction replaced by execution of the instruction restoration process Instruction impersonation processing for replacing an instruction with a dummy instruction is inserted into the protection target program. According to the above, an effect similar to the effect described above can be achieved.
本発明によれば、ダミーに偽装した命令の元の命令を暗号化するとともに、暗号化に用いる鍵を偽装するため、保護対象プログラムの解析および改ざんの困難性を向上させることができる。 According to the present invention, since the original instruction of the dummy disguised instruction is encrypted and the key used for encryption is disguised, it is possible to improve the difficulty of analyzing and falsifying the protection target program.
以下、本発明の実施形態について図面を参照しながら説明する。なお、以下の実施形態における構成要素は適宜、既存の構成要素などとの置き換えが可能であり、また、他の既存の構成要素との組合せを含む様々なバリエーションが可能である。したがって、以下の実施形態の記載をもって、特許請求の範囲に記載された発明の内容を限定するものではない。 Hereinafter, embodiments of the present invention will be described with reference to the drawings. Note that the constituent elements in the following embodiments can be appropriately replaced with existing constituent elements, and various variations including combinations with other existing constituent elements are possible. Accordingly, the description of the following embodiments does not limit the contents of the invention described in the claims.
[自己書き換え処理装置1の構成]
図1は、本発明の一実施形態に係る自己書き換え処理装置1の構成を示すブロック図である。自己書き換え処理装置1は、様々な演算処理を行うCPU(Central Processing Unit)10と、保護対象プログラムを記憶するキャッシュ20と、を備える。
[Configuration of Self-Rewriting Processing Device 1]
FIG. 1 is a block diagram showing a configuration of a self-rewriting
自己書き換え処理装置1は、後述の第1の処理(図2参照)を実行した後、後述の第2の処理(図3参照)を実行することにより、保護対象プログラムの解析および改ざんの困難性を向上させる。
The self-
[第1の処理]
図2は、上述の第1の処理のフローチャートである。
[First processing]
FIG. 2 is a flowchart of the first process described above.
ステップS1において、自己書き換え処理装置1は、CPU10により、暗号化するビットサイズL(Lは、L>0を満たす整数)を設定し、ステップS2に処理を移す。具体的には、暗号化する命令の数と、1命令当たりのビット数と、を乗算してビットサイズLとする。例えば、1つの命令が32ビットである環境において、4つの命令を暗号化する場合には、ビットサイズLは、128ビットとなる。なお、暗号化する命令の数は、例えば自己書き換え処理装置1のユーザにより決定される。
In step S1, the
ステップS2において、自己書き換え処理装置1は、CPU10により、反復回数N(Nは、N≧0を満たす整数)を設定し、ステップS3に処理を移す。
In step S2, the self-
ステップS3において、自己書き換え処理装置1は、CPU10により、変数Pに「0」を代入することで変数Pを初期化し、ステップS4に処理を移す。
In step S3, the self-
ステップS4において、自己書き換え処理装置1は、CPU10により、暗号化した命令を格納するためのデータ領域をキャッシュ20に確保し、ステップS5に処理を移す。なお、命令の暗号化は、後述の図3のステップS23において行われるため、暗号化した命令は、ステップS4が実行された段階では存在していない。このため、ステップS4を実行した段階では、暗号化した命令を格納するためにキャッシュ20に確保したデータ領域には、nullが格納される。
In step S4, the self-
ステップS5において、自己書き換え処理装置1は、CPU10により、命令を暗号化する際に用いる鍵を生成し、この鍵を格納するためのデータ領域をキャッシュ20に確保し、上述の生成した鍵を上述の確保したデータ領域に格納し、ステップS6に処理を移す。鍵の生成には、暗号鍵生成用疑似乱数を用いる。暗号鍵生成用疑似乱数は、CPU10で生成してもよいし、CPU10とは別に、乱数を生成する乱数生成器と、乱数生成器で生成された乱数をサンプリングするサンプリング部と、を設け、これら乱数生成器およびサンプリング部で生成してもよい。
In step S5, the self-
ステップS6において、自己書き換え処理装置1は、CPU10により、キャッシュ20に記憶されている保護対象プログラムのうち、保護する領域を選択し、ステップS7に処理を移す。なお、保護する領域は、例えば自己書き換え処理装置1のユーザにより、保護対象プログラムの中から決定されるものとする。また、キャッシュ20に記憶されている保護対象プログラムとは、C言語やJava(登録商標)といった高級言語で記述されているものとする。
In step S6, the self-rewriting
ステップS7において、自己書き換え処理装置1は、CPU10により、命令復号処理を、ステップS6の処理を行った保護対象プログラムに挿入し、ステップS8に処理を移す。なお、命令復号処理とは、暗号化した命令を復号する処理のことである。この命令復号処理は、ステップS6の処理が行われた保護対象プログラムのうち、ステップS6において選択された領域の前方に、挿入される。なお、保護対象プログラムに記述されているどの命令を暗号化するのかは、後述の図3のステップS22において定まるため、ステップS7が実行された段階では分からない。このため、ステップS7を実行した段階では、命令復号処理には仮引数が割り当てられる。
In step S7, the self-
ステップS8において、自己書き換え処理装置1は、CPU10により、変数Pに1を加算し、ステップS9に処理を移す。
In step S8, the self-rewriting
ステップS9において、自己書き換え処理装置1は、CPU10により、変数Pが反復回数N以下であるか否かを判別する。そして、変数Pが反復回数N以下である場合には、すなわち上述のステップS7、S8の各処理を行った回数が反復回数N以下である場合には、ステップS7に処理を戻す。一方、変数Pが反復回数Nより大きい場合には、すなわち上述のステップS7、S8の各処理を行った回数が反復回数Nより多い場合には、ステップS10に処理を移す。
In step S <b> 9, the self-
ステップS10において、自己書き換え処理装置1は、CPU10により、ステップS7の処理を行った保護対象プログラムについて、アセンブラ記述を取得し、第1の処理を終了する。具体的には、ステップS7の処理を行った保護対象プログラムについて、コンパイルして、アセンブリプログラムに変換する。
In step S10, the self-
[第2の処理]
図3は、上述の第2の処理のフローチャートである。
[Second processing]
FIG. 3 is a flowchart of the second process described above.
ステップS21において、自己書き換え処理装置1は、CPU10により、変数Qに「0」を代入することで変数Qを初期化し、ステップS22に処理を移す。
In step S21, the self-
ステップS22において、自己書き換え処理装置1は、CPU10により、ステップS10において取得したアセンブラ記述の保護対象プログラムのうち、ステップS6において選択した保護する領域に対応する領域から、第1命令セットを選択し、ステップS23に処理を移す。なお、第1命令セットとは、暗号化する命令の集合のことであり、ステップS1において設定したビットサイズLに応じた数の命令で構成されるもののことである。例えば、1つの命令が32ビットである環境において、ビットサイズLとして128ビットを設定した場合には、第1命令セットは、4つの命令で構成されることとなる。
In step S22, the self-
ステップS23において、自己書き換え処理装置1は、CPU10により、ステップS5において生成した鍵を用いて第1命令セットを暗号化し、ステップS24に処理を移す。
In step S23, the self-
ステップS24において、自己書き換え処理装置1は、CPU10により、ステップS23において暗号化した第1命令セットを、ステップS4において確保したデータ領域に格納し、ステップS25に処理を移す。
In step S24, the self-
ステップS25において、自己書き換え処理装置1は、CPU10により、第1命令セットをダミーの第1命令セットに置換し、ステップS26に処理を移す。これによれば、第1命令セットが偽装されることとなる。
In step S25, the
ステップS26において、自己書き換え処理装置1は、CPU10により、ステップS7において挿入した命令復号処理の引数に、ステップS22において選択した第1命令セットのアドレスと、ステップS24において格納した第1命令セットのアドレスと、を代入し、ステップS27に処理を移す。これによれば、鍵を用意した上で命令復号処理を実行すると、ステップS23において暗号化した第1命令セットが、復号されることとなる。
In step S26, the self-
ステップS27において、自己書き換え処理装置1は、CPU10により、命令復元処理を、ステップS26の処理を行った保護対象プログラムに挿入し、ステップS28に処理を移す。なお、命令復元処理とは、ダミーの第1命令セットを元の第1命令セットに置換する処理のことである。この命令復元処理は、ステップS26の処理が行われた保護対象プログラムのうち、ステップS26において引数を代入された命令復号処理と、ステップS25において置換されたダミーの第1命令セットと、の間に挿入される。これによれば、命令復号処理、命令復元処理の順に実行された後、第1命令セットが実行されることとなる。
In step S27, the self-
なお、上述のように、第1命令セットは、ステップS23において暗号化される。このため、仮に、命令復号処理が実行されることなく、命令復元処理が実行された場合には、元の第1命令セットが暗号化された状態のまま、命令復元処理が実行されることになるので、ダミーの第1命令セットを元の第1命令セットに正しく置換することができなくなる。ところが、本実施形態では、命令復号処理が実行された後に、命令復元処理が実行されるので、ダミーの第1命令セットを元の第1命令セットに正しく置換することができる。 As described above, the first instruction set is encrypted in step S23. For this reason, if the instruction restoration process is executed without executing the instruction decryption process, the instruction restoration process is executed while the original first instruction set is encrypted. Therefore, the dummy first instruction set cannot be correctly replaced with the original first instruction set. However, in this embodiment, since the instruction restoration process is executed after the instruction decoding process is executed, the dummy first instruction set can be correctly replaced with the original first instruction set.
ステップS28において、自己書き換え処理装置1は、CPU10により、命令偽装処理を、ステップS27の処理を行った保護対象プログラムに挿入し、ステップS29に処理を移す。なお、命令偽装処理とは、元の第1命令セットをダミーの第1命令セットに置換する処理のことである。この命令偽装処理は、ステップS27の処理が行われた保護対象プログラムのうち、ステップS25において置換されたダミーの第1命令セットの後方に、挿入される。これによれば、第1命令セットが実行された後に、命令偽装処理が実行されることとなる。このため、第1命令セットが実行された後に、この第1命令セットは、再度偽装されることとなる。
In step S28, the self-
ステップS29において、自己書き換え処理装置1は、CPU10により、ステップS23において用いた鍵にあたる命令セットを、第2命令セットとして選択し、ステップS30に処理を移す。
In step S29, the self-
ステップS30において、自己書き換え処理装置1は、CPU10により、第2命令セットをダミーの第2命令セットに置換し、ステップS31に処理を移す。これによれば、第2命令セットが偽装されることとなる。
In step S30, the self-
ステップS31において、自己書き換え処理装置1は、CPU10により、鍵復元処理を、ステップS30の処理を行った保護対象プログラムに挿入し、ステップS32に処理を移す。なお、鍵復元処理とは、ダミーの第2命令セットを元の第2命令セットに置換する処理のことである。この鍵復元処理は、ステップS30の処理が行われた保護対象プログラムのうち、ステップS26において引数を代入された命令復号処理の前方に、挿入される。これによれば、鍵復元処理が実行された後に、命令復号処理が実行されることとなる。このため、命令復号処理が実行される時点では、偽装されていた鍵が元に戻された状態となる。
In step S31, the self-
ステップS32において、自己書き換え処理装置1は、CPU10により、鍵偽装処理を、ステップS31の処理を行った保護対象プログラムに挿入し、ステップS33に処理を移す。なお、鍵偽装処理とは、元の第2命令セットをダミーの第2命令セットに置換する処理のことである。この鍵偽装処理は、ステップS31の処理が行われた保護対象プログラムのうち、ステップS26において引数を代入された命令復号処理の後方に、挿入される。これによれば、命令復号処理が実行された後に、鍵偽装処理が実行されることとなる。このため、命令復号処理において鍵が用いられた後に、この鍵は、再度偽装されることとなる。
In step S32, the self-
ステップS33において、自己書き換え処理装置1は、CPU10により、変数Qに1を加算し、ステップS34に処理を移す。
In step S33, the self-
ステップS34において、自己書き換え処理装置1は、CPU10により、変数Qが反復回数N以下であるか否かを判別する。そして、変数Qが反復回数N以下である場合には、すなわち上述のステップS22〜S33の各処理を行った回数が反復回数N以下である場合には、ステップS22に処理を戻す。一方、変数Qが反復回数Nより大きい場合には、すなわち上述のステップS22〜S33の各処理を行った回数が反復回数Nより多い場合には、第2の処理を終了する。
In step S <b> 34, the self-
[第1の処理および第2の処理を行った後の保護対象プログラム]
まず、反復回数Nを「1」として、上述の第1の処理および上述の第2の処理を行った場合について、図4および図5を用いて以下に説明する。
[Protected program after the first process and the second process]
First, the case where the number of iterations N is “1” and the above-described first process and the above-described second process are performed will be described below with reference to FIGS. 4 and 5.
図4は、反復回数Nを「1」として上述の第1の処理を行った場合の、保護対象プログラム50を示す図である。
FIG. 4 is a diagram showing the
まず、ステップS1〜S4の各処理が行われた後に、ステップS5の処理が行われ、暗号化に用いる鍵が生成され、キャッシュ20に確保されたデータ領域に格納される。このため、暗号化に用いる鍵は、保護対象プログラム50には記述されない。
First, after each process of steps S1 to S4 is performed, a process of step S5 is performed, and a key used for encryption is generated and stored in a data area secured in the
次に、ステップS6の処理が行われ、保護する領域が選択される。なお、選択された領域には、保護したい命令の集合である命令セットが記述されていることとなる。 Next, the process of step S6 is performed and the area to be protected is selected. In the selected area, an instruction set that is a set of instructions to be protected is described.
次に、ステップS7の処理が行われ、ステップS6において選択された領域の前方に、すなわち保護したい命令セットの前方に、命令復号処理が挿入される。なお、ステップS7において命令復号処理が挿入された時点では、上述のステップS26の処理が行われていないので、命令復号処理には仮引数が割り当てられている。 Next, the process of step S7 is performed, and the instruction decoding process is inserted in front of the area selected in step S6, that is, in front of the instruction set to be protected. Note that when the instruction decoding process is inserted in step S7, the above-described process of step S26 is not performed, and therefore a temporary argument is assigned to the instruction decoding process.
次に、ステップS8、S9の各処理が行われた後に、ステップS10の処理が行われ、ステップS7の処理が行われた保護対象プログラムのアセンブラ記述が取得される。これによれば、上述の保護したい命令セットが、アセンブラで記述された保護したい命令セット51に変換されるとともに、上述の命令復号処理が、アセンブラで記述された命令復号処理52に変換されることとなる。
Next, after the processes of steps S8 and S9 are performed, the process of step S10 is performed, and the assembler description of the protection target program subjected to the process of step S7 is acquired. According to this, the instruction set to be protected is converted into the
図5は、保護対象プログラム50Aを示す図である。保護対象プログラム50Aは、図4に示した保護対象プログラム50に対して、反復回数Nを「1」として上述の第2の処理を行ったものである。
FIG. 5 is a diagram showing the
まず、ステップS21の処理が行われた後に、ステップS22の処理が行われ、第1命令セットが選択される。ここでは、第1命令セットとして、図4に示した保護したい命令セット51が選択されたものとする。
First, after the process of step S21 is performed, the process of step S22 is performed and the first instruction set is selected. Here, it is assumed that the
次に、ステップS23の処理が行われ、第1命令セットとしての保護したい命令セット51が暗号化される。暗号化された第1命令セットは、ステップS24において、ステップS4において確保されたデータ領域に格納されるため、保護対象プログラム50Aには記述されない。
Next, the process of step S23 is performed, and the
次に、ステップS25の処理が行われ、第1命令セットとしての保護したい命令セット51が、ダミーの第1命令セット51Aに置換され、偽装される。
Next, the process of step S25 is performed, and the
次に、ステップS26の処理が行われ、図4に示した命令復号処理52の仮引数が上述の各アドレスに置き換えられる。ここでは、図4に示した命令復号処理52に対してステップS26の処理を行ったものを、命令復号処理52Aとする。
Next, the process of step S26 is performed, and the dummy argument of the
次に、ステップS27の処理が行われ、命令復号処理52Aとダミーの第1命令セット51Aとの間に、命令復元処理53が挿入される。
Next, the process of step S27 is performed, and the
次に、ステップS28の処理が行われ、ダミーの第1命令セット51Aの後方に、命令偽装処理54が挿入される。
Next, the process of step S28 is performed, and the
次に、ステップS29の処理が行われた後に、ステップS30の処理が行われ、ステップS23において保護したい命令セット51を暗号化する際に用いられた鍵が、ダミーの鍵に置換され、偽装される。
Next, after the process of step S29 is performed, the process of step S30 is performed, and the key used when encrypting the
次に、ステップS31の処理が行われ、命令復号処理52Aの前方に、鍵復元処理55が挿入される。
Next, the process of step S31 is performed, and the
次に、ステップS32の処理が行われ、命令復号処理52Aの後方に、鍵偽装処理56が挿入される。
Next, the process of step S32 is performed, and the
次に、反復回数Nを「2」として、上述の第1の処理および上述の第2の処理を行った場合について、図6〜図8を用いて以下に説明する。 Next, the case where the number of iterations N is “2” and the above-described first process and the above-described second process are performed will be described below with reference to FIGS. 6 to 8.
図6は、反復回数Nを「2」として上述の第1の処理を行った場合の、保護対象プログラム60を示す図である。
FIG. 6 is a diagram showing the
保護対象プログラム60は、図4に示した保護対象プログラム50とは、挿入される命令復号処理の数が異なる。具体的には、保護対象プログラム60には、保護したい命令セット61の前方に、命令復号処理621、622が挿入される。
The
図7は、保護対象プログラム60Aを示す図である。保護対象プログラム60Aは、図6に示した保護対象プログラム60に対して、ステップS21の処理を行った後に、ステップS22〜S33の各処理を1回行ったものである。
FIG. 7 is a diagram showing the
保護対象プログラム60Aにおいては、保護対象プログラム50Aと同様に、ステップS22において、第1命令セットとして保護したい命令セット61が選択され、保護したい命令セット61に関してステップS23〜S33の各処理が行われる。このため、保護対象プログラム60Aには、図5に示した保護対象プログラム50Aの鍵復元処理55、命令復号処理52A、鍵偽装処理56、命令復元処理53、ダミーの第1命令セット51A、および命令偽装処理54のそれぞれに相当するものとして、鍵復元処理65、命令復号処理621A、鍵偽装処理66、命令復元処理63、ダミーの第1命令セット61A、および命令偽装処理64がそれぞれ記述されることとなる。また、保護対象プログラム60Aには、鍵復元処理65の前方に、図6に示した命令復号処理622が記述されることとなる。
In the
図8は、保護対象プログラム60Bを示す図である。保護対象プログラム60Bは、図7に示した保護対象プログラム60Aに対して、ステップS22〜S33の各処理を1回行ったものである。
FIG. 8 is a diagram showing the
まず、ステップS21の処理が行われた後に、ステップS22の処理が行われ、第1命令セットが選択される。ここでは、第1命令セットとして、図7に示した鍵復元処理65が選択されたものとする。
First, after the process of step S21 is performed, the process of step S22 is performed and the first instruction set is selected. Here, it is assumed that the
次に、ステップS23の処理が行われ、第1命令セットとしての鍵復元処理65が暗号化される。暗号化された第1命令セットは、ステップS24において、ステップS4において確保されたデータ領域に格納されるため、保護対象プログラム60Bには記述されない。
Next, the process of step S23 is performed, and the
次に、ステップS25の処理が行われ、第1命令セットとしての鍵復元処理65が、ダミーの第1命令セット65Aに置換され、偽装される。
Next, the process of step S25 is performed, and the
次に、ステップS26の処理が行われ、図7に示した命令復号処理622の仮引数が上述の各アドレスに置き換えられる。ここでは、図7に示した命令復号処理622に対してステップS26の処理を行ったものを、命令復号処理622Aとする。
Next, the process of step S26 is performed, and the dummy argument of the
次に、ステップS27の処理が行われ、命令復号処理622Aとダミーの第1命令セット65Aとの間に、命令復元処理653が挿入される。
Next, the process of step S27 is performed, and the
次に、ステップS28の処理が行われ、ダミーの第1命令セット65Aの後方に、命令偽装処理654が挿入される。
Next, the process of step S28 is performed, and an
次に、ステップS29の処理が行われた後に、ステップS30の処理が行われ、ステップS23において鍵復元処理65を暗号化する際に用いられた鍵が、ダミーの鍵に置換され、偽装される。
Next, after the process of step S29 is performed, the process of step S30 is performed, and the key used when encrypting the
次に、ステップS31の処理が行われ、命令復号処理622Aの前方に、鍵復元処理655が挿入される。
Next, the process of step S31 is performed, and the
次に、ステップS32の処理が行われ、命令復号処理622Aの後方に、鍵偽装処理656が挿入される。
Next, the process of step S32 is performed, and the
以上の自己書き換え処理装置1によれば、以下の効果を奏することができる。
According to the self-rewriting
自己書き換え処理装置1は、ステップS25の処理を行って、保護対象プログラムに記述されている命令をダミーの命令に置換するとともに、ステップS23の処理を行って、元の命令を暗号化する。これによれば、ダミーに偽装された命令の元の命令は、暗号化された状態となる。
The self-rewriting
また、自己書き換え処理装置1は、ステップS30の処理を行って、ステップS23において命令を暗号化する際に用いる鍵を、ダミーの鍵に予め偽装する。
Further, the self-rewriting
以上によれば、自己書き換え処理装置1は、ダミーに偽装した命令の元の命令を暗号化するとともに、暗号化に用いる鍵を偽装するため、保護対象プログラムの解析および改ざんの困難性を向上させることができる。
According to the above, since the self-
また、自己書き換え処理装置1は、ステップS2において設定した反復回数Nだけ、ステップS7、S8の処理と、ステップS22〜S33の処理と、を繰り返す。このため、保護対象プログラムに記述されている命令の偽装と、この命令の暗号化と、暗号化に用いた鍵の偽装と、を複数回行うことができるので、保護対象プログラムの解析および改ざんの困難性をさらに向上させることができる。
Further, the self-rewriting
以上、この発明の実施形態につき、図面を参照して詳述してきたが、具体的な構成はこの実施形態に限られるものではなく、この発明の要旨を逸脱しない範囲の設計等も含まれる。 The embodiments of the present invention have been described in detail with reference to the drawings. However, the specific configuration is not limited to the embodiments, and includes designs and the like that do not depart from the gist of the present invention.
例えば、上述の実施形態では、ステップS5において鍵を生成したが、これに限らず、例えば自己書き換え処理装置1とは異なる装置により予め生成してもよい。
For example, in the above-described embodiment, the key is generated in step S5. However, the present invention is not limited to this. For example, the key may be generated in advance by a device different from the self-rewriting
また、上述の実施形態では、ステップS28において命令偽装処理を挿入することとした。このため、命令偽装処理を実行すると、元の命令がダミーの命令に置換される。ここで、命令偽装処理の実行により置換されるダミーの命令は、ステップS25において置換したダミーの命令と同一であってもよいし、異なっていてもよい。また、命令を暗号化する際に用いた鍵についても、ステップS32において挿入した鍵偽装処理の実行により置換されるダミーの鍵は、ステップS30において置換したダミーの鍵と同一であってもよいし、異なっていてもよい。 In the above-described embodiment, the instruction impersonation process is inserted in step S28. For this reason, when the instruction disguise process is executed, the original instruction is replaced with a dummy instruction. Here, the dummy instruction replaced by the execution of the instruction impersonation process may be the same as or different from the dummy instruction replaced in step S25. Also, with respect to the key used when encrypting the instruction, the dummy key replaced by executing the key impersonation process inserted in step S32 may be the same as the dummy key replaced in step S30. , May be different.
また、上述の実施形態では、ステップS27において命令復元処理を挿入した後に、ステップS28において命令偽装処理を挿入することとしたが、これに限らず、命令偽装処理を挿入した後に命令復元処理を挿入することとしてもよい。また、鍵復元処理および鍵偽装処理についても、鍵偽装処理を挿入した後に鍵復元処理を挿入することとしてもよい。 In the above-described embodiment, after the instruction restoration process is inserted in step S27, the instruction impersonation process is inserted in step S28. However, the present invention is not limited to this, and the instruction restoration process is inserted after the instruction impersonation process is inserted. It is good to do. Also, with regard to the key restoration process and the key impersonation process, the key restoration process may be inserted after the key impersonation process is inserted.
また、上述の実施形態では、ステップS2において反復回数Nを設定することとした。ここで、反復回数Nを大きくするに従って、保護対象プログラムの解析および改ざんの困難性を向上させることができるが、その一方で、自己書き換え処理装置1で処理された保護対象プログラムを実行する際のパフォーマンスが低下する。このため、反復回数Nは、保護対象プログラムの解析および改ざんの困難性の度合いと、自己書き換え処理装置1で処理された保護対象プログラムを実行する際のパフォーマンスと、を勘案して決定されることが好ましい。
In the above-described embodiment, the number of iterations N is set in step S2. Here, as the number of iterations N is increased, it is possible to improve the difficulty of analyzing and falsifying the protection target program. On the other hand, when executing the protection target program processed by the self-
1・・・自己書き換え処理装置
10・・・CPU
20・・・キャッシュ
50、50A、60、60A、60B・・・保護対象プログラム
DESCRIPTION OF
20 ...
Claims (5)
前記保護対象プログラムに記述されている命令を少なくとも1つ選択する選択手段と、
前記選択手段により選択された命令を、鍵を用いて暗号化する命令暗号化手段と、
前記命令暗号化手段により用いられた鍵を、ダミーの鍵に置換する鍵偽装手段と、
前記鍵偽装手段により置換されたダミーの鍵を元の鍵に置換する鍵復元処理を、前記保護対象プログラムに挿入する鍵復元処理挿入手段と、
前記命令暗号化手段により暗号化された命令を、前記鍵復元処理の実行により置換された元の鍵を用いて復号する命令復号処理を、前記保護対象プログラムに挿入する命令復号処理挿入手段と、
前記鍵復元処理の実行により置換された元の鍵をダミーの鍵に置換する鍵偽装処理を、前記保護対象プログラムに挿入する鍵偽装処理挿入手段と、
前記選択手段により選択された命令をダミーの命令に置換する命令偽装手段と、
前記命令偽装手段により置換されたダミーの命令を、前記命令復号処理の実行により復号された元の命令に置換する命令復元処理を、前記保護対象プログラムに挿入する命令復元処理挿入手段と、
前記命令復元処理の実行により置換された元の命令をダミーの命令に置換する命令偽装処理を、前記保護対象プログラムに挿入する命令偽装処理挿入手段と、を備えることを特徴とする自己書き換え処理装置。 Storage means for storing the protection target program;
Selecting means for selecting at least one instruction described in the protection target program;
An instruction encryption means for encrypting the instruction selected by the selection means using a key;
A key disguise means for replacing the key used by the instruction encryption means with a dummy key;
A key restoration process insertion means for inserting a key restoration process for replacing the dummy key replaced by the key impersonation means with the original key into the protection target program;
Instruction decryption processing insertion means for inserting into the protection target program instruction decryption processing for decrypting the instruction encrypted by the instruction encryption means using the original key replaced by execution of the key recovery processing;
A key impersonation process insertion means for inserting a key impersonation process in which the original key replaced by the execution of the key restoration process is replaced with a dummy key into the protection target program;
Instruction disguise means for replacing the instruction selected by the selection means with a dummy instruction;
Instruction restoration processing insertion means for inserting, into the protection target program, instruction restoration processing for replacing the dummy instruction replaced by the instruction disguise means with the original instruction decoded by execution of the instruction decoding processing;
A self-rewrite processing device comprising: an instruction disguise process insertion means for inserting an instruction disguise process for replacing an original instruction replaced by execution of the instruction restore process with a dummy instruction into the protection target program; .
前記命令復元処理挿入手段は、前記命令復元処理を、前記保護対象プログラムのうち、前記命令復号処理と、前記命令偽装手段により置換されたダミーの命令と、の間に挿入し、
前記命令偽装処理挿入手段は、前記命令偽装処理を、前記保護対象プログラムのうち、前記命令偽装手段により置換されたダミーの命令の後方に挿入し、
前記鍵復元処理挿入手段は、前記鍵復元処理を、前記保護対象プログラムのうち前記命令復号処理より前方に挿入し、
前記鍵偽装処理挿入手段は、前記鍵偽装処理を、前記保護対象プログラムのうち前記命令復号処理より後方に挿入することを特徴とする請求項1に記載の自己書き換え処理装置。 The instruction decoding process insertion means inserts the instruction decoding process ahead of a dummy instruction replaced by the instruction disguise means in the protection target program,
The instruction restoration process insertion means inserts the instruction restoration process between the instruction decoding process and the dummy instruction replaced by the instruction impersonation means in the protection target program,
The instruction impersonation process insertion means inserts the instruction impersonation process behind the dummy instruction replaced by the instruction impersonation means in the protection target program,
The key recovery process insertion means inserts the key recovery process ahead of the instruction decryption process in the protection target program,
The self-rewriting processing device according to claim 1, wherein the key impersonation processing insertion unit inserts the key impersonation processing behind the instruction decryption processing in the protection target program.
前記選択手段が、保護対象プログラムに記述されている命令を少なくとも1つ選択する第1ステップと、
前記命令暗号化手段が、前記第1ステップにおいて選択した命令を、鍵を用いて暗号化する第2ステップと、
前記鍵偽装手段が、前記第2ステップにおいて用いた鍵を、ダミーの鍵に置換する第3ステップと、
前記鍵復元処理挿入手段が、前記第3ステップにおいて置換したダミーの鍵を元の鍵に置換する鍵復元処理を、前記保護対象プログラムに挿入する第4ステップと、
前記命令復号処理挿入手段が、前記第2ステップにおいて暗号化した命令を、前記鍵復元処理の実行により置換された元の鍵を用いて復号する命令復号処理を、前記保護対象プログラムに挿入する第5ステップと、
前記鍵偽装処理挿入手段が、前記鍵復元処理の実行により置換された元の鍵をダミーの鍵に置換する鍵偽装処理を、前記保護対象プログラムに挿入する第6ステップと、
前記命令偽装手段が、前記第1ステップにおいて選択した命令をダミーの命令に置換する第7ステップと、
前記命令復元処理挿入手段が、前記第7ステップにおいて置換したダミーの命令を、前記命令復号処理の実行により復号された元の命令に置換する命令復元処理を、前記保護対象プログラムに挿入する第8ステップと、
前記命令偽装処理挿入手段が、前記命令復元処理の実行により置換された元の命令をダミーの命令に置換する命令偽装処理を、前記保護対象プログラムに挿入する第9ステップと、を備えることを特徴とする自己書き換え処理方法。 Self-rewriting comprising selection means, instruction encryption means, key impersonation means, key restoration processing insertion means, instruction decryption processing insertion means, key impersonation processing insertion means, instruction impersonation means, instruction restoration processing insertion means, and instruction impersonation processing insertion means A self-rewriting processing method in a processing device,
A first step in which the selection means selects at least one instruction described in the protection target program;
A second step in which the instruction encryption means encrypts the instruction selected in the first step using a key;
A third step in which the key disguise means replaces the key used in the second step with a dummy key;
A fourth step in which the key restoration processing inserting means inserts a key restoration processing in which the dummy key replaced in the third step is replaced with the original key into the protection target program;
The instruction decryption process inserting means inserts an instruction decryption process for decrypting the instruction encrypted in the second step using the original key replaced by the execution of the key restoration process into the protection target program. 5 steps,
A sixth step in which the key impersonation process insertion means inserts into the protection target program a key impersonation process that replaces the original key replaced by the execution of the key restoration process with a dummy key;
A seventh step in which the instruction disguise means replaces the instruction selected in the first step with a dummy instruction;
The instruction restoring process inserting means inserts into the protected program an instruction restoring process that replaces the dummy instruction replaced in the seventh step with the original instruction decoded by executing the instruction decoding process. Steps,
The instruction spoofing process inserting means includes a ninth step of inserting into the protection target program an instruction spoofing process that replaces the original instruction replaced by the execution of the instruction restoration process with a dummy instruction. Self-rewriting processing method.
前記第1ステップにおいて選択した命令を、鍵を用いて暗号化する第2ステップと、
前記第2ステップにおいて用いた鍵を、ダミーの鍵に置換する第3ステップと、
前記第3ステップにおいて置換したダミーの鍵を元の鍵に置換する鍵復元処理を、前記保護対象プログラムに挿入する第4ステップと、
前記第2ステップにおいて暗号化した命令を、前記鍵復元処理の実行により置換された元の鍵を用いて復号する命令復号処理を、前記保護対象プログラムに挿入する第5ステップと、
前記鍵復元処理の実行により置換された元の鍵をダミーの鍵に置換する鍵偽装処理を、前記保護対象プログラムに挿入する第6ステップと、
前記第1ステップにおいて選択した命令をダミーの命令に置換する第7ステップと、
前記第7ステップにおいて置換したダミーの命令を、前記命令復号処理の実行により復号された元の命令に置換する命令復元処理を、前記保護対象プログラムに挿入する第8ステップと、
前記命令復元処理の実行により置換された元の命令をダミーの命令に置換する命令偽装処理を、前記保護対象プログラムに挿入する第9ステップと、をコンピュータに実行させるためのプログラム。 A first step of selecting at least one instruction described in the protection target program;
A second step of encrypting the instruction selected in the first step using a key;
A third step of replacing the key used in the second step with a dummy key;
A fourth step of inserting, into the protection target program, a key restoration process for replacing the dummy key replaced in the third step with the original key;
A fifth step of inserting, into the protection target program, an instruction decryption process for decrypting the instruction encrypted in the second step using the original key replaced by the execution of the key recovery process;
A sixth step of inserting, into the protection target program, a key impersonation process for replacing the original key replaced by the execution of the key restoration process with a dummy key;
A seventh step of replacing the instruction selected in the first step with a dummy instruction;
An eighth step of inserting into the protection target program an instruction restoration process that replaces the dummy instruction replaced in the seventh step with the original instruction decoded by executing the instruction decoding process;
A program for causing a computer to execute a ninth step of inserting, into the protection target program, an instruction disguise process for replacing an original instruction replaced by execution of the instruction restoration process with a dummy instruction.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2010092497A JP5477994B2 (en) | 2010-04-13 | 2010-04-13 | Self-rewriting processing device, self-rewriting processing method, and program |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2010092497A JP5477994B2 (en) | 2010-04-13 | 2010-04-13 | Self-rewriting processing device, self-rewriting processing method, and program |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| JP2011221922A JP2011221922A (en) | 2011-11-04 |
| JP5477994B2 true JP5477994B2 (en) | 2014-04-23 |
Family
ID=45038811
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP2010092497A Expired - Fee Related JP5477994B2 (en) | 2010-04-13 | 2010-04-13 | Self-rewriting processing device, self-rewriting processing method, and program |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JP5477994B2 (en) |
Families Citing this family (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP6203028B2 (en) * | 2013-12-13 | 2017-09-27 | Kddi株式会社 | Pseudorandom number generation apparatus and method, and program obfuscation apparatus and method |
Family Cites Families (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP2002132364A (en) * | 2000-10-19 | 2002-05-10 | Yutaka Iizuka | Method for protecting program from internal analysis, computer readable recording medium and program distribution method |
| JP2003280755A (en) * | 2002-03-25 | 2003-10-02 | Nec Corp | Self-restorable program, program forming method and device, information processor and program |
| JP3944069B2 (en) * | 2002-12-06 | 2007-07-11 | 国立大学法人 奈良先端科学技術大学院大学 | Self-rewriting process addition program, self-rewriting process addition device, and self-rewriting process addition method |
| JP2004265194A (en) * | 2003-03-03 | 2004-09-24 | Matsushita Electric Ind Co Ltd | Information processing apparatus and information processing method |
| JP2007164595A (en) * | 2005-12-15 | 2007-06-28 | Toshiba Corp | Function calling method of computer system, computer system and library |
-
2010
- 2010-04-13 JP JP2010092497A patent/JP5477994B2/en not_active Expired - Fee Related
Also Published As
| Publication number | Publication date |
|---|---|
| JP2011221922A (en) | 2011-11-04 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| EP2398182B1 (en) | A device and a method for generating software code | |
| Kong et al. | Deconstructing new cache designs for thwarting software cache-based side channel attacks | |
| US20180349573A1 (en) | Securing microprocessors against information leakage and physical tampering | |
| EP2893431B1 (en) | Protection against side channel attacks | |
| JP5167348B2 (en) | Software encryption method, software decryption method, software encryption device, and software decryption device | |
| Gamido et al. | Modified AES for text and image encryption | |
| CN105453481B (en) | Computing equipment including table networks | |
| Bos et al. | Assessing the feasibility of single trace power analysis of frodo | |
| KR101324351B1 (en) | Method for generating a cipher-based message authentication code | |
| CN104272319B (en) | method for protecting data | |
| Chen et al. | Balanced encoding to mitigate power analysis: a case study | |
| JP6698774B2 (en) | Security providing apparatus and method for common intermediate language, and security executing apparatus and method | |
| CN105468940B (en) | Method for protecting software and device | |
| EP3097655A1 (en) | Method of protecting secret data when used in a cryptographic algorithm | |
| Zheng et al. | How to compare selections of points of interest for side-channel distinguishers in practice? | |
| Aulbach et al. | SoK: On the physical security of UOV-based signature schemes | |
| JPWO2015166701A1 (en) | ENCRYPTION METHOD, PROGRAM, AND SYSTEM | |
| JP5477994B2 (en) | Self-rewriting processing device, self-rewriting processing method, and program | |
| Moradi et al. | On the Portability of Side-Channel Attacks-An Analysis of the Xilinx Virtex 4, Virtex 5, and Spartan 6 Bitstream Encryption Mechanism | |
| EP2674892B1 (en) | A method, a device and a computer program support for execution of encrypted computer code | |
| JP2007013506A (en) | Encryption processor, encryption method, decryption processor, decryption method and data structure | |
| US20150269367A1 (en) | Code diversity method and system | |
| CN106599620A (en) | Binary software protection method based on dynamic code conversion | |
| Liu et al. | Detecting side channel vulnerabilities in improved rotating S-box masking scheme—Presenting four non-profiled attacks | |
| JP5416623B2 (en) | Self-rewriting processing device, self-rewriting processing method, and program |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20130311 |
|
| A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20131129 |
|
| A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20131217 |
|
| A521 | Request for written amendment filed |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20140107 |
|
| 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: 20140128 |
|
| A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20140208 |
|
| R150 | Certificate of patent or registration of utility model |
Ref document number: 5477994 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 |
|
| LAPS | Cancellation because of no payment of annual fees |