1 of 86

Security in DevOps-Strategies

The OWASP Foundation

OWASP

http://www.owasp.org

OWASP

Timo Pagel

2 of 86

Agenda

  • Introduction
  • Generic DevOps Security Maturity Model
  • Conclusion

2

Timo Pagel

OWASP

Timo Pagel

3 of 86

Agenda

  • Introduction
  • Generic DevOps Security Maturity Model
  • Conclusion

3

Timo Pagel

OWASP

Timo Pagel

4 of 86

About Me

  • DevOps Security Consultant
  • Lecturer for Security in Web Applications at University of Applied Sciences Kiel
  • Open Source Enthusiast

  • Hiring Software Developers

Timo Pagel

OWASP

Timo Pagel

5 of 86

5

OWASP

Timo Pagel

6 of 86

6

Wall of Irritation

OWASP

Timo Pagel

7 of 86

7

OWASP

Timo Pagel

8 of 86

8

OWASP

Timo Pagel

9 of 86

9

OWASP

Timo Pagel

10 of 86

10

What about quality when deploy automatically multiple times a day?

OWASP

Timo Pagel

11 of 86

11

OWASP

Timo Pagel

12 of 86

Problem Statement

  • How to enhance information security?
    • In DevOps-Strategies
    • Through DevOps-Strategies
  • How to prioritize?

12

Information Security

Timo Pagel

OWASP

Timo Pagel

13 of 86

DevOps-Dimensions

  • Build and Deployment
  • Culture and Organisation
  • Information Gathering
  • Infrastructure
  • Test and Verification

13

Timo Pagel

OWASP

Timo Pagel

14 of 86

Agenda

  • Introduction
  • Generic DevOps Security Maturity Model
  • Conclusion

14

Timo Pagel

OWASP

Timo Pagel

15 of 86

Generic DevOps Security Maturity Model

http://gdosmm.timo-pagel.de

  • Build and Deployment
  • Culture and Organisation
  • Information Gathering
    • Logging & Monitoring
  • Infrastructure
  • Test and Verification
    • Dynamic depth
    • Static depth
    • Consolidation
    • ...

15

Timo Pagel

OWASP

Timo Pagel

16 of 86

Levels

  • Level 1: Basic understanding of security practices
  • Level 2: Understanding of security practices
  • Level 3: High understanding of security practices
  • Level 4: Advanced understanding of security practices at scale

Timo Pagel

OWASP

Timo Pagel

17 of 86

Identification of the Implementation Maturity

17

Timo Pagel

OWASP

Timo Pagel

18 of 86

Implementation Point

  • Risk
  • Countermeasure
  • Outcome for Security / Hartness of Implementation
  • Dependencies
  • Implementation Hints

18

Timo Pagel

OWASP

Timo Pagel

19 of 86

I am using Docker, now I am safe

Timo Pagel

OWASP

Timo Pagel

20 of 86

Infrastructure

  • Virtual Environments
    • KVM/Docker: No network restrictions

20

Virtual Environment

Virtual Environment

Virtual Environment

Internet

Firewall

Physical Server

Timo Pagel

OWASP

Timo Pagel

21 of 86

Infrastructure

  • Virtual Environments
    • KVM/Docker: No network restrictions

21

Virtual Environment

Virtual Environment

Virtual Environment

Internet

Firewall

Physical Server

Timo Pagel

OWASP

Timo Pagel

22 of 86

Infrastructure

  • Virtual Environments
    • KVM/Docker: No network restrictions

22

Virtual Environment

Virtual Environment

Virtual Environment

Internet

Firewall

Physical Server

Not a new problem

  • More containers -> higher risk

Timo Pagel

OWASP

Timo Pagel

23 of 86

Controlled networks in virtual environments

OWASP

Timo Pagel

24 of 86

I hardened my production environment, now I am safe

Timo Pagel

OWASP

Timo Pagel

25 of 86

Build and Deployment Process

25

Developer

Version

Control

Build and Deployment

Production System

Internal Repository

Production near System

Libraries from external repositories

Timo Pagel

OWASP

Timo Pagel

26 of 86

Build and Deployment Process

26

Developer

Version

Control

Build and Deployment

Production System

Internal Repository

Production near System

Libraries from external repositories

Timo Pagel

OWASP

Timo Pagel

27 of 86

Build and Deployment Process

27

Developer

Version

Control

Build and Deployment

Production System

Internal Repository

Production near System

Libraries from external repositories

Timo Pagel

OWASP

Timo Pagel

28 of 86

Build and Deployment Process

28

Developer

Version

Control

Build and Deployment

Production System

Internal Repository

Production near System

Libraries from external repositories

Timo Pagel

OWASP

Timo Pagel

29 of 86

Build and Deployment Process

29

Developer

Version

Control

Build and Deployment

Production System

Internal Repository

Production near System

Libraries from external repositories

Accounting

Secretary

….

Timo Pagel

OWASP

Timo Pagel

30 of 86

Build and Deployment Process

30

Developer

Version

Control

Build and Deployment

Production System

Internal Repository

Production near System

Libraries from external repositories

Accounting

Secretary

….

Attacker

Timo Pagel

OWASP

Timo Pagel

31 of 86

Build and Deployment Process

31

Developer

Version

Control

Build and Deployment

Production System

Internal Repository

Production near System

Libraries from external repositories

Accounting

Secretary

….

Attacker

Timo Pagel

OWASP

Timo Pagel

32 of 86

CVE-2017-1000117

Source: https://about.gitlab.com/2017/08/10/gitlab-9-dot-4-dot-4-released/

Timo Pagel

OWASP

Timo Pagel

33 of 86

Simple access control for systems

Applications run in virtual environments

Test of server side application comp.with known vuln.

OWASP

Timo Pagel

34 of 86

Build and Deployment Process

34

Developer

Version

Control

Build and Deployment

Production System

Internal Repository

Production near System

Libraries from external repositories

Accounting

Secretary

….

Attacker

Timo Pagel

OWASP

Timo Pagel

35 of 86

Build and Deployment Process

35

Developer

Version

Control

Build and Deployment

Production System

Internal Repository

Production near System

Libraries from external repositories

Accounting

Secretary

….

Attacker

Timo Pagel

OWASP

Timo Pagel

36 of 86

Build and Deployment Process

36

Developer

Version

Control

Build and Deployment

Production System

Internal Repository

Production near System

Libraries from external repositories

Accounting

Secretary

….

Mostly credentials.xml can be read!

Attacker

Timo Pagel

OWASP

Timo Pagel

37 of 86

Demo

Developer

Version

Control

Build and Deployment

Production System

Internal Repository

Timo Pagel

OWASP

Timo Pagel

38 of 86

Simple access control for systems

Applications run in virtual environments

Checking the sources of used libraries

OWASP

Timo Pagel

39 of 86

Build and Deployment Process

39

Developer

Version

Control

Build and Deployment

Production System

Internal Repository

Production near System

Libraries from external repositories

Timo Pagel

OWASP

Timo Pagel

40 of 86

Build and Deployment Process

40

Developer

Version

Control

Build and Deployment

Production System

Internal Repository

Production near System

Libraries from external repositories

Timo Pagel

OWASP

Timo Pagel

41 of 86

Build and Deployment Process

41

Developer

Version

Control

Build and Deployment

Production System

Internal Repository

Production near System

Libraries from external repositories

Timo Pagel

OWASP

Timo Pagel

42 of 86

Building and testing of artifacts in virtual environments

Checking the sources of used libraries

Defence metrics

OWASP

Timo Pagel

43 of 86

Build and Deployment Process

43

Developer

Version

Control

Build and Deployment

Production System

Internal Repository

Production near System

Libraries from external repositories

Accounting

Secretary

….

Attacker

Timo Pagel

OWASP

Timo Pagel

44 of 86

Build and Deployment Process

44

Developer

Version

Control

Build and Deployment

Production System

Internal Repository

Production near System

Libraries from external repositories

Internet

Timo Pagel

OWASP

Timo Pagel

45 of 86

Private Registry, Public Access

Public Registry, Attack in July 2016

Source: http://blog.aquasec.com/vines-docker-registry-hack-a-bad-case-of-rtfm

Timo Pagel

OWASP

Timo Pagel

46 of 86

Simple access control for systems

OWASP

Timo Pagel

47 of 86

47

  • Integration Tests: HttpUnit
  • Static Analysis
    • FindSecurityBugs
    • OWASP Dependency Check

Developer

Version

Control

Build and Deployment

Production System

Internal Repository

Production near System

Static Test-System

OWASP

Timo Pagel

48 of 86

48

  • Integration Tests: HttpUnit
  • Static Analysis
    • FindSecurityBugs
    • OWASP Dependency Check
  • Active Tests / Vulnerability Scans
    • Arachni
    • OWASP Zap

Developer

Version

Control

Build and Deployment

Production System

Internal Repository

Production near System

Static Test-System

OWASP

Timo Pagel

49 of 86

49

  • Integration Tests: HttpUnit
  • Static Analysis
    • FindSecurityBugs
    • OWASP Dependency Check
  • Passive Vulnerability Scans:

OWASP Zap

  • Passive Infrastructure Tests:

SSLyze

  • Active Tests / Vulnerability Scans
    • Arachni
    • OWASP Zap

Developer

Version

Control

Build and Deployment

Production System

Internal Repository

Production near System

Static Test-System

OWASP

Timo Pagel

50 of 86

Detection of Components with Known Vulnerabilities

Through 2020, 99% of vulnerabilities exploited will continue to be ones known by security and IT professionals for at least one year.

Gartner, 2016

Timo Pagel

OWASP

Timo Pagel

51 of 86

Equifax Incident September 2017

Impacting approximately 143 million consumers

Reason: Using library with known vulnerabilities

(Apache Struts 2 vulnerability CVE-2017-5638)

Timo Pagel

OWASP

Timo Pagel

52 of 86

Detection of Components with Known Vulnerabilities

  • What to scan?
  • How to scan?
  • When to scan?
  • Who to report to?
  • Which actions to take?

Timo Pagel

OWASP

Timo Pagel

53 of 86

Detection of Components with Known Vulnerabilities: What/How?

  • Applications
  • Operating System Environments
  • Infrastructure/Firmware

Timo Pagel

OWASP

Timo Pagel

54 of 86

Detection of Components with Known Vulnerabilities: What/How?

  • Applications
    • Java/Ruby: OWASP Dependency Check
    • PHP: Sensio Lab Security Advisor (composer)
    • Javascript: retire.js
  • Operating System Environments
    • Root-Server / Virtual Machine
      • Vulns, OpenVAS
    • Docker
      • anchore.io, clair, openScap
  • Infrastructure/Firmware
    • ?

Timo Pagel

OWASP

Timo Pagel

55 of 86

Scan During Build-Process

Build Application

Build Image

Scan Image

Deploy-

ment

Build Trigger

Scan Application

Timo Pagel

OWASP

Timo Pagel

56 of 86

Scan During Build-Process

  • Fast Feedback on Changes

Build Application

Build Image

Scan Image

Deploy-

ment

Build Trigger

Scan Application

Timo Pagel

OWASP

Timo Pagel

57 of 86

Vulnerability Lifecycle

t

Build

Vulnerability Discovered

Patch Published

Start Container

Build

Run Container

Timo Pagel

OWASP

Timo Pagel

58 of 86

Source: https://security-tracker.debian.org/tracker/CVE-2017-8804

Timo Pagel

OWASP

Timo Pagel

59 of 86

When to report? Quality Gates

  • Criticality >= High
    • Risk Avoidance
      • Upgrade
      • Offline
    • Risk Limitation
      • Web Application Firewall
    • Risk Acceptance
      • Unstable Build
    • Risk Transfer
      • Get an Insurance

Timo Pagel

OWASP

Timo Pagel

60 of 86

Reporting

  • Build Failed/Unstable
  • E-Mail
  • Monitoring
  • Jira

Timo Pagel

OWASP

Timo Pagel

61 of 86

Test of infrastructure comp. with known vuln.

Treatment of defects with classification critical

Test of server side application comp. with known vuln.

OWASP

Timo Pagel

62 of 86

Dynamic Scanning

  • Tools:
    • Arachni, OWASP Zap, sqlmap, …

  • Orchestration
    • secureCodeBox, BDD-Security, gauntlt

Timo Pagel

OWASP

Timo Pagel

63 of 86

Integration into Jenkinsfile

[...]

httpRequest

httpMode: 'POST',

contentType: 'APPLICATION_JSON',

outputFile: 'scan_process.json',

requestBody: scanConfig,

Url:

'http://192.168.122.1:8080/engine-rest/process-definition/key/scanJobNmapDemoExternalBodgeIT/start'

[...]

OWASP

Timo Pagel

64 of 86

Simple Scan

Coverage of client side dynamic components

OWASP

Timo Pagel

65 of 86

Agenda

  • Introduction
  • Generic DevOps Security Maturity Model
  • Conclusion

65

Timo Pagel

OWASP

Timo Pagel

66 of 86

Conclusion

  • DevOps-Strategies must integrate security:

Hardening

  • DevOps-Strategies offer security benefits:

Automated testing before release

  • Prioritization:

Generic DevOps Security Maturity Model

Timo Pagel

OWASP

Timo Pagel

67 of 86

Building and testing of artifacts in virtual environments

Simple access control for systems

Controlled networks in virtual environments

Checking the sources of used libraries

Test of infrastructure comp. with known vuln.

Defence metrics

Treatment of defects with classification critical

Test of server side application comp.with known vuln.

Simple Scan

Coverage of client side dynamic components

Applications run in virtual environments

OWASP

Timo Pagel

68 of 86

Building and testing of artifacts in virtual environments

Simple access control for systems

Controlled networks in virtual environments

Checking the sources of used libraries

Test of infrastructure comp. with known vuln.

Defence metrics

Treatment of defects with classification critical

Questions?

Test of server side application comp.with known vuln.

Coverage of client side dynamic components

Simple Scan

Applications run in virtual environments

http://gdosmm.timo-pagel.de

Applications run in virtual environments

OWASP

Timo Pagel

69 of 86

Backup-Slides

Timo Pagel

OWASP

Timo Pagel

70 of 86

Comparison of Scanners (August 2017)

Criteria

  • Coverage
  • Scanning
  • Automation
  • Report

Tools

  • Arachni
  • OWASP Zap

Timo Pagel

OWASP

Timo Pagel

71 of 86

Comparison of Scanners (August 2017)

OWASP Zap 2.6.0

Arachni 1.5.1

Automation

Automation with API or CLI

Yes

Yes

Plattform

Linux/Windows (Java)

Linux (Ruby)

Timo Pagel

OWASP

Timo Pagel

72 of 86

Comparison of Scanners (August 2017)

OWASP Zap 2.6.0

Arachni 1.5.1

Automation

Automation with API or CLI

Yes

Yes

Plattform

Linux/Windows (Java)

Linux (Ruby)

Report

Machine readable report with alarms only

Yes

Yes

Ability to mark false positives

Web-UI

Integration of reports in OWASP DefectDojo

Yes

Yes

Timo Pagel

OWASP

Timo Pagel

73 of 86

Comparison of Scanners (August 2017)

OWASP Zap 2.6.0

Arachni 1.5.1

Automation

Automation with API or CLI

Yes

Yes

Plattform

Linux/Windows (Java)

Linux (Ruby)

Report

Machine readable report with alarms only

Yes

Yes

Ability to mark false positives

Web-UI

Integration of reports in OWASP DefectDojo

Yes

Yes

Coverage

Type of scanners

HTML,Ajax

HTML,Ajax

JWT for authentication

Import of Specifications (OpenAPI)

Yes

No

Ability to import/export URL-Vectors

Yes

Timo Pagel

OWASP

Timo Pagel

74 of 86

Comparison of Scanners (August 2017)

OWASP Zap 2.6.0

Arachni 1.5.1

Automation

Automation with API or CLI

Yes

Yes

Plattform

Linux/Windows (Java)

Linux (Ruby)

Report

Machine readable report with alarms only

Yes

Yes

Ability to mark false positives

Web-UI

Integration of reports in OWASP DefectDojo

Yes

Yes

Coverage

Type of scanners

HTML,Ajax

HTML,Ajax

JWT for authentication

Import of Specifications (OpenAPI)

Yes

No

Ability to import/export URL-Vectors

Yes

Scanning

Usage of different Input-Vectors

Manual Work

Yes

73

96

Timo Pagel

OWASP

Timo Pagel

75 of 86

Remember Version: Scan Nightly

Build Application

Build Image

Remember Image:Tag

Deploy-

ment

Fetch Image/Tag

Scan Image

Build Trigger

Nightly Trigger

Build of Application

Scanning

Image:Tag

Timo Pagel

OWASP

Timo Pagel

76 of 86

Remember Version: Scan Nightly

Build Application

Build Image

Remember Image/Tag

Deploy-

ment

Fetch Image/Tag

Scan Image

Build Trigger

Nightly Trigger

Build of Application

Scanning

Build Application

Build Image

Remember Image/Tag

Deploy-

ment

Build Application

Build Image

Remember Image/Tag

Deploy-

ment

Image:Tag

Fetch Image/Tag

Scan Image

Fetch Image/Tag

Scan Image

Timo Pagel

OWASP

Timo Pagel

77 of 86

Remember Version: Scan Nightly

Fetch Image/Tag

More?

Yes

Scan Image

Image:Tag

Nightly Trigger

Build Application

Build Image

Remember Image/Tag

Deploy-

ment

Build Trigger

Build Application

Build Image

Remember Image/Tag

Deploy-

ment

Build Application

Build Image

Remember Image/Tag

Deploy-

ment

Timo Pagel

OWASP

Timo Pagel

78 of 86

Remember Version: Cluster

Container

Container

Container

Node 1

Container

Container

Container

Node 2

Container

Container

Container

Node X

Timo Pagel

OWASP

Timo Pagel

79 of 86

Remember Version: Cluster

App1

ImageA:Z

App2

ImageB:Z

App3

ImageC:Z

Node 1

App1

ImageA:Z

App2

ImageB:Z

App3

ImageC:Z

Node 2

App1

ImageA:Z

App2

ImageB:Z

App3

ImageC:Y

Node X

Timo Pagel

OWASP

Timo Pagel

80 of 86

Remember Version: Cluster

Blue / Green Deployment

App1

ImageA:Z

App2

ImageB:Z

App3

ImageC:Z

Node 1

App1

ImageA:Z

App2

ImageB:Z

App3

ImageC:Z

Node 2

App1

ImageA:Z

App2

ImageB:Z

App3

ImageC:Y

Node X

Timo Pagel

OWASP

Timo Pagel

81 of 86

Remember Version: Cluster

App1

ImageA:Z

App2

ImageB:Z

App3

ImageC:Z

Node 1

App1

ImageA:Z

App2

ImageB:Z

App3

ImageC:Z

Node 2

App1

ImageA:Z

App2

ImageB:Z

App3

ImageC:Y

Node X

Master

Timo Pagel

OWASP

Timo Pagel

82 of 86

Fetch Running Containers/Images

Fetch all

running

Get Image

oc get pod --all-namespaces -o wide

oc describe pod <pod>

More?

Yes

docker ps

docker inspect <container>

Scan Image

Nightly Trigger

Timo Pagel

OWASP

Timo Pagel

83 of 86

Combination: During Build + Get Running

Fetch all

running

Get Image

More?

Yes

Scan Image

Nightly Trigger

Build Application

Build Image

Scan Image

Deploy-

ment

Build Trigger

Team/Build

Image:Tag

Remember�Team/Img.

Report

Timo Pagel

OWASP

Timo Pagel

84 of 86

Combination: During Build + Get Running

Fetch all

running

Get Image

More?

Yes

Scan Image

Nightly Trigger

Build Application

Build Image

Scan Image

Deploy-

ment

Build Trigger

Team/Build

Image:Tag

Remember�Team/Img.

Report

docker run smartapp:1.0 --label team="xyz"

Timo Pagel

OWASP

Timo Pagel

85 of 86

Fetch Vulnerable

Trigger Vulnerable Projects

Fetch all

running

Scan Images

Nightly Trigger

Remember Vulnerable

Vulnerable Image

Vulnerable?

Unstable/

Fail Build

Yes

Build

Scan

Timo Pagel

OWASP

Timo Pagel

86 of 86

Fetch Vulnerable

Trigger Vulnerable Projects

Fetch all

running

Scan Images

Nightly Trigger

Remember Vulnerable

Vulnerable Image

Vulnerable?

Unstable/

Fail Build

Yes

Build

Scan

Relation Image<>Job Name needed to trigger

Timo Pagel

OWASP

Timo Pagel