SlideShare uma empresa Scribd logo
1 de 24
OWASP ZAP
Dynamic Security Testing Workshop for Testers
Javan Rasokat, Sage - May 2021
OWASP Zed Attack Proxy (ZAP)
● OWASP Flagship Project
● “one of the world's most popular free
security tools”
● Web App DAST tool / Vulnerability
Scanner
● Integrated into CI/CD (Jenkins, Azure
DevOps, GitHub Actions, ...)
● Comprehensive API for daemon mode
● 140+ Contributors
● Marketplace for add-ons
● Highly configurable and scriptable
● Multiple Use Cases (you’ll see later)
2
Simple, free, valuable & active
3
Secure Development Lifecycle (SDL / S-SDLC)
● What scans should you run?
○ Static - Code analysis (SAST)
○ Dynamic - Live analysis (DAST)
● Dynamic Application Security Testing (DAST)
○ Black box testing
○ Requires a WebApp in staging or prod env
○ Finds environment issues
○ Finds run-time issues
4
Build Test Deploy
Shift Left
DevSecOps: Faster better feedback, fail fast and safe
What are we trying to solve?
● Finding security issues as early as possible
● Integration into the DevOps pipeline
● Finding all of the possible vulnerabilities
● Putting pentesters out of a job :P
5
What are we NOT trying to solve?
1 Tool - 3 Types of Users
● Pentesters
○ information gathering by recording traffic, manual intercepting of traffic and tampering
data
● Developers
○ running vulnerability scans as part of their CI/CD pipeline e.g. a “ZAP baseline” scan
● Testers
○ running their testing traffic through ZAP for passive scanning and/or active security
testing
The ZAP Head-up-Display (HUD) is applicable for all.
6
It is a Tool...
… start playing with it!
zaproxy.org/download
7
ZAP as Man-in-the-Middle (MitM)
8
Passive Scanning
Demo
9
Passive Scan Rules
● Missing / incorrect security headers
● Cookie problems
● Information / error disclosure
● Missing CSRF tokens
● ...
10
Attack types - Active scanning
Vulnerability
● SQL-Injection
● Time based SQL-Injection
● SSRF
● Open Redirect
● Reflected XSS
● Path Traversal
● SSTI
● ...
Payload
● api/product/99’ OR 1=1--
● api/product/99’ AND SLEEP(15000);
● api/ctrl?host=http://mydomain.org:38193/ZapTest
● oauth/login?redirect_uri=https://google.com
● spa/welcome?name=ZAP<script>alert(1)</script>
● file/?name=../../../../etc/passwd
● spa/welcome?name=${{1+2}}
● ...
11
Many ways for automation...
● Command-line options
● Pre-build Docker Images
● Python, NodeJs + Java CLI Library
● API
● Plugins (Jenkins, Azure DevOps)
● GitHub Actions
● NEW Automation Framework (YAML)
● ThreadFix Scan Agent
● SecureCodeBox for orchestrating mass-scans
12
Active Scanning
Automation for
Testers
13
Test-driven Scanning vs. Baseline scan
Benefits by using your existing test framework:
● Take advantage of existing tests
● Better coverage of the tested app
○ If you do have good test coverage all endpoints are already covered.
○ For the Crawler/Spider it is difficult to find all endpoints. Therefore it is better to record or
import all API-endpoints.
● The captured traffic is valid.
○ ZAP does not have to guess if a parameter is expected to be a integer or string. Makes it
easier for ZAP in the active scan. A request is not blocked because one of the parameters
is in the wrong format.
14
Using Command-line Options
● Command to start ZAP GUI
● As long as you keep ZAP open => HTTP Proxy and API available at localhost:8080
15
cd /Applications/OWASP ZAP.app/Contents/Java
java -jar zap-2.10.0.jar -config scanner.attackOnStart=true
-config view.mode=attack -config api.key=secret123 -
newsession Latest_WebGoat_Scan.session
Other useful commands:
● Setting the api key
○ -config api.key=secret123
● Disable API key in a safe environment
○ -config api.disablekey=true
● Tun of db recovery (speeds things up)
○ -config database.recoverylog=false
● Update all add-ons
○ -addonupdate
● Install a non default add-on
○ -addoninstall addonname
● The ZAP Port
○ -port 8080
● Starts ZAP in daemon mode, ie without a UI
○ -daemon
● Allow any source IP to connect
○ -config api.addrs.addr.regex=true
16
Using ZAP API
Two API calls to start active Scans:
1. creating a Context
2. add a URL (the target) to the Scope
17
curl
'http://localhost:8080/JSON/context/action/newContext/?zapapiformat=JSON&apikey=s
ecret123&formmethod=GET&contextName=My+Context'
curl
'http://localhost:8080/JSON/context/action/includeInContext/?apikey=secret123&con
textName=My+Context&regex=http://localhost/WebGoat.*'
Webdriver.io
● “WebdriverIO lets you control a browser or a mobile application with just
a few lines of code.”
● Simple Selenium binding for JS
● Very popular framework for automation testing
Setting proxy: https://webdriver.io/docs/proxy/
18
Selenium Driver Settings
// Set Chrome Options
ChromeOptions chromeOptions = new ChromeOptions(); chromeOptions.addArguments("--
ignore-certificate-errors");
// Set proxy
String proxyAddress = "localhost:8080";
Proxy proxy = new
Proxy();proxy.setHttpProxy(proxyAddress).setSslProxy(proxyAddress);
// Set Desired Capabilities
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setCapability(CapabilityType.PROXY, proxy);
capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
capabilities.setCapability(CapabilityType.ACCEPT_INSECURE_CERTS, true);
capabilities.setCapability(ChromeOptions.CAPABILITY, chromeOptions);
19
Different ways to become MitM
There is always a way to set a HTTP Proxy...
● Using Browser Settings
● Using a Browser Add-On like FoxyProxy
● Using Java Network Properties
○ jmeter -Dhttp.proxyHost=localhost -
Dhttp.proxyPort=8080 -
Dhttps.proxyHost=localhost -
Dhttps.proxyPort=8080
● Using system-wide OS settings
20
var proxy = "http://localhost:8080";
...
capabilities: [{
browserName: 'chrome',
proxy: {
httpProxy: proxy,
sslProxy: proxy,
ftpProxy: proxy,
proxyType: "MANUAL",
autodetect: false
},
'chrome.switches': [
'--ignore-certificate-errors'
]
}],
Solve Strict-Transport-Security Certificate Errors
If you are targeting a web application with Strict-Transport-Security and you
are using a browser, you will need to add ZAP’s Dynamic SSL Certificate to
your browser.
To retrieve the ZAP’s SSL certificate you can download the CA from
● ZAP -> Preferences -> Options -> Dynamic SSL Certificate
To import the ZAP SSL Certificate into Firefox:
● Preferences -> Privacy & Security -> View Certificates -> Authorities ->
Import
PS: Of course you can call the ZAP API to download the cert ;-)
21
Report
● HTML File - default
● XML File - default
○ Upload file to ThreadFix, a vulnerability management solution
○ Allows to synchronice with Jira
● JSON Format - a zap-baseline.py option
● Markdown Format - a zap-baseline.py option
● API
○ curl -s 'http://localhost:8080/OTHER/core/other/htmlreport/?apikey=secret123' > report.html
22
More Resources
● https://www.zaproxy.org/ - Getting started guide
● https://www.zaproxy.org/zap-in-ten/ - Series of short videos
● https://twitter.com/zaproxy - Official Twitter
23
24
Q&A

Mais conteúdo relacionado

Mais procurados

An Introduction to Maven
An Introduction to MavenAn Introduction to Maven
An Introduction to Maven
Vadym Lotar
 

Mais procurados (20)

Spring Boot
Spring BootSpring Boot
Spring Boot
 
JavaScript Event Loop
JavaScript Event LoopJavaScript Event Loop
JavaScript Event Loop
 
Zed attack proxy [ What is ZAP(Zed Attack Proxy)? ]
Zed attack proxy [ What is ZAP(Zed Attack Proxy)? ]Zed attack proxy [ What is ZAP(Zed Attack Proxy)? ]
Zed attack proxy [ What is ZAP(Zed Attack Proxy)? ]
 
Data Driven Framework in Selenium
Data Driven Framework in SeleniumData Driven Framework in Selenium
Data Driven Framework in Selenium
 
Introduction to Spring Boot
Introduction to Spring BootIntroduction to Spring Boot
Introduction to Spring Boot
 
Introduce yourself to java 17
Introduce yourself to java 17Introduce yourself to java 17
Introduce yourself to java 17
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
Burpsuite 101
Burpsuite 101Burpsuite 101
Burpsuite 101
 
Polyglot payloads in practice by avlidienbrunn at HackPra
Polyglot payloads in practice by avlidienbrunn at HackPraPolyglot payloads in practice by avlidienbrunn at HackPra
Polyglot payloads in practice by avlidienbrunn at HackPra
 
Swagger
SwaggerSwagger
Swagger
 
Introduction to Swagger
Introduction to SwaggerIntroduction to Swagger
Introduction to Swagger
 
Introduction to spring boot
Introduction to spring bootIntroduction to spring boot
Introduction to spring boot
 
Owasp zap
Owasp zapOwasp zap
Owasp zap
 
Top 10 Web Security Vulnerabilities (OWASP Top 10)
Top 10 Web Security Vulnerabilities (OWASP Top 10)Top 10 Web Security Vulnerabilities (OWASP Top 10)
Top 10 Web Security Vulnerabilities (OWASP Top 10)
 
The OWASP Zed Attack Proxy
The OWASP Zed Attack ProxyThe OWASP Zed Attack Proxy
The OWASP Zed Attack Proxy
 
Java presentation
Java presentation Java presentation
Java presentation
 
Dive in burpsuite
Dive in burpsuiteDive in burpsuite
Dive in burpsuite
 
An Introduction to Maven
An Introduction to MavenAn Introduction to Maven
An Introduction to Maven
 
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
 
Maven Basics - Explained
Maven Basics - ExplainedMaven Basics - Explained
Maven Basics - Explained
 

Semelhante a OWASP ZAP Workshop for QA Testers

Cannibalising The Google App Engine
Cannibalising The  Google  App  EngineCannibalising The  Google  App  Engine
Cannibalising The Google App Engine
catherinewall
 
Mastering selenium for automated acceptance tests
Mastering selenium for automated acceptance testsMastering selenium for automated acceptance tests
Mastering selenium for automated acceptance tests
Nick Belhomme
 

Semelhante a OWASP ZAP Workshop for QA Testers (20)

Cannibalising The Google App Engine
Cannibalising The  Google  App  EngineCannibalising The  Google  App  Engine
Cannibalising The Google App Engine
 
AppSec California 2016 - Making Security Agile
AppSec California 2016 - Making Security AgileAppSec California 2016 - Making Security Agile
AppSec California 2016 - Making Security Agile
 
introduction to node.js
introduction to node.jsintroduction to node.js
introduction to node.js
 
Integration tests: use the containers, Luke!
Integration tests: use the containers, Luke!Integration tests: use the containers, Luke!
Integration tests: use the containers, Luke!
 
Android UI Testing with Appium
Android UI Testing with AppiumAndroid UI Testing with Appium
Android UI Testing with Appium
 
Good practices for debugging Selenium and Appium tests
Good practices for debugging Selenium and Appium testsGood practices for debugging Selenium and Appium tests
Good practices for debugging Selenium and Appium tests
 
The Future of Security and Productivity in Our Newly Remote World
The Future of Security and Productivity in Our Newly Remote WorldThe Future of Security and Productivity in Our Newly Remote World
The Future of Security and Productivity in Our Newly Remote World
 
Java @ Cloud - Setor Público SP
Java @ Cloud - Setor Público SPJava @ Cloud - Setor Público SP
Java @ Cloud - Setor Público SP
 
Mastering selenium for automated acceptance tests
Mastering selenium for automated acceptance testsMastering selenium for automated acceptance tests
Mastering selenium for automated acceptance tests
 
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...
 
Django deployment with PaaS
Django deployment with PaaSDjango deployment with PaaS
Django deployment with PaaS
 
Django Architecture Introduction
Django Architecture IntroductionDjango Architecture Introduction
Django Architecture Introduction
 
An introduction to Node.js application development
An introduction to Node.js application developmentAn introduction to Node.js application development
An introduction to Node.js application development
 
Cloud Platforms for Java
Cloud Platforms for JavaCloud Platforms for Java
Cloud Platforms for Java
 
Gatling Performance Workshop
Gatling Performance WorkshopGatling Performance Workshop
Gatling Performance Workshop
 
Security DevOps - Free pentesters' time to focus on high-hanging fruits // Ha...
Security DevOps - Free pentesters' time to focus on high-hanging fruits // Ha...Security DevOps - Free pentesters' time to focus on high-hanging fruits // Ha...
Security DevOps - Free pentesters' time to focus on high-hanging fruits // Ha...
 
Appenginejs (old presentation)
Appenginejs (old presentation)Appenginejs (old presentation)
Appenginejs (old presentation)
 
Groovy In the Cloud
Groovy In the CloudGroovy In the Cloud
Groovy In the Cloud
 
Real World Lessons on the Pain Points of Node.js Applications
Real World Lessons on the Pain Points of Node.js ApplicationsReal World Lessons on the Pain Points of Node.js Applications
Real World Lessons on the Pain Points of Node.js Applications
 
Pyramid Deployment and Maintenance
Pyramid Deployment and MaintenancePyramid Deployment and Maintenance
Pyramid Deployment and Maintenance
 

Último

TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
VishalKumarJha10
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 

Último (20)

Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 

OWASP ZAP Workshop for QA Testers

  • 1. OWASP ZAP Dynamic Security Testing Workshop for Testers Javan Rasokat, Sage - May 2021
  • 2. OWASP Zed Attack Proxy (ZAP) ● OWASP Flagship Project ● “one of the world's most popular free security tools” ● Web App DAST tool / Vulnerability Scanner ● Integrated into CI/CD (Jenkins, Azure DevOps, GitHub Actions, ...) ● Comprehensive API for daemon mode ● 140+ Contributors ● Marketplace for add-ons ● Highly configurable and scriptable ● Multiple Use Cases (you’ll see later) 2
  • 4. Secure Development Lifecycle (SDL / S-SDLC) ● What scans should you run? ○ Static - Code analysis (SAST) ○ Dynamic - Live analysis (DAST) ● Dynamic Application Security Testing (DAST) ○ Black box testing ○ Requires a WebApp in staging or prod env ○ Finds environment issues ○ Finds run-time issues 4 Build Test Deploy Shift Left DevSecOps: Faster better feedback, fail fast and safe
  • 5. What are we trying to solve? ● Finding security issues as early as possible ● Integration into the DevOps pipeline ● Finding all of the possible vulnerabilities ● Putting pentesters out of a job :P 5 What are we NOT trying to solve?
  • 6. 1 Tool - 3 Types of Users ● Pentesters ○ information gathering by recording traffic, manual intercepting of traffic and tampering data ● Developers ○ running vulnerability scans as part of their CI/CD pipeline e.g. a “ZAP baseline” scan ● Testers ○ running their testing traffic through ZAP for passive scanning and/or active security testing The ZAP Head-up-Display (HUD) is applicable for all. 6
  • 7. It is a Tool... … start playing with it! zaproxy.org/download 7
  • 10. Passive Scan Rules ● Missing / incorrect security headers ● Cookie problems ● Information / error disclosure ● Missing CSRF tokens ● ... 10
  • 11. Attack types - Active scanning Vulnerability ● SQL-Injection ● Time based SQL-Injection ● SSRF ● Open Redirect ● Reflected XSS ● Path Traversal ● SSTI ● ... Payload ● api/product/99’ OR 1=1-- ● api/product/99’ AND SLEEP(15000); ● api/ctrl?host=http://mydomain.org:38193/ZapTest ● oauth/login?redirect_uri=https://google.com ● spa/welcome?name=ZAP<script>alert(1)</script> ● file/?name=../../../../etc/passwd ● spa/welcome?name=${{1+2}} ● ... 11
  • 12. Many ways for automation... ● Command-line options ● Pre-build Docker Images ● Python, NodeJs + Java CLI Library ● API ● Plugins (Jenkins, Azure DevOps) ● GitHub Actions ● NEW Automation Framework (YAML) ● ThreadFix Scan Agent ● SecureCodeBox for orchestrating mass-scans 12
  • 14. Test-driven Scanning vs. Baseline scan Benefits by using your existing test framework: ● Take advantage of existing tests ● Better coverage of the tested app ○ If you do have good test coverage all endpoints are already covered. ○ For the Crawler/Spider it is difficult to find all endpoints. Therefore it is better to record or import all API-endpoints. ● The captured traffic is valid. ○ ZAP does not have to guess if a parameter is expected to be a integer or string. Makes it easier for ZAP in the active scan. A request is not blocked because one of the parameters is in the wrong format. 14
  • 15. Using Command-line Options ● Command to start ZAP GUI ● As long as you keep ZAP open => HTTP Proxy and API available at localhost:8080 15 cd /Applications/OWASP ZAP.app/Contents/Java java -jar zap-2.10.0.jar -config scanner.attackOnStart=true -config view.mode=attack -config api.key=secret123 - newsession Latest_WebGoat_Scan.session
  • 16. Other useful commands: ● Setting the api key ○ -config api.key=secret123 ● Disable API key in a safe environment ○ -config api.disablekey=true ● Tun of db recovery (speeds things up) ○ -config database.recoverylog=false ● Update all add-ons ○ -addonupdate ● Install a non default add-on ○ -addoninstall addonname ● The ZAP Port ○ -port 8080 ● Starts ZAP in daemon mode, ie without a UI ○ -daemon ● Allow any source IP to connect ○ -config api.addrs.addr.regex=true 16
  • 17. Using ZAP API Two API calls to start active Scans: 1. creating a Context 2. add a URL (the target) to the Scope 17 curl 'http://localhost:8080/JSON/context/action/newContext/?zapapiformat=JSON&apikey=s ecret123&formmethod=GET&contextName=My+Context' curl 'http://localhost:8080/JSON/context/action/includeInContext/?apikey=secret123&con textName=My+Context&regex=http://localhost/WebGoat.*'
  • 18. Webdriver.io ● “WebdriverIO lets you control a browser or a mobile application with just a few lines of code.” ● Simple Selenium binding for JS ● Very popular framework for automation testing Setting proxy: https://webdriver.io/docs/proxy/ 18
  • 19. Selenium Driver Settings // Set Chrome Options ChromeOptions chromeOptions = new ChromeOptions(); chromeOptions.addArguments("-- ignore-certificate-errors"); // Set proxy String proxyAddress = "localhost:8080"; Proxy proxy = new Proxy();proxy.setHttpProxy(proxyAddress).setSslProxy(proxyAddress); // Set Desired Capabilities DesiredCapabilities capabilities = DesiredCapabilities.chrome(); capabilities.setCapability(CapabilityType.PROXY, proxy); capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true); capabilities.setCapability(CapabilityType.ACCEPT_INSECURE_CERTS, true); capabilities.setCapability(ChromeOptions.CAPABILITY, chromeOptions); 19
  • 20. Different ways to become MitM There is always a way to set a HTTP Proxy... ● Using Browser Settings ● Using a Browser Add-On like FoxyProxy ● Using Java Network Properties ○ jmeter -Dhttp.proxyHost=localhost - Dhttp.proxyPort=8080 - Dhttps.proxyHost=localhost - Dhttps.proxyPort=8080 ● Using system-wide OS settings 20 var proxy = "http://localhost:8080"; ... capabilities: [{ browserName: 'chrome', proxy: { httpProxy: proxy, sslProxy: proxy, ftpProxy: proxy, proxyType: "MANUAL", autodetect: false }, 'chrome.switches': [ '--ignore-certificate-errors' ] }],
  • 21. Solve Strict-Transport-Security Certificate Errors If you are targeting a web application with Strict-Transport-Security and you are using a browser, you will need to add ZAP’s Dynamic SSL Certificate to your browser. To retrieve the ZAP’s SSL certificate you can download the CA from ● ZAP -> Preferences -> Options -> Dynamic SSL Certificate To import the ZAP SSL Certificate into Firefox: ● Preferences -> Privacy & Security -> View Certificates -> Authorities -> Import PS: Of course you can call the ZAP API to download the cert ;-) 21
  • 22. Report ● HTML File - default ● XML File - default ○ Upload file to ThreadFix, a vulnerability management solution ○ Allows to synchronice with Jira ● JSON Format - a zap-baseline.py option ● Markdown Format - a zap-baseline.py option ● API ○ curl -s 'http://localhost:8080/OTHER/core/other/htmlreport/?apikey=secret123' > report.html 22
  • 23. More Resources ● https://www.zaproxy.org/ - Getting started guide ● https://www.zaproxy.org/zap-in-ten/ - Series of short videos ● https://twitter.com/zaproxy - Official Twitter 23

Notas do Editor

  1. Source: https://www.zaproxy.org/blog/2021-04-19-collecting-statistics-for-open-source-projects/
  2. Status: https://twitter.com/psiinon/status/1290229663713726467
  3. ZAP GUI => Options => Passive Scan Rules
  4. Scan policy
  5. Other projects: https://github.com/Soluto/webdriverio-zap-proxy
  6. Chrome Cert Storage: https://www.zdnet.com/article/chrome-will-soon-have-its-own-dedicated-certificate-root-store/