






本発明は、コンピュータセキュリティ技術分野に関し、具体的には、コード類似性に基づくファジィテスト方法、装置及び記憶媒体に関する。TECHNICAL FIELD The present invention relates to the technical field of computer security, and more particularly to a code similarity-based fuzzy test method, apparatus and storage medium.
ソフトウェアクローニングとはソースコードをコピーしてペーストすることで再利用することである。これらのクローンは、新しい環境や用途に適応するように少し改変されることがある。コードクローニングの問題は、コピー毎にオリジナルドキュメントのエラーを修正しなければならないため、拡張や調整などの変更を行う場合も複数回行う必要がある。しかし、作成者は、通常、コードコピーの位置を記録しない。この場合、これらを検出することは非常に困難である。Software cloning is the reuse of source code by copying and pasting it. These clones may be slightly modified to adapt to new environments and uses. The problem with code cloning is that errors in the original document must be corrected for each copy, so changes such as extensions and adjustments must be made multiple times. However, authors usually do not record the location of code copies. In this case it is very difficult to detect them.
コードの再利用により、ソフトウェアシステムに複数の類似するコードが発生し、それによりソフトウェアシステムにおける全ての脆弱性を修復することが困難であり、すなわち脆弱性は複数のソフトウェアプログラムに存在する可能性があり、十分に追跡できない。これは類似する脆弱性がプログラムにおける異なる場所に潜むことを引き起こす。すべての脆弱性インスタンスを網羅することができないため、すべての脆弱性を修復プログラムで簡単に解決することはできない。追跡コードを再利用するのが簡単であるような気がするが、プログラム数が多いため、実際には管理できない。Code reuse results in multiple similar pieces of code in a software system, making it difficult to remediate all vulnerabilities in the software system, i.e. vulnerabilities may exist in multiple software programs. Yes, not trackable enough. This causes similar vulnerabilities to lurk in different places in the program. Not all vulnerabilities can be easily resolved with remediation programs because all vulnerability instances cannot be covered. It seems like it would be easy to reuse the tracking code, but the number of programs is really unmanageable.
これに鑑みて、本発明の実施例は、従来技術における、コードの再利用のためソフトウェアシステムにおいて全ての脆弱性検出を行う効率が低くなるという技術的問題を解決するように、コード類似性に基づくファジーテスト方法、装置及び記憶媒体を提供する。In view of this, embodiments of the present invention focus on code similarity so as to solve the technical problem in the prior art that code reuse reduces the efficiency of all vulnerability detection in software systems. A fuzzy test method, apparatus and storage medium are provided.
本発明が提供する技術的解決手段は以下のとおりである。The technical solutions provided by the present invention are as follows.
本発明の実施例の第1態様は、テスト対象のコードから選択された文に対してファジーテストを行い、トリガーされた異常なクラッシュの位置コードを得るステップと、類似度分析に基づいて、テスト対象のコードにおける類似コード情報を決定するステップであって、前記類似コード情報はテスト対象のコードにおける類似コード、異常なクラッシュの位置コードにおける類似コード及びテスト対象のコードにおける脆弱性データベースコードに類似したコードを含むステップと、前記類似コード情報に基づきファジーテストを再び行い、類似コード情報における異常なクラッシュの位置コードを得るステップと、前記テスト対象のコードにおける異常なクラッシュの位置コード及び類似コード情報における異常なクラッシュの位置コードに基づいて、テスト対象のコードにおける脆弱性情報を決定するステップと、を含むコード類似性に基づくファジーテスト方法を提供する。A first aspect of an embodiment of the present invention is the step of performing a fuzzy test on selected sentences from the code under test to obtain the location code of the anomalous crash triggered; determining similar code information in code under test, wherein the similar code information is similar to similar code in code under test, similar code in abnormal crash location code and vulnerability database code in code under test. performing a fuzzy test again based on the similar code information to obtain an abnormal crash location code in the similar code information; determining vulnerability information in the code under test based on the location code of the anomalous crash.
選択的には、テスト対象のコードから選択された文に対してファジーテストを行い、トリガーされた異常なクラッシュの位置コードを得るステップは、グレイボックスファジーテストアルゴリズムに基づきテスト対象のコードから選択された文に対してファジーテストを行い、トリガーされた異常なクラッシュの位置コードを得るステップを含む。Optionally, the step of performing fuzzy testing on selected sentences from the code under test to obtain location codes for triggered abnormal crashes comprises selecting from the code under test based on a gray box fuzzy testing algorithm. performing a fuzzy test on the sentence to obtain the location code of the anomalous crash triggered.
選択的には、グレイボックスファジーテストアルゴリズムに基づきテスト対象のコードから選択された文に対してファジーテストを行い、トリガーされた異常なクラッシュの位置コードを得るステップは、リソーススケジューリングアルゴリズムを用いてテスト対象のコードにおけるファジーテストを行う条件文を選択するステップと、初期シードに対して汚染点追跡を行い、前記初期シードにおける条件文への入りに影響を与えるキーバイトを得るステップと、勾配降下アルゴリズムを用いて前記キーバイトに対して変異を行い、変異シードを得るステップと、テスト対象のコードにおける条件文に入ることができる解を得るまで、変異シードをテスト対象のコードに入力して実行するステップと、得られた解をファジーテストを行うように選択された文に入力し、予め設定された時間内に異常なクラッシュをトリガーできなくなるまで、上記汚染点追跡、シード変異及び実行のプロセスを繰り返すステップと、を含む。Optionally, the step of fuzzy testing selected sentences from the code under test based on a gray box fuzzy testing algorithm to obtain location codes for triggered abnormal crashes is tested using a resource scheduling algorithm. selecting a conditional statement for fuzzy testing in the code of interest; performing taint tracing on an initial seed to obtain key bytes that affect conditional statement entry in said initial seed; and a gradient descent algorithm. to obtain a mutation seed by mutating the key byte using ; step and input the resulting solution into the sentence selected to perform the fuzzy test, repeating the above process of taint point tracking, seed mutation and execution until no abnormal crash can be triggered within a preset time. and repeating.
選択的には、類似度分析に基づいて、テスト対象のコードにおける類似コード情報を決定するステップは、テスト対象のコードをコード行レベルのコードファイル及びコードブロックレベルのコードファイルに切り分けるステップと、コード行レベルのコードファイルに対して類似度分析を行い、第1の類似コードを得るステップと、コードブロックレベルのコードファイルに対して類似度分析を行い、第2の類似コードを得るステップと、第1の類似コード及び第2の類似コードに基づきテスト対象のコードにおける類似コード情報を得るステップと、を含む。Optionally, determining similar code information in the code under test based on the similarity analysis comprises dividing the code under test into code line level code files and code block level code files; performing similarity analysis on line-level code files to obtain first similar code; performing similarity analysis on code block-level code files to obtain second similar code; obtaining similar code information in the code under test based on the one similar code and the second similar code.
選択的には、類似度分析に基づいて、テスト対象のコードにおける類似コード情報を決定するステップは、異常なクラッシュの位置コードをコード行レベル及びコードブロックレベルにおいてテスト対象のコードと類似度分析を行い、異常なクラッシュの位置コードにおけるコード行類似コード及びコードブロック類似コードを得るステップと、テスト対象のコードを予め設定された脆弱性データベースにおけるコードと類似度分析を行い、テスト対象のコードにおける脆弱性データベースコードに類似したコードを得るステップと、をさらに含む。Optionally, the step of determining similar code information in the code under test based on the similarity analysis includes performing the similarity analysis on the code under test at the code line level and the code block level for the location code of the anomalous crashes. to obtain code line similar code and code block similar code in the location code of the abnormal crash; obtaining a code similar to the sex database code.
選択的には、前記類似コード情報に基づきファジーテストを再び行い、類似コード情報における異常なクラッシュの位置コードを得るステップは、コードブロックレベルにおけるコードブロックと類似コード情報におけるコードとの間の距離を計算するステップと、グレイボックスファジーテストにおける各シードが通ったコードブロックの対応する距離の平均値を計算するステップと、平均値が最も小さい場合の対応するシードを選択して変異を行った後にテスト対象のコードに入力してファジーテストを再び行い、類似コード情報における異常なクラッシュの位置コードを得るステップと、を含む。Optionally, the step of performing the fuzzy test again based on the similar code information to obtain the location code of the abnormal crash in the similar code information includes calculating the distance between the code block at the code block level and the code in the similar code information. calculating the average of the corresponding distances of the code blocks traversed by each seed in the greybox fuzzy test, selecting the corresponding seed with the smallest average and performing the mutation before testing Entering the code of interest and performing the fuzzy test again to obtain the location code of the abnormal crash in the similar code information.
選択的には、平均値が最も小さい場合の対応するシードを選択して変異を行った後にテスト対象のコードに入力してファジーテストを再び行い、類似コード情報における異常なクラッシュの位置コードを得るステップは、各シードの対応する平均値に基づいて平均値が最も小さい場合の対応するシードを類似コード情報のファジーテストのテストシードとして選択するステップと、勾配降下アルゴリズムを用いて前記テストシードに対して変異を行い、変異シードを得るステップと、グレイボックスファジーテストアルゴリズムに基づき、変異シードを用いてテスト対象のコードに入力しファジーテストを再び行い、類似コード情報における異常なクラッシュの位置コードを得るステップと、を含む。Alternatively, select the corresponding seed with the smallest average value, mutate it, and then enter it into the code under test to perform the fuzzy test again to obtain the location code of the abnormal crash in the similar code information. selecting the corresponding seed with the smallest mean value as a test seed for a fuzzy test of similar code information based on the corresponding mean value of each seed; to obtain a mutation seed, and according to the gray box fuzzy test algorithm, the mutation seed is used to input the code under test and perform the fuzzy test again to obtain the location code of the abnormal crash in the similar code information. and a step.
選択的には、以下の式により、コードブロックレベルにおけるコードブロックと類似コード情報におけるコードとの間の距離を計算する
以下の式により、グレイボックスファジーテストにおける各シードが通ったコードブロックの対応する距離の平均値を計算する
本発明の実施例の第2態様は、テスト対象のコードから選択された文に対してファジーテストを行い、トリガーされた異常なクラッシュの位置コードを得るための第1のテストモジュールと、類似度分析に基づいて、テスト対象のコードにおける類似コード情報を決定するための類似分析モジュールであって、前記類似コード情報はテスト対象のコードにおける類似コード、異常なクラッシュの位置コードにおける類似コード及びテスト対象のコードにおける脆弱性データベースコードに類似したコードを含む類似分析モジュールと、前記類似コード情報に基づきファジーテストを再び行い、類似コード情報における異常なクラッシュの位置コードを得るための第2のテストモジュールと、前記テスト対象のコードにおける異常なクラッシュの位置コード及び類似コード情報における異常なクラッシュの位置コードに基づいて、テスト対象のコードにおける脆弱性情報を決定するための脆弱性決定モジュールと、を含むコード類似性に基づくファジーテスト装置を提供する。A second aspect of an embodiment of the present invention comprises: a first test module for performing a fuzzy test on selected sentences from the code under test to obtain the location code of the anomalous crash triggered; A similarity analysis module for determining similar code information in code under test based on analysis, wherein the similar code information includes similar code in code under test, similar code in abnormal crash location code and test target a similarity analysis module containing code similar to the vulnerability database code in the code of and a second test module for performing the fuzzy test again based on the similar code information to obtain an abnormal crash location code in the similar code information; , a vulnerability determination module for determining vulnerability information in the code under test based on the abnormal crash location code in the code under test and the abnormal crash location code in the similar code information. A similarity-based fuzzy test device is provided.
本発明の実施例の第3態様は、本発明の実施例の第1態様及び第1態様のいずれかに記載のコード類似性に基づくファジーテスト方法を前記コンピュータに実行させるためのコンピュータ命令が記憶されているコンピュータ可読記憶媒体を提供する。A third aspect of the embodiment of the present invention is a computer instruction stored therein for causing the computer to execute the fuzzy testing method based on code similarity according to any one of the first aspect and the first aspect of the embodiment of the present invention. A computer-readable storage medium is provided.
本発明の実施例の第4態様は、メモリ及びプロセッサを含み、前記メモリと前記プロセッサは互いに通信可能に接続され、前記メモリにはコンピュータ命令が記憶されており、前記プロセッサは前記コンピュータ命令を実行することにより本発明の実施例の第1態様及び第1態様のいずれかに記載のコード類似性に基づくファジーテスト方法を実行する電子機器を提供する。A fourth aspect of an embodiment of the present invention includes a memory and a processor, the memory and the processor communicatively coupled to each other, the memory storing computer instructions, the processor executing the computer instructions. to provide an electronic device for executing the code similarity-based fuzzy testing method according to any one of the first aspect and the first aspect of the embodiments of the present invention.
本発明に係る技術的解決手段は、以下の効果を有する。The technical solution according to the present invention has the following effects.
本発明の実施例に係るコード類似性に基づくファジーテスト方法、装置及び記憶媒体は、類似コード情報をガイドとして、テスト対象のコードと類似コード情報に対してファジーテストを行い、そのうち、コード類似度分析が静的方法であり、ファジーテストが動的方法であり、該ファジーテスト方法は2つの方法を組み合わせたものであり、コード類似度の計算はファジーテストに目標を提供し、ファジーテストはコード類似度の計算にサンプルを提供し、2つの方法を組み合わせることにより、コードの再使用やコピーによって引き起こされる脆弱性を可能な限り見つけるという効果が実現される。そして、プログラムの作成者は大規模なプロジェクトのコードプログラムを作成する過程で、コードのコピーや再使用を行うことが多く、この現象はプログラムの安全性の問題をもたらしている。該方法はコード類似性を導入することにより、プログラムコードに対して多角度的な類似性研究を行い、そのうちの潜在的な隠れた危険コードを比較全面的に見つけ、ソフトウェア脆弱性を発見する可能性を大幅に向上させるとともに、ファジーテストの脆弱性発見の速度を加速させ、ファジーテストの効率は効果的に向上する。The fuzzy test method, device, and storage medium based on code similarity according to the embodiments of the present invention use similar code information as a guide to perform a fuzzy test on a code to be tested and similar code information. Analysis is a static method, fuzzy testing is a dynamic method, the fuzzy testing method is a combination of the two methods, code similarity calculation provides a goal for fuzzy testing, and fuzzy testing is a code By providing samples for similarity calculation and combining the two methods, the effect of finding as many vulnerabilities as possible caused by code reuse and copying is achieved. And in the course of creating code programs for large-scale projects, program creators often copy and reuse code, and this phenomenon brings about program security problems. By introducing code similarity, the method can conduct multi-angle similarity research on program code, comprehensively find potentially hidden dangerous code, and discover software vulnerabilities. While greatly improving the efficiency of fuzzy testing, the speed of fuzzy testing vulnerability discovery is accelerated, and the efficiency of fuzzy testing is effectively improved.
本発明の具体的な実施形態又は従来技術における技術的解決手段をより明確に説明するために、以下、具体的な実施形態又は従来技術の記述のために使用した図面を簡単に説明するが、明らかに、以下に記述した図面は本発明のいくつかの実施形態であり、当業者にとって、創造的な労力をせずに、これらの図面に基づいて他の図面を得ることもできる。In order to describe the specific embodiments of the present invention or the technical solutions in the prior art more clearly, the following briefly describes the drawings used to describe the specific embodiments or the prior art, Apparently, the drawings described below are some embodiments of the present invention, and those skilled in the art can also obtain other drawings based on these drawings without creative efforts.
当業者が本発明の解決手段をより良好に理解できるために、以下、本発明の実施例における図面を参照しながら、本発明の実施例における技術的解決手段を明確で完全に記述し、明らかなように、記述される実施例は本発明の一部の実施例に過ぎず、すべての実施例ではない。本発明の実施例に基づき、当業者であれば、創造的な労働を必要とせずに取得するすべてのその他の実施例はいずれも本発明の保護範囲に属する。In order for those skilled in the art to better understand the solutions of the present invention, the following clearly and completely describes the technical solutions in the embodiments of the present invention with reference to the drawings in the embodiments of the present invention. As such, the described embodiments are only some, but not all embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by persons skilled in the art without creative labor fall within the protection scope of the present invention.
本発明の明細書、特許請求の範囲及び上記図面における用語「第1」、「第2」、「第3」、「第4」等は類似する対象を区別するために用いられ、特定の順序又は優先順位を記述するために用いられる必要はない。ここで記述される実施例がここで示され又は記述されたもの以外の順序で実施されることを可能にするために、このように使用された数字は適した場合であれば互いに取り替え可能なことは、理解されるべきである。また、用語「含む」と「有する」及びそれらの任意の変形は、非排他的な包含物をカバーすることを意図し、たとえば、一連のステップ又はユニットを含む過程、方法、システム、製品又は機器は明確に示されるこれらのステップ又はユニットに限定される必要がなく、明瞭に示されていない又はこれらの過程、方法、製品又は機器に固有の他のステップ又はユニットを含んでもよい。The terms "first", "second", "third", "fourth", etc. in the description, claims and drawings of the present invention are used to distinguish similar objects and are not in a particular order. or need not be used to describe priority. To allow the embodiments described herein to be practiced in orders other than that shown or described herein, the numbers so used are interchangeable where appropriate. That should be understood. Also, the terms "comprising" and "comprising" and any variations thereof are intended to cover non-exclusive inclusions, such as processes, methods, systems, products or devices comprising a series of steps or units. need not be limited to those steps or units explicitly indicated, and may include other steps or units not explicitly indicated or specific to these processes, methods, products or devices.
本発明の実施例によれば、コード類似性に基づくファジーテスト方法を提供し、説明する必要があるものとして、図面のフローチャートに示されるステップはたとえば一組のコンピュータ実行可能命令のコンピュータシステムに実行され得、且つ、フローチャートには論理的順序が示されているが、場合によって、ここでの順序と異なる順序で示され又は記述されるステップを実行することができる。According to an embodiment of the present invention, a method for fuzzy testing based on code similarity is provided, and as it needs to be explained, the steps shown in the flow charts of the drawings are performed, for example, by a computer system in a set of computer-executable instructions. and although the flow charts show a logical order, in some cases the steps shown or described can be performed in a different order than here.
本実施例では、コード類似性に基づくファジーテスト方法を提供し、コンピュータ、携帯電話、タブレットPC等の電子機器に適用されており、図1は本発明の実施例に係るコード類似性に基づくファジーテスト方法のフローチャートであり、図1に示すように、該方法は以下のステップを含む。This embodiment provides a fuzzy test method based on code similarity, which is applied to electronic devices such as computers, mobile phones, and tablet PCs. Fig. 1 is a flow chart of a test method, as shown in Fig. 1, the method includes the following steps;
ステップS101:テスト対象のコードから選択された文に対してファジーテストを行い、トリガーされた異常なクラッシュの位置コードを得る。具体的に、テスト対象のコードに対してファジーテストを行う時に、初期シードを選定しリソーススケジューリングアルゴリズムを用いて条件文を選択してから、初期シードをテスト対象のコードに入力し実行する。実行中、異常なクラッシュが検出された場合にプログラム脆弱性が発見されたと見なす。これにより、脆弱性情報を決定するために、ファジーテスト時のテスト対象のコードにおけるトリガーされた異常なクラッシュの位置コードを収集することができる。Step S101: Perform a fuzzy test on the sentences selected from the code under test to obtain the location code of the abnormal crash triggered. Specifically, when a fuzzy test is performed on the code under test, an initial seed is selected, a conditional statement is selected using a resource scheduling algorithm, and then the initial seed is input to the code under test for execution. Assume that a program vulnerability has been discovered if an unusual crash is detected during execution. This allows the location code of triggered anomalous crashes in the code under test during fuzzy testing to be collected for determining vulnerability information.
ステップS102:類似度分析に基づいて、テスト対象のコードにおける類似コード情報を決定し、前記類似コード情報はテスト対象のコードにおける類似コード、異常なクラッシュの位置コードにおける類似コード及びテスト対象のコードにおける脆弱性データベースコードに類似したコードを含む。Step S102: Based on the similarity analysis, determine similar code information in the code under test, wherein the similar code information includes similar code in the code under test, similar code in the abnormal crash location code and Contains code similar to vulnerability database code.
具体的に、コードの再使用により、ソフトウェアシステムには複数の類似又は同一のコードを含む可能性がある。ソフトウェアシステムにおけるコードのすべての脆弱性をより効率的且つ包括的に検出するために、テスト対象のコードに対して類似性分析を行って、テスト対象のコードにおけるすべての類似コードを取得することができる。同時に、テスト対象のコードを脆弱性があると検出されたコードと類似分析を行い、得られる類似コード情報は後続のファジーテスト過程を指導することができ、それによりファジーテストの効率が向上する。Specifically, due to code reuse, a software system may contain multiple similar or identical pieces of code. In order to more efficiently and comprehensively detect all vulnerabilities in code in software systems, similarity analysis can be performed on the code under test to obtain all similar code in the code under test. can. At the same time, the code under test is analyzed for similarity with the code detected as vulnerable, and the obtained similar code information can guide the subsequent fuzzy testing process, thereby improving the fuzzy testing efficiency.
類似コード情報の決定は具体的に、テスト対象のコードをコード行レベルのコードファイル及びコードブロックレベルのコードファイルに切り分けるステップと、コード行レベルのコードファイルに対して類似度分析を行い、第1の類似コードを得るステップと、コードブロックレベルのコードファイルに対して類似度分析を行い、第2の類似コードを得るステップと、第1の類似コード及び第2の類似コードに基づきテスト対象のコードにおける類似コード情報を得るステップと、異常なクラッシュの位置コードをコード行レベル及びコードブロックレベルにおいてテスト対象のコードと類似度分析を行い、異常なクラッシュの位置コードにおけるコード行類似コード及びコードブロック類似コードを得るステップと、テスト対象のコードを予め設定された脆弱性データベースにおけるコードと類似度分析を行い、テスト対象のコードにおける脆弱性データベースコードに類似したコードを得るステップと、を含む。Specifically, similar code information is determined by dividing the code under test into a code file at the code line level and a code file at the code block level, and performing similarity analysis on the code file at the code line level. performing similarity analysis on the code block level code file to obtain a second similar code; and code to be tested based on the first similar code and the second similar code and performing a similarity analysis on the abnormal crash location code with the code to be tested at the code line level and the code block level to obtain code line similar code and code block similarity in the abnormal crash location code obtaining a code; and performing similarity analysis on the code under test with code in a preset vulnerability database to obtain code similar to the vulnerability database code in the code under test.
テスト対象のコードに対して類似性分析を行う時に、コード行レベル及びコードブロックレベルという2つのレベルに切り分けられる。コード行レベルのコードファイルは複数のコード行ファイルを含み、複数のコード行ファイルに対して類似度分析を行い、複数のコード行における類似コードを決定し、同様に、コードブロックファイルに含まれる複数のコードブロックが類似度分析を行うと複数の類似したコードブロックを得ることもできる。検出された異常なクラッシュの位置コードに対して同様にコード行レベル及びコードブロックレベルにおいて類似性分析を行う。この他、テスト対象のコードのみを考慮すると脆弱性があるすべての位置コードを検出できない恐れがあるので、テスト対象のコードを予め設定された脆弱性データベースにおけるコードと類似度分析を行うことができる。該予め設定された脆弱性データベースは既存の知られている脆弱性データベース、たとえばCVE(Common Vulnerabilities & Exposures、共通の脆弱性及びリスク)脆弱性データベース及び脆弱性修復プログラムデータベース(VPD、Virtural Private Database)等であってもよい。When similarity analysis is performed on the code under test, it is cut into two levels: the code line level and the code block level. A code line level code file contains multiple code line files, performs similarity analysis on multiple code line files to determine similar code in multiple code lines, and likewise multiple code block files contained in code block files. code blocks can also obtain a plurality of similar code blocks by performing similarity analysis. A similarity analysis is performed at the code line level and code block level as well for the location code of the detected anomalous crashes. In addition, if only the code under test is considered, it may not be possible to detect all location codes with vulnerabilities, so similarity analysis can be performed between the code under test and the code in the pre-configured vulnerability database. . The preconfigured vulnerability database can be an existing known vulnerability database, such as a Common Vulnerabilities & Exposures (CVE) vulnerability database and a Vulnerability Repair Program database (VPD, Virtual Private Database). etc.
類似度分析を行う時に、既存の類似度分析ツールで実現することができ、たとえば、simツールを用いるか、又はその他のツール又はアルゴリズムで類似度分析を行う。simツールで類似度分析を行う場合、その主な分析プロセスは、入力をトークンに変換し、循環的に読み取ってトークンシーケンスを取得し、ハッシュテーブルを使用してフォワード参照テーブルを構築しマッチングを行うことを含む。When performing similarity analysis, it can be implemented with existing similarity analysis tools, such as using the sim tool, or performing similarity analysis with other tools or algorithms. When performing similarity analysis with the sim tool, its main analysis process is to convert the input into tokens, read it circularly to obtain the token sequence, and use the hash table to build a forward lookup table for matching. Including.
ステップS103:前記類似コード情報に基づきファジーテストを再び行い、類似コード情報における異常なクラッシュの位置コードを得る。具体的に、上記ステップでテスト対象のコードにおけるすべてのコード類似情報を決定した後に、該類似コードを新たなテスト対象のコードとしてファジーテストを行い続け、該類似コード情報における異常なクラッシュの位置コードを得る。Step S103: Perform the fuzzy test again based on the similar code information to obtain the location code of the abnormal crash in the similar code information. Specifically, after determining all the code similarity information in the code to be tested in the above step, the similar code is treated as a new code to be tested, and the fuzzy test is continued, and the location code of the abnormal crash in the similar code information get
ステップS104:前記テスト対象のコードにおける異常なクラッシュの位置コード及び類似コード情報における異常なクラッシュの位置コードに基づいて、テスト対象のコードにおける脆弱性情報を決定する。ファジーテストを行う時に、異常なクラッシュが発生するとプログラム脆弱性が発見されたと見なすため、テスト対象のコードにおける異常なクラッシュの位置コード及び類似コード情報を利用した後に発見された異常なクラッシュの位置コードを収集することによりテスト対象のコードにおけるプログラム脆弱性を決定することができる。Step S104: Determine vulnerability information in the code under test based on the location code of the abnormal crash in the code under test and the location code of the abnormal crash in the similar code information. Abnormal crash location code found after using the abnormal crash location code and similar code information in the code under test, because program vulnerability is considered to be discovered when an abnormal crash occurs when performing a fuzzy test can be used to determine program vulnerabilities in the code under test.
本発明の実施例に係るコード類似性に基づくファジーテスト方法は、類似コード情報をガイドとして、テスト対象のコードと類似コード情報に対してファジーテストを行い、そのうち、コード類似度分析が静的方法であり、ファジーテストが動的方法であり、該ファジーテスト方法は2つの方法を組み合わせたものであり、コード類似度の計算はファジーテストに目標を提供し、ファジーテストはコード類似度の計算にサンプルを提供し、2つの方法を組み合わせることにより、コードの再使用やコピーによって引き起こされる脆弱性を可能な限り見つけるという効果が実現される。そして、プログラムの作成者は大規模なプロジェクトのコードプログラムを作成する過程で、コードのコピーや再使用を行うことが多く、この現象はプログラムの安全性の問題をもたらしている。該方法はコード類似性を導入することにより、プログラムコードに対して多角度的な類似性研究を行い、そのうちの潜在的な隠れた危険コードを比較全面的に見つけ、ソフトウェア脆弱性を発見する可能性を大幅に向上させるとともに、ファジーテストの脆弱性発見の速度を加速させ、ファジーテストの効率は効果的に向上する。The fuzzy test method based on code similarity according to the embodiment of the present invention uses the similar code information as a guide to perform a fuzzy test on the code to be tested and the similar code information. , fuzzy testing is a dynamic method, the fuzzy testing method is a combination of two methods, code similarity calculation provides fuzzy testing with a goal, and fuzzy testing is a code similarity calculation By providing samples and combining the two methods, the effect of finding as many vulnerabilities as possible caused by code reuse and copying is realized. And in the course of creating code programs for large-scale projects, program creators often copy and reuse code, and this phenomenon brings about program security problems. By introducing code similarity, the method can conduct multi-angle similarity research on program code, comprehensively find potentially hidden dangerous code, and discover software vulnerabilities. While greatly improving the efficiency of fuzzy testing, the speed of fuzzy testing vulnerability discovery is accelerated, and the efficiency of fuzzy testing is effectively improved.
一態様では、テスト対象のコードから選択された文に対してファジーテストを行い、トリガーされた異常なクラッシュの位置コードを得るステップは、グレイボックスファジーテストアルゴリズムに基づきテスト対象のコードから選択された文に対してファジーテストを行い、トリガーされた異常なクラッシュの位置コードを得るステップを含む。具体的に、グレイボックスファジーテストを用いる場合、グレイボックステストツールAngoraで具体的なファジーテスト過程を実現することができ、又は他のファジーテストツールを用いてもよい。Angoraの主な目標は非記号実行の手段によってパス制約を解決することで、アクセスのコード被覆領域を増すことである。パス制約を効果的に解決するために、Angoraテストツールは主に、効率的なバイトレベル汚染点追跡、コンテキスト依存のパス分岐検出、勾配降下に基づく検索及び入力長さのインテリジェントな修正等といういくつかのキー技術を導入している。In one aspect, the step of performing a fuzzy test on selected sentences from the code under test to obtain the location code of the anomalous crash triggered is selected from the code under test based on a gray box fuzzy testing algorithm. It involves doing a fuzzy test on the sentence to get the location code of the triggered anomalous crash. Specifically, when gray-box fuzzy testing is used, a specific fuzzy-testing process can be implemented with the gray-box testing tool Angora, or other fuzzy-testing tools can be used. Angora's main goal is to increase the code coverage area of access by resolving path constraints by means of non-symbolic execution. In order to effectively resolve path constraints, Angora testing tools mainly use several techniques such as efficient byte-level taint point tracking, context-sensitive path branch detection, gradient descent-based search and intelligent modification of input length. Some key technologies have been introduced.
図2に示すように、グレイボックスファジーテストアルゴリズムに基づきテスト対象のコードから選択された文に対してファジーテストを行い、トリガーされた異常なクラッシュの位置コードを得るステップは以下のステップを含む。As shown in FIG. 2, performing fuzzy testing on selected sentences from the code under test based on the gray box fuzzy testing algorithm to obtain location codes of triggered abnormal crashes includes the following steps.
ステップS201:リソーススケジューリングアルゴリズムを用いてテスト対象のコードにおけるファジーテストを行う条件文を選択する。グレイボックスファジーテストアルゴリズムを選択する場合、Angoraにおいてリソーススケジューリングアルゴリズムを使用してテスト対象のコードからファジーテストを行うコード文を選択することができる。すなわち、シードがどの条件文に入るかを選択する。リソーススケジューリングアルゴリズムを用いることにより、Angoraはテスト対象のコードにおいて新たな発見されていないコードブロックを最大確率で見つけることができる。具体的に、リソーススケジューリングアルゴリズムについて、従来の知られているアルゴリズムを選択して実現されてもよく、本発明の実施例はここで繰り返し説明しない。Step S201: Select a conditional statement for fuzzy testing in the code under test using a resource scheduling algorithm. When choosing a gray-box fuzzy testing algorithm, a resource scheduling algorithm can be used in Angora to select code statements to fuzzy test from the code under test. That is, it chooses which conditional statement the seed falls into. By using a resource scheduling algorithm, Angora can find new undiscovered code blocks in the code under test with maximum probability. Specifically, for the resource scheduling algorithm, any conventional known algorithm may be selected and implemented, and the embodiments of the present invention will not be repeated here.
ステップS202:初期シードに対して汚染点追跡を行い、前記初期シードにおける条件文への入りに影響を与えるキーバイトを得る。具体的に、初期シードはグレイボックスファジーテストを行う前に予め決定されてもよい。コード文を選択した後、初期シードを入力し、その後汚染点追跡アルゴリズムを用いて初期シードにおける条件文への入りに影響を与えるキーバイトを得る。そのうち、分岐条件文はテスト対象のコードにおける判断文の判断条件であり、たとえばプログラムにおけるif、switch等である。汚染点追跡により初期シードにおける重要な部分のスクリーニングを実現することができ、具体的な汚染点追跡方法については従来の知られている方法を用いることができる。Step S202: Perform taint tracing on the initial seed to obtain the key bytes that influence conditional entry in the initial seed. Specifically, the initial seed may be pre-determined prior to performing the gray-box fuzzy test. After selecting a code statement, an initial seed is entered and then a tainted point tracking algorithm is used to obtain the key bytes that influence the entry into the conditionals in the initial seed. Of these, the branch conditional statement is the judgment condition of the judgment statement in the code under test, such as if, switch, etc. in the program. Contamination point tracking can realize the screening of the important part of the initial seed, and the specific contamination point tracking method can use the conventionally known method.
ステップS203:勾配降下アルゴリズムを用いて前記キーバイトに対して変異を行い、変異シードを得る。初期シードからスクリーニングされたキーバイトについては、勾配降下アルゴリズムを用いて変異を行って、変異シードを得ることができる。同様に、該勾配降下アルゴリズムは従来の知られているアルゴリズムを用いてもよい。Step S203: Perform mutation on the key bytes using a gradient descent algorithm to obtain mutation seeds. Key bytes screened from initial seeds can be mutated using a gradient descent algorithm to obtain mutation seeds. Similarly, the gradient descent algorithm may use conventional known algorithms.
ステップS204:テスト対象のコードにおける条件文に入ることができる解を得るまで、変異シードをテスト対象のコードに入力して実行する。そのうち、変異シードをテスト対象のコードに入力して実行し、条件文を実行した後にコードブロックが続くと条件文に入る解が見つけられる。該解は入力された変異シードである。Step S204: Input the mutation seed into the code under test and execute until a solution is obtained that can enter the conditional statement in the code under test. Among them, the mutation seed is entered into the code under test and executed, and when the code block follows after executing the conditional statement, a solution that enters the conditional statement is found. The solution is the input mutation seed.
ステップS205:得られる解をファジーテストを行うように選択された次の条件文に入力し、予め設定された時間内に異常なクラッシュをトリガーできなくなるまで、上記汚染点追跡、シード変異及び実行のプロセスを繰り返す。具体的に、対応する解を得た後、上記ステップを繰り返し続け、次のファジーテストを行う文を選択し、得られる解もしくは対応する変異シードを該文に入力し、上記ステップの汚染点追跡、シード変異及び解の取得のプロセスを繰り返し、その後、得られる解を次のファジーテストを行う文に入力し、上記プロセスを連続的に繰り返して、予め設定された時間内に異常なクラッシュをトリガーできなくなるまで、該プロセスを終了する。そのうち、該予め設定された時間は実際の状況に応じて決定される。Step S205: Input the resulting solution into the next conditional statement selected to do a fuzzy test, and repeat the above tainted point tracking, seed mutation and execution until no abnormal crash can be triggered within a preset time. Repeat process. Specifically, after obtaining the corresponding solution, continue to repeat the above steps, select the sentence to perform the next fuzzy test, enter the obtained solution or the corresponding mutation seed into the sentence, and follow the contamination point of the above step. , repeat the process of seed mutation and solution acquisition, then input the resulting solution into the next fuzzy test statement, and repeat the above process continuously to trigger an abnormal crash within a preset time. Terminate the process until it is no longer possible. Wherein, the preset time is determined according to the actual situation.
一実施形態では、図3に示すように、前記類似コード情報に基づきファジーテストを再び行い、類似コード情報における異常なクラッシュの位置コードを得るステップは以下のステップを含む。In one embodiment, as shown in FIG. 3, performing fuzzy test again based on the similar code information to obtain location codes of abnormal crashes in the similar code information includes the following steps.
ステップS301:コードブロックレベルにおけるコードブロックと類似コード情報におけるコードとの間の距離を計算する。具体的に、テスト対象のコードにおける異常なクラッシュの位置コードをより迅速に決定するために、指向性計算の方式で対応するプロセスを短縮することができる。先ず、上記切り分けられたコードブロックと決定された類似コード情報におけるコードとの間の距離を計算する。そのうち、該距離を計算する際に、静的処理プロセスで計算してもよく、すなわち、非実行プロセスで対応する距離を計算する。Step S301: Calculate the distance between the code block at the code block level and the code in the similar code information. Specifically, in order to more quickly determine the location code of abnormal crashes in the code under test, the corresponding process can be shortened in the manner of directional computation. First, the distance between the cut code block and the code in the determined similar code information is calculated. Meanwhile, when calculating the distance, it may be calculated in a static processing process, ie, calculate the corresponding distance in a non-executing process.
具体的に、上記切り分けられたコードブロックと決定された類似コード情報におけるコードとの間の距離はプログラム制御フローグラフにおける2つのコードブロックの間の距離によって決定される。そのうち、プログラム制御フローグラフは制御フローグラフとも呼ばれ、1つのプロセス又はプログラムの抽象的な表現であり、コンパイラに使用される抽象的なデータ構造であり、コンパイラにより内部にメンテナンスされており、1つのプログラムの実行中にトラバーサルするすべてのパスを表す。それはグラフの形態で1つのプロセス内のすべての基本ブロックが実行する可能性のある流れを表し、1つのプロセスのリアルタイム実行プロセスを反映することもできる。Specifically, the distance between the cut code block and the code in the determined similar code information is determined by the distance between the two code blocks in the program control flow graph. Among them, the program control flow graph, also called the control flow graph, is an abstract representation of one process or program, an abstract data structure used by the compiler, and maintained internally by the compiler. Represents all paths traversed during the execution of one program. It represents the possible execution flows of all basic blocks within a process in the form of a graph, and can also reflect the real-time execution process of a process.
コードブロックレベルにおけるコードブロックと類似コード情報におけるコードとの間の距離は、コードブロックレベルの目標距離db(m,Tb)とも呼ばれ、1つのコードブロックmから類似コード情報におけるコードである目標コードブロック集合Tbまでの距離として定義され、その計算式は、
ステップS302:グレイボックスファジーテストにおける各シードが通ったコードブロックの対応する距離の平均値を計算する。上記ステップS201~ステップS205において、計算により複数の解もしくは複数の変異シードが得られており、これらの変異シードは上記ステップにおいてそれぞれテスト対象のコードに入力されて実行され、各変異シードがテスト対象のコードにおいて実行される時に通ったコードブロックをそれぞれ決定し、各コードブロックについてステップS301の計算により1つの距離を得ることができ、次に、各変異シードが通ったコードブロックの対応する距離に対して加算を行って平均値を求めることにより、各変異シードについて1つの距離値(対応する平均値)を得ることができる。Step S302: Calculate the average value of the corresponding distance of the code blocks passed by each seed in the gray box fuzzy test. In steps S201 to S205 above, a plurality of solutions or a plurality of mutation seeds are obtained by calculation, and these mutation seeds are respectively input to the code to be tested in the above steps and executed, and each mutation seed is a test target. and for each code block a distance can be obtained by the calculation in step S301, and then the corresponding distance of the code block passed by each mutation seed is One distance value (corresponding average value) can be obtained for each mutant seed by performing addition on and averaging.
具体的な計算式は、
ステップS303:平均値が最も小さい場合の対応するシードを選択して変異を行った後にテスト対象のコードに入力してファジーテストを再び行い、類似コード情報における異常なクラッシュの位置コードを得る。具体的に、上記計算により各変異シードの対応する距離値を得て、その後、これらの距離値を比較して、距離値が最も小さい場合の対応する変異シードを選択し、該変異シードに対して変異を行った後に実行プログラムに入力することにより対応する目標コード箇所(類似コード情報)を位置決めすることができる。そのうち、変異際に勾配降下アルゴリズムを用いて実現されてもよく、その後、グレイボックスファジーテストアルゴリズムに基づき、変異シードを用いてテスト対象のコードに入力しファジーテストを再び行い、類似コード情報における異常なクラッシュの位置コードを得る。Step S303: Select the corresponding seed with the smallest average value, mutate it, and then input it into the code under test to perform the fuzzy test again to obtain the location code of the abnormal crash in the similar code information. Specifically, the above calculation obtains the corresponding distance value of each mutation seed, and then compares these distance values to select the corresponding mutation seed with the smallest distance value, and for the mutation seed The corresponding target code location (similar code information) can be located by inputting to the execution program after performing the mutation. Among them, it can be realized by using the gradient descent algorithm during mutation, and then according to the gray box fuzzy test algorithm, the mutation seed is used to input the code under test to perform the fuzzy test again, and the abnormality in the similar code information is detected. Get the crash location code.
1つの実施形態では、図4に示すように、コード類似性に基づく該ファジーテスト方法は以下のプロセスで実現される。初期シードに対して変異を行った後に被テスト又はテスト対象プログラムに入力してAngoraにおいてグレイボックスファジーテストを行い、その後、グレイボックスファジーテストで得られる異常なクラッシュの位置コードを類似度分析ツールで分析し、一部の類似コード情報を得、同時に、テスト対象プログラムをコード用切り分けツールで切り分けてマルチレベルのコードファイル(コードブロックレベルのコードファイル及びコード行レベルのコードファイルを含む)を得、切り分けられたマルチレベルのコードファイル及び予め設定された脆弱性データベースを同様に類似度分析ツールで分析し、一部の類似コード情報を得、切り分けられたマルチレベルのコードファイルに対して同様に類似コード情報に加えて完成した類似コード情報を得る。得られた類似コード情報に対して指向性計算(距離及び平均値を計算する)により、Angoraに基づいてファジーテストを行い、最終的にテスト対象のコードにおける異常なクラッシュの位置コードを得る。In one embodiment, as shown in FIG. 4, the fuzzy testing method based on code similarity is implemented by the following process. After performing mutation on the initial seed, input it to the program under test or test target and perform a gray box fuzzy test in Angora, and then use the similarity analysis tool for the location code of the abnormal crash obtained by the gray box fuzzy test. Analyze and obtain some similar code information, and at the same time, divide the program under test with a code division tool to obtain a multi-level code file (including code block level code file and code line level code file), Separated multi-level code files and preset vulnerability databases are similarly analyzed with a similarity analysis tool to obtain some similar code information, and similarity is obtained for the separated multi-level code files. Obtain code information plus completed similar code information. A fuzzy test based on Angora is performed on the obtained similar code information by directional calculation (calculating the distance and average value), and finally the location code of the abnormal crash in the code under test is obtained.
本発明の実施例はコード類似性に基づくファジーテスト装置をさらに提供し、図5に示すように、該装置は、第1のテストモジュールと、類似分析モジュールと、第2のテストモジュールと、脆弱性決定モジュールとを含む。An embodiment of the present invention further provides a code-similarity-based fuzzy testing apparatus, as shown in FIG. and a sex determination module.
第1のテストモジュールは、テスト対象のコードから選択された文に対してファジーテストを行い、トリガーされた異常なクラッシュの位置コードを得るために用いられ、具体的な内容は上記方法実施例の対応する部分を参照でき、ここで繰り返し説明しない。The first test module is used to perform fuzzy tests on selected sentences from the code under test to obtain the location code of the triggered abnormal crash, the specific content of which is described in the above method embodiment. The corresponding parts can be referred to and will not be repeated here.
類似分析モジュールは、類似度分析に基づいて、テスト対象のコードにおける類似コード情報を決定するために用いられ、前記類似コード情報はテスト対象のコードにおける類似コード、異常なクラッシュの位置コードにおける類似コード及びテスト対象のコードにおける脆弱性データベースコードに類似したコードを含み、具体的な内容は上記方法実施例の対応する部分を参照でき、ここで繰り返し説明しない。The similarity analysis module is used to determine similar code information in the code under test based on the similarity analysis, the similar code information includes similar code in the code under test, similar code in the abnormal crash location code. and code similar to the vulnerability database code in the code under test, the specific content can refer to the corresponding part of the above method embodiments, and will not be repeated here.
第2のテストモジュールは、前記類似コード情報に基づきファジーテストを再び行い、類似コード情報における異常なクラッシュの位置コードを得るために用いられ、具体的な内容は上記方法実施例の対応する部分を参照でき、ここで繰り返し説明しない。The second test module is used to perform a fuzzy test again based on the similar code information to obtain the location code of the abnormal crash in the similar code information, the specific contents refer to the corresponding part of the above method embodiment. can be referenced and will not be repeated here.
脆弱性決定モジュールは、前記テスト対象のコードにおける異常なクラッシュの位置コード及び類似コード情報における異常なクラッシュの位置コードに基づいて、テスト対象のコードにおける脆弱性情報を決定するために用いられる。具体的な内容は上記方法実施例の対応する部分を参照でき、ここで繰り返し説明しない。The vulnerability determination module is used to determine vulnerability information in the code under test based on the abnormal crash location code in the code under test and the abnormal crash location code in the similar code information. The specific contents can be referred to the corresponding parts of the above method embodiments and will not be repeated here.
本発明の実施例に係るコード類似性に基づくファジーテスト装置は、類似コード情報をガイドとして、テスト対象のコードと類似コード情報に対してファジーテストを行い、そのうち、コード類似度分析が静的方法であり、ファジーテストが動的方法であり、該ファジーテスト装置は2つの方法を組み合わせたものであり、コード類似度の計算はファジーテストに目標を提供し、ファジーテストはコード類似度の計算にサンプルを提供し、2つの方法を組み合わせることにより、コードの再使用やコピーによって引き起こされる脆弱性を可能な限り見つけるという効果が実現される。そして、プログラムの作成者は大規模なプロジェクトのコードプログラムを作成する過程で、コードのコピーや再使用を行うことが多く、この現象はプログラムの安全性の問題をもたらしている。該装置はコード類似性を導入することにより、プログラムコードに対して多角度的な類似性研究を行い、そのうちの潜在的な隠れた危険コードを比較全面的に見つけ、ソフトウェア脆弱性を発見する可能性を大幅に向上させるとともに、ファジーテストの脆弱性発見の速度を加速させ、ファジーテストの効率は効果的に向上する。The fuzzy test device based on code similarity according to the embodiment of the present invention uses the similar code information as a guide to perform fuzzy tests on the code to be tested and the similar code information. , the fuzzy test is a dynamic method, the fuzzy test apparatus is a combination of two methods, the calculation of code similarity provides a target for fuzzy test, and the fuzzy test is By providing samples and combining the two methods, the effect of finding as many vulnerabilities as possible caused by code reuse and copying is realized. And in the course of creating code programs for large-scale projects, program creators often copy and reuse code, and this phenomenon brings about program security problems. By introducing code similarity, the device can conduct multi-angle similarity research on program code, comprehensively find potentially hidden dangerous code, and discover software vulnerabilities. While greatly improving the efficiency of fuzzy testing, the speed of fuzzy testing vulnerability discovery is accelerated, and the efficiency of fuzzy testing is effectively improved.
本発明の実施例に係るコード類似性に基づくファジーテスト装置の機能についての記述の細部は上記実施例におけるコード類似性に基づくファジーテスト方法についての記述を参照する。For the detailed description of the function of the fuzzy testing apparatus based on code similarity according to the embodiment of the present invention, please refer to the description of the fuzzy testing method based on code similarity in the above embodiments.
本発明の実施例は記憶媒体をさらに提供し、図6に示すように、プロセッサにより実行されると上記実施例におけるコード類似性に基づくファジーテスト方法のステップを実現するコンピュータプログラム601が記憶されている。該記憶媒体にはオーディオ/ビデオストリームデータ、特徴フレームデータ、相互作用要求シグナリング、暗号化されたデータ及び予め設定されたデータの大きさ等が記憶されている。そのうち、記憶媒体は磁気ディスク、光ディスク、読み出し専用メモリ(Read-Only  Memory、ROM)、ランダムアクセスメモリ(Random  Access  Memory、RAM)、フラッシュメモリ(Flash  Memory)、ハードディスク(Hard  Disk  Drive、HDDと略される)又はソリッドステートドライブ(Solid-State  Drive、SSD)等であってもよく、前記記憶媒体はさらに上記の種類のメモリの組み合わせを含んでもよい。Embodiments of the present invention further provide a storage medium, as shown in FIG. 6, storing a
当業者であれば、理解できるように、上記実施例の方法における全部又は一部のプロセスの実現は、コンピュータプログラムによって関連ハードウェアに命令を出して完成することができ、前記プログラムはコンピュータ可読記憶媒体等に記憶されてもよく、該プログラムが実行されるとき、上記各方法の実施例のプロセスを含んでもよい。そのうち、前記記憶媒体は磁気ディスク、光ディスク、読み出し専用メモリ(Read-Only Memory、ROM)、ランダムアクセスメモリ(Random AccessMemory、RAM)、フラッシュメモリ(Flash Memory)、ハードディスク(Hard Disk Drive、HDDと略される)又はソリッドステートドライブ(Solid-State Drive、SSD)等であってもよく、前記記憶媒体はさらに上記種類のメモリの組み合わせを含んでもよい。Those skilled in the art will understand that the implementation of all or part of the processes in the methods of the above embodiments can be completed by issuing instructions to relevant hardware by a computer program, which is stored in a computer readable memory. It may be stored in a medium or the like, and when the program is executed, it may include the processes of the above-described method embodiments. Among them, the storage medium includes a magnetic disk, an optical disk, a read-only memory (ROM), a random access memory (RAM), a flash memory, and a hard disk drive (HDD). ) or a Solid-State Drive (SSD), etc., and said storage medium may further comprise a combination of the above types of memory.
本発明の実施例は電子機器をさらに提供し、図7に示すように、該電子機器はプロセッサ51及びメモリ52を含んでもよく、プロセッサ51及びメモリ52はバス又はその他の形態で接続されてもよく、図7ではバスで接続されることを例にとる。Embodiments of the present invention further provide an electronic device, which may include a processor 51 and a memory 52, which may be connected by a bus or otherwise, as shown in FIG. In FIG. 7, an example of connection via a bus is taken as an example.
プロセッサ51は中央プロセッサ(Central Processing Unit、CPU)であってもよい。プロセッサ51は更に他の汎用プロセッサ、デジタル信号プロセッサ(Digital Signal Processor、DSP)、特定用途向け集積回路(Application Specific Integrated Circuit、ASIC)、フィールドプログラマブルゲートアレイ(Field-Programmable Gate Array、FPGA)又は他のプログラマブルロジックデバイス、ディスクリートゲート又はトランジスタ論理デバイス、ディスクリートハードウェア部品等のチップ、又は上記各種のチップの組み合わせであってもよい。Processor 51 may be a central processing unit (CPU). Processor 51 may also be any other general purpose processor, Digital Signal Processor (DSP), Application Specific Integrated Circuit (ASIC), Field-Programmable Gate Array (FPGA) or other It may be a chip such as a programmable logic device, a discrete gate or transistor logic device, a discrete hardware component, or a combination of the various types of chips.
メモリ52は非一時的コンピュータ可読記憶媒体として、非一時的ソフトウェアプログラム、非一時的コンピュータ実行可能プログラム及びモジュール、例えば本発明の実施例における対応するプログラム命令/モジュールを記憶するために用いることができる。プロセッサ51はメモリ52に記憶される非一時的ソフトウェアプログラム、命令及びモジュールを実行することにより、プロセッサの様々な機能アプリケーション及びデータ処理を実行し、すなわち上記方法実施例におけるコード類似性に基づくファジーテスト方法を実現する。Memory 52 can be used as a non-transitory computer-readable storage medium for storing non-transitory software programs, non-transitory computer-executable programs and modules, such as corresponding program instructions/modules in embodiments of the present invention. . The processor 51 executes the non-transitory software programs, instructions and modules stored in the memory 52 to perform the various functional applications and data processing of the processor, namely the fuzzy testing based on code similarity in the above method embodiments. implement the method.
メモリ52はプログラム記憶領域及びデータ記憶領域を含んでもよく、プログラム記憶領域はオペレーティング装置、少なくとも1つの機能に必要なアプリケーションプログラムを記憶してもよく、データ記憶領域はプロセッサ51が作成したデータ等を記憶してもよい。この他、メモリ52は高速ランダムアクセスメモリを含んでもよく、さらに非一時的メモリ、たとえば少なくとも1つの磁気ディスク記憶デバイス、フラッシュメモリデバイス、又はその他の非一時的ソリッドステートメモリデバイスを含んでもよい。いくつかの実施例では、選択的には、メモリ52はプロセッサ51に対して遠隔設置されたメモリを含み、これらの遠隔メモリはネットワークを介してプロセッサ51に接続され得る。上記ネットワークの実例はインターネット、イントラネット、ローカルエリアネットワーク、モバイル通信ネット及びこれらの組み合わせを含むが、これらに限らない。Memory 52 may include a program storage area and a data storage area, where the program storage area may store an operating system, application programs required for at least one function, and the data storage area may store data generated by processor 51, and the like. You can remember. Alternatively, memory 52 may include high speed random access memory and may also include non-transitory memory such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid state memory device. In some embodiments, memory 52 optionally includes memory remotely located relative to processor 51, and these remote memories may be connected to processor 51 via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
前記1つ又は複数のモジュールは前記メモリ52に記憶され、前記プロセッサ51によって実行されると、図1~4に示される実施例におけるコード類似性に基づくファジーテスト方法を実行する。The one or more modules are stored in the memory 52 and, when executed by the processor 51, perform the code similarity-based fuzzy testing method in the embodiments shown in FIGS. 1-4.
上記電子機器の具体的な細部は図1~図4に示される実施例における対応する関連記述及び効果を対応的に参照して理解することができ、ここで繰り返し説明しない。The specific details of the electronic device can be understood with corresponding reference to the corresponding related descriptions and effects in the embodiments shown in FIGS. 1-4 and will not be repeated here.
図面を参照しながら本発明の実施例を記述しているが、当業者であれば、本発明の精神及び範囲を逸脱することなく様々な修正や変形を行うことができ、このような修正や変形はいずれも添付の請求項によって限定される範囲内に属する。Although embodiments of the present invention have been described with reference to the drawings, various modifications and variations can be made by those skilled in the art without departing from the spirit and scope of the invention, and such modifications and variations can be made. All variations are within the scope defined by the appended claims.
| Application Number | Priority Date | Filing Date | Title | 
|---|---|---|---|
| CN202210401549.6ACN114491566B (en) | 2022-04-18 | 2022-04-18 | Fuzzy test method and device based on code similarity and storage medium | 
| CN202210401549.6 | 2022-04-18 | 
| Publication Number | Publication Date | 
|---|---|
| JP7290784B1true JP7290784B1 (en) | 2023-06-13 | 
| JP2023158623A JP2023158623A (en) | 2023-10-30 | 
| Application Number | Title | Priority Date | Filing Date | 
|---|---|---|---|
| JP2022182775AActiveJP7290784B1 (en) | 2022-04-18 | 2022-11-15 | Fuzzy test method, device and storage medium based on code similarity | 
| Country | Link | 
|---|---|
| JP (1) | JP7290784B1 (en) | 
| CN (1) | CN114491566B (en) | 
| Publication number | Priority date | Publication date | Assignee | Title | 
|---|---|---|---|---|
| CN117033171A (en)* | 2023-06-28 | 2023-11-10 | 清华大学 | Reproduction method, device, equipment and medium for triggering input data of software vulnerability | 
| CN117290856A (en)* | 2023-11-14 | 2023-12-26 | 广州红海云计算股份有限公司 | Intelligent test management system based on software automation test technology | 
| CN118132453A (en)* | 2024-05-10 | 2024-06-04 | 中移(杭州)信息技术有限公司 | Firmware testing method and device | 
| CN118227494A (en)* | 2024-04-01 | 2024-06-21 | 浪潮卓数大数据产业发展有限公司 | Code testing method, equipment and medium based on directional gray box fuzzy testing technology | 
| CN118427821A (en)* | 2024-04-11 | 2024-08-02 | 浙江大学 | A state-based fuzz testing method for industrial control protocols | 
| CN118733445A (en)* | 2024-06-17 | 2024-10-01 | 之江实验室 | An efficient fuzz testing method based on scoring matrix | 
| CN118939566A (en)* | 2024-10-15 | 2024-11-12 | 浙江大学 | A fuzzy testing method and device for conditional competition vulnerabilities in inter-process communication interfaces | 
| CN119046953A (en)* | 2024-11-01 | 2024-11-29 | 国网浙江省电力有限公司电力科学研究院 | Method, device, equipment and medium for testing fuzziness of firmware directional ash box of power equipment | 
| CN119415391A (en)* | 2024-10-23 | 2025-02-11 | 四川大学 | A fuzzy testing method and system for industrial control protocols based on large language model | 
| CN119697076A (en)* | 2025-01-23 | 2025-03-25 | 燕山大学 | Network protocol fuzz testing system based on enhanced context information | 
| CN119814353A (en)* | 2024-11-28 | 2025-04-11 | 华北电力科学研究院有限责任公司 | Network protocol gray box fuzz testing method and device based on device response status | 
| CN120086148A (en)* | 2025-04-30 | 2025-06-03 | 湖南泛联新安信息科技有限公司 | Implementation method and system for adapting existing fuzz testing engine to parallel architecture | 
| Publication number | Priority date | Publication date | Assignee | Title | 
|---|---|---|---|---|
| CN116383834B (en)* | 2023-06-02 | 2023-08-08 | 北京邮电大学 | Detection method for source code vulnerability detection tool abnormality and related equipment | 
| CN118586009A (en)* | 2024-08-06 | 2024-09-03 | 北京关键科技股份有限公司 | Code defect vulnerability scanning and determination method based on knowledge base | 
| Publication number | Priority date | Publication date | Assignee | Title | 
|---|---|---|---|---|
| JP2004062394A (en) | 2002-07-26 | 2004-02-26 | Toshiba Corp | Similar correction location search method and program for it | 
| JP2015179312A (en) | 2014-03-18 | 2015-10-08 | 株式会社東芝 | Information processor, information processing method, and program | 
| JP2018136763A (en) | 2017-02-22 | 2018-08-30 | 三菱電機株式会社 | Similar function extracting device and similar function extracting program | 
| US20200065226A1 (en) | 2018-08-22 | 2020-02-27 | Fujitsu Limited | Automated software program repair of similar code snippets | 
| Publication number | Priority date | Publication date | Assignee | Title | 
|---|---|---|---|---|
| US5574837A (en)* | 1995-01-17 | 1996-11-12 | Lucent Technologies Inc. | Method of generating a browser interface for representing similarities between segments of code | 
| US9098352B2 (en)* | 2013-07-17 | 2015-08-04 | Deja Vu Security, Llc | Metaphor based language fuzzing of computer code | 
| CN109635568B (en)* | 2018-11-26 | 2023-05-26 | 华中科技大学 | A concurrent vulnerability detection method based on the combination of static analysis and fuzz testing | 
| CN110008710B (en)* | 2019-04-15 | 2022-11-18 | 上海交通大学 | Vulnerability detection method based on deep reinforcement learning and program path instrumentation | 
| CN111831562A (en)* | 2020-07-08 | 2020-10-27 | 信联科技(南京)有限公司 | Fuzzy test case generation method based on machine learning, computer equipment and readable storage medium for operating method | 
| CN112800423B (en)* | 2021-01-26 | 2022-10-11 | 北京航空航天大学 | A binary code authorization vulnerability detection method | 
| CN113901474B (en)* | 2021-09-13 | 2022-07-26 | 四川大学 | A vulnerability detection method based on function-level code similarity | 
| Publication number | Priority date | Publication date | Assignee | Title | 
|---|---|---|---|---|
| JP2004062394A (en) | 2002-07-26 | 2004-02-26 | Toshiba Corp | Similar correction location search method and program for it | 
| JP2015179312A (en) | 2014-03-18 | 2015-10-08 | 株式会社東芝 | Information processor, information processing method, and program | 
| JP2018136763A (en) | 2017-02-22 | 2018-08-30 | 三菱電機株式会社 | Similar function extracting device and similar function extracting program | 
| US20200065226A1 (en) | 2018-08-22 | 2020-02-27 | Fujitsu Limited | Automated software program repair of similar code snippets | 
| Publication number | Priority date | Publication date | Assignee | Title | 
|---|---|---|---|---|
| CN117033171B (en)* | 2023-06-28 | 2024-03-26 | 清华大学 | Reproduction method, device, equipment and medium for triggering input data of software vulnerability | 
| CN117033171A (en)* | 2023-06-28 | 2023-11-10 | 清华大学 | Reproduction method, device, equipment and medium for triggering input data of software vulnerability | 
| CN117290856A (en)* | 2023-11-14 | 2023-12-26 | 广州红海云计算股份有限公司 | Intelligent test management system based on software automation test technology | 
| CN117290856B (en)* | 2023-11-14 | 2024-02-23 | 广州红海云计算股份有限公司 | Intelligent test management system based on software automation test technology | 
| CN118227494A (en)* | 2024-04-01 | 2024-06-21 | 浪潮卓数大数据产业发展有限公司 | Code testing method, equipment and medium based on directional gray box fuzzy testing technology | 
| CN118427821A (en)* | 2024-04-11 | 2024-08-02 | 浙江大学 | A state-based fuzz testing method for industrial control protocols | 
| CN118132453A (en)* | 2024-05-10 | 2024-06-04 | 中移(杭州)信息技术有限公司 | Firmware testing method and device | 
| CN118733445A (en)* | 2024-06-17 | 2024-10-01 | 之江实验室 | An efficient fuzz testing method based on scoring matrix | 
| CN118939566A (en)* | 2024-10-15 | 2024-11-12 | 浙江大学 | A fuzzy testing method and device for conditional competition vulnerabilities in inter-process communication interfaces | 
| CN119415391A (en)* | 2024-10-23 | 2025-02-11 | 四川大学 | A fuzzy testing method and system for industrial control protocols based on large language model | 
| CN119046953A (en)* | 2024-11-01 | 2024-11-29 | 国网浙江省电力有限公司电力科学研究院 | Method, device, equipment and medium for testing fuzziness of firmware directional ash box of power equipment | 
| CN119814353A (en)* | 2024-11-28 | 2025-04-11 | 华北电力科学研究院有限责任公司 | Network protocol gray box fuzz testing method and device based on device response status | 
| CN119697076A (en)* | 2025-01-23 | 2025-03-25 | 燕山大学 | Network protocol fuzz testing system based on enhanced context information | 
| CN120086148A (en)* | 2025-04-30 | 2025-06-03 | 湖南泛联新安信息科技有限公司 | Implementation method and system for adapting existing fuzz testing engine to parallel architecture | 
| Publication number | Publication date | 
|---|---|
| CN114491566B (en) | 2022-07-05 | 
| JP2023158623A (en) | 2023-10-30 | 
| CN114491566A (en) | 2022-05-13 | 
| Publication | Publication Date | Title | 
|---|---|---|
| JP7290784B1 (en) | Fuzzy test method, device and storage medium based on code similarity | |
| US11218510B2 (en) | Advanced cybersecurity threat mitigation using software supply chain analysis | |
| US11693962B2 (en) | Malware clustering based on function call graph similarity | |
| Tien et al. | Machine learning framework to analyze iot malware using elf and opcode features | |
| US10956477B1 (en) | System and method for detecting malicious scripts through natural language processing modeling | |
| US11916937B2 (en) | System and method for information gain for malware detection | |
| US20210092160A1 (en) | Data set creation with crowd-based reinforcement | |
| US20210240829A1 (en) | Malware Clustering Based on Analysis of Execution-Behavior Reports | |
| JP2009535747A (en) | Approximate pattern matching method and apparatus | |
| Martín et al. | Android malware characterization using metadata and machine learning techniques | |
| US7912894B2 (en) | Computerized, copy-detection and discrimination apparatus and method | |
| CN113168472A (en) | Utilization-based network security vulnerability repair method and system | |
| Rafiq et al. | AndroMalPack: enhancing the ML-based malware classification by detection and removal of repacked apps for Android systems | |
| CN113918951B (en) | Malicious code detection method and device based on abstract syntax tree and electronic equipment | |
| CN112131571B (en) | Threat tracing method and related equipment | |
| EP3692695B1 (en) | Intrusion investigation | |
| US12088602B2 (en) | Estimation apparatus, estimation method and program | |
| Akram et al. | DroidMD: an efficient and scalable android malware detection approach at source code level | |
| US20120185943A1 (en) | Classification of code constructs using string analysis | |
| Merlo et al. | Phishing kits source code similarity distribution: A case study | |
| CN105790967A (en) | Weblog processing method and device | |
| US11356853B1 (en) | Detection of malicious mobile apps | |
| CN115455425A (en) | Method, system, equipment and storage medium for generating protection patch | |
| CN110719274B (en) | Network security control method, device, device and storage medium | |
| US20250278268A1 (en) | Using Artificial Intelligence (AI) Algorithms to Identify Input that Produces Issues in AI Generated Source Code | 
| Date | Code | Title | Description | 
|---|---|---|---|
| A621 | Written request for application examination | Free format text:JAPANESE INTERMEDIATE CODE: A621 Effective date:20221115 | |
| A871 | Explanation of circumstances concerning accelerated examination | Free format text:JAPANESE INTERMEDIATE CODE: A871 Effective date:20230227 | |
| A131 | Notification of reasons for refusal | Free format text:JAPANESE INTERMEDIATE CODE: A131 Effective date:20230328 | |
| A521 | Request for written amendment filed | Free format text:JAPANESE INTERMEDIATE CODE: A523 Effective date:20230511 | |
| 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:20230523 | |
| A61 | First payment of annual fees (during grant procedure) | Free format text:JAPANESE INTERMEDIATE CODE: A61 Effective date:20230601 | |
| R150 | Certificate of patent or registration of utility model | Ref document number:7290784 Country of ref document:JP Free format text:JAPANESE INTERMEDIATE CODE: R150 |