38
SOFTWARE CODE QUALITY CHECKING (SCQC) SUPPORTING TEST AND EVALUATION THROUGH EARLY IDENTIFICATION AND CORRECTION OF SECURITY VULNERABILITIES 2011 Nominee International Security Executives (ISE®) Information Security Project of the Year North America Government Sector

SOFTWARE CODE QUALITY CHECKING (SCQC) - ITEA€¦ · Static Security Analysis. is the analysis of computer software that is performed without actually executing programs to detect

  • Upload
    others

  • View
    4

  • Download
    0

Embed Size (px)

Citation preview

Page 1: SOFTWARE CODE QUALITY CHECKING (SCQC) - ITEA€¦ · Static Security Analysis. is the analysis of computer software that is performed without actually executing programs to detect

SOFTWARE CODE QUALITY CHECKING

(SCQC)

SUPPORTING TEST AND EVALUATION THROUGH

EARLY IDENTIFICATION AND CORRECTION OF SECURITY

VULNERABILITIES 2011 Nominee

International Security Executives (ISE®) Information Security Project of the Year

North America Government Sector

Page 2: SOFTWARE CODE QUALITY CHECKING (SCQC) - ITEA€¦ · Static Security Analysis. is the analysis of computer software that is performed without actually executing programs to detect

A Presentation by The

2

Page 3: SOFTWARE CODE QUALITY CHECKING (SCQC) - ITEA€¦ · Static Security Analysis. is the analysis of computer software that is performed without actually executing programs to detect

POINT OF CONTACT • IT Specialist, SCQC Task Manager

• John Keane • 703-380-5554, [email protected] • Level 3 Certified Test & Evaluation Engineering • Level 2 Certified Program Management • Level 1 Certified

• Information Technology • Life Cycle Logistics • Business – Financial Management • Systems Planning, RD&E – Systems Engineering

• Level B – Requirements Management • DAU Guest Lecturer – SAM 301

• Experience based on Medical Information Systems • Mostly Legacy Business Systems in Modernization/Sustainment • SOME New Development

3

Page 4: SOFTWARE CODE QUALITY CHECKING (SCQC) - ITEA€¦ · Static Security Analysis. is the analysis of computer software that is performed without actually executing programs to detect

A WORD OF CAUTION

• This presentation is not meant to endorse or recommend the use of any of the products identified within.

• The presentation is intended to provide insight into specific lessons-learned through the application of a disciplined methodology, supplemented by a suite of tools as implemented by skilled practitioners.

4

Page 5: SOFTWARE CODE QUALITY CHECKING (SCQC) - ITEA€¦ · Static Security Analysis. is the analysis of computer software that is performed without actually executing programs to detect

•The level of confidence that software functions only as intended and is free of vulnerabilities, either intentionally or unintentionally designed or inserted as part of the software throughout the lifecycle.

5

SOFTWARE ASSURANCE

Page 6: SOFTWARE CODE QUALITY CHECKING (SCQC) - ITEA€¦ · Static Security Analysis. is the analysis of computer software that is performed without actually executing programs to detect

• When we scan code and find vulnerabilities, are we testing or are we really verifying the lack of good quality assurance practices?

• What is the value of fixing security vulnerabilities in code that is technically flawed, architecturally unsound and unable to satisfy functional/performance requirements?

• The time spent to write a justification for why a particular vulnerability was not fixed is often far greater than the time needed to either not make the mistake in the first place or correct it early in the SDLC.

• “Urban legends,” as opposed to facts, seem to dominate the discussions.

• Should the presence of “enough” security vulnerabilities, as detected by scanning tools, be justification to not allow entry into testing.

6

SOME ANNOYING THOUGHTS

Page 7: SOFTWARE CODE QUALITY CHECKING (SCQC) - ITEA€¦ · Static Security Analysis. is the analysis of computer software that is performed without actually executing programs to detect

INTRODUCTORY MATERIAL

7

Page 8: SOFTWARE CODE QUALITY CHECKING (SCQC) - ITEA€¦ · Static Security Analysis. is the analysis of computer software that is performed without actually executing programs to detect

Software Code Quality Checking (SCQC) is • A scan of the source code, executables, and related

artifacts, e.g., documentation, to ensure that the System Under Review can • Continue with development, demonstration, and

test; and • Can meet the stated performance, maintainability,

and usability requirements within cost (program budget), schedule (program schedule), risk, and other system constraints.

WHAT IS SCQC?

8

Page 9: SOFTWARE CODE QUALITY CHECKING (SCQC) - ITEA€¦ · Static Security Analysis. is the analysis of computer software that is performed without actually executing programs to detect

• Encompasses the use of • Static code analysis, • Static security analysis, • Dynamic code analysis, • Dynamic security analysis, and • Architectural analysis and

• Is USUALLY performed using automated tools.

WHAT IS SCQC?

9

Page 10: SOFTWARE CODE QUALITY CHECKING (SCQC) - ITEA€¦ · Static Security Analysis. is the analysis of computer software that is performed without actually executing programs to detect

Static Analysis is the analysis of computer software and related documentation that is performed without actually executing programs built from the software. Focuses on code quality among other factors. • It is a recognized BEST practice that SHOULD precede Static Security

Analysis. • Non-compliance with Coding Standards is a DISA Applications Security

and Development Security Technical Implementation Guide Category II vulnerability (Section 2.1.5).

Static Security Analysis is the analysis of computer software that is performed

without actually executing programs to detect and report weaknesses that can lead to security vulnerabilities. • Static security analysis, in conjunction with manual review of the code,

is recommended in section 5.4 of the DISA Applications Security and Development Security Technical Implementation Guide.

• Use of automated tools is now mandated for DoD by Federal Law

SELECTED TERMINOLOGY

10

Page 11: SOFTWARE CODE QUALITY CHECKING (SCQC) - ITEA€¦ · Static Security Analysis. is the analysis of computer software that is performed without actually executing programs to detect

RELATIONSHIP TO INFORMATION ASSURANCE • Information Assurance (IA) relates to measures that protect

and defend information and information systems by ensuring their availability, integrity, authentication, confidentiality and non-repudiation. These measures include providing for restorations of information systems by incorporating protection, detection, and reaction capabilities. Information systems include the software that controls the systems and processes data and information.

• Therefore, measures must be used to protect systems from

(both) software vulnerabilities and unintended software processing that expose a system to compromises in availability, integrity and other security properties. Software Assurance (SwA) provides these measures. 11

Page 12: SOFTWARE CODE QUALITY CHECKING (SCQC) - ITEA€¦ · Static Security Analysis. is the analysis of computer software that is performed without actually executing programs to detect

SELECTED ANALYSIS TOOLS (JAVA ONLY) CAST Application Intelligence Platform (CAST) Analyze source code (Static Analysis) Supports multiple languages Checks against multiple code quality

metrics

Fortify (Fortify Source Code Analyzer) Analyzes source code security

vulnerabilities Supports multiple languages Checks against multiple security standards Static Security Analysis

FindBugs with FindSecurityBugs Open Source Java Code Analyzer Static Quality Analysis Used to find additional flaws and remove

tool bias. Static Security Analysis Supplement Can scan third-party JARs

JArchitect Measure software quality against

standard code metrics Currently supports Java Inspects assembly dependencies

extensively

SonarQube Measure software quality against

Microsoft Quality Standards Runs quality analysis based of findings. Inspects assembly dependencies

extensively

WebInspect Analyzes source code security

vulnerabilities Dynamic Security analysis

OWASP Dependency Check

Open source utility Identifies third-party project

dependencies Checks for known, publicly disclosed,

vulnerabilities

12

Page 13: SOFTWARE CODE QUALITY CHECKING (SCQC) - ITEA€¦ · Static Security Analysis. is the analysis of computer software that is performed without actually executing programs to detect

THE VALUE PROPOSITION

13

Page 14: SOFTWARE CODE QUALITY CHECKING (SCQC) - ITEA€¦ · Static Security Analysis. is the analysis of computer software that is performed without actually executing programs to detect

DEFECT DENSITY - BASIC MODEL* Requirements Analysis/Desig

n

Code/Unit Testing

Government Testing

Production/ Deployment

Total Cost/ Investment

Return on Investment

Error Distribution

10% 20% 55% 15%

Hours to Correct per Defect

50 120 380

Cost per Hour $100 $100 $100

Cost to Fix 1000 Errors

(900 in testing)

$1,000,000 $6,600,000 $5,700,000 $13,300,000

• *Stewart-Priven Group, 2009 Presentation to PMI-MHS “Software Inspection Success” • DAU Advanced Test and Evaluation (TST 303)

14

Page 15: SOFTWARE CODE QUALITY CHECKING (SCQC) - ITEA€¦ · Static Security Analysis. is the analysis of computer software that is performed without actually executing programs to detect

RETURN ON INVESTMENT

15

Page 16: SOFTWARE CODE QUALITY CHECKING (SCQC) - ITEA€¦ · Static Security Analysis. is the analysis of computer software that is performed without actually executing programs to detect

CLINGER-COHEN SEC. 5122. CAPITAL PLANNING AND INVESTMENT CONTROL. (a) DESIGN OF PROCESS- In fulfilling the responsibilities assigned under section 3506(h) of title 44, United States Code, the head of each executive agency shall design and implement in the executive agency a process for maximizing the value and assessing and managing the risks of the information technology acquisitions of the executive agency. (b) CONTENT OF PROCESS- The process of an executive agency shall-- (1) provide for the selection of information technology investments to be made by the executive agency, the management of such investments, and the evaluation of the results of such investments; (2) be integrated with the processes for making budget, financial, and program management decisions within the executive agency; (3) include minimum criteria to be applied in considering whether to undertake a particular investment in information systems, including criteria related to the quantitatively expressed projected net, risk-adjusted return on investment and specific quantitative and qualitative criteria for comparing and prioritizing alternative information systems investment projects; (4) provide for identifying information systems investments that would result in shared benefits or costs for other Federal agencies or State or local governments; (5) provide for identifying for a proposed investment quantifiable measurements for determining the net benefits and risks of the investment; and (6) provide the means for senior management personnel of the executive agency to obtain timely information regarding the progress of an investment in an information system, including a system of milestones for measuring progress, on an independently verifiable basis, in terms of cost, capability of the system to meet specified requirements, timeliness, and quality. 16

Page 17: SOFTWARE CODE QUALITY CHECKING (SCQC) - ITEA€¦ · Static Security Analysis. is the analysis of computer software that is performed without actually executing programs to detect

20% DEFECT REMOVAL ROI MODEL

Requirements Analysis/Design

Code/Unit Testing

Government Testing

Production/ Deployment

Total Cost/ Investment

Return on Investment

Error Distribution 10% 20% 55% 15%

Hours to Correct per Defect

50 120 380

Cost per Hour $100 $100 $100

Cost to Fix 1000 Errors (900 in Testing)

$1,000,000 $6,600,000 $5,700,000 $13,300,000

SCQC Applied

Error Distribution 10% 40% 45% 5%

Hours to Correct per Defect

50 120 380

Cost per Hour $100 $100 $100

Cost to Fix 1000 Errors (900 in Testing)

$2,013,518 $5,400,000 $1,800,000 $9,213,158

Cost Avoidance $1,013,518 $1,200,000 $3,900,000 $4,086,842

SCQC Investment $1,868,230

ROI 118.75%

17

Page 18: SOFTWARE CODE QUALITY CHECKING (SCQC) - ITEA€¦ · Static Security Analysis. is the analysis of computer software that is performed without actually executing programs to detect

OBSERVED SCQC BENEFITS • Testing by itself is time consuming and not very efficient.*

• Most forms of testing only find about 35% of the bugs that are present.

• Static analysis prior to testing is very quick and about 85% efficient. • As a result, when testing starts there are so few bugs present that testing

schedules are cut down by perhaps 50%. • Static analysis will also find some structural defects that are not usually found by

testing.

• Static Security Analysis prior to RMF testing may find, and be able to help correct, a large number of the Applications Source Code defects identified during RMF testing. • When combined with Manual Code Review and Dynamic Analyses, can reduce

“False Positives.”

*Capers Jones -Distinguished Advisor to the Consortium for IT Software Quality (CISQ). CISQ brings together industry executives from Global 2000 IT organizations, system integrators, outsourcers, and package vendors to jointly address the challenge of standardizing the measurement of IT software quality and to promote a market-based ecosystem to support its deployment.

18

Page 19: SOFTWARE CODE QUALITY CHECKING (SCQC) - ITEA€¦ · Static Security Analysis. is the analysis of computer software that is performed without actually executing programs to detect

85% DEFECT REMOVAL ROI MODEL Requirements

Analysis/Design Code/Unit

Testing Government

Testing Production/ Deployment

Total Cost/ Investment

Return on

Investment

Error Distribution 10% 20% 55% 15%

Hours to Correct per Defect

50 120 380

Cost per Hour $100 $100 $100

Cost to Fix 1000 Errors $1,000,000 $6,600,000 $5,700,000 $13,300,000

SCQC Applied

Error Distribution 10% 80% 7% 3%

Hours to Correct per Defect

50 120 380

Cost per Hour $100 $100 $100

Cost to Fix 1000 Errors $2,960,000 $621,600 $843,600 $4,425,000

Cost Avoidance $1,960,000 $5,978,400 $4,856,400 $8,874,000

SCQC Investment $1,868,230

ROI 375.04%

19

Page 20: SOFTWARE CODE QUALITY CHECKING (SCQC) - ITEA€¦ · Static Security Analysis. is the analysis of computer software that is performed without actually executing programs to detect

WHAT’S THE PROBLEM WITH THE MODEL?

Page 21: SOFTWARE CODE QUALITY CHECKING (SCQC) - ITEA€¦ · Static Security Analysis. is the analysis of computer software that is performed without actually executing programs to detect

MODEL ISSUES • The Numbers in Red Are Today’s BUDGET

Issues • The Benefits/Value Appear In The Out-Years • Managers Worry About Budgets • Leaders Look To The Future and Worry About

Value • Are You a Manager or Are You a Leader?

• Model assumes that vendors continue to

make mistakes early in the SDLC and continue to correct them

21

Page 22: SOFTWARE CODE QUALITY CHECKING (SCQC) - ITEA€¦ · Static Security Analysis. is the analysis of computer software that is performed without actually executing programs to detect

HOW DO WE CONDUCT AND REPORT OUR SECURITY FINDINGS?

22

Page 23: SOFTWARE CODE QUALITY CHECKING (SCQC) - ITEA€¦ · Static Security Analysis. is the analysis of computer software that is performed without actually executing programs to detect

SECURITY ANALYSIS AND REPORTS • FORTIFY is primary tool

• FindBugs, FindSecurityBugs, SONAR and CAST Used as Supplemental Support

• Focus is on Software WEAKNESSES • External AND Internal Security Vulnerabilities/Violations • Also Identifies Related Code Quality Issues

• Automated Scan • Manual review required for removal of “False Positives”

• Reports • High Level DISA STIG Summary with Level of Effort • Detailed Violation Report with Suggested Remedial Action for CAT 1

Violations • Spreadsheet with Individual Defects Identified Down to the Line of Code • .FPR file for vendors with the tool • Face-to-Face Consultation When Asked

23

Page 24: SOFTWARE CODE QUALITY CHECKING (SCQC) - ITEA€¦ · Static Security Analysis. is the analysis of computer software that is performed without actually executing programs to detect

REPRESENTATIVE FINDINGS File Name

Line # Category CWE STIG

D*****_v1.0.0.405/D*****_UserInterface/controls/EncounterTabUserControl.ascx

142 Cross-Site Scripting: Persistent

CWE ID 79, CWE ID 80

APP3510 CAT I, APP3580 CAT I

D*****_v1.0.0.405/D*****_UserInterface/patients.aspx

115 Cross-Site Scripting: Persistent

CWE ID 79, CWE ID 80

APP3510 CAT I, APP3580 CAT I

D*****_v1.0.0.405/D*****_UserInterface/controls/EncounterTabUserControl.ascx

95 Cross-Site Scripting: Persistent

CWE ID 79, CWE ID 80

APP3510 CAT I, APP3580 CAT I

D*****_v1.0.0.405/D*****_UserInterface/controls/RegistryAdminInfoTabUserControl.ascx

88 Cross-Site Scripting: Persistent

CWE ID 79, CWE ID 80

APP3510 CAT I, APP3580 CAT I

D*****_v1.0.0.405/D*****_UserInterface/controls/D*****BaseControl.ascx.cs

1061

Dead Code: Unused Method

CWE ID 561 APP3050 CAT II

D*****_v1.0.0.405/BusinessManager/Utilities/Dynamic.cs

1421

Dead Code: Unused Method

CWE ID 561 APP3050 CAT II

D*****_v1.0.0.405/D*****_UserInterface/controls/EncounterTabUserControl.ascx.cs

165 Dead Code: Unused Method

CWE ID 561 APP3050 CAT II

D*****_v1.0.0.405/D*****_UserInterface/Referral.aspx.cs

1101 Dead Code: Unused Method

CWE ID 561 APP3050 CAT II

D*****_v1.0.0.405/Business/LINQEntityBase.cs 147 Missing XML Validation CWE ID 112 APP3510 CAT I

D*****_v1.0.0.405/Business/SerializerUtil.cs 43 Missing XML Validation CWE ID 112 APP3510 CAT I

D*****_v1.0.0.405/D*****_UserInterface/App_Code/HtmlUtilities.cs

85 Poor Error Handling: Empty Catch Block

CWE ID 391 APP3120 CAT II

D*****_v1.0.0.405/Business/LINQEntityBase.cs 758 Poor Error Handling: Empty Catch Block

CWE ID 391 APP3120 CAT II

Page 25: SOFTWARE CODE QUALITY CHECKING (SCQC) - ITEA€¦ · Static Security Analysis. is the analysis of computer software that is performed without actually executing programs to detect

RECENT SECURITY FINDINGS DEFECTS REMEDIATION EFFORT (HOURS)

LINES OF CODE

CAT 1 CAT 2 OTHER TOTAL DENSITY CAT 1 CAT 2 TOTAL

Project 1a 87,393 274 1751 83 2108 2.41% 52 110 162

Project 1b 74,623 123 1070 806 1999 1.65% 25 108 133

Project 2 5,126 23 99 13 135 2.63% 4 25 29

Project 3a 43,867 143 352 n/a 495 1.13% n/a n/a 92.1

Project 3b 22,393 108 366 n/a 474 2.11% 26 44.6 70.6

Project 4a 27,639 35 58 16 109 0.39% 4 11.5 15.5

Project 4b 15,155 2 15 n/a 17 0.11% .25 5.25 5.5

Project 4c 37,299 175 513 n/a 688 1.97% 20.8 50 70.8

Project 5a 49,664 376 738 39 1153 2.32% 66 100.8 166.8

Project 5b 35,329 126 485 n/a 611 1.7% 36 84.1 120

Project Xa 147,026 733 1781 234 2748 1.9% 90 277.4 367.4

Project Xb 112,671 375 813 18 1206 1.07% 60 164.5 224.5

Page 26: SOFTWARE CODE QUALITY CHECKING (SCQC) - ITEA€¦ · Static Security Analysis. is the analysis of computer software that is performed without actually executing programs to detect

AN IMPORTANT SECURITY LESSON

• Nothing Beats Having a Consistent Tool That is Used by EVERYONE Throughout The SDLC.

• Developers at the Desktop • Contractor’s Auditor/Code Master • Government Independent Auditor

• We exchange tool output files…… • Project X is Our Best Example

26

Page 27: SOFTWARE CODE QUALITY CHECKING (SCQC) - ITEA€¦ · Static Security Analysis. is the analysis of computer software that is performed without actually executing programs to detect

• Began Using FORTIFY – February 2013 • Exchanged Spreadsheets for early releases • Fully Integrated Tool Into Development Environment

• Works with IDE and Code Quality Tools • 56% Defect Reduction in Three (3) Weeks • Second Lowest Defect Density (1.07%) in SCQC History • Achieved 0.21% DEFECT DENSITY AS OF 9 AUGUST 2013

• 184 Defects to be fixed in 86,382 Lines of Code • Achieved .004244% DEFECT DENSITY AS OF 11 FEBRUARY

2014 • 5 Defects to be fixed in 117,804 Lines of Code

PROJECT X

27

Page 28: SOFTWARE CODE QUALITY CHECKING (SCQC) - ITEA€¦ · Static Security Analysis. is the analysis of computer software that is performed without actually executing programs to detect

PENETRATION TESTING

28

Page 29: SOFTWARE CODE QUALITY CHECKING (SCQC) - ITEA€¦ · Static Security Analysis. is the analysis of computer software that is performed without actually executing programs to detect

“EVERY SYSTEM WILL BE SUBJECT TO PENETRATION TESTING’

DOT&E

29

Page 30: SOFTWARE CODE QUALITY CHECKING (SCQC) - ITEA€¦ · Static Security Analysis. is the analysis of computer software that is performed without actually executing programs to detect

WHAT ARE WE DOING?

• Static Security Analysis using • FORTIFY • FindBugs with FindSecurityBugs

• Dynamic Security Analysis using • WebInspect

• Crawl • Audit • Deep Audit

• Performed on Production-Representative System in a Lab • 16,800 attacks – 47 Unaudited Findings • 14,200 attacks – 1 Residual Finding

• Project X 30

Page 31: SOFTWARE CODE QUALITY CHECKING (SCQC) - ITEA€¦ · Static Security Analysis. is the analysis of computer software that is performed without actually executing programs to detect

OPEN SOURCE AND THIRD PARTY SOFTWARE

or HOW BIG IS MY

APPLICATION REALLY? 31

Page 32: SOFTWARE CODE QUALITY CHECKING (SCQC) - ITEA€¦ · Static Security Analysis. is the analysis of computer software that is performed without actually executing programs to detect

FindBugs w FindSecurityBugs • Vendor Code Only

• Scanned 9 October 2014 • 113143 Lines of Code • 207 Bugs

• 32 Performance

• 27 Security Bugs (Unaudited)

• Vendor Plus Third Party and Open Source Code • Scanned 9 October 2104 • 3,369,107 Lines of Code • 28,788 Bugs

• 167 Unsatisfied Obligation to Clean Up Stream or Resource

• 379 Inconsistent Synchronization

• 1106 Security Bugs (Unaudited)

Page 33: SOFTWARE CODE QUALITY CHECKING (SCQC) - ITEA€¦ · Static Security Analysis. is the analysis of computer software that is performed without actually executing programs to detect

WHAT ABOUT AGILE DEVELOPMENT?

Page 34: SOFTWARE CODE QUALITY CHECKING (SCQC) - ITEA€¦ · Static Security Analysis. is the analysis of computer software that is performed without actually executing programs to detect

RATIONAL UNIFIED PROCESS (RUP)

• Develop iteratively, with risk as the primary Sprint driver • Manage requirements • Employ a component-based architecture • Model software visually • Continuously verify quality* • Control changes

* If you are not continuously checking/verifying the quality and security of your code, you are not truly Agile; you are just fast and sloppy….

Page 35: SOFTWARE CODE QUALITY CHECKING (SCQC) - ITEA€¦ · Static Security Analysis. is the analysis of computer software that is performed without actually executing programs to detect

AGILE DEVELOPMENT MODEL

35

Initial Requirements and Architecture Models

Sprint #1

Sprint #3

Sprint #2

Sprint #4

Sprint #9

Sprint #8

Sprint #5

Establish Battle-Rhythm

Lessons Learned

Lessons Learned

Lessons Learned

Lessons Learned

Lessons Learned

Lessons Learned

CODE DROP &

AUDIT

Refine Results

CODE DROP &

AUDIT

CODE DROP &

AUDIT

Etc.

464 Findings

CODE DROP &

AUDIT

4 Findings

Page 36: SOFTWARE CODE QUALITY CHECKING (SCQC) - ITEA€¦ · Static Security Analysis. is the analysis of computer software that is performed without actually executing programs to detect

WHAT WAS THE END RESULT?

0 defects detected in

pre-production environment

Page 37: SOFTWARE CODE QUALITY CHECKING (SCQC) - ITEA€¦ · Static Security Analysis. is the analysis of computer software that is performed without actually executing programs to detect

WORDS OF WISDOM FROM NSA

•None of the Static Analysis Tools Are Perfect

•The time for studying and analyzing is over

•Pick a tool and just do it….. 37

Page 38: SOFTWARE CODE QUALITY CHECKING (SCQC) - ITEA€¦ · Static Security Analysis. is the analysis of computer software that is performed without actually executing programs to detect

Questions?

38