NIST IR 8165 日本語訳
英語タイトル : Impact of Code Complexity on Software Analysis日本語タイトル : ソフトウェア分析におけるコード複雑性の影響
公開日 : 2017-02-09
原文URL : https://csrc.nist.gov/pubs/ir/8165/final
翻訳編集 : 自動生成(有志による非公式の日本語訳), 原文取得日 : 2026-10-31, 訳文 : 118 / 134 ブロック
[要約] NIST IR 8165 は、静的解析ツールの評価に携わる SAMATE チームが、数千件の警告を調べた結果をもとにまとめた論文です。ツールは、弱点がないことと、無関係なコード要素に埋もれた弱点があることとの区別が難しいとされ、本書はこうしたコード要素の分類を「コード複雑性」と呼んで示します。コード複雑性は、静的解析ツールを評価する際のテストケース生成戦略の一部として用いられてきたものであり、コーディングガイドラインの策定やテストケースの多様化に役立つとしています。本書はコード複雑性の要因と、学術界・産業界での適用事例を扱っており、撤回された刊行物である旨の表示が付いています。
Withdrawn NIST Technical Series Publication
撤回された NIST テクニカルシリーズ刊行物
| Warning Notice | |
|---|---|
| The attached publication has been withdrawn (archived), and is provided solely for historical purposes. It may have been superseded by another publication (indicated below). | |
| Withdrawn Publication | |
| Series/Number | NISTIR 8165 |
| Title | Impact of Code Complexity On Software Analysis |
| Publication Date(s) | 02/08/2017 |
| Withdrawal Date | 02/23/2023 |
| Withdrawal Note | Superseded by updated version |
| Superseding Publication(s) (if applicable) | |
| The attached publication has been superseded by the following publication(s): | |
| Series/Number | NIST IR 8165-upd1 |
| Title | Impact of Code Complexity On Software Analysis |
| Author(s) | Charles D. De Oliveira, Elizabeth Fong, Paul E. Black |
| Publication Date(s) | 02/23/2023 |
| URL/DOI | https:/ |
| Additional Information (if applicable) | |
| Contact | |
| Latest revision of the attached publication | |
| Related Information | |
| Withdrawal Announcement Link | |
| 警告 | |
|---|---|
| 添付の刊行物は撤回(アーカイブ)されており、歴史的な目的のためだけに提供されています。別の刊行物(下記に示します)に置き換えられている場合があります。 | |
| 撤回された刊行物 | |
| シリーズ/番号 | NISTIR 8165 |
| 題名 | Impact of Code Complexity On Software Analysis |
| 発行日 | 02/08/2017 |
| 撤回日 | 02/23/2023 |
| 撤回に関する注記 | 更新版に置き換えられました |
| 置き換えた刊行物 (該当する場合) | |
| 添付の刊行物は、次の刊行物に置き換えられました: | |
| シリーズ/番号 | NIST IR 8165-upd1 |
| 題名 | Impact of Code Complexity On Software Analysis |
| 著者 | Charles D. De Oliveira, Elizabeth Fong, Paul E. Black |
| 発行日 | 02/23/2023 |
| URL/DOI | https:/ |
| 追加情報 (該当する場合) | |
| 連絡先 | |
| 添付の刊行物の最新の改訂 | |
| 関連情報 | |
| 撤回の告知へのリンク | |
Date updated: February 23, 2023
更新日: 2023 年 2 月 23 日
NISTIR 8165
NISTIR 8165
Impact of Code Complexity On Software Analysis
ソフトウェア分析におけるコード複雑性の影響
Charles D. De Oliveira
Elizabeth Fong
Paul E. Black
Charles D. De Oliveira
Elizabeth Fong
Paul E. Black
This publication is available free of charge from:
https://doi.org/10.6028/NIST.IR.8165
この刊行物は次の場所から無料で入手できます:
https://doi.org/10.6028/NIST.IR.8165
[NIST のロゴ。公的な標章のため、この非公式サイトには掲載していません。原本 PDF を参照してください。]
NISTIR 8165
NISTIR 8165
Impact of Code Complexity On Software Analysis
ソフトウェア分析におけるコード複雑性の影響
Charles D. De Oliveira
Elizabeth Fong
Paul E. Black
Software and Systems Division
Information Technology Laboratory
Charles D. De Oliveira
Elizabeth Fong
Paul E. Black
ソフトウェア・システム部門
情報技術研究所
This publication is available free of charge from:
https://doi.org/10.6028/NIST.IR.8165
この刊行物は次の場所から無料で入手できます:
https://doi.org/10.6028/NIST.IR.8165
February 2017
2017 年 2 月
National Institute of Standards and Technology
Kent Rochford, Acting NIST Director and Under Secretary of Commerce for Standards and Technology
米国国立標準技術研究所
Kent Rochford、NIST 所長代行兼商務次官(標準・技術担当)
Abstract
概要
The Software Assurance Metrics and Tool Evaluation (SAMATE) team studied thousands of warnings from static analyzers. Tools have difficulty distinguishing between the absence of a weakness and the presence of a weakness that is buried in otherwise-irrelevant code elements. This paper presents classes of these code elements, which we call “code complexities.”
Software Assurance Metrics and Tool Evaluation(SAMATE)チームは、静的アナライザによる数千件の警告を調べました。ツールは、弱点が存在しないことと、それ以外は無関係なコード要素の中に埋もれた弱点が存在することを区別するのに苦労します。本稿は、これらのコード要素のクラスを示し、それを「コード複雑性」と呼びます。
They have been present in software assurance as part of test cases generation strategy when evaluating static analyzers. Benefits of using code complexity include the development of coding guidelines, boosting diversification of test cases.
これらは、静的アナライザを評価する際のテストケース生成戦略の一部として、ソフトウェアアシュアランスで用いられてきました。コード複雑性を使う利点には、コーディングガイドラインの策定や、テストケースの多様化の促進が含まれます。
Keywords: code complexity; test cases; static source code scanner; vulnerability; software assurance.
キーワード: コード複雑性、テストケース、静的ソースコードスキャナ、脆弱性、ソフトウェアアシュアランス。
DISCLAIMER
免責事項
Certain commercial entities, equipment, or materials may be identified in this document in order to describe an experimental procedure or concept adequately. Such identification is not intended to imply recommendation or endorsement by the National Institute of Standards and Technology, nor is it intended to imply that the entities, materials, or equipment are necessarily the best available for the purpose.
本書では、実験の手順や概念を適切に説明するために、特定の商業団体、機器、材料に言及している場合があります。そのような言及は、米国国立標準技術研究所による推奨や推薦を意味するものではなく、それらの団体、材料、機器がその目的に利用可能なもののうち必ずしも最良であることを意味するものでもありません。
Table of Contents
目次
1. Introduction
1. はじめに
How can one gain assurance that software is free from vulnerabilities? One step is to use static and dynamic analysis tools. Many of the common weakness and bug classes, such as buffer overflows, cross-site scripting and failures to validate input values, can be found by such automated tools.
ソフトウェアに脆弱性がないという確信は、どうすれば得られるでしょうか。1 つの手段は、静的および動的な分析ツールを使うことです。バッファオーバーフロー、クロスサイトスクリプティング、入力値の検証の失敗など、一般的な弱点やバグのクラスの多くは、このような自動化されたツールで見つけられます。
There are many types of static analysis tools today, both proprietary and open source. These tools analyze software and detect vulnerabilities. Although a tool may be able to detect vulnerabilities in many cases, a vulnerability may not be reported if it is surrounded by extraneous elements. The reasons vary. In order to be responsive and powerful, many tools employ sophisticated heuristics. These heuristics may be engineered to summarize or ignore data in order to minimize storage or to limit the depth and breadth of analysis to save time. Thus, these extraneous elements, which we call “code complexities,” may confuse static code analyzers, making bugs harder to find. This paper presents classes of code complexity.
今日では、プロプライエタリなものもオープンソースのものも含めて、多くの種類の静的分析ツールがあります。これらのツールはソフトウェアを分析し、脆弱性を検出します。ツールは多くの場合に脆弱性を検出できても、脆弱性が余分な要素に囲まれていると、報告されないことがあります。その理由はさまざまです。応答性が高く強力であるために、多くのツールは高度なヒューリスティクスを採用しています。これらのヒューリスティクスは、記憶域を最小化するため、または時間を節約するために分析の深さと幅を制限するために、データを要約または無視するように作られている場合があります。そのため、私たちが「コード複雑性」と呼ぶこれらの余分な要素が、静的コードアナライザを混乱させ、バグを見つけにくくすることがあります。本稿は、コード複雑性のクラスを示します。
1.1. Background
1.1. 背景
The Software Assurance Metrics and Tool Evaluation (SAMATE) project at the National Institute of Standards and Technology (NIST) [8] team studied a broad class of software assurance tools by performing a series of experiments, known as the Static Analysis Tool Exposition (SATE) [12][9][10][11][4]. The five SATEs utilized test cases comprised of millions of lines of code. Static analysis tool makers ran their tools on test cases and gave us their outputs, covering a total of almost 4 million warnings. Although we did not have the resources to analyze all warnings, we spent many person-years determining the accuracy of thousands of warnings. By analyzing these warnings, we learned that elements that we call “code complexities” make the detection of warnings more difficult for tools.
米国国立標準技術研究所(NIST)の Software Assurance Metrics and Tool Evaluation(SAMATE)プロジェクト [8] のチームは、Static Analysis Tool Exposition(SATE)[12][9][10][11][4] として知られる一連の実験を行い、幅広いクラスのソフトウェアアシュアランスツールを調べました。5 回の SATE では、数百万行のコードからなるテストケースを使用しました。静的分析ツールの開発元は、テストケースに対して自社のツールを実行して出力を提供し、合計で約 400 万件の警告が得られました。すべての警告を分析するだけの資源はありませんでしたが、数千件の警告の正確さを判定するために、数人年を費やしました。これらの警告を分析することで、私たちが「コード複雑性」と呼ぶ要素が、ツールによる警告の検出をより難しくしていることがわかりました。
For the SATEs, we chose test cases in C/C++, Java, and PHP. Some cases involved production software, e.g., Chrome and Wireshark. Other test cases had been generated: thousands of synthetic programs, consisting of a page or two of code, e.g., Juliet [2]. We knew the location of all of the vulnerabilities in the synthetic programs and some of the production vulnerabilities from Common Vulnerabilities and Exposures (CVE) [7] reports. Many of these test cases are publicly available in our repository, known as the Software Assurance Reference Dataset (SARD) [14]. It hosts more than 200 000 test cases in different programming languages.
SATE では、C/C++、Java、PHP のテストケースを選びました。一部のケースは、Chrome や Wireshark など、実運用のソフトウェアに関するものでした。それ以外のテストケースは、1〜2 ページのコードからなる数千もの合成プログラム(たとえば、Juliet [2])として生成されたものでした。合成プログラムのすべての脆弱性の位置と、実運用の脆弱性の一部の位置は、Common Vulnerabilities and Exposures(CVE)[7] の報告からわかっていました。これらのテストケースの多くは、Software Assurance Reference Dataset(SARD)[14] として知られる私たちのリポジトリで公開されています。ここには、さまざまなプログラミング言語の 200 000 を超えるテストケースが置かれています。
1.2. Purpose of Code Complexity
1.2. コード複雑性の目的
In white-box assurance using static analysis tools, defect detection is limited by the capabilities and intelligence of a given tool. The Heartbleed vulnerability (CVE-2014-0160) and the GNU/libc DNS resolver vulnerability (CVE-2015-7547) revealed that static analysis tools failed to find some bugs. To improve their capabilities and increase their use, one needs a better understanding of how tools discover vulnerabilities.
静的分析ツールを使ったホワイトボックスのアシュアランスでは、欠陥の検出は、個々のツールの能力と知能によって制限されます。Heartbleed 脆弱性(CVE-2014-0160)と GNU/libc DNS リゾルバの脆弱性(CVE-2015-7547)は、静的分析ツールが一部のバグを見つけられなかったことを明らかにしました。ツールの能力を向上させ、その利用を増やすには、ツールがどのように脆弱性を発見するかをよりよく理解する必要があります。
1.3. Using Code Complexity to Characterize Vulnerabilities
1.3. コード複雑性を使った脆弱性の特徴づけ
Black et. al. created The Bugs Framework (BF): A Structured Approach to express bugs [1]. The approach seeks to better express software bugs enclosing in four main areas: cause, attributes, consequences and sites. The attributes refer to well defined characteristics of a specific bug, e.g. source code elements. The BF is intended to characterize general software bugs classes. In particular, the buffer overflow class contains code complexities described in this paper such as access type and magnitude.
Black et. al. は、バグを表現するための構造化されたアプローチである The Bugs Framework(BF)を作成しました [1]。このアプローチは、ソフトウェアのバグを、原因(cause)、属性(attributes)、結果(consequences)、箇所(sites)という 4 つの主要な領域に分類して、よりよく表現することを目指しています。属性は、ソースコードの要素など、特定のバグについて明確に定義された特徴を指します。BF は、一般的なソフトウェアのバグのクラスを特徴づけることを意図しています。特に、バッファオーバーフローのクラスは、アクセス型(access type)や大きさ(magnitude)など、本稿で説明するコード複雑性を含んでいます。
1.4. Using Code Complexity to Generate Test Cases
1.4. コード複雑性を使ったテストケースの生成
Code complexities can be manually coded into test cases. However, the most beneficial use of code complexities is in the design of a test case generator capable of creating a large number of test cases. A test case generator needs to produce not only valid and vulnerable code, but also various complexities. This could be very time-consuming for a human to implement systematically. Using code complexity factors, each class of complexity can be systematically constructed and the results can be methodically reviewed.
コード複雑性は、手作業でテストケースにコーディングできます。しかし、コード複雑性の最も有益な使い方は、多数のテストケースを作成できるテストケースジェネレータの設計です。テストケースジェネレータは、有効で脆弱なコードだけでなく、さまざまな複雑性も生成する必要があります。これを人間が系統的に実装するには、非常に時間がかかる場合があります。コード複雑性の要因を使うと、複雑性の各クラスを系統的に構築し、その結果を体系的にレビューできます。
2. Code Complexity Factors
2. コード複雑性の要因
Code complexity is a feature of the programming language that, in theory, has no impact on whether there is a vulnerability or not. They are combined and nested to create real source code. The most commonly used complexities occur in expression, control or data flow, loop structure, or memory access. Each code complexity can spawn many sub categories; some of which are language specific (e.g., use of pointers in C and C++). Categories of code complexities were explained by Wu and Boland [18].
コード複雑性は、理論上、脆弱性があるかどうかに影響を与えない、プログラミング言語の特徴です。これらは組み合わされ、入れ子にされて、実際のソースコードを作ります。最もよく使われる複雑性は、式、制御フローまたはデータフロー、ループ構造、メモリアクセスに現れます。各コード複雑性は多くのサブカテゴリを生み出すことができ、その一部は、C と C++ でのポインタの使用のように、言語固有です。コード複雑性のカテゴリは、Wu と Boland [18] によって説明されました。
| |
| |
Figure 1: Program fragments illustrating code complexities
図 1: コード複雑性を示すプログラム断片
To illustrate, consider the fragments of code in Figure 1. The code on the left side has a problem in line 2: the character “C” is assigned to the variable data, but that value is never used. It is overwritten by the assignment in line 3. Programmers should be warned about such problems. At best, it is a little extra code to understand, document, and compile. In the worst case, it may indicate a bug: that the value was supposed to be used (e.g., a new call to printLine() after line 2), that the value at line 4 should be “C,” but the programmer did not notice that it was overwritten at line 3, or that some other variable should have been set at line 2.
例を示すために、図 1 のコード断片を考えます。左側のコードには、2 行目に問題があります。文字「C」が変数 data に代入されていますが、その値は使われません。3 行目の代入によって上書きされます。プログラマには、このような問題について警告すべきです。うまくいっても、理解し、文書化し、コンパイルしなければならない余分なコードが少し増えるだけです。最悪の場合、これはバグを示している可能性があります。たとえば、その値が使われるはずだった(たとえば、2 行目の後に printLine() の新しい呼び出しがあるはずだった)、4 行目の値が「C」であるべきなのに、プログラマが 3 行目で上書きされたことに気づかなかった、あるいは 2 行目で別の変数を設定するはずだった、といった場合です。
The fragment on the right hand side is functionally exactly the same, but it contains extra code that makes it more difficult for a static analysis tool (or a human!) to recognize the problem. As an extreme example, a very simplistic tool might ignore the control flow caused by the if-else statements altogether, notice the use of data on line 5, and decide that the value was (or, may have been) used.
右側の断片は、機能的にはまったく同じですが、静的分析ツール(あるいは人間も!)が問題を認識することをより難しくする余分なコードを含んでいます。極端な例として、非常に単純なツールは、if-else 文によって生じる制御フローを完全に無視し、5 行目の data の使用に気づいて、その値が使われた(あるいは使われた可能性がある)と判断するかもしれません。
Although this is a relatively simple case, other code complexities impose significant burdens on analysis. For example, the definition and use of a variable may be in separate files or the value may be transferred between several intermediate variables and structures before being used (or not). In theory, what we term a code complexity does not impact our reasoning regarding the presence or absence of a flaw. In both fragments, an analyst (human or automated program) must note that data was given a value, which was overwritten before it was ever used.
これは比較的単純な例ですが、その他のコード複雑性は、分析に大きな負担を課します。たとえば、変数の定義と使用が別々のファイルにあったり、値が使われる(または使われない)前に、複数の中間変数や構造体の間で受け渡されたりすることがあります。理論上、私たちがコード複雑性と呼ぶものは、欠陥が存在するか否かについての私たちの推論に影響を与えません。どちらの断片でも、分析者(人間または自動化されたプログラム)は、data に値が代入され、その値が使われる前に上書きされたことに気づかなければなりません。
Note that code complexity differs from cyclomatic complexity, which is a measure of the number of paths through the code [17]. As used in this paper, the term refers to pieces of code that must be handled correctly to establish control and data flow which are frequently encountered. However, once flows and values are determined, it should not affect the detection of a flaw.
コード複雑性は、コードを通る経路の数の尺度である循環的複雑度 [17] とは異なることに注意してください。本稿で使う場合、この用語は、頻繁に遭遇する制御フローとデータフローを確立するために、正しく扱わなければならないコードの断片を指します。ただし、フローと値が決定されれば、欠陥の検出に影響を与えるべきではありません。
Code complexities can be minimal, such as the one in Figure 1. However, production code involves many code complexities which are intricately interwoven. Each code complexity can occur inside a loop or function call chains. Some complexities are specific to programming languages, such as pointers in C and C++.
コード複雑性は、図 1 のもののように、最小限である場合もあります。しかし、実運用のコードには、複雑に織り込まれた多くのコード複雑性が含まれます。各コード複雑性は、ループや関数呼び出しの連鎖の内部で生じる場合があります。C と C++ のポインタなど、プログラミング言語に固有の複雑性もあります。
2.1. Classes of Code Complexities
2.1. コード複雑性のクラス
We describe some classes of code complexity, using the C programming language. Some code complexities in other programming languages may not be represented here. For clarity, we will illustrate each class of code complexity with an example of a classic stack buffer overflow, adapted from the baseline snippet below. In this example, the array buffer can store up to 5 integer numbers. The C standard defines arrays as starting at index 0. Thus, the greatest index of an array is n - 1, where n is the length of the array. However, our example accesses position 5 of buffer, which has a greatest index of 4 (5 - 1), causing an access outside its boundaries.
C プログラミング言語を使って、コード複雑性のいくつかのクラスを説明します。他のプログラミング言語のコード複雑性の一部は、ここには示されていない場合があります。わかりやすくするために、コード複雑性の各クラスを、次の基準となるコード断片を適応させた、典型的なスタックバッファオーバーフローの例で示します。この例では、配列 buffer は最大 5 個の整数を格納できます。C の標準は、配列がインデックス 0 から始まると定めています。したがって、配列の最大のインデックスは n - 1 です(n は配列の長さ)。しかし、この例は buffer の位置 5 にアクセスしており、その最大のインデックスは 4(5 - 1)であるため、境界の外へのアクセスが生じます。
void buffer_overflow() {
int buffer[] = {1,2,3,4,5}, ret;
ret = buffer[5];
}
•Separate files: This code complexity is based on the premise that programs may be composed of many files. In this example, the program uses File 1 and File 2. Data flow through different functions and scopes in several files requires some tracking, similar to production code.
•別々のファイル: このコード複雑性は、プログラムが多くのファイルで構成されている場合があるという前提に基づいています。この例では、プログラムはファイル 1 とファイル 2 を使用します。複数のファイルにまたがる異なる関数やスコープを通るデータフローは、実運用のコードと同様に、ある程度の追跡を必要とします。
// File 1 // File 2
int index() { void buffer_overflow() {
return 5; int buffer[] = {1,2,3,4,5}, ret;
} ret = buffer[index()];
}
•Control flow and loop structure: These can be enumerated using the following code: if, switch-case, goto, setjmp, longjmp, function pointer, function call, for, do-while, and while. Our example was elaborated to add a basic if statement around the flawed line.
•制御フローとループ構造: これらは、次のコードを使って列挙できます: if、switch-case、goto、setjmp、longjmp、関数ポインタ、関数呼び出し、for、do-while、while。この例は、欠陥のある行の周りに基本的な if 文を加えて作成しました。
void buffer_overflow() {
int buffer[] = {1,2,3,4,5}, ret;
if(0 == 0) {
ret = buffer[5];
}
}
•Duplicate variable or function name: This code complexity explores the same identifier referring to different objects. For example, a global variable named buffer may conflict with a local variable named buffer. In the example below buffer is declared twice. The first time buffer is declared with global scope as an array of 5 integers. The second time buffer is declared, it has local scope and ends its life at the closing curly brace following the semicolon. It might be confusing due to the fact buffer is being overflowed right after the local buffer was declared.
•変数名または関数名の重複: このコード複雑性は、同じ識別子が異なるオブジェクトを指す場合を扱います。たとえば、buffer という名前のグローバル変数が、buffer という名前のローカル変数と衝突する場合があります。次の例では、buffer が 2 回宣言されています。1 回目は、5 個の整数の配列として、グローバルスコープで buffer が宣言されます。2 回目に buffer が宣言されるときは、ローカルスコープであり、セミコロンに続く閉じ波括弧でその存続が終わります。ローカルの buffer が宣言された直後に buffer がオーバーフローするため、混乱を招く可能性があります。
int buffer[] = {1,2,3,4,5};
void buffer_overflow() {
int ret;
{ int buffer[] = {1,2,3,4,5,6}; }
ret = buffer[5];
}
•Container: The data may be wrapped in arrays, structs, or unions. Our example shows buffer wrapped within a structure declaration (struct wrap).
•コンテナ: データは、配列、struct、union に包まれている場合があります。この例では、構造体宣言(struct wrap)の中に包まれた buffer を示しています。
struct wrap {
int buffer[5];
};
void buffer_overflow() {
struct wrap obj = {{1,2,3,4,5}};
int ret;
ret = obj.buffer[5];
}
•Access by array or pointer: A value may be accessed through an array-like construct, i.e., using square braces, or a pointer-like construct, i.e., using an asterisk. This example uses a pointer arithmetic approach to trigger a buffer overflow. This is because buffer + 5 indicates the fifth address of the array, and the asterisk is an access to that address.
•配列またはポインタによるアクセス: 値は、配列のような構文、すなわち角括弧を使う方法、またはポインタのような構文、すなわちアスタリスクを使う方法でアクセスされる場合があります。この例は、ポインタ演算の手法を使ってバッファオーバーフローを引き起こします。これは、buffer + 5 が配列の5番目のアドレスを示し、アスタリスクがそのアドレスへのアクセスであるためです。
void buffer_overflow() {
int buffer[] = {1,2,3,4,5}, ret;
ret = *(buffer + 5);
}
•Read or write access: This code complexity explores whether access was simply using the value or assigning the value. The buffer[5] statement assigns a new value to the 5th element of buffer, which does not exist.
•読み取りまたは書き込みのアクセス: このコード複雑性は、アクセスが単に値を使うものであったか、値を代入するものであったかを扱います。buffer[5] 文は、存在しない buffer の 5 番目の要素に新しい値を代入します。
void buffer_overflow() {
int buffer[] = {1,2,3,4,5};
buffer[5] = 10;
}
•Magnitude: This term refers to how far outside the boundary the violation extends, in other words, how far from the first and last indexes of the allocated memory space. Our example below depicts an access far from regular off-by-one buffer overflows. This is because buffer is being requested to access its 5000th element, which is far from what it is able to store.
•大きさ(Magnitude): この用語は、違反が境界の外へどれだけ遠くまで及ぶか、言い換えると、割り当てられたメモリ空間の最初と最後のインデックスからどれだけ離れているかを指します。次の例は、通常の 1 つ違い(off-by-one)のバッファオーバーフローとは大きくかけ離れたアクセスを示します。これは、buffer が 5000 番目の要素にアクセスするよう要求されており、これが格納できる範囲から大きく離れているためです。
void buffer_overflow() {
int buffer[] = {1,2,3,4,5}, ret;
ret = buffer[5000];
}
•Alias (passed through other variables): Aliases are values that originate in one place, but are copied or referenced through other variables. In our example, buffer is aliased to ptr, which in turn has its 5th element accessed, still causing the exact overflow as other examples presented.
•エイリアス(他の変数を経由して渡される): エイリアスは、ある場所に由来するものの、他の変数を通じてコピーまたは参照される値です。この例では、buffer は ptr のエイリアスになっており、その 5 番目の要素にアクセスしても、示した他の例とまったく同じオーバーフローが生じます。
void buffer_overflow() {
int buffer[] = {1,2,3,4,5}, ret, *ptr;
ptr = buffer;
ret = ptr[5];
}
•Unreachable and dead code: This refers to a piece of code that logically can never be run because it is not reachable. In the case below, the if statement will always fail, since in C the value 0 is equivalent to false. Code in this state can be distracting or confusing to reviewers (human or automated).
•到達不能コードとデッドコード: これは、到達できないために論理的に決して実行されないコードの断片を指します。次の例では、C では値 0 が false と等価であるため、if 文は常に失敗します。この状態のコードは、レビュー担当者(人間または自動化されたもの)の気を散らしたり、混乱させたりする場合があります。
void buffer_overflow() {
int buffer[] = {1,2,3,4,5}, ret;
if(0) {
ret = buffer[5];
}
}
•Unusual syntax: Test cases used to evaluate static analysis tools should exclude compiler test suites. Nonetheless, it may be useful to have some cases to understand how well unusual syntax is handled. Our example uses digraphs, trigraphs, and a pointer to an array ((*)[]), all valid statements specified by the C standard. Trigraphs and digraphs are features from earlier versions of the C language that allowed programmers to represent ASCII characters using non-ASCII keyboards. Our example presents two digraphs and two trigraphs. The first digraph, <:, is equivalent to the left square brace, [, and the second, :>, to the right square brace, ]. The first trigraph, ??<, is equivalent to the left curly brace, {, and the second , ??>, to the right curly brace, }. The prefixes, di- and tri-, mean the number of characters each, 2 and 3, respectively. Lexical analyzers in C compilers consider these as their equivalent tokens. Perhaps, compilers may require extra options for trigraphs and digraphs to be properly evaluated.
•珍しい構文: 静的分析ツールの評価に使うテストケースは、コンパイラのテストスイートを除外すべきです。それでも、珍しい構文がどの程度うまく扱われるかを理解するために、いくつかのケースがあると役立つ場合があります。この例は、ダイグラフ、トライグラフ、配列へのポインタ((*)[])を使っており、これらはすべて C の標準が規定する有効な文です。トライグラフとダイグラフは、C 言語の初期のバージョンにあった機能で、プログラマが ASCII 以外のキーボードを使って ASCII 文字を表現できるようにするものでした。この例には、2 つのダイグラフと 2 つのトライグラフがあります。最初のダイグラフ <: は左角括弧 [ と等価であり、2 つ目の :> は右角括弧 ] と等価です。最初のトライグラフ ??< は左波括弧 { と等価であり、2 つ目の ??> は右波括弧 } と等価です。接頭辞の di- と tri- は、それぞれ文字数の 2 と 3 を意味します。C コンパイラの字句解析器は、これらを等価なトークンとみなします。コンパイラによっては、トライグラフとダイグラフを正しく評価するために、追加のオプションが必要な場合があります。
void buffer_overflow() {
int buffer<::> = ??<1,2,3,4,5??>, ret, (*ptr)[5];
ptr = buffer;
ret = ptr[5];
}
•Data type: This is one of the simplest complexities, establishing the type of the main variable in the test case. The example below presents a variation of the baseline simple code, now using float as data type instead of an integer (int) data type.
•データ型: これは最も単純な複雑性の 1 つで、テストケースの主な変数の型を定めるものです。次の例は、基準となる単純なコードの変形で、整数(int)のデータ型の代わりに float をデータ型として使っています。
void buffer_overflow() {
float buffer[]={1.0,2.0,3.0,4.0,5.0}, ret;
ret = buffer[5];
}
2.2. Other Complementary Code Complexities
2.2. その他の補完的なコード複雑性
The following are not code complexities as we have defined them. However, they are useful attributes to consider when thinking about test cases.
次のものは、私たちが定義したコード複雑性ではありません。しかし、テストケースを考えるときに考慮すると役立つ属性です。
•Fixed (unflawed) cases: These cases are corrected versions of flawed test cases, used to identify false positive results. A trivial “analysis tool” might incorrectly flag SQL statements as sites of SQL injection. If only flawed test cases are presented, then their lack of discrimination would go undetected. Because flaws can be fixed in a number of ways, there may be several “fixed” cases for a given “flawed” case. Our example below presents one of many possible ways to fix the overflow. Now buffer is being accessed in its 4th element, which is expected.
•修正済み(欠陥なし)のケース: これらのケースは、欠陥のあるテストケースを修正したものであり、偽陽性の結果を特定するために使います。取るに足らない「分析ツール」は、SQL 文を SQL インジェクションの箇所であると誤ってフラグ付けする場合があります。欠陥のあるテストケースだけを提示すると、その識別力のなさは検出されないままになります。欠陥はさまざまな方法で修正できるため、ある「欠陥のある」ケースに対して、複数の「修正済み」のケースがあり得ます。次の例は、オーバーフローを修正するための多くの方法のうちの 1 つを示します。ここでは、buffer の 4 番目の要素にアクセスしており、これは想定どおりです。
void buffer_overflow() {
int buffer[] = {1,2,3,4,5}, ret;
ret = buffer[4];
}
•Undefined, unspecified, or implementation-dependent behavior: This behavior refers to code that may yield divergent results depending on compilers and platforms. Strictly speaking, “unspecified” may cause absolutely any behavior. Test cases with such code are useful for checking a tool’s capability to detect and report them. In our example, func() is defined as a function that does not receive parameters and does not return a value. However, further down in the code func is cast to func ptr, which is a pointer to a function that does not receive parameters but returns an integer. The C standard allows such features, so that when it comes to the line where func ptr() is called, the actual function being called is func(), and its return value is used as index to access an element from buffer. But as defined earlier, func() does not return anything, how can it return an integer? This question has multiple answers; so does the value this function returns. The C standard does not define behavior for such construction, letting it be implemented by compilers/platforms. We ran some tests using Linux 3.16, running Debian 8 x86 64, using two different compilers, GCC-4.9.2 and Clang-4.0.0. On the one hand, GCC uses a register to store a function’s return value, then sets it to zero before a function call. So the call to func ptr() returned 0. On the other hand, Clang does not share that strategy, thus the call to func ptr() returns a different value every time the program runs.
•未定義、未規定、または実装依存の動作: この動作は、コンパイラやプラットフォームによって異なる結果を生じる可能性のあるコードを指します。厳密に言えば、「未規定」の動作では、どのような動作も起こり得ます。このようなコードを含むテストケースは、ツールがそのような動作を検出して報告する能力を確認するのに役立ちます。この例では、func() は、パラメータを受け取らず、値を返さない関数として定義されています。しかし、コードのさらに下で、func は func ptr にキャストされます。これは、パラメータを受け取らず、整数を返す関数へのポインタです。C 標準はこのような機能を許しているため、func ptr() が呼び出される行では、実際に呼び出される関数は func() であり、その戻り値が buffer の要素にアクセスするためのインデックスとして使われます。しかし、前述のとおり func() は何も返しません。それなのに、どうして整数を返せるのでしょうか。この問いには複数の答えがあり、この関数が返す値についても同様です。C 標準はこのような構成の動作を定義しておらず、コンパイラやプラットフォームによる実装に任せています。私たちは、Linux 3.16 上で Debian 8 x86 64 を実行し、GCC-4.9.2 と Clang-4.0.0 という 2 つの異なるコンパイラを使って、いくつかのテストを実行しました。一方、GCC は関数の戻り値を保存するためにレジスタを使い、関数呼び出しの前にその値をゼロに設定します。そのため、func ptr() の呼び出しは 0 を返しました。他方、Clang はその戦略を共有していないため、func ptr() の呼び出しは、プログラムを実行するたびに異なる値を返します。
void func(){}
int main() {
int (*func_ptr)(), ret, buffer[] = {1,2,3,4};
func_ptr = (int (*)())func;
ret = buffer[func_ptr()];
return 0;
}
•Minimal “fake” parsing: Some tools perform complete syntactic analysis, parsing, or semantic analysis. It is easier to build tools that search (“grep”) for a regular expression, such as an apparent call of the function strcpy() (string copy, which is susceptible to buffer overflow). Such a search would flag strcpy() in a comment. Examples with invalid code inform an evaluator of less-than-strict analysis.
•最小限の「偽の」構文解析: ツールの中には、完全な構文解析、パース、または意味解析を行うものがあります。関数 strcpy()(文字列コピーで、バッファオーバーフローの影響を受けやすい)の見かけ上の呼び出しなど、正規表現を探す(「grep」する)ツールのほうが、作りやすいです。そのような検索は、コメント内の strcpy() にフラグを付けてしまいます。無効なコードを含む例は、評価者に、厳密ではない分析であることを知らせます。
void buffer_overflow() {
char buffer[] = "hello";
// strcpy(buffer, "world");
}
3. Code Complexities Applied in Academia and Industry
3. 学術界と産業界で適用されているコード複雑性
Section 2 depicted classes of code complexities by straightforward examples by a single factor. When applied in academic and industrial applications, code complexities are blended along weaknesses and bugs in order to create test cases for static analyzers. We collected 5 such test case generations, 4 by the government or a university, and 1 by researchers at Toyota InfoTechnology Center (ITC). We name each of these as a test suite.
第 2 節では、コード複雑性のクラスを、単一の要因による単純な例で示しました。学術界や産業界の用途では、静的アナライザ用のテストケースを作るため、コード複雑性を弱点やバグと組み合わせます。私たちは、そのようなテストケース生成を 5 件集めました。4 件は政府または大学によるもの、1 件は Toyota InfoTechnology Center(ITC)の研究者によるものです。これらのそれぞれを、テストスイートと呼びます。
Next subsections describe the test suites individually, and the methods for incorporating code complexity. Thus, the examples below contain detailed information about complexities identifiers, sometimes in file names or numeric codes. It is also important to note that all test suites described in the following subsections contain both flawed and fixed versions of test cases, except the one in Subsec. 3.3.
次の小節では、各テストスイートと、コード複雑性を組み込む方法を説明します。そのため、以下の例には、ファイル名や数値コードの場合もある複雑性識別子についての詳細な情報が含まれています。また、以下の小節で説明するすべてのテストスイートは、第 3.3 節のものを除き、テストケースの欠陥のあるバージョンと修正済みのバージョンの両方を含んでいることにも注意してください。
3.1. Juliet
3.1. Juliet
The Center for Assured Software at the U.S. National Security Agency developed [2] the Juliet test suite to evaluate static analysis tools. The test suite is a collection of 86 864 C/C++ and Java programs with well characterized weaknesses (i.e., flaws or defects) of 181 different kinds. Each flaw occurs in simple code and embedded in three dozen code complexities, involving different control flow, data flow, and data types. The weakness dictionary for Juliet is the Common Weaknesses Enumeration (CWE).
米国国家安全保障局の Center for Assured Software は、静的分析ツールを評価するために、Juliet テストスイートを開発しました [2]。このテストスイートは、181 種類の、よく特徴づけられた弱点(すなわち、欠陥または不具合)を持つ、86 864 件の C/C++ と Java のプログラムの集まりです。各欠陥は、単純なコードの中と、異なる制御フロー、データフロー、データ型を含む 36 個のコード複雑性に埋め込まれた状態の両方で生じます。Juliet の弱点辞書は、Common Weaknesses Enumeration(CWE)です。
Code complexities and weaknesses are injected in each test case in a manner that it is uncomplicated to interpret its file name. The weakness is represented with a CWE identifier at the beginning of every file name. There will be at least one test case serving as baseline per weakness type, free of code complexity (files ending with 01). Control flow complexities, e.g. if ’s, switch’s, while’s, for’s, goto’s and functions change program flow appear in tests with endings from 2 through 22. These are intermixed with global constants and static variables. Data flow complexities, such as values being passed through other variables multiple times or even through a function in different files are present in tests from 31 through 84. Note that several code complexity variants are language-specific to C++ and Java and were not described in this paper.
コード複雑性と弱点は、ファイル名を解釈しやすいように、各テストケースに注入されています。弱点は、すべてのファイル名の先頭にある CWE 識別子で表されます。弱点の種類ごとに、コード複雑性のない、基準として機能するテストケースが少なくとも 1 つあります(01 で終わるファイル)。制御フローの複雑性、たとえば、if、switch、while、for、goto、プログラムのフローを変える関数は、末尾が 2 から 22 のテストに現れます。これらは、グローバル定数や静的変数と混在しています。データフローの複雑性、たとえば、値が他の変数を複数回経由して渡される、あるいは別々のファイルにある関数を経由して渡されるものは、31 から 84 のテストに存在します。複数のコード複雑性の変種が C++ と Java に固有であり、本稿では説明していないことに注意してください。
Following is an example of a Juliet test case file name: CWE121_Stack_Based_Buffer_Overflow_fgets_05. It indicates a test case containing a stack-based buffer overflow (CWE-121), surrounded by an if using a static variable within its Boolean expression (ending with 05).
Juliet のテストケースのファイル名の例を次に示します: CWE121_Stack_Based_Buffer_Overflow_fgets_05。これは、スタックベースのバッファオーバーフロー(CWE-121)を含み、そのブール式の中で静的変数を使った if で囲まれた(05 で終わる)テストケースを示します。
3.2. Taxonomy for Buffer Overflows
3.2. バッファオーバーフローの分類
Kratkiewicz and Lippmann designed [6] a taxonomy of C code complexities consisted of twenty-two attributes, able to properly characterize a buffer access or overflow. Many complexities described in Sec. 2 appear in this test suite, including read or write access, data type and magnitude. They created four version of 291 test cases. First containing no weakness: buffer access does not cause overflow; the other three are structurally identical to the first except that they contain a buffer violation in different magnitudes: 1, 8 and 4096 bytes out-of-range, under or overflow. The four variations resulted in 1164 test cases.
Kratkiewicz と Lippmann は、バッファアクセスまたはオーバーフローを適切に特徴づけることができる、22 個の属性からなる C のコード複雑性の分類を設計しました [6]。第 2 節で説明した多くの複雑性が、このテストスイートに現れており、読み取りまたは書き込みのアクセス、データ型、大きさを含みます。彼らは、291 件のテストケースの 4 つのバージョンを作成しました。最初のものは弱点を含まず、バッファアクセスがオーバーフローを引き起こしません。他の 3 つは、最初のものと構造的に同一ですが、範囲外のバイト数が異なる大きさ(1、8、4096 バイト)での、バッファ違反(アンダーフローまたはオーバーフロー)を含みます。4 つのバリエーションにより、1164 件のテストケースが作られました。
Test cases have a twenty-two-digit numeric code describing complexities enclosing the weakness. The following is an example: 0000000100000153000110. In this particular case, it represents a write of a constant value to the upper boundary of a character buffer allocated in the stack; the trigger point occurs in the same scope where its memory was allocated; it was accessed directly through a primitive variable, and the site is wrapped by a do-while loop and an if statement. We do not intend to explain every detail of the test case since that is not the purpose of this paper.
テストケースには、弱点を囲む複雑性を表す 22 桁の数値コードが付けられています。例を次に示します: 0000000100000153000110。この特定の場合、これは、スタックに割り当てられた文字バッファの上限への定数値の書き込みを表します。トリガーとなる箇所は、メモリが割り当てられたのと同じスコープで生じ、プリミティブ変数を通じて直接アクセスされ、その箇所は do-while ループと if 文に包まれています。このテストケースのすべての詳細を説明するつもりはありません。それは本稿の目的ではないためです。
3.3. STONESOUP
3.3. STONESOUP
The Intelligence Advanced Research Projects Activity (IARPA) developed the Securely Taking On Software Of Uncertain Provenance (STONESOUP) program [3], igniting security research on software binaries from unknown provenance, or third-party software. For the final phase of the program, they created a test suite consisting of C and Java test cases. A test is an extension of an open source software (e.g., GNU/Gimp), spawning variants by intermixing a code complexity class, an injection point, and a weakness type. The code complexities were organized in four groups: taint source, data type, data flow and control flow. Taint source indicates an input type, choosing one from: environment variables, file contents, sockets, or shared memory. Data type indicates whether the main variable that triggers the vulnerability is: simple (primitive), array, void pointer, heap pointer, struct/union, or user defined types (e.g., typedef or class). Data flow indicates the variable type used to transport input data to a trigger point, some of the options are aliases, index aliases, constant addresses, variable number of arguments, buffer addresses, or Java generics (templates). Control flow defines language constructions that change the flow of a program: call back/recursive functions, infinite/long loops, inter class/procedures, try-catch’s, function pointers, macros, goto’s, and jumps. The complexities map to unique identifiers, later used to characterize test cases. All four groups are present in test cases, differing on the chosen code elements.
Intelligence Advanced Research Projects Activity(IARPA)は、出所不明のソフトウェアバイナリ、すなわちサードパーティ製ソフトウェアのセキュリティ研究を促す、Securely Taking On Software Of Uncertain Provenance(STONESOUP)プログラム [3] を開発しました。プログラムの最終フェーズに向けて、彼らは C と Java のテストケースからなるテストスイートを作成しました。テストは、オープンソースソフトウェア(たとえば、GNU/Gimp)の拡張であり、コード複雑性のクラス、注入点、弱点の種類を混ぜ合わせることで変種を生み出します。コード複雑性は、汚染源、データ型、データフロー、制御フローの 4 つのグループに整理されました。汚染源は入力の種類を示し、環境変数、ファイルの内容、ソケット、共有メモリのいずれかから選びます。データ型は、脆弱性を引き起こす主な変数が、単純な型(プリミティブ)、配列、void ポインタ、ヒープポインタ、struct/union、またはユーザー定義型(たとえば、typedef や class)のいずれであるかを示します。データフローは、入力データをトリガーとなる箇所へ運ぶために使われる変数の型を示し、選択肢には、エイリアス、インデックスエイリアス、定数アドレス、可変個の引数、バッファアドレス、Java のジェネリクス(テンプレート)などがあります。制御フローは、プログラムのフローを変える言語構造を定義します。すなわち、コールバック/再帰関数、無限/長いループ、クラス間/プロシージャ間、try-catch、関数ポインタ、マクロ、goto、ジャンプです。複雑性は一意の識別子に対応付けられ、後でテストケースを特徴づけるために使われます。4 つのグループはすべてテストケースに存在し、選ばれるコード要素が異なります。
Complexities identifiers are stamped in file names, along with information regarding weakness and injection point. The following code name illustrates an instance of a STONESOUP test case: C-C120D-GIMP-06-ST02-DT04-DF05-CF12-01. The tainted source comes from a file (ST02). Data type is a heap pointer (DT04). Data flow is a constant address (DF05), passed to another function (CF12), where a buffer copy results in overflow. The first letter indicates a test case written in C, forked from a GNU/Gimp (GIMP) source tree, containing a buffer copy without checking the size of input (CWE-120). Other pieces of information from the example aforementioned are not relevant for the purpose of the paper.
複雑性の識別子は、弱点と注入点に関する情報とともに、ファイル名に刻まれています。次のコード名は、STONESOUP のテストケースの一例を示します: C-C120D-GIMP-06-ST02-DT04-DF05-CF12-01。汚染されたソースはファイルに由来します(ST02)。データ型はヒープポインタです(DT04)。データフローは定数アドレスで(DF05)、別の関数に渡され(CF12)、そこでバッファコピーによりオーバーフローが生じます。最初の文字は、GNU/Gimp(GIMP)のソースツリーから派生し、入力のサイズを確認しないバッファコピー(CWE-120)を含む、C で書かれたテストケースであることを示します。上記の例のその他の情報は、本稿の目的には関係ありません。
3.4. PHP Test Suite
3.4. PHP Test Suite
Stivalet and Delaitre [16] designed a test case generator and created 42 212 safe and unsafe PHP programs. The test cases cover the Open Web Application Security Project (OWASP) top 10 weaknesses [13], i.e. cross-site scripting, insecure direct object reference, injection, URL redirects, security misconfiguration and sensitive data exposure. The design of code complexities within a test case starts with input coming through a taint source; passed to a sanitizing step, filtering received input; and ends with the construction of the output. Basically these are small programs that receive input, process it then generate content based on inputs.
Stivalet と Delaitre [16] は、テストケースジェネレータを設計し、安全な PHP プログラムと安全でない PHP プログラムを 42 212 件作成しました。テストケースは、Open Web Application Security Project(OWASP)のトップ 10 の弱点 [13]、すなわち、クロスサイトスクリプティング、安全でない直接オブジェクト参照、インジェクション、URL リダイレクト、セキュリティの設定ミス、機微なデータの露出を対象としています。テストケース内のコード複雑性の設計は、汚染源から入力が来るところから始まり、受け取った入力をフィルタリングするサニタイズのステップに渡され、出力の構築で終わります。基本的に、これらは、入力を受け取り、処理し、入力に基づいてコンテンツを生成する小さなプログラムです。
Similarly, to other suites presented in this Section, complexities of PHP test cases are present in file names. Following is a sample test case name extracted from the test suite: CWE_601_fopen_no_sanitizing_header_file_name-concatenation_simple_quote. The input comes from a file containing a malicious URL, read with the function fopen. No sanitization is performed. The tainted source was concatenated through the header function. Note that complexities explored in this test suite are language-specific and web-oriented.
この節で示す他のスイートと同様に、PHP のテストケースの複雑性はファイル名に含まれています。テストスイートから抽出したテストケース名のサンプルを次に示します: CWE_601_fopen_no_sanitizing_header_file_name-concatenation_simple_quote。入力は、悪意のある URL を含むファイルから来ており、関数 fopen で読み取られます。サニタイズは行われません。汚染されたソースは、header 関数を通じて連結されました。このテストスイートで扱う複雑性は、言語固有であり、ウェブ指向であることに注意してください。
3.5. ITC Benchmarks
3.5. ITC Benchmarks
The Toyota InfoTechnology Center developed [15] a test suite for evaluating static analysis tool, incorporating characteristics of automotive software. It contains approximately 30 000 lines of code, including 39 different weakness categories, mostly written in C. The test suite explores in depth undefined behaviors such as bit shifts, function casting, memory allocation on stack, and integer overflows. It is comprised of fifty different types of test cases, each type in its own file. There are eight major defect types, including memory and pointer issues, numerical defects, and race conditions. Each file contains many instances of a targeted defect in various levels of complexity. Although file names only identify weakness categories, the defects are well described in comments throughout the source code.
Toyota InfoTechnology Center は、自動車ソフトウェアの特徴を取り入れた、静的分析ツールを評価するためのテストスイートを開発しました [15]。これには約 30 000 行のコードが含まれ、39 種類の異なる弱点カテゴリが含まれており、そのほとんどは C で書かれています。このテストスイートは、ビットシフト、関数のキャスト、スタックでのメモリ割り当て、整数オーバーフローなどの未定義動作を深く調べます。50 種類の異なるテストケースで構成され、各種類は専用のファイルに置かれています。メモリとポインタの問題、数値上の欠陥、競合状態を含む、8 つの主要な欠陥の種類があります。各ファイルには、さまざまな複雑性の水準で、対象とする欠陥の多くの事例が含まれています。ファイル名は弱点のカテゴリを識別するだけですが、欠陥は、ソースコード全体のコメントで詳しく説明されています。
Complexities appear in the test cases uniformly, including data type, alias, and undefined behavior. Each test is enclosed in a function, receiving an identifier; exploring a complexity. Further in the file, tests pack multiple complexities combined. Although not clearly documented, ITC implements similar code complexities found in other test suites, such as Juliet and STONESOUP.
複雑性は、データ型、エイリアス、未定義動作を含め、テストケースに一様に現れます。各テストは関数に包まれ、識別子を受け取り、1 つの複雑性を調べます。ファイルのさらに先では、テストは、複数の複雑性を組み合わせてまとめています。明確に文書化されてはいませんが、ITC は、Juliet や STONESOUP など、他のテストスイートに見られるものと同様のコード複雑性を実装しています。
4. Conclusion
4. 結論
Applying characteristics of code complexity in test suites can greatly improve the evaluation of static analyzer products. Understanding code complexity can assist in the development of coding guidelines for assuring that software is fully analyzable by static analyzers.
テストスイートにコード複雑性の特徴を適用すると、静的アナライザ製品の評価を大きく改善できます。コード複雑性を理解することは、ソフトウェアが静的アナライザによって完全に分析可能であることを保証するためのコーディングガイドラインの策定に役立ちます。
In this paper, we sketched many of the factors making programs less analyzable. Our five SATEs showed that heuristics and other engineering constraints may prevent tools from identifying “obvious” weaknesses. A tool may find a weakness in one context, but not another context. Hence, test cases containing many occurrences of the same weakness type, surrounded by many code complexities [5], broadens the working range of a static analyzer, exploring more of its functionalities.
本稿では、プログラムの分析可能性を下げる多くの要因を概説しました。5 回の SATE は、ヒューリスティクスやその他の工学上の制約によって、ツールが「明白な」弱点を特定できない場合があることを示しました。ツールは、ある文脈では弱点を見つけても、別の文脈では見つけない場合があります。したがって、多くのコード複雑性 [5] に囲まれた、同じ種類の弱点を多数含むテストケースは、静的アナライザの動作範囲を広げ、その機能をより多く調べます。
Some complexities were detailed in this paper, and some were referenced from earlier publications. The majority of available test suites used C, C++, C#, Java, and PHP. Both are attempts of creating small versions of programs as well as combining the realism of production code to improve the mechanical analysis of tools, representing the needs of organizations willing to make investments in tools.
本稿では、いくつかの複雑性を詳しく説明し、いくつかは以前の刊行物を参照しました。利用可能なテストスイートの大半は、C、C++、C#、Java、PHP を使っていました。これらの取り組みは、プログラムの小規模版を作成することと、実運用コードの現実性を取り入れることの両方を試み、ツールによる機械的な分析を改善するとともに、ツールへの投資を行おうとする組織のニーズを表しています。
Future research involves refining and incorporating this code complexity element in the design and selection of test cases for the next static analysis tool exposition.
今後の研究には、次回の静的分析ツール展示会に向けて、このコード複雑性の要素を洗練させ、テストケースの設計と選定に取り入れることが含まれます。
5. References
5. 参考文献
[1] I. Bojanova, P. E. Black, Y. Yesha, and Y. Wu. The Bugs Framework (BF): A Structured Approach to Express Bugs. 2016 IEEE International Conference on Software Quality, Reliability and Security, 2016. https://doi.org/10.1109/QRS.2016.29
[1] I. Bojanova, P. E. Black, Y. Yesha, and Y. Wu. The Bugs Framework (BF): A Structured Approach to Express Bugs. 2016 IEEE International Conference on Software Quality, Reliability and Security, 2016. https://doi.org/10.1109/QRS.2016.29
[2] T. Boland and P. E. Black. The Juliet 1.1 C/C++ and Java Test Suite. IEEE Computer society, Computer, pages 82–84, 2012. http://doi.ieeecomputersociety.org/10.1109/MC.2012.345
[2] T. Boland and P. E. Black. The Juliet 1.1 C/C++ and Java Test Suite. IEEE Computer society, Computer, pages 82–84, 2012. http://doi.ieeecomputersociety.org/10.1109/MC.2012.345
[3] C. De Oliveira and F. Boland. Real World Software Assurance Test Suite: STONESOUP. In Proceedings of software Technology Conference, STC ’15, October 2015.
[3] C. De Oliveira and F. Boland. Real World Software Assurance Test Suite: STONESOUP. In Proceedings of software Technology Conference, STC ’15, October 2015.
[4] A. Delaitre and et al. Report on Static Analysis Tool Exposition (SATE) V. To be published. Available at https://samate.nist.gov/SATE.html.
[4] A. Delaitre and et al. Report on Static Analysis Tool Exposition (SATE) V. 刊行予定。 入手先: https://samate.nist.gov/SATE.html.
[5] A. Delaitre, B. Stivalent, E. Fong, and V. Okun. Evaluating Bug Finders, Test and Measurement of Static Code Analyzers. In Proceedings of the 1st International Workshop on Complex Faults and failures in Large Software Systems, COUFLESS’ 15, pages 14–20. IEEE, May 2015.
[5] A. Delaitre, B. Stivalent, E. Fong, and V. Okun. Evaluating Bug Finders, Test and Measurement of Static Code Analyzers. In Proceedings of the 1st International Workshop on Complex Faults and failures in Large Software Systems, COUFLESS’ 15, pages 14–20. IEEE, May 2015.
[6] K. Kratkiewicz. Evaluating Static Analysis Tools for Detecting Buffer Overflows in C Code. Master’s thesis, Harvard University, Cambridge, MA, USA, 2005.
[6] K. Kratkiewicz. Evaluating Static Analysis Tools for Detecting Buffer Overflows in C Code. Master’s thesis, Harvard University, Cambridge, MA, USA, 2005.
[7] MITRE. Common Vulnerabilities and Exposures. https://cve.mitre.org/, 2016.
[7] MITRE. Common Vulnerabilities and Exposures. https://cve.mitre.org/, 2016.
[8] NIST. Software Assurance Metrics and Tool Evaluation (SAMATE). http://samate.nist.gov, 2016.
[8] NIST. Software Assurance Metrics and Tool Evaluation (SAMATE). http://samate.nist.gov, 2016.
[9] V. Okun, A. Delaitre, and P. Black. The Second Static Analysis Tool Exposition (SATE). NIST Special Publication 500-287, 2010. Available at https://samate.nist.gov/SATE2009.html.
[9] V. Okun, A. Delaitre, and P. Black. The Second Static Analysis Tool Exposition (SATE). NIST Special Publication 500-287, 2010. 入手先: https://samate.nist.gov/SATE2009.html.
[10] V. Okun, A. Delaitre, and P. Black. Report on the Third Static Analysis Tool Exposition (SATE). NIST Special Publication 500-283, 2011. Available at https://samate.nist.gov/SATE2010.html.
[10] V. Okun, A. Delaitre, and P. Black. Report on the Third Static Analysis Tool Exposition (SATE). NIST Special Publication 500-283, 2011. 入手先: https://samate.nist.gov/SATE2010.html.
[11] V. Okun, A. Delaitre, and P. Black. Report on Static Analysis Tool Exposition (SATE) IV. NIST Special Publication 500-297, 2013. Available at https://samate.nist.gov/SATE4.html.
[11] V. Okun, A. Delaitre, and P. Black. Report on Static Analysis Tool Exposition (SATE) IV. NIST Special Publication 500-297, 2013. 入手先: https://samate.nist.gov/SATE4.html.
[12] V. Okun, R. Gaucher, and P. Black. Static Analysis Tool Exposition (SATE). NIST Special Publication 500-279, 2009. Available at https://samate.nist.gov/SATE2008.html.
[12] V. Okun, R. Gaucher, and P. Black. Static Analysis Tool Exposition (SATE). NIST Special Publication 500-279, 2009. 入手先: https://samate.nist.gov/SATE2008.html.
[13] OWASP. The ten most critical web application security risk. https://www.owasp.org/index.php/Top 10 2013-Top 10, 2013.
[13] OWASP. The ten most critical web application security risk. https://www.owasp.org/index.php/Top 10 2013-Top 10, 2013.
[14] SAMATE. Software Assurance Reference Dataset. http://samate.nist.gov/SARD, 2016.
[14] SAMATE. Software Assurance Reference Dataset. http://samate.nist.gov/SARD, 2016.
[15] S. Shiraishi, V. Mohan, and H. Marimuthu. Quantitative Evaluation of Static Analysis Tools. In Proceedings of the 2014 IEEE International Symposium on Software Reliability Engineering Workshops, ISSREW ’14, pages 96–99, Washington, DC, USA, 2014. https://doi.org/10.1109/ISSREW.2014.62
[15] S. Shiraishi, V. Mohan, and H. Marimuthu. Quantitative Evaluation of Static Analysis Tools. In Proceedings of the 2014 IEEE International Symposium on Software Reliability Engineering Workshops, ISSREW ’14, pages 96–99, Washington, DC, USA, 2014. https://doi.org/10.1109/ISSREW.2014.62
[16] B. Stivalet and E. Fong. Large Scale Generation of Complex and Faulty PHP Test Cases. In Proceedings of the 2016 IEEE International Conference on Software Testing, Verification and Validation (ICST), ICST ’16, pages 409–415. (IEEE Computer Society, Washington, DC), April 2016. https://doi.org/10.1109/ICST.2016.43
[16] B. Stivalet and E. Fong. Large Scale Generation of Complex and Faulty PHP Test Cases. In Proceedings of the 2016 IEEE International Conference on Software Testing, Verification and Validation (ICST), ICST ’16, pages 409–415. (IEEE Computer Society, Washington, DC), April 2016. https://doi.org/10.1109/ICST.2016.43
[17] A. H. Watson and T. J. McCabe. Structured Testing: A Testing Methodology Using the Cyclomatic Complexity Metric. NIST Special Publication 500-235, 1996. Available at http://www.mccabe.com/pdf/mccabe-nist235r.pdf.
[17] A. H. Watson and T. J. McCabe. Structured Testing: A Testing Methodology Using the Cyclomatic Complexity Metric. NIST Special Publication 500-235, 1996. 入手先: http://www.mccabe.com/pdf/mccabe-nist235r.pdf.
[18] Y. Wu and F. Boland. Categorizing Code Complexities in support of analysis. In Proceedings of the 11th International Conference on Cyber Warfare and Security, ICCWS 2016, pages 17–18, Boston, MA, USA, 2016.
[18] Y. Wu and F. Boland. Categorizing Code Complexities in support of analysis. In Proceedings of the 11th International Conference on Cyber Warfare and Security, ICCWS 2016, pages 17–18, Boston, MA, USA, 2016.