SlideShare a Scribd company logo
Seattle | September 16-17, 2019
Ban Footguns:
How to standardize how developers use dangerous
aspects of your framework
MORGAN ROMAN
Seattle | September 16-17, 2019
About Me
Currently work on the application security team at
DocuSign
Special thanks to Hailey Dhanens, John Heasman,
Krishna Rai, Rui Tu, Josh Estalilla, and Skyler Berg
We were tired of playing whack-a-mole with bugs
Note: My examples may use one particular library or framework,
but this strategy is independent of any
framework/language/library.
Seattle | September 16-17, 2019
The problem
A B
The easy way
Validation
Encoding
Logging
The secure way
Seattle | September 16-17, 2019
The solution
A B
Make the easy way the secure way
Seattle | September 16-17, 2019
This is BAD!
A B
The easy way
Validation
Encoding
Logging
The secure way
Seattle | September 16-17, 2019
This is GOOD!
A B
Make the easy way the secure way
Seattle | September 16-17, 2019
If you make the easy way the secure way
● Developers will do whatever is simplest, which is secure
● You will need less developer training
● Training will be more effective
● Security will not impede development
Seattle | September 16-17, 2019
Existing Examples
Seattle | September 16-17, 2019
Example: Reducing XSS thanks to React
• By Default: HTML will not encode user input by default
• It relies on the developer to encode the user input
• The app will ‘work’ without proper encoding
• This leads to XSS
• React/JSX makes it safe by default
• By default it encodes
• If you want to go unsafe, you have a scary name!
• Result: developers usually do it the safe way
Seattle | September 16-17, 2019
Example: Eliminating the dangers of string concatenation
● Dynamic SQL can end up with SQL injection
● ORMs (Object relational mapper) removes the need for dynamic SQL
● Result: Developers do it the safe way!
The developers just wanted to query the database
And then they shoot themselves in the foot!
Set it to ‘alice OR 1=1’ and you’ll dump the whole DB!
Seattle | September 16-17, 2019
Example XXE in .Net
• By default: XMLDocument uses document type definitions (DTD)
• This lead to XML external entity attacks
• To turn it off you had to set the ProhibitDtd property to true
• From .Net 4.6 onward it was safe by default
• If you really wanted, you can turn it back on
• Result: developers do it the safe way
The developers just wanted to parse XML!
And then they shoot themselves in the foot!
You can just read from the file system!
Seattle | September 16-17, 2019
How to make the easy way the secure way!
A B
Seattle | September 16-17, 2019
How to make it easy
1. Find the bad pattern
2. Make the the safe pattern the default one
3. Train the developers to use the safe pattern
4. Build tools to enforce the new rules
Seattle | September 16-17, 2019
ReDoS: Regex Denial of Service
● In some frameworks an inefficient regex can hold up a thread
perpetually
● The safe way is to ALWAYS wrap it in a timeout
Developers have to remember a timeout every time!
Seattle | September 16-17, 2019
ReDoS: Make it safe by default
● Create a wrapper class around regex
This gets technical
Do this once right so you don’t repeat yourself
Seattle | September 16-17, 2019
ReDoS: Sample training
If you use the default regex class, a poorly crafted regular expression can
result in executing with exponential time. Instead use the MySafeRegex
class since this bounds the execution to a reasonable amount of time.
Seattle | September 16-17, 2019
How to write training/documentation
• If you use <THE BAD WAY>, <BAD THING WILL HAPPEN>. Instead use the
<THE GOOD WAY> since <IT STOPS THE BAD THING>.
• DO NOT DO THIS:
• <EXAMPLE OF THE BAD WAY>
• DO THIS INSTEAD:
• <EXAMPLE OF THE GOOD WAY>
Explain it simply and clearly.
You do not need to use security lingo
like XXE/ReDoS/XSS/RCE etc.
First show an example on how the developer
intends to do it if you have one
Then show how they can do it correctly.
Make sure it is simple to do.
If you want, you can include more details and links to OWASP or another good resource.
Seattle | September 16-17, 2019
When should you train developers?
● When they get access to the repository
● Once a year, retrain for their specific department
Seattle | September 16-17, 2019
ReDoS Code Analysis
Simple way
Use a regex to find where your developers are using
the bad method:
I recommend using a tool like DevSkim, but you can
use any code searching tool like grep
https://github.com/microsoft/DevSkim
Complex and more accurate way
Use a static analyzer to find all instances of the base
regex class being used
Roslyn is a great tool for this. You can get the type of
all objects and then show results for banned classes.
Seattle | September 16-17, 2019
Example unsafe regex class rule for DevSkim
Clear description
Optional:
Link to documentation
Start with simple rules.
Go for 80%
Optional:
Have exclusions
Seattle | September 16-17, 2019
When to use this code analysis
● In the IDE is great, but difficult to get adoption
● Developers are open to feedback in pull requests before merge
• The target is developers. Include it as part of your existing CI/CD
pipeline
● On your own cadence for your entire code base
• The target is the security team. Schedule a regular cadence for this
Seattle | September 16-17, 2019
How we made it easy to stop ReDoS
1. Find the bad pattern
2. Make the the safe pattern the default one
3. Train the developers to use the safe pattern
4. Build tools to enforce the new rules
Seattle | September 16-17, 2019
XXE in Java: Bad Pattern and Safe Default
● By default the SAXParser XML parser for Java allows DTDs
● Create a wrapper factory
SAXParser is just an example Java library, I am not picking on it for any particular reason.
This is explained for other Java libraries on:
https://cheatsheetseries.owasp.org/cheatsheets/XML_External_Entity_Prevention_Cheat_Sheet.html accessed 07/29/2019
Wrap in your own class
Set to safe by default
Seattle | September 16-17, 2019
XXE in Java: Training
• If you use the standard XML parsers like SAXParser, you may allow an
attacker to remotely write files and control the server through the DTD.
Instead use the MySafeXMLParserFactory since it blocks the attacker
from setting DTD variables.
Seattle | September 16-17, 2019
XXE in Java: Enforce the Rules
Seattle | September 16-17, 2019
How we made it easy to stop XXE
1. Find the bad pattern
2. Make the the safe pattern the default one
3. Train the developers to use the safe pattern
4. Build tools to enforce the new rules
Seattle | September 16-17, 2019
Imagine you get an email like…
Hello!
We need you to log into your bank account to verify your information since
we believe you may have been hacked.
Please go to https://somebigbank.com?redirect=http://evilphishingsite.com
and type in your username and password to stop Mr. Robot!
We take your security very seriously!
Some Big Bank
Seattle | September 16-17, 2019
Dangers of Open Redirects
● Open redirects can trick users into malicious phishing sites
● If you don’t block the protocol, you can get XSS if the payload is:
javascript:alert(1)
● We often recommend people to use a whitelist
Let’s play spot the bug!!!
mysafewebsitexcom.evilwebsite.com
evilwebsite.com?foo=mysafewebsite.com
javascript:alert(‘mysafewebsite.com’)
Seattle | September 16-17, 2019
Redirect safely once and for all!
● Make a Safe Redirect with:
○ An internal redirect method
■ Blocks all non-http(s) protocols
■ Only allows redirects to your
specific site
○ An external redirect method
■ Blocks all non-http(s) protocols
■ Requires a whitelist as an
argument
You can assume all internal redirects are safe
You can audit all uses of the external redirect to ensure it
has a good whitelist
Seattle | September 16-17, 2019
Example DevSkim Rules for Open Redirects
For ‘unsafe’ use cases
Aim for 80% on your rule
Seattle | September 16-17, 2019
Dangers of Server Side Request Forgery
Hacker
Vulnerable
Server
Victim
Server
Blocked
Bypasses the firewall
Seattle | September 16-17, 2019
What could you do with server side request forgery in C#?
● Get past the firewall by calling internal IP addresses
● Call external servers with long responses
● Do a file read file:C:pathtofile.txt
● Do a file write to file:C:inetpubwwwrootdefault.html
Seattle | September 16-17, 2019
Server Side Request Forgery
● Sometimes an application must perform web calls (This is a feature)
● You want to limit the damage of SSRFAAS (SSRF as a service)
○ Block internal IPs
○ Have a built in timeout for long running requests
○ Block calls to the file system (This can lead to LFI and RCE)
● Set up a safe version that inherits all the features of your web client
library
Seattle | September 16-17, 2019
Recap
Seattle | September 16-17, 2019
1. Find the bad pattern
• Look for a common ‘sink’
that a kind of bug has to
reach
ReDoS must reach a regular expression!
XXE requires that you parse XML!
Open redirects require a redirect!
Seattle | September 16-17, 2019
2. Make the safe pattern the default one
• Make a safe default wrapper class for the unsafe method
• Have a coder do this once right
Seattle | September 16-17, 2019
3. Train the developers to use the safe pattern
• If you use <THE BAD WAY>, <BAD THING WILL HAPPEN>. Instead use the
<THE GOOD WAY> since <IT STOPS THE BAD THING>.
• DO NOT DO THIS:
• <EXAMPLE OF THE BAD WAY>
• DO THIS INSTEAD:
• <EXAMPLE OF THE GOOD WAY>
Seattle | September 16-17, 2019
4. Build tools to enforce the rules
● Use simple regex to find the bad pattern with tools like DevSkim
● Aim for 80% effective at first
● Run at a regular cadence
Seattle | September 16-17, 2019
Recap on how to do this
1. Find the bad pattern
2. Make the safe pattern the default one
3. Train the developers to use the safe pattern
4. Build tools to enforce the new rules
Make the easy way the secure way!
A B
Seattle | September 16-17, 2019
Thank you!
Morgan.roman@docusign.com

More Related Content

What's hot

Inspec: Turn your compliance, security, and other policy requirements into au...
Inspec: Turn your compliance, security, and other policy requirements into au...Inspec: Turn your compliance, security, and other policy requirements into au...
Inspec: Turn your compliance, security, and other policy requirements into au...
Kangaroot
 
InSpec - June 2018 at Open28.be
InSpec - June 2018 at Open28.beInSpec - June 2018 at Open28.be
InSpec - June 2018 at Open28.be
Mandi Walls
 
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
 
InSpec Workflow for DevOpsDays Riga 2017
InSpec Workflow for DevOpsDays Riga 2017InSpec Workflow for DevOpsDays Riga 2017
InSpec Workflow for DevOpsDays Riga 2017
Mandi Walls
 
Compliance Automation with InSpec - Chef NYC Meetup - April 2017
Compliance Automation with InSpec - Chef NYC Meetup - April 2017Compliance Automation with InSpec - Chef NYC Meetup - April 2017
Compliance Automation with InSpec - Chef NYC Meetup - April 2017
adamleff
 
Analysis of-quality-of-pkgs-in-packagist-univ-20171024
Analysis of-quality-of-pkgs-in-packagist-univ-20171024Analysis of-quality-of-pkgs-in-packagist-univ-20171024
Analysis of-quality-of-pkgs-in-packagist-univ-20171024
Clark Everetts
 
Php Dependency Management with Composer ZendCon 2017
Php Dependency Management with Composer ZendCon 2017Php Dependency Management with Composer ZendCon 2017
Php Dependency Management with Composer ZendCon 2017
Clark Everetts
 
InSpec For DevOpsDays Amsterdam 2017
InSpec For DevOpsDays Amsterdam 2017InSpec For DevOpsDays Amsterdam 2017
InSpec For DevOpsDays Amsterdam 2017
Mandi Walls
 
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
DevOps.com
 
DevSecCon London 2017: Permitting agility whilst enforcing security by Alina ...
DevSecCon London 2017: Permitting agility whilst enforcing security by Alina ...DevSecCon London 2017: Permitting agility whilst enforcing security by Alina ...
DevSecCon London 2017: Permitting agility whilst enforcing security by Alina ...
DevSecCon
 
Introduction to Infrastructure as Code & Automation / Introduction to Chef
Introduction to Infrastructure as Code & Automation / Introduction to ChefIntroduction to Infrastructure as Code & Automation / Introduction to Chef
Introduction to Infrastructure as Code & Automation / Introduction to Chef
Nathen Harvey
 
Operating Docker
Operating DockerOperating Docker
Operating Docker
Jen Andre
 
Create Disposable Test Environments with Vagrant and Puppet
Create Disposable Test Environments with Vagrant and PuppetCreate Disposable Test Environments with Vagrant and Puppet
Create Disposable Test Environments with Vagrant and Puppet
Gene Gotimer
 
Automated Infrastructure Testing
Automated Infrastructure TestingAutomated Infrastructure Testing
Automated Infrastructure Testing
Ranjib Dey
 
OSDC 2017 | Building Security Into Your Workflow with InSpec by Mandi Walls
OSDC 2017 | Building Security Into Your Workflow with InSpec by Mandi WallsOSDC 2017 | Building Security Into Your Workflow with InSpec by Mandi Walls
OSDC 2017 | Building Security Into Your Workflow with InSpec by Mandi Walls
NETWAYS
 
DevOpsDays Singapore - Continuous Auditing with Compliance as Code
DevOpsDays Singapore - Continuous Auditing with Compliance as CodeDevOpsDays Singapore - Continuous Auditing with Compliance as Code
DevOpsDays Singapore - Continuous Auditing with Compliance as Code
Matt Ray
 
DevSecCon London 2017: Hands-on secure software development from design to de...
DevSecCon London 2017: Hands-on secure software development from design to de...DevSecCon London 2017: Hands-on secure software development from design to de...
DevSecCon London 2017: Hands-on secure software development from design to de...
DevSecCon
 
Adding Security to Your Workflow with InSpec (MAY 2017)
Adding Security to Your Workflow with InSpec (MAY 2017)Adding Security to Your Workflow with InSpec (MAY 2017)
Adding Security to Your Workflow with InSpec (MAY 2017)
Mandi Walls
 
DevOpsDays Singapore Habitat Ignite
DevOpsDays Singapore Habitat IgniteDevOpsDays Singapore Habitat Ignite
DevOpsDays Singapore Habitat Ignite
Matt Ray
 
Drupal Continuous Integration with Jenkins - Deploy
Drupal Continuous Integration with Jenkins - DeployDrupal Continuous Integration with Jenkins - Deploy
Drupal Continuous Integration with Jenkins - Deploy
John Smith
 

What's hot (20)

Inspec: Turn your compliance, security, and other policy requirements into au...
Inspec: Turn your compliance, security, and other policy requirements into au...Inspec: Turn your compliance, security, and other policy requirements into au...
Inspec: Turn your compliance, security, and other policy requirements into au...
 
InSpec - June 2018 at Open28.be
InSpec - June 2018 at Open28.beInSpec - June 2018 at Open28.be
InSpec - June 2018 at Open28.be
 
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 ...
 
InSpec Workflow for DevOpsDays Riga 2017
InSpec Workflow for DevOpsDays Riga 2017InSpec Workflow for DevOpsDays Riga 2017
InSpec Workflow for DevOpsDays Riga 2017
 
Compliance Automation with InSpec - Chef NYC Meetup - April 2017
Compliance Automation with InSpec - Chef NYC Meetup - April 2017Compliance Automation with InSpec - Chef NYC Meetup - April 2017
Compliance Automation with InSpec - Chef NYC Meetup - April 2017
 
Analysis of-quality-of-pkgs-in-packagist-univ-20171024
Analysis of-quality-of-pkgs-in-packagist-univ-20171024Analysis of-quality-of-pkgs-in-packagist-univ-20171024
Analysis of-quality-of-pkgs-in-packagist-univ-20171024
 
Php Dependency Management with Composer ZendCon 2017
Php Dependency Management with Composer ZendCon 2017Php Dependency Management with Composer ZendCon 2017
Php Dependency Management with Composer ZendCon 2017
 
InSpec For DevOpsDays Amsterdam 2017
InSpec For DevOpsDays Amsterdam 2017InSpec For DevOpsDays Amsterdam 2017
InSpec For DevOpsDays Amsterdam 2017
 
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
 
DevSecCon London 2017: Permitting agility whilst enforcing security by Alina ...
DevSecCon London 2017: Permitting agility whilst enforcing security by Alina ...DevSecCon London 2017: Permitting agility whilst enforcing security by Alina ...
DevSecCon London 2017: Permitting agility whilst enforcing security by Alina ...
 
Introduction to Infrastructure as Code & Automation / Introduction to Chef
Introduction to Infrastructure as Code & Automation / Introduction to ChefIntroduction to Infrastructure as Code & Automation / Introduction to Chef
Introduction to Infrastructure as Code & Automation / Introduction to Chef
 
Operating Docker
Operating DockerOperating Docker
Operating Docker
 
Create Disposable Test Environments with Vagrant and Puppet
Create Disposable Test Environments with Vagrant and PuppetCreate Disposable Test Environments with Vagrant and Puppet
Create Disposable Test Environments with Vagrant and Puppet
 
Automated Infrastructure Testing
Automated Infrastructure TestingAutomated Infrastructure Testing
Automated Infrastructure Testing
 
OSDC 2017 | Building Security Into Your Workflow with InSpec by Mandi Walls
OSDC 2017 | Building Security Into Your Workflow with InSpec by Mandi WallsOSDC 2017 | Building Security Into Your Workflow with InSpec by Mandi Walls
OSDC 2017 | Building Security Into Your Workflow with InSpec by Mandi Walls
 
DevOpsDays Singapore - Continuous Auditing with Compliance as Code
DevOpsDays Singapore - Continuous Auditing with Compliance as CodeDevOpsDays Singapore - Continuous Auditing with Compliance as Code
DevOpsDays Singapore - Continuous Auditing with Compliance as Code
 
DevSecCon London 2017: Hands-on secure software development from design to de...
DevSecCon London 2017: Hands-on secure software development from design to de...DevSecCon London 2017: Hands-on secure software development from design to de...
DevSecCon London 2017: Hands-on secure software development from design to de...
 
Adding Security to Your Workflow with InSpec (MAY 2017)
Adding Security to Your Workflow with InSpec (MAY 2017)Adding Security to Your Workflow with InSpec (MAY 2017)
Adding Security to Your Workflow with InSpec (MAY 2017)
 
DevOpsDays Singapore Habitat Ignite
DevOpsDays Singapore Habitat IgniteDevOpsDays Singapore Habitat Ignite
DevOpsDays Singapore Habitat Ignite
 
Drupal Continuous Integration with Jenkins - Deploy
Drupal Continuous Integration with Jenkins - DeployDrupal Continuous Integration with Jenkins - Deploy
Drupal Continuous Integration with Jenkins - Deploy
 

Similar to Banfootguns devseccon 2019

Dont run with scissors
Dont run with scissorsDont run with scissors
Dont run with scissors
Morgan Roman
 
Attacking and defending GraphQL applications: a hands-on approach
 Attacking and defending GraphQL applications: a hands-on approach Attacking and defending GraphQL applications: a hands-on approach
Attacking and defending GraphQL applications: a hands-on approach
Davide Cioccia
 
(SEC202) Best Practices for Securely Leveraging the Cloud
(SEC202) Best Practices for Securely Leveraging the Cloud(SEC202) Best Practices for Securely Leveraging the Cloud
(SEC202) Best Practices for Securely Leveraging the Cloud
Amazon Web Services
 
DevSecCon Seattle 2019: Liquid Software as the real solution for the Sec in D...
DevSecCon Seattle 2019: Liquid Software as the real solution for the Sec in D...DevSecCon Seattle 2019: Liquid Software as the real solution for the Sec in D...
DevSecCon Seattle 2019: Liquid Software as the real solution for the Sec in D...
DevSecCon
 
Software craftsmanship
Software craftsmanshipSoftware craftsmanship
Software craftsmanship
ColdFusionConference
 
Webinar–Reviewing Modern JavaScript Applications
Webinar–Reviewing Modern JavaScript ApplicationsWebinar–Reviewing Modern JavaScript Applications
Webinar–Reviewing Modern JavaScript Applications
Synopsys Software Integrity Group
 
RWD
RWDRWD
NKU Cybersecurity Symposium: Active Defense - Helping threat actors hack them...
NKU Cybersecurity Symposium: Active Defense - Helping threat actors hack them...NKU Cybersecurity Symposium: Active Defense - Helping threat actors hack them...
NKU Cybersecurity Symposium: Active Defense - Helping threat actors hack them...
ThreatReel Podcast
 
SACON - Automating SecOps (Murray Goldschmidt)
SACON - Automating SecOps (Murray Goldschmidt)SACON - Automating SecOps (Murray Goldschmidt)
SACON - Automating SecOps (Murray Goldschmidt)
Priyanka Aash
 
Overcoming the old ways of working with DevSecOps - Culture, Data, Graph, and...
Overcoming the old ways of working with DevSecOps - Culture, Data, Graph, and...Overcoming the old ways of working with DevSecOps - Culture, Data, Graph, and...
Overcoming the old ways of working with DevSecOps - Culture, Data, Graph, and...
Erkang Zheng
 
Xamarin security talk slideshare
Xamarin security talk slideshareXamarin security talk slideshare
Xamarin security talk slideshare
Marcus de Wilde
 
OISF Aniversary: Active Defense - Helping threat actors hack themselves!
OISF Aniversary: Active Defense - Helping threat actors hack themselves!OISF Aniversary: Active Defense - Helping threat actors hack themselves!
OISF Aniversary: Active Defense - Helping threat actors hack themselves!
ThreatReel Podcast
 
PHP Mega Meetup, Sep, 2020, Anti patterns in php
PHP Mega Meetup, Sep, 2020, Anti patterns in phpPHP Mega Meetup, Sep, 2020, Anti patterns in php
PHP Mega Meetup, Sep, 2020, Anti patterns in php
Ahmed Abdou
 
Year Zero
Year ZeroYear Zero
Year Zero
leifdreizler
 
Douglas - Real JavaScript
Douglas - Real JavaScriptDouglas - Real JavaScript
Douglas - Real JavaScript
d0nn9n
 
Of innovation and impatience - Future Decoded 2015
Of innovation and impatience - Future Decoded 2015Of innovation and impatience - Future Decoded 2015
Of innovation and impatience - Future Decoded 2015
Christian Heilmann
 
Common Security Misconception
Common Security MisconceptionCommon Security Misconception
Common Security Misconception
Matthew Ong
 
How to build Sdk? Best practices
How to build Sdk? Best practicesHow to build Sdk? Best practices
How to build Sdk? Best practices
Vitali Pekelis
 
Content Security Policy - Lessons learned at Yahoo
Content Security Policy - Lessons learned at YahooContent Security Policy - Lessons learned at Yahoo
Content Security Policy - Lessons learned at Yahoo
Binu Ramakrishnan
 
How to Incorporate a Security-First Approach to Your Products by spiderSlik C...
How to Incorporate a Security-First Approach to Your Products by spiderSlik C...How to Incorporate a Security-First Approach to Your Products by spiderSlik C...
How to Incorporate a Security-First Approach to Your Products by spiderSlik C...
Product School
 

Similar to Banfootguns devseccon 2019 (20)

Dont run with scissors
Dont run with scissorsDont run with scissors
Dont run with scissors
 
Attacking and defending GraphQL applications: a hands-on approach
 Attacking and defending GraphQL applications: a hands-on approach Attacking and defending GraphQL applications: a hands-on approach
Attacking and defending GraphQL applications: a hands-on approach
 
(SEC202) Best Practices for Securely Leveraging the Cloud
(SEC202) Best Practices for Securely Leveraging the Cloud(SEC202) Best Practices for Securely Leveraging the Cloud
(SEC202) Best Practices for Securely Leveraging the Cloud
 
DevSecCon Seattle 2019: Liquid Software as the real solution for the Sec in D...
DevSecCon Seattle 2019: Liquid Software as the real solution for the Sec in D...DevSecCon Seattle 2019: Liquid Software as the real solution for the Sec in D...
DevSecCon Seattle 2019: Liquid Software as the real solution for the Sec in D...
 
Software craftsmanship
Software craftsmanshipSoftware craftsmanship
Software craftsmanship
 
Webinar–Reviewing Modern JavaScript Applications
Webinar–Reviewing Modern JavaScript ApplicationsWebinar–Reviewing Modern JavaScript Applications
Webinar–Reviewing Modern JavaScript Applications
 
RWD
RWDRWD
RWD
 
NKU Cybersecurity Symposium: Active Defense - Helping threat actors hack them...
NKU Cybersecurity Symposium: Active Defense - Helping threat actors hack them...NKU Cybersecurity Symposium: Active Defense - Helping threat actors hack them...
NKU Cybersecurity Symposium: Active Defense - Helping threat actors hack them...
 
SACON - Automating SecOps (Murray Goldschmidt)
SACON - Automating SecOps (Murray Goldschmidt)SACON - Automating SecOps (Murray Goldschmidt)
SACON - Automating SecOps (Murray Goldschmidt)
 
Overcoming the old ways of working with DevSecOps - Culture, Data, Graph, and...
Overcoming the old ways of working with DevSecOps - Culture, Data, Graph, and...Overcoming the old ways of working with DevSecOps - Culture, Data, Graph, and...
Overcoming the old ways of working with DevSecOps - Culture, Data, Graph, and...
 
Xamarin security talk slideshare
Xamarin security talk slideshareXamarin security talk slideshare
Xamarin security talk slideshare
 
OISF Aniversary: Active Defense - Helping threat actors hack themselves!
OISF Aniversary: Active Defense - Helping threat actors hack themselves!OISF Aniversary: Active Defense - Helping threat actors hack themselves!
OISF Aniversary: Active Defense - Helping threat actors hack themselves!
 
PHP Mega Meetup, Sep, 2020, Anti patterns in php
PHP Mega Meetup, Sep, 2020, Anti patterns in phpPHP Mega Meetup, Sep, 2020, Anti patterns in php
PHP Mega Meetup, Sep, 2020, Anti patterns in php
 
Year Zero
Year ZeroYear Zero
Year Zero
 
Douglas - Real JavaScript
Douglas - Real JavaScriptDouglas - Real JavaScript
Douglas - Real JavaScript
 
Of innovation and impatience - Future Decoded 2015
Of innovation and impatience - Future Decoded 2015Of innovation and impatience - Future Decoded 2015
Of innovation and impatience - Future Decoded 2015
 
Common Security Misconception
Common Security MisconceptionCommon Security Misconception
Common Security Misconception
 
How to build Sdk? Best practices
How to build Sdk? Best practicesHow to build Sdk? Best practices
How to build Sdk? Best practices
 
Content Security Policy - Lessons learned at Yahoo
Content Security Policy - Lessons learned at YahooContent Security Policy - Lessons learned at Yahoo
Content Security Policy - Lessons learned at Yahoo
 
How to Incorporate a Security-First Approach to Your Products by spiderSlik C...
How to Incorporate a Security-First Approach to Your Products by spiderSlik C...How to Incorporate a Security-First Approach to Your Products by spiderSlik C...
How to Incorporate a Security-First Approach to Your Products by spiderSlik C...
 

Recently uploaded

Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
Matthew Sinclair
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
Zilliz
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
SOFTTECHHUB
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
Neo4j
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
Neo4j
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Vladimir Iglovikov, Ph.D.
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
Neo4j
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
DianaGray10
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
名前 です男
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
DianaGray10
 
Data structures and Algorithms in Python.pdf
Data structures and Algorithms in Python.pdfData structures and Algorithms in Python.pdf
Data structures and Algorithms in Python.pdf
TIPNGVN2
 
Building RAG with self-deployed Milvus vector database and Snowpark Container...
Building RAG with self-deployed Milvus vector database and Snowpark Container...Building RAG with self-deployed Milvus vector database and Snowpark Container...
Building RAG with self-deployed Milvus vector database and Snowpark Container...
Zilliz
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
shyamraj55
 

Recently uploaded (20)

Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
 
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AIEnchancing adoption of Open Source Libraries. A case study on Albumentations.AI
Enchancing adoption of Open Source Libraries. A case study on Albumentations.AI
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
 
Data structures and Algorithms in Python.pdf
Data structures and Algorithms in Python.pdfData structures and Algorithms in Python.pdf
Data structures and Algorithms in Python.pdf
 
Building RAG with self-deployed Milvus vector database and Snowpark Container...
Building RAG with self-deployed Milvus vector database and Snowpark Container...Building RAG with self-deployed Milvus vector database and Snowpark Container...
Building RAG with self-deployed Milvus vector database and Snowpark Container...
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
 

Banfootguns devseccon 2019

  • 1. Seattle | September 16-17, 2019 Ban Footguns: How to standardize how developers use dangerous aspects of your framework MORGAN ROMAN
  • 2. Seattle | September 16-17, 2019 About Me Currently work on the application security team at DocuSign Special thanks to Hailey Dhanens, John Heasman, Krishna Rai, Rui Tu, Josh Estalilla, and Skyler Berg We were tired of playing whack-a-mole with bugs Note: My examples may use one particular library or framework, but this strategy is independent of any framework/language/library.
  • 3. Seattle | September 16-17, 2019 The problem A B The easy way Validation Encoding Logging The secure way
  • 4. Seattle | September 16-17, 2019 The solution A B Make the easy way the secure way
  • 5. Seattle | September 16-17, 2019 This is BAD! A B The easy way Validation Encoding Logging The secure way
  • 6. Seattle | September 16-17, 2019 This is GOOD! A B Make the easy way the secure way
  • 7. Seattle | September 16-17, 2019 If you make the easy way the secure way ● Developers will do whatever is simplest, which is secure ● You will need less developer training ● Training will be more effective ● Security will not impede development
  • 8. Seattle | September 16-17, 2019 Existing Examples
  • 9. Seattle | September 16-17, 2019 Example: Reducing XSS thanks to React • By Default: HTML will not encode user input by default • It relies on the developer to encode the user input • The app will ‘work’ without proper encoding • This leads to XSS • React/JSX makes it safe by default • By default it encodes • If you want to go unsafe, you have a scary name! • Result: developers usually do it the safe way
  • 10. Seattle | September 16-17, 2019 Example: Eliminating the dangers of string concatenation ● Dynamic SQL can end up with SQL injection ● ORMs (Object relational mapper) removes the need for dynamic SQL ● Result: Developers do it the safe way! The developers just wanted to query the database And then they shoot themselves in the foot! Set it to ‘alice OR 1=1’ and you’ll dump the whole DB!
  • 11. Seattle | September 16-17, 2019 Example XXE in .Net • By default: XMLDocument uses document type definitions (DTD) • This lead to XML external entity attacks • To turn it off you had to set the ProhibitDtd property to true • From .Net 4.6 onward it was safe by default • If you really wanted, you can turn it back on • Result: developers do it the safe way The developers just wanted to parse XML! And then they shoot themselves in the foot! You can just read from the file system!
  • 12. Seattle | September 16-17, 2019 How to make the easy way the secure way! A B
  • 13. Seattle | September 16-17, 2019 How to make it easy 1. Find the bad pattern 2. Make the the safe pattern the default one 3. Train the developers to use the safe pattern 4. Build tools to enforce the new rules
  • 14. Seattle | September 16-17, 2019 ReDoS: Regex Denial of Service ● In some frameworks an inefficient regex can hold up a thread perpetually ● The safe way is to ALWAYS wrap it in a timeout Developers have to remember a timeout every time!
  • 15. Seattle | September 16-17, 2019 ReDoS: Make it safe by default ● Create a wrapper class around regex This gets technical Do this once right so you don’t repeat yourself
  • 16. Seattle | September 16-17, 2019 ReDoS: Sample training If you use the default regex class, a poorly crafted regular expression can result in executing with exponential time. Instead use the MySafeRegex class since this bounds the execution to a reasonable amount of time.
  • 17. Seattle | September 16-17, 2019 How to write training/documentation • If you use <THE BAD WAY>, <BAD THING WILL HAPPEN>. Instead use the <THE GOOD WAY> since <IT STOPS THE BAD THING>. • DO NOT DO THIS: • <EXAMPLE OF THE BAD WAY> • DO THIS INSTEAD: • <EXAMPLE OF THE GOOD WAY> Explain it simply and clearly. You do not need to use security lingo like XXE/ReDoS/XSS/RCE etc. First show an example on how the developer intends to do it if you have one Then show how they can do it correctly. Make sure it is simple to do. If you want, you can include more details and links to OWASP or another good resource.
  • 18. Seattle | September 16-17, 2019 When should you train developers? ● When they get access to the repository ● Once a year, retrain for their specific department
  • 19. Seattle | September 16-17, 2019 ReDoS Code Analysis Simple way Use a regex to find where your developers are using the bad method: I recommend using a tool like DevSkim, but you can use any code searching tool like grep https://github.com/microsoft/DevSkim Complex and more accurate way Use a static analyzer to find all instances of the base regex class being used Roslyn is a great tool for this. You can get the type of all objects and then show results for banned classes.
  • 20. Seattle | September 16-17, 2019 Example unsafe regex class rule for DevSkim Clear description Optional: Link to documentation Start with simple rules. Go for 80% Optional: Have exclusions
  • 21. Seattle | September 16-17, 2019 When to use this code analysis ● In the IDE is great, but difficult to get adoption ● Developers are open to feedback in pull requests before merge • The target is developers. Include it as part of your existing CI/CD pipeline ● On your own cadence for your entire code base • The target is the security team. Schedule a regular cadence for this
  • 22. Seattle | September 16-17, 2019 How we made it easy to stop ReDoS 1. Find the bad pattern 2. Make the the safe pattern the default one 3. Train the developers to use the safe pattern 4. Build tools to enforce the new rules
  • 23. Seattle | September 16-17, 2019 XXE in Java: Bad Pattern and Safe Default ● By default the SAXParser XML parser for Java allows DTDs ● Create a wrapper factory SAXParser is just an example Java library, I am not picking on it for any particular reason. This is explained for other Java libraries on: https://cheatsheetseries.owasp.org/cheatsheets/XML_External_Entity_Prevention_Cheat_Sheet.html accessed 07/29/2019 Wrap in your own class Set to safe by default
  • 24. Seattle | September 16-17, 2019 XXE in Java: Training • If you use the standard XML parsers like SAXParser, you may allow an attacker to remotely write files and control the server through the DTD. Instead use the MySafeXMLParserFactory since it blocks the attacker from setting DTD variables.
  • 25. Seattle | September 16-17, 2019 XXE in Java: Enforce the Rules
  • 26. Seattle | September 16-17, 2019 How we made it easy to stop XXE 1. Find the bad pattern 2. Make the the safe pattern the default one 3. Train the developers to use the safe pattern 4. Build tools to enforce the new rules
  • 27. Seattle | September 16-17, 2019 Imagine you get an email like… Hello! We need you to log into your bank account to verify your information since we believe you may have been hacked. Please go to https://somebigbank.com?redirect=http://evilphishingsite.com and type in your username and password to stop Mr. Robot! We take your security very seriously! Some Big Bank
  • 28. Seattle | September 16-17, 2019 Dangers of Open Redirects ● Open redirects can trick users into malicious phishing sites ● If you don’t block the protocol, you can get XSS if the payload is: javascript:alert(1) ● We often recommend people to use a whitelist Let’s play spot the bug!!! mysafewebsitexcom.evilwebsite.com evilwebsite.com?foo=mysafewebsite.com javascript:alert(‘mysafewebsite.com’)
  • 29. Seattle | September 16-17, 2019 Redirect safely once and for all! ● Make a Safe Redirect with: ○ An internal redirect method ■ Blocks all non-http(s) protocols ■ Only allows redirects to your specific site ○ An external redirect method ■ Blocks all non-http(s) protocols ■ Requires a whitelist as an argument You can assume all internal redirects are safe You can audit all uses of the external redirect to ensure it has a good whitelist
  • 30. Seattle | September 16-17, 2019 Example DevSkim Rules for Open Redirects For ‘unsafe’ use cases Aim for 80% on your rule
  • 31. Seattle | September 16-17, 2019 Dangers of Server Side Request Forgery Hacker Vulnerable Server Victim Server Blocked Bypasses the firewall
  • 32. Seattle | September 16-17, 2019 What could you do with server side request forgery in C#? ● Get past the firewall by calling internal IP addresses ● Call external servers with long responses ● Do a file read file:C:pathtofile.txt ● Do a file write to file:C:inetpubwwwrootdefault.html
  • 33. Seattle | September 16-17, 2019 Server Side Request Forgery ● Sometimes an application must perform web calls (This is a feature) ● You want to limit the damage of SSRFAAS (SSRF as a service) ○ Block internal IPs ○ Have a built in timeout for long running requests ○ Block calls to the file system (This can lead to LFI and RCE) ● Set up a safe version that inherits all the features of your web client library
  • 34. Seattle | September 16-17, 2019 Recap
  • 35. Seattle | September 16-17, 2019 1. Find the bad pattern • Look for a common ‘sink’ that a kind of bug has to reach ReDoS must reach a regular expression! XXE requires that you parse XML! Open redirects require a redirect!
  • 36. Seattle | September 16-17, 2019 2. Make the safe pattern the default one • Make a safe default wrapper class for the unsafe method • Have a coder do this once right
  • 37. Seattle | September 16-17, 2019 3. Train the developers to use the safe pattern • If you use <THE BAD WAY>, <BAD THING WILL HAPPEN>. Instead use the <THE GOOD WAY> since <IT STOPS THE BAD THING>. • DO NOT DO THIS: • <EXAMPLE OF THE BAD WAY> • DO THIS INSTEAD: • <EXAMPLE OF THE GOOD WAY>
  • 38. Seattle | September 16-17, 2019 4. Build tools to enforce the rules ● Use simple regex to find the bad pattern with tools like DevSkim ● Aim for 80% effective at first ● Run at a regular cadence
  • 39. Seattle | September 16-17, 2019 Recap on how to do this 1. Find the bad pattern 2. Make the safe pattern the default one 3. Train the developers to use the safe pattern 4. Build tools to enforce the new rules Make the easy way the secure way! A B
  • 40. Seattle | September 16-17, 2019 Thank you! Morgan.roman@docusign.com

Editor's Notes

  1. DocuSign is a esignature platform. I was an SDET. I wrote web and api tests. I would help out the security team by creating regression tests for them occasionally. DocuSign has an amazing set of integration tests.
  2. May add filter?
  3. Is repeating bad?
  4. Simple as possible to get it running Hard to undo bad patterns The default
  5. Angular does it too!
  6. DTD = document type definitions
  7. The Gist of what we are doing Bad pattern Make it safe by default
  8. Add image
  9. Remember to explain DevSkim made by microsoft Talk about blocking with these tools at the PR How to convince devs: Before they get git access During PRs Bad idea in the IDE
  10. Format of the code { "name": "Possible regex denial of service attack", "id": "REDOS_1", "description": "It is possible to perform a regex denial of service attack with the standard .Net regex library. ", "recommendation": "Please use MySafeRegex class to generate this", "applies_to": [ "csharp" ], "severity": "important", "patterns": [ { "pattern": "new Regex\\(", "type": "regex-word", "scopes": [ "code" ] } ], "conditions": [ { "pattern": { "pattern": "new MySafeRegex\\(", "type": "regex-word", "scopes": [ "code" ] }, "search_in": "finding-only", "negate_finding": true } ] },
  11. The Gist of what we are doing Bad pattern Make it safe by default
  12. Note that you didn’t need exceptions in this one
  13. The Gist of what we are doing Bad pattern Make it safe by default
  14. Mysafewebsitexcom.evilwebsite.com would match evilwebsite.com?foo=mysafewebsitexcom would match
  15. Removw file write