Owasp Final
Owasp Final
OWASP Poland
Wroclaw Meetup #5
17.02.2017
About us
• Alexander Antukh
• OWASP Poland Board
Member
• Head of Product Security at
• @c0rdis
About us
• Marek Puchalski
• OWASP Poland member
• Developer and Security
Consultant at Capgemini
• https://marek.puchal.ski
About us
• Pawel Rzepa
• Security Engineer in Intive
As of 2016, there are 133 different projects, which can help you
whether you are on attacker’s or defender’s parts of the
barricades!
Program for today
…and XSS
allows you
injecting such
horrifying
pop up
windows!!!
Security awareness
trainings for
developers are quite
common, but reality
shows they are still
ineffective :(
Problem of efficient security training
What about…
Finally a security
training which isn’t
an online course to
fly through and
forget!
• Documentation:
https://github.com/WebGoat/WebGoat
Problem: how to efficiently manage
outputs from many different applications?
• Each pentester uses many different applications (vuln scanner,
web crawler, SSL/TLS tests, session management tests)
• Running each of those tests consumes time, right?
• It’s easy to automate those tasks, but analysing a consolidated
output is much more difficult :(
• And finally you have to form a readable report from all those
tests…
• …oooh… :(
Typical penetration testing process
(…)
<runs a lot of tests> <which generates lots of output>
ancy &
<creates a f
ort>
readable rep
• Documentation:
http://docs.owtf.org/en/latest/
SANS Institute, May 2015, State of Application Security: Closing the Gap
https://www.sans.org/reading-room/whitepapers/analyst/2015-state-application-security-closing-gap-35942
In short
OWASP Application Security Verification Standard
(ASVS) is a list of application security requirements or
tests that can be used by architects, developers, testers,
security professionals, and even consumers to define
what a secure application is.
Example requirements
Example requirements
• Architecture and design
• Input handling
• Data protection • 19 sections in total
• Excel checklist:
https://github.com/OWASP/ASVS/blob/master/ASVS-excel-v3.0.1.xlsx
• Github:
https://github.com/OWASP/owasp-masvs
OWASP Cornucopia
In short
OWASP Cornucopia is a mechanism in the form of a card game
to assist software development teams identify security
requirements in Agile, conventional and formal development
processes. It is language, platform and technology agnostic.
Cornucopia is based on the concepts and game ideas from
Microsoft SDL EoP game and OWASP Secure Coding Practices
Guide.
Rank
Threat
Suite
References:
- Secure Coding Practices
- ASVS
- AppSensor project
- Common Attack Pattern (CAPEC)
- Software Assurance Forum for
Excellence in Code (SAFECode)
Cornucopia rules
• Prepare everything (deck, cards, data flow diagram,
prizes…)
• Deal all the cards
• Play a round – every player has to utilize one card
of the selected suit. Highest played card in the suit
wins and starts next round until all cards are played
• Count points and define the winner
• Closure: review all threats and matching security
requirements
https://www.owasp.org/index.php/OWASP_Cornucopia#tab=How_to_Play
Cornucopia rules
Playing a card:
• each player reads it out loud
• explains how the threat could apply (or not) to his
application
• player gets a point for attacks that work, and the
group thinks it is an actionable bug
• Exact descriptions of
threats
• Actionable items
• Developers know
precisely what
functionality is affected
Benefits for you
https://github.com/blabla1337/skf-flask#installing
Overview
https://demo.securityknowledgeframework.org
admin : test-skf
SKF: Projects
• Security awareness
• Source code:
https://github.com/blabla1337/skf-flask
https://www.owasp.org/index.php/OWASP_AppSec_Pipeline
Example of workflow
- Code written
- Code committed to repository
- Unit test the code
- Package the code for deployment
- Integration testing
- Deploy code in production
Pipeline design patterns
Pipeline design patterns
Security tools evaluation criteria
• API is the first
• Pipeline position
• Cloud scalable
• Runs as a service
• Client libraries
• CI/CD plugins
What is OWASP ZAP?
• Webapp security testing tool
https://www.owasp.org/index.php/ZAP
OWASP ZAP Features
• GUI, headless and REST API
• Intercepting proxy
• Classic and AJAX spiders
• Passive and active scanning
• … and of course can be extended via addons!
Addons
How can it all help me???
ZAP for pentests
• Configure your browser to use ZAP as a proxy
• Explore the application manually
• Use the spider to find other content and input points
• See what security issues the passive scanner has
found
• Use the active scanner to find vulnerabilities
• Do manual pentesting 😎
ZAP as a part of your appsec pipeline
processes
The baseline scan
• Uses Docker
• Only passive scanning
• Time limited spider of target
• By default warns on all issues:
– Missing / incorrect security headers like CSP
– Cookie problems
– Information / error disclosure
– Missing CSRF tokens etc.
The baseline scan example
$ docker run -t owasp/zap2docker-weekly zap-baseline.py -t
https://oxdef.info
...
Total of 81 URLs
PASS: Cookie No HttpOnly Flag [10010]
...
WARN: Web Browser XSS Protection Not Enabled [10016] x 52
https://oxdef.info
...
FAIL: 0 WARN: 5 INFO: 0 IGNORE: 0 PASS: 21
1 n33d m0re p0w3r!
• REST API is your choice 😏
• zap.sh -daemon -host 0.0.0.0 -port 8080
• http(s)://zap/<format>/<component>/<operation>/<op
name>[/?<params>]
• Also available in Docker image owasp/zap2docker-*
• Maps closely to the UI / code
• JSON, HTML and XML formats
• Clients in: Java, Python, NodeJS, .Net, PHP, Go ...
Simple scan using API and client in
Python
target = 'http://some-target.com'
zap = ZAPv2()
scanid = zap.spider.scan(target)
while(int(zap.spider.status(scanid)) < 100):
print 'Spider progress %: ' + zap.spider.status(scanid)
scanid = zap.ascan.scan(target)
while(int(zap.ascan.status(scanid)) < 100):
print 'Scan progress %: ' + zap.ascan.status(scanid)
pprint(zap.core.alerts())
Cheat Sheet Series
Cheat Sheet Series
Cheat Sheet Series
• «The OWASP Cheat Sheet Series was created to
provide a concise collection of high value
information on specific web application security
topics»
• You can browse it online or get as PDF book
• Mostly fresh and actual topics
https://www.owasp.org/index.php/Cheat_Sheets
3rd party JavaScript management
The invocation of 3rd party JS code in a web application
requires consideration for 3 risks in particular:
• The loss of control over changes to the client application
• The execution of arbitrary code on client systems
• The disclosure or leakage of sensitive information to 3rd
parties
https://
www.owasp.org/index.php/3rd_Party_Javascript_Manage
ment_Cheat_Sheet
XSS Prevention
RULE #3 - JavaScript Escape Before Inserting
Untrusted Data into JavaScript Data Values
Except for alphanumeric characters, escape all
characters less than 256 with the \xHH format to
prevent switching out of the data value into the
script context or into another attribute.
https://www.owasp.org/index.php/XSS_(Cross_Site_Scrip
ting)_
Prevention_Cheat_Sheet
XXE Prevention
Libxml2: the Enum xmlParserOption should not have
the following options defined:
• XML_PARSE_NOENT: Expands entities and substitutes them with
replacement text
https://
www.owasp.org/index.php/XML_External_Entity_(XXE)_
Prevention_Cheat_Sheet
Featured cheat sheets
• Clickjacking Defense
• Cross-Site Request Forgery (CSRF) Prevention
• Deserialization
• DOM based XSS Prevention
• REST Security
• Virtual Patching
Summary
• OWASP AppSec Pipeline helps you with choosing
suitable tools and building your own AppSec pipeline
• Summary
• How to test
Fingerprint
• Tools Web Application Fra
mework
• Remediation
• References
Why to test
• The steps that need to be undertaken to build and
operate a testing program on web apps.
• Effective testing program:
– People
– Process
– Technology
• Testing just the technical implementation of an
application will not uncover management or
operational vulnerabilities that could be present
When to test
• Don’t test software until it has already been
created and is in the deployment phase of its
life cycle ineffective and cost-prohibitive
practice
• One of the best methods to prevent security
bugs from appearing in production
applications is to improve the SDLC by
including security in each of its phases
Example Testing guide XXE
Summary
• Constant work in progress
• Complementary
– Security Testing in the Application Development Lifecycle
– Tools
MSTG Structure
Typical MSTG chapter
• Summary
• Remediation
• References
• Tools
Typical MSTG chapter
Practical examples of
how to test it right,
with tools, samples
and references
Summary
• Constant work in progress
• https://github.com/OWASP/owasp-mstg
Foreword
Foreword
• There are many projects happening right now (very
good examples are MASVS and MSTG)