software security engineering

41
1

Upload: ahm-pervej-kabir

Post on 15-Jan-2017

346 views

Category:

Engineering


0 download

TRANSCRIPT

Page 1: Software security engineering

1

Page 2: Software security engineering

2

Agenda1. Approaches To Application Security2. Software Security Roadmap (CMM, S-SDLCs)3. Software Security Activities And Artifacts

Security Requirements and Abuse Cases Threat Modeling Secure Design Guidelines Secure Coding Standards and Reviews Security Tests Secure Configuration and Deployment

4. Metrics and Measurements5. Business Cases

Page 3: Software security engineering

3

Approaches To Application Security

Page 4: Software security engineering

4

The “Know But Ignore” Approach: Do Not Act

Page 5: Software security engineering

5

Tactical View: Finding Vulnerabilities

AutomatedAutomatedVulnerabilityVulnerabilityScanningScanning

AutomatedAutomatedStatic CodeStatic Code

AnalysisAnalysis

ManualManualPenetrationPenetrationTestingTesting

ManualManualCodeCode

ReviewReview

Page 6: Software security engineering

6

Strategic View: Manage Software Risks

Page 7: Software security engineering

7

Holistic View: Software vs. Application Security

Security applied by catch and patches

Security built into each phase ofthe SDLC

Look at root problem causes

Look at externalsymptoms

Reactive, Incident Response,Compliance

Proactive, Threat Modeling, Secure Code Reviews

Page 8: Software security engineering

8

Software Security Roadmap

Page 9: Software security engineering

9

Software Security Roadmap1. Assess the maturity of the organization

software security development processes, people and tools

2. Define the software security process: security enhanced SDLCs, frameworks and checkpoints

3. Implement software security activities1. Security Requirements2. Secure Design and Threat Modeling3. Secure Coding Guidelines and Security Code Review4. Security Testing 5. Secure Deployment

4. Collect metrics and measurements5. Create business cases and set objectives

Page 10: Software security engineering

10

Security-enhanced lifecycle process (S-SDLC) models: MS-SDL , CLASP

Page 11: Software security engineering

11

Building Security In the Waterfall SDLC

Threat Modeling

Secure Requirements

Secure Code Reviews

Security Testing

Page 12: Software security engineering

12

Periodic Security Sprints

Build Security in Agile SDLC

Threat Model

Stakeholder Security Stories

Application Security Assurance Review

Periodic Security Sprints

{

12

Page 13: Software security engineering

13

Security Requirements and Abuse Cases

Page 14: Software security engineering

14

Security Requirements

Encompasses both functional requirements for security controls and risk mitigation driven requirements from the abuse case scenarios

Define Security Requirements in StandardsWhich controls are required (e.g. authentication,

authorization, encryption etc)Where should be implemented (e.g. design, source

code, application, server)Why are required

Compliance and auditing Mitigation for known threats

How should be implemented and tested

Page 15: Software security engineering

15

Functional and Non Functional Requirements Functional Requirements:

Define the expected functionality of security controlsDepends on the applicable standards, policies and regulations

Positive statements “the application will lockout the user after 6 failed logon

attempts” “passwords need to be 6 min characters, alphanumeric”

Risk Driven Security RequirementsAddress all common vulnerabilitiesCan be derived by use (or misuse) casesNegative statements

The application should not allow of the data being altered or destroyed

The application should not be compromised or misused for un-authorized financial transaction by a malicious user.

Page 16: Software security engineering

16

Security Requirements Derivation Through Use and Misuse Cases

Source: OWASP Testing Guide Vs 3 Introduction

User

Hacker/Malicious User

Brure ForceAuthentication

Enter Username andpassword

Validate PasswordMinimum Length and

ComplexityApplication/Server

Includes

Mitigates

User Authentication

Includes

Includes

Includes

Mitigates

Threatens

Show Generic ErrorMessage

Includes

Includes

Lock Account After N.Failed Login Attempts

Harverst (e.g. guess)Valid User Accounts

Dictionary Attack

Mitigates

Mitigates

Page 17: Software security engineering

17

Threat Modeling

Page 18: Software security engineering

18

Threat Modeling Categorizes the threats to the

application, highlights potential vulnerabilities and identifies countermeasures to be developed

Use a systematic fact based and methodical approach:

1. Scope AssessmentRequirements, Use Cases

2. System ModelingPhysical and Logical View, Data Flows, Trust

Boundaries, Entry Points3. Threat Identification

STRIDE, ASF4. Threat Vulnerabilities and Attacks

Checklists, Attack Vulnerability Mapping5. Identification of Countermeasures

Security Controls6. Threat Prioritization and Risk Ranking

Risk Modeling

Page 19: Software security engineering

19

System Modeling: Data Flow Diagrams

Anonymous

Administrator

Database

Logs

User Web Server

HTTP/HTTPS over public internet, form

logins

Apache 2.0.54 on OpenBSD 3.7 with

mod_lisp and CMUCL

FirewallLocal

Filesystem

Machine Boundary

ODBC over SSL on switched 100bT, user/pass login

Flat text file on OpenBSD

3.7

PostgreSQL 8.0.3 on OpenBSD 3.7

Source: Threat Modeling Dr James Walden

Page 20: Software security engineering

20

Threats and Countermeasures Identification

Source: OWASP TM

Page 21: Software security engineering

21

Threat Modeling in the SDLCThreat Modeling in the SDLC

Des

ign

Des

ign

Dev

elop

men

tD

evel

opm

ent

Test

ing

Test

ing

Dep

loym

ent

Dep

loym

ent

Def

initi

onD

efin

ition Use and Abuse

CasesSecurity

Requirements

Threat ModelingData Flow Diagrams Attack Trees

Secure Code Reviews

Security Integrated Testing

Vulnerability Assessments

(User Acceptance Test)

Secure Architecture

Modeling

Secure Coding Standards

Secure Configuration &

Installation

Security Testing Guidelines

(System Tests)

Secure Requirements Engineering

Security Testing Guidelines (Unit

Tests)Security Unit

Testing

Vulnerability Assessments (Production)

Page 22: Software security engineering

22

Secure Design Guidelines

Page 23: Software security engineering

23

Security Design ReviewsObjective is promote secure design and

identify of potential flaws before construction phase

Secure Architecture Review ProcessReview High Level Design documents and verify that security controls requirements are documented

Engage with: Architects Application Security Experts

Provide guidance on security technology/design patterns

Identify potential gaps in security controls with threat modeling

Page 24: Software security engineering

24

Secure Coding Standards and Secure Code Reviews

Page 25: Software security engineering

25

Secure Coding Standards/Guidelines

Describe secure coding requirement in terms of:1. The common vulnerabilities (e.g. OWASP T10)2. The issue type (e.g. Application Security

Frame)3. The security threat or how can be exploited4. The in-secure code root cause of the

vulnerability5. The “How to” find the vulnerability with

black box and white box testing 6. The secure coding

requirement/recommendation7. The risk rating (e.g. STRIDE/DREAD, OWASP)

Page 26: Software security engineering

26

Example SQL Injection - Secure coding requirements

Use SQL parameterized queries, avoid dynamic SQL generation: SELECT * FROM users WHERE username=? JAVA EE use strongly typed “PreparedStatement” in .NET use “SqlCommand” with

“SqlParameters”Sanitize input, remove special

characters: ' " ` ; * % _ =&\|*?~<>^()[]{}$\n\r

Use custom error messages: No SQL exception information in error messages

Page 27: Software security engineering

27

Secure Code Reviews Objectives:

Identification of security issues in source code, the type of the issue, the severity and recommendation on how should be fixed

Can be used to validate secure coding standards Security assessment before releasing to QA and

production Methodologies:

Automated Focused Source Code Analysis Focus is on validation of false positives and auditing of

automated scan results Manually Focused Secure Code Review

Focus is on identification of security issues as bugs vs. flaws by categorizing the issues by type of vulnerability introduced

Page 28: Software security engineering

28

Source Code Analysis

Page 29: Software security engineering

29

Security Tests

Page 30: Software security engineering

30

Security TestingDevelop security test cases

Positive functional security test casesNegative test cases (from use and misuse cases)Common vulnerabilities exposure

Integrate Tests in Developers and Testers WorkflowsStatic and Dynamic Testing, Unit TestsIntegrated System Tests and Operational Tests

Analyze and report test dataDefect ManagementRoot Cause Identification

Page 31: Software security engineering

31

Security Testing Example: XSSDefine Test Case

Test login web page for XSSTesting Procedure

Type the following strings in input fields <script>alert()</script>; javascript:alert() +ADw-SCRIPT+AD4-alert();+

Pass: Input validation Error is through to the user

Fail: an alert dialog box is seen in the browser window.

Page 32: Software security engineering

32

Testing Tools Categorization and Examples Vulnerability Scanning

ISS, Foundscan, Nessus, Nikto Fault Injection Testing (Black Box Testing)

Webinspect, Appscan, Hailstorm, Paros, Peach Binary Analysis

IDA Pro, @stake SmartRisk Source Code Analysis

Fortify, Klockworks, Parasoft, Free Tools (e.g. FindBugs) Threat Modeling

MS TAM, TRIKE, PTA Technologies Rootkit BackDoor Analysis

ootkits.org and rootkit.nl

Page 33: Software security engineering

33

Secure Configuration And Deployment

Page 34: Software security engineering

34

Secure Deployment And Configuration ItemsEnsure the server configuration is secure

Only essential services, server hardening policiesProtect Access To Application Files/Data

XML files, property files, scripts, databases, directories

Enable Auditing And LoggingEnable all secure auditing and logging, protect logs

Enforce Change Management ControlsDon’t allow configuration changes without oversightAudit configuration data

Release SecurelyDon’t allow releases to ship without a security review

Page 35: Software security engineering

35

Metrics And Measurements

Page 36: Software security engineering

36

Application Security Defect Tracking and MetricsDefine where and how security metrics is collected Tracking security defects throughout the SDLC

Report the root causes: requirements, design, code, application

Report the type of the issues, the severity and whether has been fixed or no

MetricsWhat lifecycle stage are most flaws originating in?What security mechanisms/controls are we having trouble implementing?

What security vulnerabilities are we having trouble fixing?

Page 37: Software security engineering

37

Examples of Application Security Metrics

Process Metrics Is a SDL is used are

security gates enforced? Is code validated against

security standards? Security posture of a new

application before delivery Security Officers Sign Off? Test For Security

Vulnerabilities Executed? All high risk issues closed? Risk assessments

completed? % of developers trained,

using organizational security best practice technology, architecture and processes

Management Metrics % of applications rated

“business-critical” that have been security tested

% of projects that where developed with the SDL

% of security issues identified by lifecycle phase

% of issues whose risk has been accepted

% of security issues being fixed

Average time to correct vulnerabilities

Business impact of critical security incidents.

Page 38: Software security engineering

38

Security Metrics Goals The Good and The Bad

Good: if goals when are “SMART” that is Specific, Measurable, Attainable, Realistic, Traceable and Appropriate Example: reducing the overall number of vulnerabilities by

30% by fixing all low hanging fruits with source code analysis during construction

Bad: if the goals justify the means to obtain the goals

Page 39: Software security engineering

39

Business Case

Page 40: Software security engineering

40

Business Cases for Your Organization

Tie the metrics to the business cases and support the project stakeholders agendas: Developer Leads: show that software can be build more

securely and efficiently Project Managers: shows that projects are on schedule

and moving on target for the delivery dates and are getting better during tests

Information Security Officers: provides a level of assurance that security standard compliance is addressed through the security review processes within the organization.

Benefits: Cost savings Risk measurement and reduction Compliance reporting

Page 41: Software security engineering

41

Business Cases And Software Security Strategy Be realistic on what can be achievedOrganization is not yet ready (e.g. mature)Engineers are not trained in software securityThere are no tools available

Adapt the strategy to realityBuild upon your company strenghtsGet stakeholders buy in (CIOs, ISOs, PM, Developers,

Architects)Set achieveable goals: reduce 30% of vulnerabilities

found through ethical hacking via source code analysys Perform a gap analysis and proceed with process

improvement cycles:Tailor to the initiative to the company cultureBe risk management driven Introduce metrics and prove results