JP5416623B2 - Self-rewriting processing device, self-rewriting processing method, and program - Google Patents

Self-rewriting processing device, self-rewriting processing method, and program Download PDF

Info

Publication number
JP5416623B2
JP5416623B2 JP2010057210A JP2010057210A JP5416623B2 JP 5416623 B2 JP5416623 B2 JP 5416623B2 JP 2010057210 A JP2010057210 A JP 2010057210A JP 2010057210 A JP2010057210 A JP 2010057210A JP 5416623 B2 JP5416623 B2 JP 5416623B2
Authority
JP
Japan
Prior art keywords
data
instruction
dummy
protection target
target program
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
JP2010057210A
Other languages
Japanese (ja)
Other versions
JP2011191993A (en
Inventor
利樹 松井
和英 福島
真 西川
信一 渡部
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.)
KDDI Corp
Original Assignee
KDDI 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 KDDI Corp filed Critical KDDI Corp
Priority to JP2010057210A priority Critical patent/JP5416623B2/en
Publication of JP2011191993A publication Critical patent/JP2011191993A/en
Application granted granted Critical
Publication of JP5416623B2 publication Critical patent/JP5416623B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Description

本発明は、自己書き換え処理装置、自己書き換え処理方法、およびプログラムに関する。   The present invention relates to a self-rewriting processing device, a self-rewriting processing method, and a program.

従来より、保護対象プログラムの解析および改ざんを困難にする手法が提案されている(例えば、特許文献1参照)。特許文献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). Patent Document 1 discloses a self-rewriting technique as a technique for making it difficult to analyze and falsify a program to be protected. In the self-rewriting shown in this Patent Document 1, an instruction described in a protection target program is disguised with a fake instruction.

特開2004−192068号公報Japanese Patent Laid-Open No. 2004-192068

一般的に、プログラムには、命令だけでなく、データも記述されている。ここで、データには、例えば、スタティックに定義された数値や、暗号化に用いるマスターキーなどが含まれる。   In general, a program describes not only instructions but also data. Here, the data includes, for example, a statically defined numerical value, a master key used for encryption, and the like.

上述の特許文献1に示されている手法では、保護対象プログラムに記述されている情報のうち、命令については、偽装できるが、マスターキーといった重要な情報を含むデータについては、偽装できなかった。   In the method disclosed in Patent Document 1 described above, among the information described in the protection target program, instructions can be camouflaged, but data including important information such as a master key cannot be camouflaged.

そこで、本発明は、上述の課題に鑑みてなされたものであり、保護対象プログラムの解析および改ざんを困難にする自己書き換え処理装置、自己書き換え処理方法、およびプログラムについて、命令だけでなくデータも偽装することを目的とする。   Therefore, the present invention has been made in view of the above-described problems, and for the self-rewriting processing device, the self-rewriting processing method, and the program that make it difficult to analyze and falsify a protection target program, not only instructions but also data are impersonated. The purpose is to do.

本発明は、上記の課題を解決するために、以下の事項を提案している。   The present invention proposes the following matters in order to solve the above problems.

(1) 本発明は、保護対象プログラムを記憶する記憶手段(例えば、図1のキャッシュ20に相当)と、前記保護対象プログラムに記述されている命令またはデータのうち少なくとも1つを選択する選択手段(例えば、図1のCPU10に相当)と、前記選択手段により選択されたデータを参照する処理(例えば、図6の処理C1、C2、C3に相当)を、前記保護対象プログラムの中から検出する検出手段(例えば、図1のCPU10に相当)と、前記選択手段により選択された命令をダミーの命令に置換するとともに、前記検出手段により検出された処理について、当該処理で参照されるデータをダミーのデータに置換する偽装手段(例えば、図1のCPU10に相当)と、前記偽装手段により置換されたダミーの命令を元の命令に置換する第1復元処理(例えば、図7の復元処理52に相当)と、前記偽装手段により置換されたダミーのデータを元のデータに置換する第2復元処理(例えば、図8の復元処理63に相当)と、を前記保護対象プログラムに挿入する第1挿入手段(例えば、図1のCPU10に相当)と、前記第1復元処理の実行により置換された元の命令をダミーの命令に置換する第1偽装処理(例えば、図7の偽装処理53に相当)と、前記第2復元処理の実行により置換された元のデータをダミーのデータに置換する第2偽装処理(例えば、図8の偽装処理64に相当)と、を前記保護対象プログラムに挿入する第2挿入手段(例えば、図1のCPU10に相当)と、を備えることを特徴とする自己書き換え処理装置を提案している。   (1) The present invention provides a storage means for storing a protection target program (for example, equivalent to the cache 20 in FIG. 1) and a selection means for selecting at least one of instructions or data described in the protection target program. (For example, corresponding to the CPU 10 in FIG. 1) and processing (for example, corresponding to the processing C1, C2, and C3 in FIG. 6) referring to the data selected by the selection unit are detected from the protection target program. The detection unit (e.g., corresponding to the CPU 10 in FIG. 1) and the instruction selected by the selection unit are replaced with a dummy instruction, and for the processing detected by the detection unit, the data referred to in the processing is dummy And a dummy instruction replaced by the disguise means (for example, equivalent to the CPU 10 in FIG. 1) and the original instruction. A first restoration process (for example, equivalent to the restoration process 52 in FIG. 7) and a second restoration process (for example, the restoration process 63 in FIG. 8) that replaces the dummy data replaced by the disguise means with the original data. A first insertion means (for example, equivalent to the CPU 10 in FIG. 1) and a first instruction for replacing the original instruction replaced by execution of the first restoration process with a dummy instruction. 1 camouflage process (for example, equivalent to camouflage process 53 in FIG. 7) and a second camouflage process (for example, camouflage process in FIG. 8) that replaces original data replaced by execution of the second restoration process with dummy data And a second insertion means (for example, equivalent to the CPU 10 of FIG. 1) for inserting the program into the protection target program.

この発明によれば、自己書き換え処理装置に、記憶手段、選択手段、検出手段、偽装手段、第1挿入手段、および第2挿入手段を設けた。そして、記憶手段により、保護対象プログラムを記憶することとした。また、選択手段により、保護対象プログラムに記述されている命令またはデータのうち少なくとも1つを選択することとした。また、検出手段により、選択手段により選択されたデータを参照する処理を、保護対象プログラムの中から検出することとした。また、偽装手段により、選択手段により選択された命令をダミーの命令に置換するとともに、検出手段により検出された処理について、この処理で参照されるデータをダミーのデータに置換することとした。また、第1挿入手段により、偽装手段により置換されたダミーの命令を元の命令に置換する第1復元処理と、偽装手段により置換されたダミーのデータを元のデータに置換する第2復元処理と、を保護対象プログラムに挿入することとした。また、第2挿入手段により、第1復元処理の実行により置換された元の命令をダミーの命令に置換する第1偽装処理と、第2復元処理の実行により置換された元のデータをダミーのデータに置換する第2偽装処理と、を保護対象プログラムに挿入することとした。   According to this invention, the self-rewriting processing apparatus is provided with the storage means, the selection means, the detection means, the camouflage means, the first insertion means, and the second insertion means. Then, the storage target program is stored by the storage means. Further, at least one of instructions or data described in the protection target program is selected by the selection means. In addition, the process of referring to the data selected by the selection unit is detected from the protection target program by the detection unit. Further, the camouflage means replaces the instruction selected by the selection means with a dummy instruction, and replaces the data referenced in this process with dummy data for the process detected by the detection means. Also, a first restoration process for replacing the dummy instruction replaced by the camouflage means with the original instruction by the first insertion means, and a second restoration process for replacing the dummy data replaced by the camouflage means with the original data Was inserted into the protected program. Further, the second insertion means replaces the original instruction replaced by execution of the first restoration process with a dummy instruction, and the original data replaced by execution of the second restoration process is replaced with a dummy The second disguise process that replaces data is inserted into the protection target program.

このため、自己書き換え処理装置は、選択手段により、保護対象プログラムに記述されている命令を選択し、偽装手段により、選択手段により選択された命令をダミーの命令に置換する。したがって、自己書き換え処理装置は、保護対象プログラムに記述されている命令を偽装することができ、保護対象プログラムの解析および改ざんを困難にすることができる。   For this reason, the self-rewriting processing device selects an instruction described in the protection target program by the selection means, and replaces the instruction selected by the selection means with a dummy instruction by the impersonation means. Therefore, the self-rewriting processing device can disguise instructions described in the protection target program, and can make it difficult to analyze and falsify the protection target program.

また、自己書き換え処理装置は、選択手段により、保護対象プログラムに記述されているデータを選択し、検出手段により、選択手段により選択されたデータを参照する処理を、保護対象プログラムの中から検出する。これによれば、保護対象プログラムにおいて、どのデータがどの処理で参照されているのかを把握することができる。そして、自己書き換え処理装置は、偽装手段により、検出手段により検出された処理について、この処理で参照されるデータをダミーのデータに置換する。以上によれば、自己書き換え処理装置は、保護対象プログラムに記述されている処理で参照されるデータをダミーのデータに置換して、保護対象プログラムに記述されているデータを偽装することができ、保護対象プログラムの解析および改ざんをさらに困難にすることができる。   In addition, the self-rewriting processing device selects data described in the protection target program by the selection unit, and detects a process of referring to the data selected by the selection unit from the protection target program by the detection unit. . According to this, it is possible to grasp which data is referred to in which process in the protection target program. Then, the self-rewrite processing device replaces the data referred to in this process with dummy data for the process detected by the detection means by the camouflage means. According to the above, the self-rewrite processing device can disguise the data described in the protection target program by replacing the data referred to in the processing described in the protection target program with dummy data, Analysis and alteration of the program to be protected can be made more difficult.

また、自己書き換え処理装置は、命令やデータが偽装手段により偽装された保護対象プログラムに対して、第1挿入手段により第1復元処理および第2復元処理を挿入するとともに、第2挿入手段により第1偽装処理および第2偽装処理を挿入する。このため、第1復元処理を実行することで、ダミーの命令を元の命令に戻すことができ、第2復元処理を実行することで、ダミーのデータを参照する処理を元のデータを参照する処理に戻すことができ、保護対象プログラムを正しく実行することができる。また、第1偽装処理を実行することで、処理を終えた命令をダミーの命令に置き換えて偽装することができ、第2偽装処理を実行することで、処理を終えた元のデータを参照する処理について、ダミーのデータを参照する処理に置き換えて、偽装することができる。以上によれば、第1復元処理を実行してから第1偽装処理を実行するまでの期間でのみ、命令を正しく読み出すことができ、上述の期間以外では、命令を正しく読み出すことができなくなる。また、第2復元処理を実行してから第2偽装処理を実行するまでの期間でのみ、データを正しく読み出すことができ、上述の期間以外では、データを正しく読み出すことができなくなる。したがって、保護対象プログラムの解析および改ざんをより困難にすることができる。   The self-rewriting processing device inserts the first restoration process and the second restoration process by the first insertion means and the second insertion means by the second insertion means with respect to the protection target program in which the instructions and data are impersonated by the impersonation means. Insert 1 impersonation process and 2nd impersonation process. Therefore, the dummy instruction can be returned to the original instruction by executing the first restoration process, and the process of referring to the dummy data is referred to by executing the second restoration process. The process can be returned to, and the protection target program can be executed correctly. Also, by executing the first camouflage process, the processed instruction can be replaced with a dummy instruction to impersonate, and by executing the second camouflage process, the original data after the process is referred to The processing can be disguised by replacing the processing with reference to dummy data. According to the above, the instruction can be read correctly only during the period from the execution of the first restoration process to the execution of the first impersonation process, and the instruction cannot be read out correctly outside the above-described period. In addition, data can be read correctly only during the period from the execution of the second restoration process to the execution of the second camouflage process, and the data cannot be read correctly outside the above-described period. Therefore, analysis and falsification of the protection target program can be made more difficult.

(2) 本発明は、(1)の自己書き換え処理装置について、前記第1挿入手段は、前記第1復元処理を、前記保護対象プログラムのうち、前記偽装手段により置換されたダミーの命令(例えば、図7のダミーの命令51Aに相当)より前方に挿入するとともに、前記第2復元処理を、前記保護対象プログラムのうち、前記偽装手段により置換されたダミーのデータを参照する処理(例えば、図8のステップS14において選択されたデータのダミーを参照する処理62Aに相当)より前方に挿入し、前記第2挿入手段は、前記第1偽装処理を、前記保護対象プログラムのうち、前記偽装手段により置換されたダミーの命令(例えば、図7のダミーの命令51Aに相当)より後方に挿入するとともに、前記第2偽装処理を、前記保護対象プログラムのうち、前記偽装手段により置換されたダミーのデータを参照する処理(例えば、図8のステップS14において選択されたデータのダミーを参照する処理62Aに相当)より後方に挿入することを特徴とする自己書き換え処理装置を提案している。   (2) The present invention relates to the self-rewriting processing device according to (1), wherein the first insertion means performs a first instruction to perform a dummy instruction (for example, a replacement of the protection target program by the impersonation means). , Corresponding to the dummy instruction 51A in FIG. 7), and the second restoration process is performed by referring to the dummy data replaced by the impersonation means in the protection target program (for example, FIG. 8 is equivalent to the process 62A referring to the dummy of the data selected in step S14), and the second insertion means performs the first impersonation process by the impersonation means in the protection target program. It is inserted behind the replaced dummy instruction (for example, equivalent to the dummy instruction 51A in FIG. 7), and the second impersonation process is performed on the protection target process. The ram is inserted after the process of referring to the dummy data replaced by the camouflage means (for example, the process 62A referring to the dummy of the data selected in step S14 in FIG. 8). Has proposed a self-rewriting processor.

この発明によれば、(1)の自己書き換え処理装置において、第1挿入手段は、第1復元処理を、保護対象プログラムのうち、偽装手段により置換されたダミーの命令より前方に挿入するとともに、第2復元処理を、保護対象プログラムのうち、偽装手段により置換されたダミーのデータを参照する処理より前方に挿入することとした。また、第2挿入手段は、第1偽装処理を、保護対象プログラムのうち、偽装手段により置換されたダミーの命令より後方に挿入するとともに、第2偽装処理を、保護対象プログラムのうち、偽装手段により置換されたダミーのデータを参照する処理より後方に挿入することとした。   According to the present invention, in the self-rewriting processing device of (1), the first insertion means inserts the first restoration process ahead of the dummy instruction replaced by the camouflage means in the protection target program, The second restoration process is inserted ahead of the process of referring to the dummy data replaced by the camouflage means in the protection target program. The second inserting means inserts the first camouflage process behind the dummy instruction replaced by the camouflage means in the protection target program, and the second camouflage process in the protection target program. It was decided to insert it behind the process of referring to the dummy data replaced by.

このため、第1復元処理が実行され、正しい命令が実行された後に、第1偽装処理が実行される。また、第2復元処理が実行され、正しいデータを参照する処理が実行された後に、第2偽装処理が実行される。これによれば、上述した効果と同様の効果を奏することができる。   For this reason, after the first restoration process is executed and the correct instruction is executed, the first impersonation process is executed. Further, after the second restoration process is executed and the process for referring to correct data is executed, the second disguise process is executed. According to this, an effect similar to the effect mentioned above can be produced.

(3) 本発明は、(1)または(2)の自己書き換え処理装置について、前記選択手段による選択と、前記検出手段による検出と、前記偽装手段による置換と、前記第1挿入手段による挿入と、前記第2挿入手段による挿入と、を予め定められた回数(例えば、図3の反復回数Nに相当)だけ繰り返すことを特徴とする自己書き換え処理装置を提案している。   (3) The present invention relates to the self-rewriting processing device of (1) or (2), selection by the selection means, detection by the detection means, replacement by the impersonation means, and insertion by the first insertion means. A self-rewriting processing device is proposed in which the insertion by the second insertion means is repeated a predetermined number of times (for example, corresponding to the number of repetitions N in FIG. 3).

この発明によれば、(1)または(2)の自己書き換え処理装置において、選択手段による選択と、検出手段による検出と、偽装手段による置換と、第1挿入手段による挿入と、第2挿入手段による挿入と、を予め定められた回数だけ繰り返すこととした。   According to the present invention, in the self-rewriting processing device of (1) or (2), selection by the selection means, detection by the detection means, replacement by impersonation means, insertion by the first insertion means, and second insertion means It was decided to repeat the insertion by 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, it is possible to replace a command or data with a dummy multiple times. Multiple counterfeiting can be performed. Therefore, it is possible to make it more difficult to analyze and falsify the protection target program.

(4) 本発明は、選択手段(例えば、図1のCPU10に相当)、検出手段(例えば、図1のCPU10に相当)、偽装手段(例えば、図1のCPU10に相当)、第1挿入手段(例えば、図7の復元処理52に相当)、および第2挿入手段(例えば、図7の復元処理52に相当)を備える自己書き換え処理装置における自己書き換え処理方法であって、前記選択手段が、保護対象プログラムに記述されている命令またはデータのうち少なくとも1つを選択する第1ステップ(例えば、図3のステップS14に相当)と、前記検出手段が、前記第1ステップにおいて選択したデータを参照する処理を、前記保護対象プログラムの中から検出する第2ステップ(例えば、図3のステップS13およびステップS15に相当)と、前記偽装手段が、前記第1ステップにおいて選択した命令をダミーの命令に置換するとともに、前記第2ステップにおいて検出した処理について、当該処理で参照されるデータをダミーのデータに置換する第3ステップ(例えば、図3のステップS16に相当)と、前記第1挿入手段が、前記第3ステップにおいて置換したダミーの命令を元の命令に置換する第1復元処理(例えば、図7の復元処理52に相当)と、前記第3ステップにおいて置換したダミーのデータを元のデータに置換する第2復元処理(例えば、図8の復元処理63に相当)と、を前記保護対象プログラムに挿入する第4ステップ(例えば、図3のステップS17に相当)と、前記第2挿入手段が、前記第1復元処理の実行により置換された元の命令をダミーの命令に置換する第1偽装処理(例えば、図7の偽装処理53に相当)と、前記第2復元処理の実行により置換された元のデータをダミーのデータに置換する第2偽装処理(例えば、図8の偽装処理64に相当)と、を前記保護対象プログラムに挿入する第5ステップ(例えば、図3のステップS18に相当)と、を備えることを特徴とする自己書き換え処理方法を提案している。 (4) The present invention includes selection means (for example, equivalent to the CPU 10 in FIG. 1), detection means (for example, equivalent to the CPU 10 in FIG. 1), impersonation means (for example, equivalent to the CPU 10 in FIG. 1), first insertion means. (For example, equivalent to the restoration process 52 of FIG. 7) and a self-rewrite processing method in a self-rewrite processing device comprising a second insertion means (for example, equivalent to the restoration process 52 of FIG. 7), wherein the selection means comprises: A first step (for example, corresponding to step S14 in FIG. 3) for selecting at least one of instructions or data described in the protection target program, and the detection means refer to the data selected in the first step the process of the second step of detecting from the protected program (e.g., corresponding to steps S13 and S15 in FIG. 3) and, the impersonation means The instruction selected in the first step is replaced with a dummy instruction, and the data detected in the second step is replaced with dummy data for the process detected in the second step (for example, FIG. 3). And a first restoration process (for example, equivalent to the restoration process 52 in FIG. 7) in which the first insertion unit replaces the dummy instruction replaced in the third step with the original instruction. A fourth step (for example, FIG. 8) for inserting a second restoration process (for example, equivalent to the restoration process 63 in FIG. 8) for replacing the dummy data replaced in the third step with the original data. 3 corresponds to step S17 in), the second insertion means, first disguised to replace the original instruction substituted in the dummy instruction by executing the first restoration processing (E.g., equivalent to the camouflage process 53 of FIG. 7) and a second camouflage process (for example, the camouflage process 64 of FIG. 8) that replaces the original data replaced by the execution of the second restoration process with dummy data. And a fifth step (for example, equivalent to step S18 in FIG. 3) of inserting the above into the protection target program.

この発明によれば、保護対象プログラムに記述されている命令またはデータのうち少なくとも1つを選択し、選択したデータを参照する処理を、保護対象プログラムの中から検出する。そして、選択した命令をダミーの命令に置換するとともに、検出した処理について、この処理で参照されるデータをダミーのデータに置換する。また、ダミーの命令を元の命令に置換する第1復元処理と、ダミーのデータを元のデータに置換する第2復元処理と、を保護対象プログラムに挿入する。また、元の命令をダミーの命令に置換する第1偽装処理と、元のデータをダミーのデータに置換する第2偽装処理と、を保護対象プログラムに挿入する。これによれば、上述した効果と同様の効果を奏することができる。   According to the present invention, at least one instruction or data described in the protection target program is selected, and a process for referring to the selected data is detected from the protection target program. Then, the selected instruction is replaced with a dummy instruction, and for the detected process, the data referred to in this process is replaced with dummy data. Also, a first restoration process that replaces the dummy instruction with the original instruction and a second restoration process that replaces the dummy data with the original data are inserted into the protection target program. Also, a first camouflage process that replaces the original instruction with a dummy instruction and a second camouflage process that replaces the original data with dummy data are inserted into the protection target program. According to this, an effect similar to the effect mentioned above can be produced.

(5) 本発明は、保護対象プログラムに記述されている命令またはデータのうち少なくとも1つを選択する第1ステップ(例えば、図3のステップS14に相当)と、前記第1ステップにおいて選択したデータを参照する処理を、前記保護対象プログラムの中から検出する第2ステップ(例えば、図3のステップS13およびステップS15に相当)と、前記第1ステップにおいて選択した命令をダミーの命令に置換するとともに、前記第2ステップにおいて検出した処理について、当該処理で参照されるデータをダミーのデータに置換する第3ステップ(例えば、図3のステップS16に相当)と、前記第3ステップにおいて置換したダミーの命令を元の命令に置換する第1復元処理(例えば、図7の復元処理52に相当)と、前記第3ステップにおいて置換したダミーのデータを元のデータに置換する第2復元処理(例えば、図8の復元処理63に相当)と、を前記保護対象プログラムに挿入する第4ステップ(例えば、図3のステップS17に相当)と、前記第1復元処理の実行により置換された元の命令をダミーの命令に置換する第1偽装処理(例えば、図7の偽装処理53に相当)と、前記第2復元処理の実行により置換された元のデータをダミーのデータに置換する第2偽装処理(例えば、図8の偽装処理64に相当)と、を前記保護対象プログラムに挿入する第5ステップ(例えば、図3のステップS18に相当)と、をコンピュータに実行させるためのプログラムを提案している。   (5) The present invention provides a first step (for example, corresponding to step S14 in FIG. 3) for selecting at least one of instructions or data described in the protection target program, and the data selected in the first step. A second step (for example, equivalent to step S13 and step S15 in FIG. 3) for detecting the process referring to the protection target program, and replacing the instruction selected in the first step with a dummy instruction. For the processing detected in the second step, the third step (for example, corresponding to step S16 in FIG. 3) for replacing the data referred to in the processing with dummy data, and the dummy for replacement in the third step A first restoration process (for example, equivalent to the restoration process 52 in FIG. 7) for replacing the instruction with the original instruction; The fourth step (for example, the step of FIG. 3) of inserting the second restoration process (for example, equivalent to the restoration process 63 in FIG. 8) for replacing the dummy data replaced in the step with the original data, into the protection target program. S17), a first disguise process (for example, equivalent to the disguise process 53 of FIG. 7) for replacing the original instruction replaced by the execution of the first restore process with a dummy instruction, and the second restore process A fifth disguise process (for example, equivalent to the disguise process 64 in FIG. 8) for replacing the original data replaced by the execution of the dummy data with a fifth step (for example, FIG. 3). The program for causing a computer to execute the program is proposed.

この発明によれば、プログラムをコンピュータに実行させることで、保護対象プログラムに記述されている命令またはデータのうち少なくとも1つを選択し、選択したデータを参照する処理を、保護対象プログラムの中から検出する。そして、選択した命令をダミーの命令に置換するとともに、検出した処理について、この処理で参照されるデータをダミーのデータに置換する。また、ダミーの命令を元の命令に置換する第1復元処理と、ダミーのデータを元のデータに置換する第2復元処理と、を保護対象プログラムに挿入する。また、元の命令をダミーの命令に置換する第1偽装処理と、元のデータをダミーのデータに置換する第2偽装処理と、を保護対象プログラムに挿入する。これによれば、上述した効果と同様の効果を奏することができる。   According to this invention, by causing a computer to execute a program, a process of selecting at least one of instructions or data described in the protection target program and referring to the selected data is performed from the protection target program. To detect. Then, the selected instruction is replaced with a dummy instruction, and for the detected process, the data referred to in this process is replaced with dummy data. Also, a first restoration process that replaces the dummy instruction with the original instruction and a second restoration process that replaces the dummy data with the original data are inserted into the protection target program. Also, a first camouflage process that replaces the original instruction with a dummy instruction and a second camouflage process that replaces the original data with dummy data are inserted into the protection target program. According to this, an effect similar to the effect mentioned above can be produced.

本発明によれば、保護対象プログラムに記述されている命令だけでなくデータも偽装することができ、保護対象プログラムの解析および改ざんを困難にすることができる。   According to the present invention, not only instructions described in the protection target program but also data can be camouflaged, and analysis and falsification of the protection target program can be made difficult.

本発明の一実施形態に係る自己書き換え処理装置の構成を示すブロック図である。It is a block diagram which shows the structure of the self-rewriting processing apparatus which concerns on one Embodiment of this invention. 前記自己書き換え処理装置における第1の処理のフローチャートである。It is a flowchart of the 1st process in the said self-rewriting processing apparatus. 前記自己書き換え処理装置における第2の処理のフローチャートである。It is a flowchart of the 2nd process in the said self-rewriting processing apparatus. 前記第2の処理を説明するための図である。It is a figure for demonstrating a said 2nd process. 前記第2の処理を説明するための図である。It is a figure for demonstrating a said 2nd process. 前記第2の処理を説明するための図である。It is a figure for demonstrating a said 2nd process. 前記第2の処理を説明するための図である。It is a figure for demonstrating a said 2nd process. 前記第2の処理を説明するための図である。It is a figure for demonstrating a said 2nd process.

以下、本発明の実施形態について図面を参照しながら説明する。なお、以下の実施形態における構成要素は適宜、既存の構成要素などとの置き換えが可能であり、また、他の既存の構成要素との組合せを含む様々なバリエーションが可能である。したがって、以下の実施形態の記載をもって、特許請求の範囲に記載された発明の内容を限定するものではない。   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 processing device 1 according to an embodiment of the present invention. The self-rewriting processing device 1 includes a CPU (Central Processing Unit) 10 that performs various arithmetic processes, and a cache 20 that stores a protection target program.

自己書き換え処理装置1は、後述の第1の処理(図2参照)を実行した後、後述の第2の処理(図3参照)を行うことにより、保護対象プログラムに記述されている命令だけでなくデータも偽装して、保護対象プログラムの解析および改ざんを困難にする。   The self-rewriting processing device 1 executes only the instructions described in the protection target program by executing the second process (see FIG. 3) described later after executing the first process (refer to FIG. 2) described later. And disguise the data, making it difficult to analyze and tamper with the protected program.

[第1の処理]
図2は、上述の第1の処理のフローチャートである。
[First processing]
FIG. 2 is a flowchart of the first process described above.

ステップS1において、CPU10により、キャッシュ20に記憶されている保護対象プログラムのうち、保護する領域を選択し、ステップS2に移る。なお、ステップS1における保護対象プログラムは、C言語やJava(登録商標)といった高級言語で記述されているものとする。また、保護する領域は、例えば自己書き換え処理装置1のユーザにより、保護対象プログラムの中から決定されるものとする。   In step S1, the CPU 10 selects an area to be protected from the protection target programs stored in the cache 20, and proceeds to step S2. Note that the protection target program in step S1 is described in a high-level language such as C language or Java (registered trademark). In addition, it is assumed that the area to be protected is determined from the protection target program by the user of the self-rewriting processing apparatus 1, for example.

ステップS2において、CPU10により、キャッシュ20に記憶されている保護対象プログラムのうち、ステップS1において選択した領域について、アセンブラ記述を取得し、第1の処理を終了する。このステップでは、例えば、保護対象プログラムのうち上述の選択した領域について、コンパイルして、アセンブリプログラムに変換する。   In step S2, the CPU 10 acquires an assembler description for the area selected in step S1 among the protection target programs stored in the cache 20, and ends the first process. In this step, for example, the above-mentioned selected area of the protection target program is compiled and converted into an assembly program.

[第2の処理]
図3は、上述の第2の処理のフローチャートである。
[Second processing]
FIG. 3 is a flowchart of the second process described above.

ステップS11において、CPU10により、変数Mに「0」を代入することで変数Mを初期化し、ステップS12に移る。   In step S11, the CPU 10 initializes the variable M by substituting “0” for the variable M, and proceeds to step S12.

ステップS12において、CPU10により、反復回数N(Nは、N≧0を満たす整数)を設定し、ステップS13に移る。   In step S12, the CPU 10 sets the number of iterations N (N is an integer satisfying N ≧ 0), and proceeds to step S13.

ステップS13において、CPU10により、上述のステップS2において取得したアセンブラ記述の保護対象プログラムの制御構造を解析し、ステップS14に移る。この保護対象プログラムの制御構造の解析について、図4および図5を用いて以下に説明する。   In step S13, the CPU 10 analyzes the control structure of the protection target program of the assembler description acquired in step S2, and then proceeds to step S14. The analysis of the control structure of the protection target program will be described below with reference to FIGS.

図4、5は、ステップS2の処理により得られたアセンブラ記述の保護対象プログラム100を示す図である。保護対象プログラム100には、データの記述された領域110と、命令の記述された領域120と、がある。   FIGS. 4 and 5 are diagrams showing the protection target program 100 in the assembler description obtained by the process of step S2. The protection target program 100 includes an area 110 in which data is described and an area 120 in which instructions are described.

命令の記述された領域120には、図5に示すように、計算や代入といった処理を行う命令と、条件を満たすか否かの判断を行う分岐の命令と、が記述されている。保護対象プログラム100に対してステップS13の処理が行われると、命令の記述された領域120において、まず、分岐の命令がそれぞれ判定され、処理が分解される。次に、連続して実行される1以上の処理で構成され、分岐を含まないパスが検出される。図5においては、パスA1、A2、A3、A4、A5が検出されることを示している。   As shown in FIG. 5, in the area 120 where the instruction is described, an instruction that performs processing such as calculation and assignment and a branch instruction that determines whether or not the condition is satisfied are described. When the process of step S13 is performed on the protection target program 100, first, branch instructions are respectively determined in the area 120 where the instructions are described, and the process is decomposed. Next, a path that includes one or more processes executed continuously and does not include a branch is detected. FIG. 5 shows that paths A1, A2, A3, A4, and A5 are detected.

以上のように、ステップS13の処理を行うと、保護対象プログラムのうち命令の記述された領域について、連続して実行される1以上の処理で構成され、分岐を含まないパスが検出される。   As described above, when the process of step S13 is performed, a path that includes one or more processes that are continuously executed and does not include a branch is detected for the area in which the instruction is described in the protection target program.

図3に戻って、ステップS14において、CPU10により、ステップS13において制御構造を解析したアセンブラ記述の保護対象プログラムの中から、偽装させる命令またはデータを選択し、ステップS15に移る。   Returning to FIG. 3, in step S14, the CPU 10 selects an instruction or data to be camouflaged from the protection target programs of the assembler description whose control structure is analyzed in step S13, and proceeds to step S15.

ステップS15において、CPU10により、ステップS13において制御構造を解析したアセンブラ記述の保護対象プログラムの中から、ステップS14において選択したデータを参照する処理を検出し、ステップS16に移る。このステップS14において選択したデータを参照する処理の検出について、図5および図6を用いて以下に説明する。   In step S15, the CPU 10 detects processing referring to the data selected in step S14 from the protection target program of the assembler description whose control structure is analyzed in step S13, and proceeds to step S16. The detection of the process referring to the data selected in step S14 will be described below with reference to FIGS.

例えば、ステップS14において、図6に示すように、データB1が選択されたものとする。すると、このデータB1を参照する処理が、図5のパスA1〜A5の中から検出される。ここで、図6の処理C1、C2、C3のそれぞれにおいてデータB1が参照されるものとすると、ステップS15の処理が行われると、これら処理C1〜C3が検出されることとなる。   For example, assume that data B1 is selected in step S14 as shown in FIG. Then, a process referring to the data B1 is detected from the paths A1 to A5 in FIG. Here, if the data B1 is referred to in each of the processes C1, C2, and C3 in FIG. 6, when the process of step S15 is performed, these processes C1 to C3 are detected.

なお、ステップS14において命令を選択した場合には、上述の検出を行うことなく、ステップS16に移る。   If an instruction is selected in step S14, the process proceeds to step S16 without performing the above-described detection.

図3に戻って、ステップS16において、CPU10により、ステップS14において選択した命令、または、ステップS15において検出した処理で参照されるデータを、ダミーに置換し、ステップS17に移る。具体的には、ステップS14において命令を選択した場合には、この命令をダミーの命令に置換する。また、ステップS14においてデータを選択した場合には、ステップS15において検出した処理で参照されるデータを、ダミーのデータに置換する。   Returning to FIG. 3, in step S16, the CPU 10 replaces the instruction selected in step S14 or the data referenced in the process detected in step S15 with a dummy, and proceeds to step S17. Specifically, when an instruction is selected in step S14, this instruction is replaced with a dummy instruction. If data is selected in step S14, the data referenced in the process detected in step S15 is replaced with dummy data.

ステップS17において、CPU10により、ステップS16の処理を行った保護対象プログラムに復元処理を挿入し、ステップS18に移る。なお、復元処理とは、ステップS16において置換したダミーの命令およびダミーのデータを、それぞれ、元の命令および元のデータに戻す処理のことである。この復元処理を挿入する位置について、以下に説明する。   In step S17, the CPU 10 inserts a restoration process into the protection target program that has undergone the process of step S16, and then proceeds to step S18. The restoration process is a process for returning the dummy instruction and the dummy data replaced in step S16 to the original instruction and the original data, respectively. The position where this restoration process is inserted will be described below.

ステップS14において命令を選択した場合には、ステップS16の処理を行った保護対象プログラムのうち、上述の命令をステップS16においてダミーに置換したものより前方に、復元処理を挿入する(後述の図7参照)。これによれば、保護対象プログラムにおいて、復元処理が、ダミーの命令より前方に記述されることになるので、この命令は、ダミーから元に戻された後に、実行されることとなる。   When an instruction is selected in step S14, a restoration process is inserted in front of the protected program that has been subjected to the process in step S16 before the above-described instruction is replaced with a dummy in step S16 (FIG. 7 described later). reference). According to this, since the restoration process is described ahead of the dummy instruction in the protection target program, this instruction is executed after being restored from the dummy.

一方、ステップS14においてデータを選択した場合には、ステップS16の処理を行った保護対象プログラムのうち、上述のデータを参照する処理について、参照されるデータをステップS16においてダミーに置換したものより前方に、復元処理を挿入する(後述の図8参照)。これによれば、保護対象プログラムにおいて、復元処理が、ダミーのデータを参照する処理より前方に記述されることになるので、ダミーのデータを参照する処理は、参照するデータをダミーから元に戻された後に、実行されることとなる。   On the other hand, when data is selected in step S14, the process of referring to the above-described data in the protection target program that has performed the process of step S16 is ahead of the reference data replaced with a dummy in step S16. Then, a restoration process is inserted (see FIG. 8 described later). According to this, in the protection target program, the restoration process is described ahead of the process of referring to the dummy data. Therefore, the process of referring to the dummy data returns the reference data from the dummy to the original. Will be executed.

ステップS18において、CPU10により、ステップS17の処理を行った保護対象プログラムに偽装処理を挿入し、ステップS18に移る。なお、偽装処理とは、復元処理の実行により置換された元の命令および元のデータを、それぞれ、ダミーの命令およびダミーのデータに置換する処理のことである。この偽装処理を挿入する位置について、以下に説明する。   In step S18, the CPU 10 inserts a camouflage process into the protection target program that has performed the process of step S17, and then proceeds to step S18. The camouflage process is a process of replacing the original instruction and the original data replaced by the execution of the restoration process with a dummy instruction and dummy data, respectively. The position where this impersonation process is inserted will be described below.

ステップS14において命令を選択した場合には、ステップS17の処理を行った保護対象プログラムのうち、上述の命令をステップS16においてダミーに置換したものより後方に、偽装処理を挿入する(後述の図7参照)。これによれば、保護対象プログラムにおいて、偽装処理が、ダミーの命令より後方に記述されることになるので、この命令が実行された後に、偽装処理が実行され、この命令が偽装されることとなる。   When an instruction is selected in step S14, an impersonation process is inserted behind the protection target program that has undergone the process of step S17 after the above-described instruction is replaced with a dummy in step S16 (FIG. 7 described later). reference). According to this, since the impersonation process is described behind the dummy instruction in the protection target program, after this instruction is executed, the impersonation process is executed, and this instruction is impersonated. Become.

一方、ステップS14においてデータを選択した場合には、ステップS17の処理を行った保護対象プログラムのうち、上述のデータを参照する処理について、参照されるデータをステップS16においてダミーに置換したものより後方に、偽装処理を挿入する(後述の図8参照)。これによれば、保護対象プログラムにおいて、偽装処理が、ダミーのデータを参照する処理より後方に記述されることになるので、この処理が実行された後に、偽装処理が実行され、この処理により参照されるデータが偽装されることとなる。   On the other hand, when data is selected in step S14, the process of referring to the above-described data in the protection target program that has performed the process of step S17 is behind the replacement of the referenced data with the dummy in step S16. Then, a camouflage process is inserted (see FIG. 8 described later). According to this, in the protection target program, the camouflage process is described behind the process of referring to the dummy data. Therefore, after this process is executed, the camouflage process is executed, and the process is referred to by this process. Data to be impersonated.

ステップS19において、CPU10により、変数Mに1を加算し、ステップS20に移る。   In step S19, the CPU 10 adds 1 to the variable M and proceeds to step S20.

ステップS20において、CPU10により、変数Mが反復回数N以下であるか否かを判別する。そして、変数Mが反復回数N以下である場合には、すなわち上述のステップS14〜S19を繰り返した回数が反復回数N以下である場合には、ステップS14に戻る。一方、変数Mが反復回数Nより大きい場合には、すなわち上述のステップS14〜S19を繰り返した回数が反復回数Nより多い場合には、第2の処理を終了する。   In step S20, the CPU 10 determines whether or not the variable M is equal to or less than the number of iterations N. If the variable M is equal to or smaller than the number of iterations N, that is, if the number of times the above steps S14 to S19 are repeated is equal to or smaller than the number of iterations N, the process returns to step S14. On the other hand, if the variable M is larger than the number of iterations N, that is, if the number of times the above-described steps S14 to S19 are repeated is greater than the number of iterations N, the second process is terminated.

図7は、ステップS14において命令を選択した場合における、ステップS15〜S18の処理を行う前後での保護対象プログラムを示す図である。   FIG. 7 is a diagram showing protection target programs before and after performing the processing of steps S15 to S18 when an instruction is selected in step S14.

保護対象プログラム50は、ステップS14の処理を行った後の保護対象プログラムを示す。保護対象プログラム50には、ステップS1において選択された保護する領域Pが定められており、保護対象プログラム50のうち保護する領域Pには、ステップS14において選択された命令51が記述されている。   The protection target program 50 indicates the protection target program after performing the process of step S14. In the protection target program 50, the area P to be protected selected in step S1 is defined, and the instruction 51 selected in step S14 is described in the area P to be protected in the protection target program 50.

以上の保護対象プログラム50に対してステップS15〜S18の処理を行ったものが、保護対象プログラム50Aである。保護対象プログラム50Aのうち保護する領域Pには、ステップS14において選択された命令51をステップS16において置換した、ダミーの命令51Aが記述されている。また、ダミーの命令51Aの前方には、ステップS17において挿入した、復元処理52が記述されている。また、ダミーの命令51Aの後方には、ステップS18において挿入した、偽装処理53が記述されている。   The protection target program 50A is obtained by performing the processes of steps S15 to S18 on the protection target program 50 described above. In the area P to be protected of the protection target program 50A, a dummy instruction 51A in which the instruction 51 selected in step S14 is replaced in step S16 is described. Further, the restoration process 52 inserted in step S17 is described in front of the dummy instruction 51A. Further, the camouflage process 53 inserted in step S18 is described behind the dummy instruction 51A.

以上の保護対象プログラム50Aを実行する場合について、以下に説明する。まず、復元処理52が実行される。これによれば、ダミーの命令51Aが、元の命令であるステップS14において選択された命令51に戻ることとなる。   A case where the above protection target program 50A is executed will be described below. First, the restoration process 52 is executed. According to this, the dummy instruction 51A returns to the instruction 51 selected in step S14 which is the original instruction.

次に、上述の復元処理52の実行により元に戻った、ステップS14において選択された命令51が実行される。   Next, the instruction 51 selected in step S <b> 14, which has been restored by the execution of the restoration process 52 described above, is executed.

次に、偽装処理53が実行される。これによれば、ステップS14において選択された命令51の実行後に、この命令51がダミーに置換されることとなる。   Next, a camouflage process 53 is executed. According to this, after execution of the instruction 51 selected in step S14, this instruction 51 is replaced with a dummy.

以上によれば、保護対象プログラム50Aでは、復元処理52が実行されてから、偽装処理53が実行されるまでの期間でのみ、元の命令であるステップS14において選択された命令51を正しく読み出すことができ、この期間以外では、命令51を読み出そうとしてもダミーの命令しか読み出すことができない。   According to the above, in the protection target program 50A, the instruction 51 selected in step S14 that is the original instruction is correctly read out only during the period from the execution of the restoration process 52 to the execution of the impersonation process 53. During this period, only dummy instructions can be read out even if the instruction 51 is read out.

図8は、ステップS14においてデータを選択した場合における、ステップS15〜S18の処理を行う前後での保護対象プログラムを示す図である。   FIG. 8 is a diagram showing the protection target program before and after performing the processing of steps S15 to S18 when data is selected in step S14.

保護対象プログラム60は、ステップS14の処理を行った後の保護対象プログラムを示す。保護対象プログラム60には、ステップS1において選択された保護する領域Qが定められており、保護対象プログラム60のうち保護する領域Qには、ステップS14において選択されたデータ61と、このデータ61を参照する処理62と、が記述されている。   The protection target program 60 indicates the protection target program after performing the process of step S14. In the protection target program 60, the area Q to be protected selected in step S1 is defined. In the protection target program 60, the data 61 selected in step S14 and the data 61 are stored in the area Q to be protected. Processing 62 to be referred to is described.

以上の保護対象プログラム60に対してステップS15〜S18の処理を行ったものが、保護対象プログラム60Aである。保護対象プログラム60Aのうち保護する領域Qには、ステップS14において選択されたデータ61と、このデータ61のダミーを参照する処理62Aと、が記述されている。ここで、データ61のダミーを参照する処理62Aとは、データ61を参照する処理について、参照するデータをステップS16においてデータ61からダミーのデータに置換したもののことである。また、データ61のダミーを参照する処理62Aの前方には、ステップS17において挿入した、復元処理が記述されている。また、データ61のダミーを参照する処理62Aの後方には、ステップS18において挿入した、偽装処理64が記述されている。   The protection target program 60A is obtained by performing the processing of steps S15 to S18 on the above protection target program 60. In the area Q to be protected in the protection target program 60A, the data 61 selected in step S14 and the process 62A for referring to the dummy of the data 61 are described. Here, the process 62A for referring to the dummy of the data 61 refers to the process of referring to the data 61 in which the data to be referred to is replaced with the dummy data from the data 61 in step S16. In addition, the restoration process inserted in step S17 is described in front of the process 62A referring to the dummy of the data 61. Further, the disguise process 64 inserted in step S18 is described behind the process 62A that refers to the dummy of the data 61.

以上の保護対象プログラム60Aを実行する場合について、以下に説明する。まず、復元処理63が実行される。これによれば、データ61のダミーを参照する処理62Aが、データ61を参照する処理62に戻ることとなる。   A case where the above protection target program 60A is executed will be described below. First, the restoration process 63 is executed. According to this, the process 62A for referring to the dummy of the data 61 returns to the process 62 for referring to the data 61.

次に、上述の復元処理63の実行により元に戻った、データ61を参照する処理62が実行される。   Next, a process 62 that refers to the data 61 that has been restored by the execution of the above-described restoration process 63 is executed.

次に、偽装処理64が実行される。これによれば、データ61を参照する処理62の実行後に、データ61を参照する処理62が、データ61のダミーを参照する処理に、置換されることとなる。   Next, a camouflage process 64 is executed. According to this, after the process 62 that refers to the data 61 is executed, the process 62 that refers to the data 61 is replaced with a process that refers to the dummy of the data 61.

以上によれば、保護対象プログラム60Aでは、復元処理63が実行されてから、偽装処理64が実行されるまでの期間でのみ、元のデータであるステップS14において選択されたデータ61を正しく読み出すことができ、この期間以外では、データ61を読み出そうとしてもダミーのデータしか読み出すことができない。   As described above, the protection target program 60A correctly reads the data 61 selected in step S14, which is the original data, only during the period from the execution of the restoration process 63 to the execution of the impersonation process 64. During this period, only dummy data can be read out even if the data 61 is read out.

以上の自己書き換え処理装置1によれば、以下の効果を奏することができる。   According to the self-rewriting processing device 1 described above, the following effects can be obtained.

自己書き換え処理装置1は、ステップS2の処理を行って保護対象プログラムのアセンブラ記述を取得した後、ステップS16の処理を行って、命令をダミーの命令に置換したり、データを参照する処理をダミーのデータを参照する処理に置換したりする。したがって、自己書き換え処理装置は、保護対象プログラムに記述されている命令だけでなくデータも偽装することができ、保護対象プログラムの解析および改ざんを困難にすることができる。   The self-rewrite processing device 1 performs the process of step S2 to acquire the assembler description of the protection target program, and then performs the process of step S16 to replace the instruction with a dummy instruction or perform a process of referring to data as a dummy. Or a process that refers to the data of. Therefore, the self-rewriting processing device can disguise not only the instructions described in the protection target program but also the data, and can make it difficult to analyze and falsify the protection target program.

また、自己書き換え処理装置1は、ステップS16の処理を行って命令やデータを偽装した保護対象プログラムに対して、ステップS17の処理により復元処理を挿入するとともに、ステップS18の処理により偽装処理を挿入する。このため、復元処理を実行することで、ダミーの命令やダミーのデータを元の命令や元のデータに戻すことができ、保護対象プログラムを正しく実行することができる。また、偽装処理を実行することで、処理を終えた命令やデータについて、ダミーの命令やダミーのデータに置き換えて、偽装することができる。以上によれば、復元処理を実行してから偽装処理を実行するまでの期間でのみ、命令やデータを正しく読み出すことができ、上述の期間以外では、命令やデータを正しく読み出すことができなくなる。したがって、保護対象プログラムの解析および改ざんをより困難にすることができる。   Further, the self-rewrite processing device 1 inserts the restoration process by the process of step S17 and the forgery process by the process of step S18 for the protection target program that has performed the process of step S16 and impersonates the instruction and data. To do. Therefore, by executing the restoration process, the dummy instruction and dummy data can be returned to the original instruction and the original data, and the protection target program can be executed correctly. Further, by executing the camouflage process, it is possible to perform the camouflage by replacing the processed instruction and data with a dummy instruction or dummy data. According to the above, it is possible to correctly read the instruction and data only during the period from the execution of the restoration process to the execution of the impersonation process, and the instruction and data cannot be correctly read outside the above period. Therefore, analysis and falsification of the protection target program can be made more difficult.

また、自己書き換え処理装置1は、ステップS12において設定した反復回数Nだけ、ステップS14〜S19の処理を繰り返す。このため、保護対象プログラムに記述されている命令およびデータについて、何重にも偽装する多重偽装を施すことができるので、保護対象プログラムの解析および改ざんをさらに困難にすることができる。   Further, the self-rewriting processing device 1 repeats the processes of steps S14 to S19 for the number of repetitions N set in step S12. For this reason, since the instructions and data described in the protection target program can be subjected to multiple disguises that are disguised multiple times, analysis and falsification of the protection target program can be made more difficult.

以上、この発明の実施形態につき、図面を参照して詳述してきたが、具体的な構成はこの実施形態に限られるものではなく、この発明の要旨を逸脱しない範囲の設計等も含まれる。   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.

例えば、上述の実施形態では、ステップS18において偽装処理を挿入することとした。このため、挿入した偽装処理を実行すると、元の命令および元のデータは、それぞれ、ダミーの命令およびダミーのデータに置換される。ここで、偽装処理の実行により置換されるダミーの命令およびダミーのデータは、それぞれ、ステップS16において置換したダミーの命令およびダミーのデータと同一であってもよいし、異なっていてもよい。   For example, in the above-described embodiment, the impersonation process is inserted in step S18. Therefore, when the inserted camouflage process is executed, the original instruction and the original data are replaced with the dummy instruction and the dummy data, respectively. Here, the dummy instruction and the dummy data replaced by the execution of the camouflage process may be the same as or different from the dummy instruction and the dummy data replaced in step S16, respectively.

また、上述の実施形態では、ステップS17において復元処理を挿入した後、ステップS18において偽装処理を挿入したが、これに限らず、例えば偽装処理を挿入した後に復元処理を挿入してもよい。   In the above-described embodiment, after the restoration process is inserted in step S17, the impersonation process is inserted in step S18. However, the present invention is not limited to this. For example, the restoration process may be inserted after the impersonation process is inserted.

また、上述の実施形態では、ステップS12において反復回数Nを設定することとした。ここで、反復回数Nを大きくするに従って、保護対象プログラムの解析および改ざんの困難性を向上させることができるが、その一方で、自己書き換え処理装置1で処理された保護対象プログラムを実行する際のパフォーマンスが低下する。このため、反復回数Nは、保護対象プログラムの解析および改ざんの困難性の度合いと、自己書き換え処理装置1で処理された保護対象プログラムを実行する際のパフォーマンスと、を勘案して決定されることが好ましい。   In the above-described embodiment, the number of iterations N is set in step S12. 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-rewrite processing device 1 Performance is degraded. For this reason, the number of iterations N is determined in consideration of the degree of difficulty in analyzing and falsifying the protection target program and the performance when the protection target program processed by the self-rewrite processing device 1 is executed. Is preferred.

1・・・自己書き換え処理装置
10・・・CPU
20・・・キャッシュ
50、50A、60、60A、100・・・保護対象プログラム
52、63・・・復元処理
53、64・・・偽装処理
DESCRIPTION OF SYMBOLS 1 ... Self-rewriting processing apparatus 10 ... CPU
20: Cache 50, 50A, 60, 60A, 100 ... Protection target program 52, 63 ... Restoration processing 53, 64 ... Impersonation processing

Claims (5)

保護対象プログラムを記憶する記憶手段と、
前記保護対象プログラムに記述されている命令またはデータのうち少なくとも1つを選択する選択手段と、
前記選択手段により選択されたデータを参照する処理を、前記保護対象プログラムの中から検出する検出手段と、
前記選択手段により選択された命令をダミーの命令に置換するとともに、前記検出手段により検出された処理について、当該処理で参照されるデータをダミーのデータに置換する偽装手段と、
前記偽装手段により置換されたダミーの命令を元の命令に置換する第1復元処理と、前記偽装手段により置換されたダミーのデータを元のデータに置換する第2復元処理と、を前記保護対象プログラムに挿入する第1挿入手段と、
前記第1復元処理の実行により置換された元の命令をダミーの命令に置換する第1偽装処理と、前記第2復元処理の実行により置換された元のデータをダミーのデータに置換する第2偽装処理と、を前記保護対象プログラムに挿入する第2挿入手段と、を備えることを特徴とする自己書き換え処理装置。
Storage means for storing the protection target program;
Selecting means for selecting at least one of instructions or data described in the protection target program;
Detecting means for detecting processing referring to the data selected by the selecting means from the protection target program;
Disguise means for replacing the instruction selected by the selection means with a dummy instruction and replacing the data referred to in the processing with dummy data for the processing detected by the detection means;
A first restoration process that replaces the dummy instruction replaced by the impersonation means with the original instruction and a second restoration process that replaces the dummy data replaced by the impersonation means with the original data First insertion means for inserting into the program;
A first disguise process for replacing the original instruction replaced by execution of the first restoration process with a dummy instruction; and a second for replacing original data replaced by execution of the second restoration process with dummy data. A self-rewriting processing apparatus comprising: a second insertion unit that inserts a camouflage process into the protection target program.
前記第1挿入手段は、前記第1復元処理を、前記保護対象プログラムのうち、前記偽装手段により置換されたダミーの命令より前方に挿入するとともに、前記第2復元処理を、前記保護対象プログラムのうち、前記偽装手段により置換されたダミーのデータを参照する処理より前方に挿入し、
前記第2挿入手段は、前記第1偽装処理を、前記保護対象プログラムのうち、前記偽装手段により置換されたダミーの命令より後方に挿入するとともに、前記第2偽装処理を、前記保護対象プログラムのうち、前記偽装手段により置換されたダミーのデータを参照する処理より後方に挿入することを特徴とする請求項1に記載の自己書き換え処理装置。
The first insertion means inserts the first restoration processing ahead of the dummy instruction replaced by the camouflage means in the protection target program, and the second restoration processing is performed on the protection target program. Among them, inserted before the process of referring to the dummy data replaced by the disguise means,
The second insertion means inserts the first camouflage process behind the dummy instruction replaced by the camouflage means in the protection target program and the second camouflage process of the protection target program. 2. The self-rewriting processing apparatus according to claim 1, wherein the self-rewriting processing device is inserted behind the processing of referring to the dummy data replaced by the camouflage means.
前記選択手段による選択と、前記検出手段による検出と、前記偽装手段による置換と、前記第1挿入手段による挿入と、前記第2挿入手段による挿入と、を予め定められた回数だけ繰り返すことを特徴とする請求項1または2に記載の自己書き換え処理装置。   The selection by the selection means, the detection by the detection means, the replacement by the impersonation means, the insertion by the first insertion means, and the insertion by the second insertion means are repeated a predetermined number of times. The self-rewriting processing device according to claim 1 or 2. 選択手段、検出手段、偽装手段、第1挿入手段、および第2挿入手段を備える自己書き換え処理装置における自己書き換え処理方法であって、
前記選択手段が、保護対象プログラムに記述されている命令またはデータのうち少なくとも1つを選択する第1ステップと、
前記検出手段が、前記第1ステップにおいて選択したデータを参照する処理を、前記保護対象プログラムの中から検出する第2ステップと、
前記偽装手段が、前記第1ステップにおいて選択した命令をダミーの命令に置換するとともに、前記第2ステップにおいて検出した処理について、当該処理で参照されるデータをダミーのデータに置換する第3ステップと、
前記第1挿入手段が、前記第3ステップにおいて置換したダミーの命令を元の命令に置換する第1復元処理と、前記第3ステップにおいて置換したダミーのデータを元のデータに置換する第2復元処理と、を前記保護対象プログラムに挿入する第4ステップと、
前記第2挿入手段が、前記第1復元処理の実行により置換された元の命令をダミーの命令に置換する第1偽装処理と、前記第2復元処理の実行により置換された元のデータをダミーのデータに置換する第2偽装処理と、を前記保護対象プログラムに挿入する第5ステップと、を備えることを特徴とする自己書き換え処理方法。
A self-rewrite processing method in a self-rewrite processing device comprising a selection means, a detection means, a camouflage means, a first insertion means, and a second insertion means,
A first step in which the selecting means selects at least one of instructions or data described in the protection target program;
A second step of detecting, from the protection target program, a process in which the detecting means refers to the data selected in the first step;
A third step in which the camouflage means replaces the instruction selected in the first step with a dummy instruction, and replaces data referred to in the process with dummy data for the process detected in the second step; ,
The first insertion means replaces the dummy instruction replaced in the third step with the original instruction, and the second recovery replaces the dummy data replaced in the third step with the original data. A fourth step of inserting a process into the protected program;
The second insertion means replaces the original instruction replaced by the execution of the first restoration process with a dummy instruction, and the original data replaced by the execution of the second restoration process is a dummy. A self-rewriting processing method, comprising: a second disguise process for replacing the data with a fifth step of inserting into the protection target program.
保護対象プログラムに記述されている命令またはデータのうち少なくとも1つを選択する第1ステップと、
前記第1ステップにおいて選択したデータを参照する処理を、前記保護対象プログラムの中から検出する第2ステップと、
前記第1ステップにおいて選択した命令をダミーの命令に置換するとともに、前記第2ステップにおいて検出した処理について、当該処理で参照されるデータをダミーのデータに置換する第3ステップと、
前記第3ステップにおいて置換したダミーの命令を元の命令に置換する第1復元処理と、前記第3ステップにおいて置換したダミーのデータを元のデータに置換する第2復元処理と、を前記保護対象プログラムに挿入する第4ステップと、
前記第1復元処理の実行により置換された元の命令をダミーの命令に置換する第1偽装処理と、前記第2復元処理の実行により置換された元のデータをダミーのデータに置換する第2偽装処理と、を前記保護対象プログラムに挿入する第5ステップと、をコンピュータに実行させるためのプログラム。
A first step of selecting at least one of instructions or data described in the protection target program;
A second step of detecting a process referring to the data selected in the first step from the protection target program;
A third step of replacing the instruction selected in the first step with a dummy instruction and replacing the data referenced in the process with the dummy data for the process detected in the second step;
A first restoration process that replaces the dummy instruction replaced in the third step with the original instruction, and a second restoration process that replaces the dummy data replaced in the third step with the original data. A fourth step to insert into the program;
A first disguise process for replacing the original instruction replaced by execution of the first restoration process with a dummy instruction; and a second for replacing original data replaced by execution of the second restoration process with dummy data. A program for causing a computer to execute a disguise process and a fifth step of inserting the impersonation process into the protection target program.
JP2010057210A 2010-03-15 2010-03-15 Self-rewriting processing device, self-rewriting processing method, and program Expired - Fee Related JP5416623B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2010057210A JP5416623B2 (en) 2010-03-15 2010-03-15 Self-rewriting processing device, self-rewriting processing method, and program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2010057210A JP5416623B2 (en) 2010-03-15 2010-03-15 Self-rewriting processing device, self-rewriting processing method, and program

Publications (2)

Publication Number Publication Date
JP2011191993A JP2011191993A (en) 2011-09-29
JP5416623B2 true JP5416623B2 (en) 2014-02-12

Family

ID=44796836

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2010057210A Expired - Fee Related JP5416623B2 (en) 2010-03-15 2010-03-15 Self-rewriting processing device, self-rewriting processing method, and program

Country Status (1)

Country Link
JP (1) JP5416623B2 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP3591550A1 (en) 2018-07-06 2020-01-08 Koninklijke Philips N.V. A compiler device with masking function

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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

Also Published As

Publication number Publication date
JP2011191993A (en) 2011-09-29

Similar Documents

Publication Publication Date Title
EP2486482B1 (en) A system and method for aggressive self-modification in dynamic function call systems
CN104834859B (en) The dynamic testing method of malicious act in a kind of Android applications
Ma et al. Accurate, low cost and instrumentation-free security audit logging for windows
CN104123493B (en) The safety detecting method and device of application program
CN109308415B (en) Binary-oriented guidance quality fuzzy test method and system
CN105787305B (en) A kind of method for protecting software for resisting semiology analysis and stain analysis
CN106326737B (en) System and method for detecting the harmful file that can be executed on virtual stack machine
WO2007025279A3 (en) Apparatus and method for analyzing and supplementing a program to provide security
KR102317833B1 (en) method for machine LEARNING of MALWARE DETECTING MODEL AND METHOD FOR detecting Malware USING THE SAME
EP3264274B1 (en) Input discovery for unknown program binaries
CN103065069A (en) Shell technology based software protection method
CN111881471A (en) Non-intrusive log data desensitization method, device and system
JP2015130152A (en) Information processing device and program
EP3428828A1 (en) System and method for locating and correcting vulnerabilites in a target computer system
JP2006191520A5 (en)
JP5416623B2 (en) Self-rewriting processing device, self-rewriting processing method, and program
CN108334756B (en) Interference method and device for decompiling recursive descent type analyzer
JP5417228B2 (en) Self-rewriting processing device, self-rewriting processing method, and program
KR102090229B1 (en) Method and apparatus for identifying security vulnerability and cause point thereof of executable binaries
CN110414220A (en) Operation file extracting method and device during sandbox internal program Dynamic Execution
JP2012208655A (en) Self-rewriting processing device, self-rewriting processing method, and program
Shin et al. Data Hiding in Windows Executable Files
CN104956337B (en) The control method of computer installation and computer installation
JP5477994B2 (en) Self-rewriting processing device, self-rewriting processing method, and program
CN109933962A (en) The software watermark process hereby guessed based on koala

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20120830

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20130821

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20130903

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20131018

TRDD Decision of grant or rejection written
A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20131115

R150 Certificate of patent or registration of utility model

Ref document number: 5416623

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

LAPS Cancellation because of no payment of annual fees