• No results found

Qualitative & Quantitative Evaluation of Static Code Analysis Tools

N/A
N/A
Protected

Academic year: 2021

Share "Qualitative & Quantitative Evaluation of Static Code Analysis Tools"

Copied!
26
0
0

Loading.... (view fulltext now)

Full text

(1)

CYBER SECURITY DIVISION

2014 R&D SHOWCASE AND TECHNICAL WORKSHOP

Qualitative & Quantitative

Evaluation of Static Code

Analysis Tools

Indiana University-Purdue University Indianapolis

Dr. James H. Hill ([email protected])

(2)

Project Overview

Static code analysis (SCA) is a

methodology of detecting errors

in program based on the review

of code marked by the analyzer in

areas where potential errors may

occur

SCA tools aid developers in

quickly identifying errors through

automation

memory leaks

dead code

code conformance

etc.

(3)

Existing Static Code Analysis Tools

HP Fortify Source

Code Analyzer AdaControl Pylint

Axivion Bauhaus Suite Astrée Parasoft C/C++test IBM Rational AppScan

Source Edition cpplint Klocwork Insight Imagix 4D Clang SofCheck Inspector

MALPAS PVS-Studio CodeRush

CodeSonar Cppcheck Visual Studio Team System

CodeIt.Right Protecode DMS Software

Reengineering Toolkit

FxCop FindBugs Kalistick

Apparat PMD …

It is also a costly & time-consuming process

evaluating the quality of each tool…

Given the vast

number of SCA

tools, it can be hard

identifying what

SCA tools are best

for the job!

Our objective is to evaluate the quality of static code analysis tool, and understand how to best apply them to a given piece of source code

(4)

Current Status

• Acquired and deployed three commercial SCA tools into

the System Integration Lab at IUPUI

• Developed an extensible framework for automating the

evaluation of SCA tools (SCATE)

• Exploring methodology and reporting features

– Granularity

– Aggregating multiple tools

– Permutation heat map

(5)

Granularity

(6)

Granularity

• Controls the required accuracy for the tool

10 void CWE835_Infinite_Loop__do_01_bad() {

11 int i = 0;

12

13 /* FLAW: Infinite Loop - do..while() with no break point */

14 do 15 { 16 printIntLine(i); 17 i = (i + 1) % 256; 18 } while(i >= 0); 19 } CWE835_Infinite_Loop__do_01.c

(7)

Granularity

• Controls the required accuracy for the tool

10 void CWE835_Infinite_Loop__do_01_bad() {

11 int i = 0;

12

13 /* FLAW: Infinite Loop - do..while() with no break point */

14 do 15 { 16 printIntLine(i); 17 i = (i + 1) % 256; 18 } while(i >= 0); 19 } CWE835_Infinite_Loop__do_01.c Flaw

(8)

Granularity

• Controls the required accuracy for the tool

10 void CWE835_Infinite_Loop__do_01_bad() {

11 int i = 0;

12

13 /* FLAW: Infinite Loop - do..while() with no break point */

14 do 15 { 16 printIntLine(i); 17 i = (i + 1) % 256; 18 } while(i >= 0); 19 } CWE835_Infinite_Loop__do_01.c Flaw FILE

The tool can find the flaw anywhere in the file

FUNCTION

The tool can find the flaw anywhere in the function

LINE

The tool must find the flaw on line 14

(9)

Granularity

• Controls the required accuracy for the tool

Granularity Detected Flaws

File 25,511

Function 3,565

Line 2,215

• Increasing granularity reduces

(10)

Using Multiple Tools

(11)

Using Multiple Tools

• Organizations will often run multiple tools to reduce risk

Tool 1 Tool 2 Tool 3

TP FP 12,235 9,174 TP FP 5,155 206,433 TP FP 25,511 111,397

(12)

Using Multiple Tools

• Organizations will often run multiple tools to reduce risk

Tool 1 Tool 2 Tool 3

Aggregate TP FP 12,235 9,174 TP FP 5,155 206,433 TP FP 25,511 111,397 TP FP 31,329 327,004

(13)

Using Multiple Tools

• Organizations will often run multiple tools to reduce risk

Tool 1 Tool 2 Tool 3

Aggregate 11,572 Duplicate TPs TP FP 12,235 9,174 TP FP 5,155 206,433 TP FP 25,511 111,397 TP FP 31,329 327,004

(14)

Using Multiple Tools

• Organizations will often run multiple tools to reduce risk

Tool 1 Tool 2 Tool 3

Aggregate

• Not all TPs are unique

• TPs increase but at the cost of

many more FPs (reduced precision) 11,572 Duplicate TPs TP FP 12,235 9,174 TP FP 5,155 206,433 TP FP 25,511 111,397 TP FP 31,329 327,004

(15)

Permutation Heat Map

• Permutations use Data and/or Control flows to obscurify

a Flaw to test SCA tools

(16)

Permutation Heat Map

• Permutations use Data and/or Control flows to obscurify

a Flaw to test SCA tools

Permutation 01:

void bad (void) {

// FLAW: … }

Permutation 02:

void bad (void) { if (1) { // FLAW: … } } Permutation 03:

void bad (void) { if (5==5) { // FLAW: … } }

(17)
(18)

Permutation Heat Map

CWE 415 (Double Free) 15: 50 % Flaws Found 16: 100% Flaws Found

(19)

Permutation Heat Map

CWE 415 (Double Free) 15: 50 % Flaws Found 16: 100% Flaws Found

Permutation 16:

void bad (void) { while (1) { // FLAW: … break } } Permutation 15:

void bad (void) { switch(6) { case (6): // FLAW: … break } }

(20)

Permutation Heat Map

CWE 415 (Double Free) 15: 50 % Flaws Found 16: 100% Flaws Found

Permutation 16:

void bad (void) { while (1) { // FLAW: … break } } Permutation 15:

void bad (void) { switch(6) { case (6): // FLAW: … break } }

• The type of permutation can

(21)

Future Work

• SWAMP Integration

• Tool behavioral model

• Predict tool quality against source code

• Streamline analysis into a cloud-based testing as a

service product

(22)

Future Work

• SWAMP Integration

• Tool behavioral model

• Predict tool quality against source code

• Streamline analysis into a cloud-based testing as a

service product

Tool

Results The SWAMP has multiple SCA tools integrated into

their environment and can provide tool results

(23)

Future Work

• SWAMP Integration

• Tool behavioral model

• Predict tool quality against source code

• Streamline analysis into a cloud-based testing as a

service product

Tool Model Evaluation Results Metadata Code Metrics

(24)

Future Work

• SWAMP Integration

• Tool behavioral model

• Predict tool quality against source code

• Streamline analysis into a cloud-based testing as a

service product

Tool

Model Source Code

Quality Prediction

(25)

Future Work

• SWAMP Integration

• Tool behavioral model

• Predict tool quality against source code

• Streamline analysis into a cloud-based testing as a

service product

(26)

Questions

References

Related documents

Housing demand is dominant in the real estate market of coastal cities, whereas housing supply capacity is poor; thus, rising housing price increases demand for urban land, which

Type declaration instruction - to declare the type of variables used in C program.. Input/Output Instructions: - Too perform the function of supplying input data to a

With a simple example of a hospital with two primary wards, we have shown that open- ing an EOA Ward results in an increase of urgent patient admissions, but at the same time in

The key research question to be addressed by this study is therefore defined as follows: What is the contribution of the human enabling factors of leadership, relationship,

cyber security controls against commodity attacks, given a limited budget B , and other preferences the organisation has in terms of risks and indirect costs. Our work is based

In Oregon, a variety of community-based care (CBC) settings, including assisted living, residential care, and memory care facilities, serve older persons who need on-going

specification can include a template (between { } ) Post and Put operations can have a payload: The format of that payload can be specified in a @Consumes(<format>) annotation

Table 3.3: Classification accuracy using decision fusion (GMM classifier) and feature fusion (SVM classifier), where (1) represents the enhanced summary autocorrelation pattern,