SlideShare a Scribd company logo
1 of 44
Download to read offline
Security Testing with
OWASP ZAP in CI/CD
Simon Bennetts - @psiinon
AMSTERDAM 16 - 17 MAY 2017
The Plan
• What are we trying to solve?
• What can you get out of this?
• Introduction to ZAP
• Where to start
• Where to go from there
2
What are we trying to solve?
• Find security issues as early as possible
• Integration into the devops pipeline
• Finding all of the possible vulnerabilities
• Putting pentesters out of a job :P
3
What are we not trying to solve?
What can you get out of this?
• A way to quickly evaluate your apps
• Options for more thorough scanning
• An introduction to the ZAP API
4
5
ZAP Introduction
• A tool for finding web app vulnerabilities
• One of the worlds most popular free security tools
• Completely free and open source
• OWASP Flagship project
• Ideal for people new to security
• But also used by security professionals
• Ideal for devs, esp. for automated security tests
• Not a silver bullet!
6
ZAP Features
• Swing based UI for desktop mode
• Comprehensive API for daemon mode
• Plugin architecture (add-ons)
• Online ‘marketplace’ (all free:)
• Release, beta and alpha quality add-ons
• Traditional and ajax spiders
• Passive and active scanning
• Highly configurable, eg scan policies
• Highly scriptable
Some ZAP use cases
• Point and shoot – the Quick Start tab
• Proxying via ZAP, and then scanning
• Manual pentesting
• Automated security regression tests
• Debugging
• Part of a larger security program
7
ZAP Install Options
• Windows, Linux and Mac OS Installers
• Linux packages, Mac OS Homebrew Cask
• Cross Platform zip
• Docker Images
• owasp/zap2docker-stable
• owasp/zap2docker-weekly
• owasp/zap2docker-live
• Distros like Kali
8
Where to start?
• The Baseline scan
• Completely safe
• Runs quickly (1-2 minutes?)
• Can be easily integrated into CI/CD
• Easy to get started – just required the target:
• Very configurable if needed
9
• docker pull owasp/zap2docker-weekly
• docker run -t owasp/zap2docker-weekly 
zap-baseline.py -t https://www.example.com
Baseline scan
• Uses docker (the only dependency)
• Time limited spider of target (default 1 min)
• Just passive scanning
• By default warns on all issues
• Can change to ignore, info or fail
• Can include any ZAP cmdline option
• Can ignore any url regex for any rule
10
Baseline scan - issues
• All release and beta passive scan rules, eg
• Missing / incorrect security headers
• Cookie problems
• Information / error disclosure
• Missing CSRF tokens
•...
• Can optionally include alpha pscan rules
11
Baseline scan – usage
12
Usage: zap-baseline.py -t <target> [options]
-t target target URL including the protocol, eg https://www
Options:
-c config_file config file to use to INFO, IGNORE or FAIL warnin
-u config_url URL of config file to use to INFO, IGNORE or FAIL
-g gen_file generate default config file (all rules set to WA
-m mins the number of minutes to spider for (default 1)
-r report_html file to write the full ZAP HTML report
-w report_md file to write the full ZAP Wiki (Markdown) report
-x report_xml file to write the full ZAP XML report
-a include the alpha passive scan rules as well
-d show debug messages
-i default rules not in the config file to INFO
-j use the Ajax spider in addition to the traditiona
-l level minimum level to show: PASS, IGNORE, INFO, WARN o
-s short output format - dont show PASSes or example
-z zap_options ZAP command line options e.g. -z "-config aaa=bbb
Baseline scan – output
14
./zap-baseline.py -t https://www.example.com
3 URLs
PASS: Cookie No HttpOnly Flag [10010]
PASS: Cookie Without Secure Flag [10011]
PASS: Password Autocomplete in Browser [10012]
<snip>
WARN: Incomplete or No Cache-control and Pragma HTTP Header Set [10015]
https://www.example.com
WARN: Web Browser XSS Protection Not Enabled [10016] x 3
https://www.example.com
https://www.example.com/robots.txt
https://www.example.com/sitemap.xml
WARN: X-Frame-Options Header Not Set [10020] x 1
https://www.example.com
WARN: X-Content-Type-Options Header Missing [10021] x 1
https://www.example.com
FAIL: 0 WARN: 4 INFO: 0 IGNORE: 0 PASS: 22
Baseline scan – conf file
• Use -g option to generate, -c or -u to use
15
# zap-baseline rule configuration file
# Change WARN to IGNORE to ignore rule or FAIL to fail if rule matches
# Only the rule identifiers are used - the names are just for info
# You can add your own messages to each rule by appending them after a
10010 WARN(Cookie No HttpOnly Flag)
10011 WARN(Cookie Without Secure Flag)
10012 WARN(Password Autocomplete in Browser)
10015 WARN(Incomplete or No Cache-control and Pragma HTTP Header Set)
10016 WARN(Web Browser XSS Protection Not Enabled)
10017 WARN(Cross-Domain JavaScript Source File Inclusion)
10019 WARN(Content-Type Header Missing)
10020 WARN(X-Frame-Options Header Scanner)
10021 WARN(X-Content-Type-Options Header Missing)
10023 WARN(Information Disclosure - Debug Error Messages)
10024 WARN(Information Disclosure - Sensitive Information in URL)
10025 WARN(Information Disclosure - Sensitive Information in HTTP Refer
Where next?
• Mass Baseline scan
• Provides a simple dashboard
• Shows the detailed results
• Shows the per service history
16
Mass Baseline scan
• Part of the community-scripts repo:
zaproxy/community-scripts/api/mass-baseline
17
Full Scans
• Packaged options:
• Cmdline quick scan
• Jenkins plugin
• Sdlc-integration scripts
• Scripted API scan (coming soon)
• Daemon mode + API
• (ZAP as a Service – in development)
18
Cmdline Quick Scan
19
./zap.sh -cmd -quickurl 
http://example.com/ -quickprogress
• Spidering
• Active scanning
• [====================] 100%
• Attack complete
• <?xml version="1.0"?><OWASPZAPReport
version="2.5.0" generated="Tue, 4 Oct 2016
09:31:53">
• <site name="http://example.com" ...
Official Jenkins plugin
Official Jenkins plugin
• https://wiki.jenkins-ci.org/display/JENKINS/zap+plugin
• Maintained by the ZAP core team
• Supports authentication, scan policies, Jira integration
• Dedicated User Group:
https://groups.google.com/group/zaproxy-jenkins
• Supports ZAP 2.6.0 +
21
Sdlc integration scripts
• Part of the community-scripts repo:
zaproxy/community-scripts/api/sdlc-integration
• Spidering, passive and active scanning
• Supports authentication
• Supports JIRA integration
• Linux only, requires some file editing
22
Useful cmdline options
• Turn off db recovery (speeds things up)
-config database.recoverylog=false
• Update all add-ons
-addonupdate
• Install a non default add-on
-addoninstall addonname
• Setting the API key
-config api.key=j8WdOEq8dhwWE24VGDsreP
• Disable API key in a safe environment
-config api.disablekey=true
23
Using the ZAP API
• Intro to the API
• Exploring
• Scanning
• Reporting
• Authenticating
• Tuning
24
Intro to the API
• RESTish – ok, only uses GET/POST requests
http(s)://zap/<format>/<component>/
<operation>/<op name>[/?<params>]
• Maps closely to the UI / code
• Theres a v basic (but complete) web UI for it
• And clients in various langs:
Java, Python, Node JS, .Net, PHP, Go …
• Clients are generated from the code
25
API UI – Top Level
API Pro Tips
1. Experiment with the Desktop UI
2. Export configs from the UI (contexts, scan policies..)
3. Then reproduce using the API UI
4. Finally convert to a script
27
Intro – Python API
• Install from pypi:
pip install python-owasp-zap-v2.4
• In your script:
from zapv2 import ZAPv2
zap = ZAPv2()
zap = ZAPv2(proxies={
'http': 'http://localhost:8080',
'https': 'http://localhost:8090'})
28
h
from zapv2 import ZAPv2
zap = ZAPv2(
apikey='mysupersecretkey',
proxies={
'http': 'http://localhost:8090',
'https': 'http://localhost:8090'})
• zap.urlopen(target)
• pip install python-owasp-zap-v2.4
Exploring
• Proxy Regression / Unit tests
• Traditional Spider (crawler)
• Ajax Spider (browsers)
• Spider SOAP definition (via alpha add-on)
• Spider Swagger/ OpenAPI definition (via alpha add-on)
• Import ModSecurity2 logs (via alpha add-on)
29
Spider Desktop and API UIs
Spider Desktop and API UIs
Exploring – Trad Spider
32
h
id = zap.spider.scan(target)
• time.sleep(5)
• while int(zap.spider.status(id)) < 100:
• print ('Spider progress %: ' +
zap.spider.status(id))
• time.sleep(5)
• print ('Spider completed')
Exploring – Ajax Spider
33
h
id = zap.ajaxSpider.scan(target)
• time.sleep(5)
• while zap.ajaxSpider.status(id) == 'running':
• print ('Ajax Spider # results: ' +
zap.ajaxSpider.number_of_results(id))
• time.sleep(5)
• print ('Ajax Spider completed')
Scanning – Passive Scan
34
while int(zap.pscan.records_to_scan) > 0:
• print ('Pscan records : ' +
zap.pscan.records_to_scan)
• time.sleep(5)
• print ('Pscan completed')
h
• Passive scanning happens automatically when
proxying
• To tell when its finished:
Scanning – Active Scan
35
h
id = zap.ascan.scan(target)
• time.sleep(5)
• while int(zap.ascan.status(id)) < 100:
• print ('Ascan progress %: ' +
zap.ascan.status(id))
• time.sleep(5)
• print ('Ascan completed')
Reporting – HTML + XML
36
h
# HTML Report
• with open ('report.html', 'w') as f:
f.write(zap.core.htmlreport())
# XML Report
• with open ('report.xml', 'w') as f:
f.write(zap.core.xmlreport())
Reporting – all alert data
37
h
# Use paging for lots of alerts
• offset = 0; page = 5000
• alerts = zap.core.alerts('', offset, page)
• while len(alerts) > 0:
• for alert in alerts:
• # Do whatever you want with alert
• offset += page
• alerts = zap.core.alerts('', offset, page)
And dont forget...
38
h
# Your work here is done...
• zap.core.shutdown()
Authenticating
• Authentication can be hard :(
• Simple form based auth should be ok
• Authentication scripts should be able to handle anything
• But if you have complex SSO or equiv you may want a
simpler option in your test env
• Pro Top: use the UI to set authentication up!
39
Tuning - speed
• Spider time limits
• Data driven content
• Technology
• Active scan
• Scan rules
• Input vectors
• Attack strength
40
Tuning - feedback
• Active scan stats
• Response stats
• Authentication stats (alpha add-on)
• Statsd support
41
Tuning - accuracy
• Attack thresholds
• Rule configuration
– Forms that dont need CSRF tokens
– Increase timing attacks from 5 seconds
42
And if you need help...
• ZAP Getting Started Guide
• ZAP User Guide
• ZAP User Group
• ZAP Developer Group
• ZAP wiki, includes links to videos
• irc.mozilla.com #websectools
43
Talk Summary
• Use the baseline scan for a quick security overview
• Use the mass baseline to create a dashboard
• Use the new Jenkins plugin for more depth
• Use the ZAP API for even more control
• If you need help, just ask :)
44
Question Time
http://www.owasp.org/index.php/ZAP
AMSTERDAM 16 - 17 MAY 2017

More Related Content

What's hot

2014 ZAP Workshop 2: Contexts and Fuzzing
2014 ZAP Workshop 2: Contexts and Fuzzing2014 ZAP Workshop 2: Contexts and Fuzzing
2014 ZAP Workshop 2: Contexts and FuzzingSimon Bennetts
 
2020 OWASP Thailand - ZAP intro
2020 OWASP Thailand - ZAP intro2020 OWASP Thailand - ZAP intro
2020 OWASP Thailand - ZAP introSimon Bennetts
 
Security Testing with OWASP ZAP in CI/CD - Simon Bennetts - Codemotion Amster...
Security Testing with OWASP ZAP in CI/CD - Simon Bennetts - Codemotion Amster...Security Testing with OWASP ZAP in CI/CD - Simon Bennetts - Codemotion Amster...
Security Testing with OWASP ZAP in CI/CD - Simon Bennetts - Codemotion Amster...Codemotion
 
OWASP 2014 AppSec EU ZAP Advanced Features
OWASP 2014 AppSec EU ZAP Advanced FeaturesOWASP 2014 AppSec EU ZAP Advanced Features
OWASP 2014 AppSec EU ZAP Advanced FeaturesSimon Bennetts
 
Automating OWASP ZAP - DevCSecCon talk
Automating OWASP ZAP - DevCSecCon talk Automating OWASP ZAP - DevCSecCon talk
Automating OWASP ZAP - DevCSecCon talk Simon Bennetts
 
OWASP 2013 APPSEC USA Talk - OWASP ZAP
OWASP 2013 APPSEC USA Talk - OWASP ZAPOWASP 2013 APPSEC USA Talk - OWASP ZAP
OWASP 2013 APPSEC USA Talk - OWASP ZAPSimon Bennetts
 
BlackHat 2014 OWASP ZAP Turbo Talk
BlackHat 2014 OWASP ZAP Turbo TalkBlackHat 2014 OWASP ZAP Turbo Talk
BlackHat 2014 OWASP ZAP Turbo TalkSimon Bennetts
 
BSides Manchester 2014 ZAP Advanced Features
BSides Manchester 2014 ZAP Advanced FeaturesBSides Manchester 2014 ZAP Advanced Features
BSides Manchester 2014 ZAP Advanced FeaturesSimon Bennetts
 
OWASP Zed Attack Proxy Demonstration - OWASP Bangalore Nov 22 2014
OWASP Zed Attack Proxy Demonstration - OWASP Bangalore Nov 22 2014OWASP Zed Attack Proxy Demonstration - OWASP Bangalore Nov 22 2014
OWASP Zed Attack Proxy Demonstration - OWASP Bangalore Nov 22 2014gmaran23
 
OWASP 2012 AppSec Dublin ZAP Intro
OWASP 2012 AppSec Dublin ZAP IntroOWASP 2012 AppSec Dublin ZAP Intro
OWASP 2012 AppSec Dublin ZAP IntroSimon Bennetts
 
JoinSEC 2013 London - ZAP Intro
JoinSEC 2013 London - ZAP IntroJoinSEC 2013 London - ZAP Intro
JoinSEC 2013 London - ZAP IntroSimon Bennetts
 
N Different Strategies to Automate OWASP ZAP - Cybersecurity WithTheBest - Oc...
N Different Strategies to Automate OWASP ZAP - Cybersecurity WithTheBest - Oc...N Different Strategies to Automate OWASP ZAP - Cybersecurity WithTheBest - Oc...
N Different Strategies to Automate OWASP ZAP - Cybersecurity WithTheBest - Oc...gmaran23
 
OWASP 2013 EU Tour Amsterdam ZAP Intro
OWASP 2013 EU Tour Amsterdam ZAP IntroOWASP 2013 EU Tour Amsterdam ZAP Intro
OWASP 2013 EU Tour Amsterdam ZAP IntroSimon Bennetts
 
Using the Zed Attack Proxy as a Web App testing tool
Using the Zed Attack Proxy as a Web App testing toolUsing the Zed Attack Proxy as a Web App testing tool
Using the Zed Attack Proxy as a Web App testing toolDavid Sweigert
 
Security Testing - Zap It
Security Testing - Zap ItSecurity Testing - Zap It
Security Testing - Zap ItManjyot Singh
 
Virtual Security Lab Setup - OWASP Broken Web Apps, Webgoat, & ZAP
Virtual Security Lab Setup - OWASP Broken Web Apps, Webgoat, & ZAPVirtual Security Lab Setup - OWASP Broken Web Apps, Webgoat, & ZAP
Virtual Security Lab Setup - OWASP Broken Web Apps, Webgoat, & ZAPMichael Coates
 
Practical Security Testing for Developers using OWASP ZAP at Dot Net Bangalor...
Practical Security Testing for Developers using OWASP ZAP at Dot Net Bangalor...Practical Security Testing for Developers using OWASP ZAP at Dot Net Bangalor...
Practical Security Testing for Developers using OWASP ZAP at Dot Net Bangalor...gmaran23
 
The OWASP Zed Attack Proxy
The OWASP Zed Attack ProxyThe OWASP Zed Attack Proxy
The OWASP Zed Attack ProxyAditya Gupta
 

What's hot (20)

2014 ZAP Workshop 2: Contexts and Fuzzing
2014 ZAP Workshop 2: Contexts and Fuzzing2014 ZAP Workshop 2: Contexts and Fuzzing
2014 ZAP Workshop 2: Contexts and Fuzzing
 
2020 OWASP Thailand - ZAP intro
2020 OWASP Thailand - ZAP intro2020 OWASP Thailand - ZAP intro
2020 OWASP Thailand - ZAP intro
 
Security Testing with OWASP ZAP in CI/CD - Simon Bennetts - Codemotion Amster...
Security Testing with OWASP ZAP in CI/CD - Simon Bennetts - Codemotion Amster...Security Testing with OWASP ZAP in CI/CD - Simon Bennetts - Codemotion Amster...
Security Testing with OWASP ZAP in CI/CD - Simon Bennetts - Codemotion Amster...
 
OWASP 2014 AppSec EU ZAP Advanced Features
OWASP 2014 AppSec EU ZAP Advanced FeaturesOWASP 2014 AppSec EU ZAP Advanced Features
OWASP 2014 AppSec EU ZAP Advanced Features
 
Automating OWASP ZAP - DevCSecCon talk
Automating OWASP ZAP - DevCSecCon talk Automating OWASP ZAP - DevCSecCon talk
Automating OWASP ZAP - DevCSecCon talk
 
OWASP 2013 APPSEC USA Talk - OWASP ZAP
OWASP 2013 APPSEC USA Talk - OWASP ZAPOWASP 2013 APPSEC USA Talk - OWASP ZAP
OWASP 2013 APPSEC USA Talk - OWASP ZAP
 
BlackHat 2014 OWASP ZAP Turbo Talk
BlackHat 2014 OWASP ZAP Turbo TalkBlackHat 2014 OWASP ZAP Turbo Talk
BlackHat 2014 OWASP ZAP Turbo Talk
 
BSides Manchester 2014 ZAP Advanced Features
BSides Manchester 2014 ZAP Advanced FeaturesBSides Manchester 2014 ZAP Advanced Features
BSides Manchester 2014 ZAP Advanced Features
 
OWASP Zed Attack Proxy Demonstration - OWASP Bangalore Nov 22 2014
OWASP Zed Attack Proxy Demonstration - OWASP Bangalore Nov 22 2014OWASP Zed Attack Proxy Demonstration - OWASP Bangalore Nov 22 2014
OWASP Zed Attack Proxy Demonstration - OWASP Bangalore Nov 22 2014
 
Zap vs burp
Zap vs burpZap vs burp
Zap vs burp
 
OWASP 2012 AppSec Dublin ZAP Intro
OWASP 2012 AppSec Dublin ZAP IntroOWASP 2012 AppSec Dublin ZAP Intro
OWASP 2012 AppSec Dublin ZAP Intro
 
JoinSEC 2013 London - ZAP Intro
JoinSEC 2013 London - ZAP IntroJoinSEC 2013 London - ZAP Intro
JoinSEC 2013 London - ZAP Intro
 
N Different Strategies to Automate OWASP ZAP - Cybersecurity WithTheBest - Oc...
N Different Strategies to Automate OWASP ZAP - Cybersecurity WithTheBest - Oc...N Different Strategies to Automate OWASP ZAP - Cybersecurity WithTheBest - Oc...
N Different Strategies to Automate OWASP ZAP - Cybersecurity WithTheBest - Oc...
 
OWASP 2013 EU Tour Amsterdam ZAP Intro
OWASP 2013 EU Tour Amsterdam ZAP IntroOWASP 2013 EU Tour Amsterdam ZAP Intro
OWASP 2013 EU Tour Amsterdam ZAP Intro
 
Using the Zed Attack Proxy as a Web App testing tool
Using the Zed Attack Proxy as a Web App testing toolUsing the Zed Attack Proxy as a Web App testing tool
Using the Zed Attack Proxy as a Web App testing tool
 
OWASP Zed Attack Proxy
OWASP Zed Attack ProxyOWASP Zed Attack Proxy
OWASP Zed Attack Proxy
 
Security Testing - Zap It
Security Testing - Zap ItSecurity Testing - Zap It
Security Testing - Zap It
 
Virtual Security Lab Setup - OWASP Broken Web Apps, Webgoat, & ZAP
Virtual Security Lab Setup - OWASP Broken Web Apps, Webgoat, & ZAPVirtual Security Lab Setup - OWASP Broken Web Apps, Webgoat, & ZAP
Virtual Security Lab Setup - OWASP Broken Web Apps, Webgoat, & ZAP
 
Practical Security Testing for Developers using OWASP ZAP at Dot Net Bangalor...
Practical Security Testing for Developers using OWASP ZAP at Dot Net Bangalor...Practical Security Testing for Developers using OWASP ZAP at Dot Net Bangalor...
Practical Security Testing for Developers using OWASP ZAP at Dot Net Bangalor...
 
The OWASP Zed Attack Proxy
The OWASP Zed Attack ProxyThe OWASP Zed Attack Proxy
The OWASP Zed Attack Proxy
 

Similar to 2017 Codemotion OWASP ZAP in CI/CD

Simon Bennetts - Automating ZAP
Simon Bennetts - Automating ZAP Simon Bennetts - Automating ZAP
Simon Bennetts - Automating ZAP DevSecCon
 
N Different Strategies to Automate OWASP ZAP - OWASP APPSec BUCHAREST - Oct 1...
N Different Strategies to Automate OWASP ZAP - OWASP APPSec BUCHAREST - Oct 1...N Different Strategies to Automate OWASP ZAP - OWASP APPSec BUCHAREST - Oct 1...
N Different Strategies to Automate OWASP ZAP - OWASP APPSec BUCHAREST - Oct 1...gmaran23
 
we45 DEFCON Workshop - Building AppSec Automation with Python
we45 DEFCON Workshop - Building AppSec Automation with Pythonwe45 DEFCON Workshop - Building AppSec Automation with Python
we45 DEFCON Workshop - Building AppSec Automation with PythonAbhay Bhargav
 
The basics of hacking and penetration testing 이제 시작이야 해킹과 침투 테스트 kenneth.s.kwon
The basics of hacking and penetration testing 이제 시작이야 해킹과 침투 테스트 kenneth.s.kwonThe basics of hacking and penetration testing 이제 시작이야 해킹과 침투 테스트 kenneth.s.kwon
The basics of hacking and penetration testing 이제 시작이야 해킹과 침투 테스트 kenneth.s.kwonKenneth Kwon
 
Automating security test using Selenium and OWASP ZAP - Practical DevSecOps
Automating security test using Selenium and OWASP ZAP - Practical DevSecOpsAutomating security test using Selenium and OWASP ZAP - Practical DevSecOps
Automating security test using Selenium and OWASP ZAP - Practical DevSecOpsMohammed A. Imran
 
DAST in CI/CD pipelines using Selenium & OWASP ZAP
DAST in CI/CD pipelines using Selenium & OWASP ZAPDAST in CI/CD pipelines using Selenium & OWASP ZAP
DAST in CI/CD pipelines using Selenium & OWASP ZAPsrini0x00
 
Security DevOps - Staying secure in agile projects // OWASP AppSecEU 2015 - A...
Security DevOps - Staying secure in agile projects // OWASP AppSecEU 2015 - A...Security DevOps - Staying secure in agile projects // OWASP AppSecEU 2015 - A...
Security DevOps - Staying secure in agile projects // OWASP AppSecEU 2015 - A...Christian Schneider
 
OWASP ZAP Workshop for QA Testers
OWASP ZAP Workshop for QA TestersOWASP ZAP Workshop for QA Testers
OWASP ZAP Workshop for QA TestersJavan Rasokat
 
DC612 Day - Hands on Penetration Testing 101
DC612 Day - Hands on Penetration Testing 101DC612 Day - Hands on Penetration Testing 101
DC612 Day - Hands on Penetration Testing 101dc612
 
Threat hunting on the wire
Threat hunting on the wireThreat hunting on the wire
Threat hunting on the wireInfoSec Addicts
 
InSpec For DevOpsDays Amsterdam 2017
InSpec For DevOpsDays Amsterdam 2017InSpec For DevOpsDays Amsterdam 2017
InSpec For DevOpsDays Amsterdam 2017Mandi Walls
 
Sensu and Sensibility - Puppetconf 2014
Sensu and Sensibility - Puppetconf 2014Sensu and Sensibility - Puppetconf 2014
Sensu and Sensibility - Puppetconf 2014Tomas Doran
 
Silent web app testing by example - BerlinSides 2011
Silent web app testing by example - BerlinSides 2011Silent web app testing by example - BerlinSides 2011
Silent web app testing by example - BerlinSides 2011Abraham Aranguren
 
DevOpsDaysRiga 2017: Mandi Walls - Building security into your workflow with ...
DevOpsDaysRiga 2017: Mandi Walls - Building security into your workflow with ...DevOpsDaysRiga 2017: Mandi Walls - Building security into your workflow with ...
DevOpsDaysRiga 2017: Mandi Walls - Building security into your workflow with ...DevOpsDays Riga
 
Security DevOps: Wie Sie in agilen Projekten trotzdem sicher bleiben // JAX 2015
Security DevOps: Wie Sie in agilen Projekten trotzdem sicher bleiben // JAX 2015Security DevOps: Wie Sie in agilen Projekten trotzdem sicher bleiben // JAX 2015
Security DevOps: Wie Sie in agilen Projekten trotzdem sicher bleiben // JAX 2015Christian Schneider
 
Ansible benelux meetup - Amsterdam 27-5-2015
Ansible benelux meetup - Amsterdam 27-5-2015Ansible benelux meetup - Amsterdam 27-5-2015
Ansible benelux meetup - Amsterdam 27-5-2015Pavel Chunyayev
 
Blue Teaming on a Budget of Zero
Blue Teaming on a Budget of ZeroBlue Teaming on a Budget of Zero
Blue Teaming on a Budget of ZeroKyle Bubp
 
(APP307) Leverage the Cloud with a Blue/Green Deployment Architecture | AWS r...
(APP307) Leverage the Cloud with a Blue/Green Deployment Architecture | AWS r...(APP307) Leverage the Cloud with a Blue/Green Deployment Architecture | AWS r...
(APP307) Leverage the Cloud with a Blue/Green Deployment Architecture | AWS r...Amazon Web Services
 
Ansible is the simplest way to automate. MoldCamp, 2015
Ansible is the simplest way to automate. MoldCamp, 2015Ansible is the simplest way to automate. MoldCamp, 2015
Ansible is the simplest way to automate. MoldCamp, 2015Alex S
 
Security DevOps - Wie Sie in agilen Projekten trotzdem sicher bleiben // DevO...
Security DevOps - Wie Sie in agilen Projekten trotzdem sicher bleiben // DevO...Security DevOps - Wie Sie in agilen Projekten trotzdem sicher bleiben // DevO...
Security DevOps - Wie Sie in agilen Projekten trotzdem sicher bleiben // DevO...Christian Schneider
 

Similar to 2017 Codemotion OWASP ZAP in CI/CD (20)

Simon Bennetts - Automating ZAP
Simon Bennetts - Automating ZAP Simon Bennetts - Automating ZAP
Simon Bennetts - Automating ZAP
 
N Different Strategies to Automate OWASP ZAP - OWASP APPSec BUCHAREST - Oct 1...
N Different Strategies to Automate OWASP ZAP - OWASP APPSec BUCHAREST - Oct 1...N Different Strategies to Automate OWASP ZAP - OWASP APPSec BUCHAREST - Oct 1...
N Different Strategies to Automate OWASP ZAP - OWASP APPSec BUCHAREST - Oct 1...
 
we45 DEFCON Workshop - Building AppSec Automation with Python
we45 DEFCON Workshop - Building AppSec Automation with Pythonwe45 DEFCON Workshop - Building AppSec Automation with Python
we45 DEFCON Workshop - Building AppSec Automation with Python
 
The basics of hacking and penetration testing 이제 시작이야 해킹과 침투 테스트 kenneth.s.kwon
The basics of hacking and penetration testing 이제 시작이야 해킹과 침투 테스트 kenneth.s.kwonThe basics of hacking and penetration testing 이제 시작이야 해킹과 침투 테스트 kenneth.s.kwon
The basics of hacking and penetration testing 이제 시작이야 해킹과 침투 테스트 kenneth.s.kwon
 
Automating security test using Selenium and OWASP ZAP - Practical DevSecOps
Automating security test using Selenium and OWASP ZAP - Practical DevSecOpsAutomating security test using Selenium and OWASP ZAP - Practical DevSecOps
Automating security test using Selenium and OWASP ZAP - Practical DevSecOps
 
DAST in CI/CD pipelines using Selenium & OWASP ZAP
DAST in CI/CD pipelines using Selenium & OWASP ZAPDAST in CI/CD pipelines using Selenium & OWASP ZAP
DAST in CI/CD pipelines using Selenium & OWASP ZAP
 
Security DevOps - Staying secure in agile projects // OWASP AppSecEU 2015 - A...
Security DevOps - Staying secure in agile projects // OWASP AppSecEU 2015 - A...Security DevOps - Staying secure in agile projects // OWASP AppSecEU 2015 - A...
Security DevOps - Staying secure in agile projects // OWASP AppSecEU 2015 - A...
 
OWASP ZAP Workshop for QA Testers
OWASP ZAP Workshop for QA TestersOWASP ZAP Workshop for QA Testers
OWASP ZAP Workshop for QA Testers
 
DC612 Day - Hands on Penetration Testing 101
DC612 Day - Hands on Penetration Testing 101DC612 Day - Hands on Penetration Testing 101
DC612 Day - Hands on Penetration Testing 101
 
Threat hunting on the wire
Threat hunting on the wireThreat hunting on the wire
Threat hunting on the wire
 
InSpec For DevOpsDays Amsterdam 2017
InSpec For DevOpsDays Amsterdam 2017InSpec For DevOpsDays Amsterdam 2017
InSpec For DevOpsDays Amsterdam 2017
 
Sensu and Sensibility - Puppetconf 2014
Sensu and Sensibility - Puppetconf 2014Sensu and Sensibility - Puppetconf 2014
Sensu and Sensibility - Puppetconf 2014
 
Silent web app testing by example - BerlinSides 2011
Silent web app testing by example - BerlinSides 2011Silent web app testing by example - BerlinSides 2011
Silent web app testing by example - BerlinSides 2011
 
DevOpsDaysRiga 2017: Mandi Walls - Building security into your workflow with ...
DevOpsDaysRiga 2017: Mandi Walls - Building security into your workflow with ...DevOpsDaysRiga 2017: Mandi Walls - Building security into your workflow with ...
DevOpsDaysRiga 2017: Mandi Walls - Building security into your workflow with ...
 
Security DevOps: Wie Sie in agilen Projekten trotzdem sicher bleiben // JAX 2015
Security DevOps: Wie Sie in agilen Projekten trotzdem sicher bleiben // JAX 2015Security DevOps: Wie Sie in agilen Projekten trotzdem sicher bleiben // JAX 2015
Security DevOps: Wie Sie in agilen Projekten trotzdem sicher bleiben // JAX 2015
 
Ansible benelux meetup - Amsterdam 27-5-2015
Ansible benelux meetup - Amsterdam 27-5-2015Ansible benelux meetup - Amsterdam 27-5-2015
Ansible benelux meetup - Amsterdam 27-5-2015
 
Blue Teaming on a Budget of Zero
Blue Teaming on a Budget of ZeroBlue Teaming on a Budget of Zero
Blue Teaming on a Budget of Zero
 
(APP307) Leverage the Cloud with a Blue/Green Deployment Architecture | AWS r...
(APP307) Leverage the Cloud with a Blue/Green Deployment Architecture | AWS r...(APP307) Leverage the Cloud with a Blue/Green Deployment Architecture | AWS r...
(APP307) Leverage the Cloud with a Blue/Green Deployment Architecture | AWS r...
 
Ansible is the simplest way to automate. MoldCamp, 2015
Ansible is the simplest way to automate. MoldCamp, 2015Ansible is the simplest way to automate. MoldCamp, 2015
Ansible is the simplest way to automate. MoldCamp, 2015
 
Security DevOps - Wie Sie in agilen Projekten trotzdem sicher bleiben // DevO...
Security DevOps - Wie Sie in agilen Projekten trotzdem sicher bleiben // DevO...Security DevOps - Wie Sie in agilen Projekten trotzdem sicher bleiben // DevO...
Security DevOps - Wie Sie in agilen Projekten trotzdem sicher bleiben // DevO...
 

Recently uploaded

Large Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLarge Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLionel Briand
 
Ronisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited CatalogueRonisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited Catalogueitservices996
 
VictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics
 
Understanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM ArchitectureUnderstanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM Architecturerahul_net
 
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxThe Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxRTS corp
 
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdfAndrey Devyatkin
 
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...OnePlan Solutions
 
Introduction to Firebase Workshop Slides
Introduction to Firebase Workshop SlidesIntroduction to Firebase Workshop Slides
Introduction to Firebase Workshop Slidesvaideheekore1
 
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4jGraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4jNeo4j
 
[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf
[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf
[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdfSteve Caron
 
Keeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldKeeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldRoberto Pérez Alcolea
 
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...Bert Jan Schrijver
 
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...OnePlan Solutions
 
Best Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITBest Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITmanoharjgpsolutions
 
Amazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilitiesAmazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilitiesKrzysztofKkol1
 
2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shardsChristopher Curtin
 
SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?Alexandre Beguel
 
eSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolseSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolsosttopstonverter
 
Advantages of Cargo Cloud Solutions.pptx
Advantages of Cargo Cloud Solutions.pptxAdvantages of Cargo Cloud Solutions.pptx
Advantages of Cargo Cloud Solutions.pptxRTS corp
 
Osi security architecture in network.pptx
Osi security architecture in network.pptxOsi security architecture in network.pptx
Osi security architecture in network.pptxVinzoCenzo
 

Recently uploaded (20)

Large Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLarge Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and Repair
 
Ronisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited CatalogueRonisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited Catalogue
 
VictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News UpdateVictoriaMetrics Q1 Meet Up '24 - Community & News Update
VictoriaMetrics Q1 Meet Up '24 - Community & News Update
 
Understanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM ArchitectureUnderstanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM Architecture
 
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxThe Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
 
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
2024-04-09 - From Complexity to Clarity - AWS Summit AMS.pdf
 
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
Tech Tuesday Slides - Introduction to Project Management with OnePlan's Work ...
 
Introduction to Firebase Workshop Slides
Introduction to Firebase Workshop SlidesIntroduction to Firebase Workshop Slides
Introduction to Firebase Workshop Slides
 
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4jGraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
GraphSummit Madrid - Product Vision and Roadmap - Luis Salvador Neo4j
 
[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf
[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf
[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf
 
Keeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldKeeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository world
 
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
 
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
 
Best Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITBest Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh IT
 
Amazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilitiesAmazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilities
 
2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards
 
SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?
 
eSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolseSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration tools
 
Advantages of Cargo Cloud Solutions.pptx
Advantages of Cargo Cloud Solutions.pptxAdvantages of Cargo Cloud Solutions.pptx
Advantages of Cargo Cloud Solutions.pptx
 
Osi security architecture in network.pptx
Osi security architecture in network.pptxOsi security architecture in network.pptx
Osi security architecture in network.pptx
 

2017 Codemotion OWASP ZAP in CI/CD

  • 1. Security Testing with OWASP ZAP in CI/CD Simon Bennetts - @psiinon AMSTERDAM 16 - 17 MAY 2017
  • 2. The Plan • What are we trying to solve? • What can you get out of this? • Introduction to ZAP • Where to start • Where to go from there 2
  • 3. What are we trying to solve? • Find security issues as early as possible • Integration into the devops pipeline • Finding all of the possible vulnerabilities • Putting pentesters out of a job :P 3 What are we not trying to solve?
  • 4. What can you get out of this? • A way to quickly evaluate your apps • Options for more thorough scanning • An introduction to the ZAP API 4
  • 5. 5 ZAP Introduction • A tool for finding web app vulnerabilities • One of the worlds most popular free security tools • Completely free and open source • OWASP Flagship project • Ideal for people new to security • But also used by security professionals • Ideal for devs, esp. for automated security tests • Not a silver bullet!
  • 6. 6 ZAP Features • Swing based UI for desktop mode • Comprehensive API for daemon mode • Plugin architecture (add-ons) • Online ‘marketplace’ (all free:) • Release, beta and alpha quality add-ons • Traditional and ajax spiders • Passive and active scanning • Highly configurable, eg scan policies • Highly scriptable
  • 7. Some ZAP use cases • Point and shoot – the Quick Start tab • Proxying via ZAP, and then scanning • Manual pentesting • Automated security regression tests • Debugging • Part of a larger security program 7
  • 8. ZAP Install Options • Windows, Linux and Mac OS Installers • Linux packages, Mac OS Homebrew Cask • Cross Platform zip • Docker Images • owasp/zap2docker-stable • owasp/zap2docker-weekly • owasp/zap2docker-live • Distros like Kali 8
  • 9. Where to start? • The Baseline scan • Completely safe • Runs quickly (1-2 minutes?) • Can be easily integrated into CI/CD • Easy to get started – just required the target: • Very configurable if needed 9 • docker pull owasp/zap2docker-weekly • docker run -t owasp/zap2docker-weekly zap-baseline.py -t https://www.example.com
  • 10. Baseline scan • Uses docker (the only dependency) • Time limited spider of target (default 1 min) • Just passive scanning • By default warns on all issues • Can change to ignore, info or fail • Can include any ZAP cmdline option • Can ignore any url regex for any rule 10
  • 11. Baseline scan - issues • All release and beta passive scan rules, eg • Missing / incorrect security headers • Cookie problems • Information / error disclosure • Missing CSRF tokens •... • Can optionally include alpha pscan rules 11
  • 12. Baseline scan – usage 12 Usage: zap-baseline.py -t <target> [options] -t target target URL including the protocol, eg https://www Options: -c config_file config file to use to INFO, IGNORE or FAIL warnin -u config_url URL of config file to use to INFO, IGNORE or FAIL -g gen_file generate default config file (all rules set to WA -m mins the number of minutes to spider for (default 1) -r report_html file to write the full ZAP HTML report -w report_md file to write the full ZAP Wiki (Markdown) report -x report_xml file to write the full ZAP XML report -a include the alpha passive scan rules as well -d show debug messages -i default rules not in the config file to INFO -j use the Ajax spider in addition to the traditiona -l level minimum level to show: PASS, IGNORE, INFO, WARN o -s short output format - dont show PASSes or example -z zap_options ZAP command line options e.g. -z "-config aaa=bbb
  • 13. Baseline scan – output 14 ./zap-baseline.py -t https://www.example.com 3 URLs PASS: Cookie No HttpOnly Flag [10010] PASS: Cookie Without Secure Flag [10011] PASS: Password Autocomplete in Browser [10012] <snip> WARN: Incomplete or No Cache-control and Pragma HTTP Header Set [10015] https://www.example.com WARN: Web Browser XSS Protection Not Enabled [10016] x 3 https://www.example.com https://www.example.com/robots.txt https://www.example.com/sitemap.xml WARN: X-Frame-Options Header Not Set [10020] x 1 https://www.example.com WARN: X-Content-Type-Options Header Missing [10021] x 1 https://www.example.com FAIL: 0 WARN: 4 INFO: 0 IGNORE: 0 PASS: 22
  • 14. Baseline scan – conf file • Use -g option to generate, -c or -u to use 15 # zap-baseline rule configuration file # Change WARN to IGNORE to ignore rule or FAIL to fail if rule matches # Only the rule identifiers are used - the names are just for info # You can add your own messages to each rule by appending them after a 10010 WARN(Cookie No HttpOnly Flag) 10011 WARN(Cookie Without Secure Flag) 10012 WARN(Password Autocomplete in Browser) 10015 WARN(Incomplete or No Cache-control and Pragma HTTP Header Set) 10016 WARN(Web Browser XSS Protection Not Enabled) 10017 WARN(Cross-Domain JavaScript Source File Inclusion) 10019 WARN(Content-Type Header Missing) 10020 WARN(X-Frame-Options Header Scanner) 10021 WARN(X-Content-Type-Options Header Missing) 10023 WARN(Information Disclosure - Debug Error Messages) 10024 WARN(Information Disclosure - Sensitive Information in URL) 10025 WARN(Information Disclosure - Sensitive Information in HTTP Refer
  • 15. Where next? • Mass Baseline scan • Provides a simple dashboard • Shows the detailed results • Shows the per service history 16
  • 16. Mass Baseline scan • Part of the community-scripts repo: zaproxy/community-scripts/api/mass-baseline 17
  • 17. Full Scans • Packaged options: • Cmdline quick scan • Jenkins plugin • Sdlc-integration scripts • Scripted API scan (coming soon) • Daemon mode + API • (ZAP as a Service – in development) 18
  • 18. Cmdline Quick Scan 19 ./zap.sh -cmd -quickurl http://example.com/ -quickprogress • Spidering • Active scanning • [====================] 100% • Attack complete • <?xml version="1.0"?><OWASPZAPReport version="2.5.0" generated="Tue, 4 Oct 2016 09:31:53"> • <site name="http://example.com" ...
  • 20. Official Jenkins plugin • https://wiki.jenkins-ci.org/display/JENKINS/zap+plugin • Maintained by the ZAP core team • Supports authentication, scan policies, Jira integration • Dedicated User Group: https://groups.google.com/group/zaproxy-jenkins • Supports ZAP 2.6.0 + 21
  • 21. Sdlc integration scripts • Part of the community-scripts repo: zaproxy/community-scripts/api/sdlc-integration • Spidering, passive and active scanning • Supports authentication • Supports JIRA integration • Linux only, requires some file editing 22
  • 22. Useful cmdline options • Turn off db recovery (speeds things up) -config database.recoverylog=false • Update all add-ons -addonupdate • Install a non default add-on -addoninstall addonname • Setting the API key -config api.key=j8WdOEq8dhwWE24VGDsreP • Disable API key in a safe environment -config api.disablekey=true 23
  • 23. Using the ZAP API • Intro to the API • Exploring • Scanning • Reporting • Authenticating • Tuning 24
  • 24. Intro to the API • RESTish – ok, only uses GET/POST requests http(s)://zap/<format>/<component>/ <operation>/<op name>[/?<params>] • Maps closely to the UI / code • Theres a v basic (but complete) web UI for it • And clients in various langs: Java, Python, Node JS, .Net, PHP, Go … • Clients are generated from the code 25
  • 25. API UI – Top Level
  • 26. API Pro Tips 1. Experiment with the Desktop UI 2. Export configs from the UI (contexts, scan policies..) 3. Then reproduce using the API UI 4. Finally convert to a script 27
  • 27. Intro – Python API • Install from pypi: pip install python-owasp-zap-v2.4 • In your script: from zapv2 import ZAPv2 zap = ZAPv2() zap = ZAPv2(proxies={ 'http': 'http://localhost:8080', 'https': 'http://localhost:8090'}) 28 h from zapv2 import ZAPv2 zap = ZAPv2( apikey='mysupersecretkey', proxies={ 'http': 'http://localhost:8090', 'https': 'http://localhost:8090'}) • zap.urlopen(target) • pip install python-owasp-zap-v2.4
  • 28. Exploring • Proxy Regression / Unit tests • Traditional Spider (crawler) • Ajax Spider (browsers) • Spider SOAP definition (via alpha add-on) • Spider Swagger/ OpenAPI definition (via alpha add-on) • Import ModSecurity2 logs (via alpha add-on) 29
  • 31. Exploring – Trad Spider 32 h id = zap.spider.scan(target) • time.sleep(5) • while int(zap.spider.status(id)) < 100: • print ('Spider progress %: ' + zap.spider.status(id)) • time.sleep(5) • print ('Spider completed')
  • 32. Exploring – Ajax Spider 33 h id = zap.ajaxSpider.scan(target) • time.sleep(5) • while zap.ajaxSpider.status(id) == 'running': • print ('Ajax Spider # results: ' + zap.ajaxSpider.number_of_results(id)) • time.sleep(5) • print ('Ajax Spider completed')
  • 33. Scanning – Passive Scan 34 while int(zap.pscan.records_to_scan) > 0: • print ('Pscan records : ' + zap.pscan.records_to_scan) • time.sleep(5) • print ('Pscan completed') h • Passive scanning happens automatically when proxying • To tell when its finished:
  • 34. Scanning – Active Scan 35 h id = zap.ascan.scan(target) • time.sleep(5) • while int(zap.ascan.status(id)) < 100: • print ('Ascan progress %: ' + zap.ascan.status(id)) • time.sleep(5) • print ('Ascan completed')
  • 35. Reporting – HTML + XML 36 h # HTML Report • with open ('report.html', 'w') as f: f.write(zap.core.htmlreport()) # XML Report • with open ('report.xml', 'w') as f: f.write(zap.core.xmlreport())
  • 36. Reporting – all alert data 37 h # Use paging for lots of alerts • offset = 0; page = 5000 • alerts = zap.core.alerts('', offset, page) • while len(alerts) > 0: • for alert in alerts: • # Do whatever you want with alert • offset += page • alerts = zap.core.alerts('', offset, page)
  • 37. And dont forget... 38 h # Your work here is done... • zap.core.shutdown()
  • 38. Authenticating • Authentication can be hard :( • Simple form based auth should be ok • Authentication scripts should be able to handle anything • But if you have complex SSO or equiv you may want a simpler option in your test env • Pro Top: use the UI to set authentication up! 39
  • 39. Tuning - speed • Spider time limits • Data driven content • Technology • Active scan • Scan rules • Input vectors • Attack strength 40
  • 40. Tuning - feedback • Active scan stats • Response stats • Authentication stats (alpha add-on) • Statsd support 41
  • 41. Tuning - accuracy • Attack thresholds • Rule configuration – Forms that dont need CSRF tokens – Increase timing attacks from 5 seconds 42
  • 42. And if you need help... • ZAP Getting Started Guide • ZAP User Guide • ZAP User Group • ZAP Developer Group • ZAP wiki, includes links to videos • irc.mozilla.com #websectools 43
  • 43. Talk Summary • Use the baseline scan for a quick security overview • Use the mass baseline to create a dashboard • Use the new Jenkins plugin for more depth • Use the ZAP API for even more control • If you need help, just ask :) 44