SlideShare a Scribd company logo
1 of 56
Download to read offline
Secure DevOps: A Puma’s Tail
SANS Secure DevOps Summit
Tuesday, October 10th 2017
Eric Johnson (@emjohn20)
Puma Security
• Principal Security
Engineer
• Modern static code
analysis
• DevSecOps automation
• Secure Development
Lifecycle
SANS Institute
• Certified Instructor
DEV541: Secure Coding in Java
DEV534: Secure DevOps
• Course Author
DEV531: Mobile App Security
Essentials
DEV540: Secure DevOps &
Cloud Application Security
DEV544: Secure Coding in .NET
Eric Johnson, CISSP, AWS CD, GSSP, GWAPT
©2018 – Puma Security, LLC
Roadmap
• The DevOps Problem
• Security Unit / Integration Testing
• Static Analysis Options
• Pre-Commit
• Continuous Integration
• Conclusion
©2017 – Puma Security, LLC
Case Study | Travel Industry Breaches
• Airline Company
• 5,000 employees
• 50 .NET C# applications
• 20 software engineers
• 0 application security engineers
• 1 deployment / week
©2017 – Puma Security, LLC
• Continuous Integration via Jenkins
• Continuous Delivery via Jenkins pipeline plugin
Case Study | State of DevOps
©2017 – Puma Security, LLC
• External vendor performing
annual code assessments
• Internal security team receives
1,000 page PDF report
• Internal security team performs
dynamic pen testing, fuzzing,
etc.
Case Study | State of Security
©2017 – Puma Security, LLC
• Security was not invited to the DevOps party
• Internal security team does not have
development background
• Frequent deployments invalidate assessment
results
• Missing a huge opportunity for app sec in the
pipeline
Case Study | The Problem
©2017 – Puma Security, LLC
• Published
October 2016
• Release
frequency up 30x
• Silos still exist
between Sec and
DevOps
HPE | AppSec & DevOps Survey
20%
38%
25%
17%
Security in DevOps
SecDevOps Gated Reviews Network Defenses Nothing
©2017 – Puma Security, LLC
What is SecDevOps
SecDevOps / DevSecOps / DevOpsSec is about
breaking down walls between security and:
• Development
• Operations
• Business
©2017 – Puma Security, LLC
SecDevOps Security Controls
PRE-COMMIT COMMIT ACCEPTANCE DEPLOYMENT
THREAT MODELING
IDE SAST
CODE REVIEWS
SECURITY UNIT TESTS
CI SAST
HIGH RISK CODE
ALERTS
SECURITY ACCEPTANCE
TESTS
CI DAST
AUTOMATED SECURITY
ATTACKS
AUTOMATE
DEPLOYMENT
SECURITY
MONITORING
SECURITY SMOKE
TESTING
SECURITY STORIES
• Security controls in a Continuous Integration
(CI) / Continuous Delivery (CD) pipeline:
SUPPLY CHAIN SCANS MANUAL PEN TESTING VIRTUAL PATCHING
©2017 – Puma Security, LLC
SecDevOps Quick Wins
PRE-COMMIT COMMIT ACCEPTANCE DEPLOYMENT
THREAT MODELING
IDE SAST
CODE REVIEWS
CI SAST
HIGH RISK CODE
ALERTS
CI DAST
AUTOMATED SECURITY
ATTACKS
AUTOMATE
DEPLOYMENT
SECURITY
MONITORING
SECURITY SMOKE
TESTING
• Narrowing the scope and identifying some
quick wins for our case study:
SUPPLY CHAIN SCANS MANUAL PEN TESTING VIRTUAL PATCHING
©2017 – Puma Security, LLC
SECURITY UNIT TESTS
SECURITY ACCEPTANCE
TESTS
SECURITY STORIES
Roadmap
• The DevOps Problem
• Security Unit / Integration Testing
• Static Analysis Options
• Pre-Commit
• Continuous Integration
• Conclusion
©2017 – Puma Security, LLC
Built on top of standard unit and integration tests to
enforce security requirements:
Security Unit / Integration Testing
SECURITY STORIES
UNIT / ACCEPTANCE
TESTING
PRE-COMMIT
COMMIT
©2017 – Puma Security, LLC
• Create abuse cases and evil user
stories
• Focus on high risk code and business
logic flaws
• Fast execution in the IDE / CI pipeline
• Engineers often stay on the "happy path"
• Prove the code works under normal usage
• Example: positive validation testing for a
normal user's name
The Happy Path
©2017 – Puma Security, LLC
[Fact]
public void NameValidationPositiveTest()
{
bool isValid = Validator.IsNameValid("Bobby Tables");
Assert.Equal(isValid, true);
}
1
2
3
4
5
6
• Security works with engineers to write test cases
• Prove the code is secure under abnormal usage
• Example: Negative validation w/ evil injection
characters
Evil Security Stories
©2017 – Puma Security, LLC
[Fact]
public void ValidateNameNegativeTest()
{
string EVIL = "&<>"()|;!=~*/{}#";
foreach (char s in EVIL.ToArray())
Assert.Equal(Validator.IsNameValid(s.ToString()), false);
}
1
2
3
4
5
6
7
Security identifies high risk code performing the
following functionality:
• Authentication
• Access control
• Output encoding
• Input validation
• High risk business logic
• Data entitlement checks
• Handling confidential data
• Cryptography
High Risk Code Examples
©2017 – Puma Security, LLC
• Automated and configurable security unit
testing framework written by @sethlaw
• Payload lists for XSS and Injection
SQLi, NoSQL, LDAP, XML, XPath, OS vulnerabilities
• Supports Java Spring, ASP.NET MVC, and
Django
• https://github.com/sethlaw/sputr
Security Payload Unit Test Repository (SPUTR)
©2017 – Puma Security, LLC
Roadmap
• The DevOps Problem
• Security Unit / Integration Testing
• Static Analysis Options
• Pre-Commit
• Continuous Integration
• Conclusion
©2017 – Puma Security, LLC
Limited opportunity for static analysis in CI & CD
pipelines:
SecDevOps Static Analysis
IDE SAST
CI SAST
PRE-COMMIT
COMMIT
• Speed matters (< 10 minutes)
• High accuracy rules
• Low false positive rates
©2017 – Puma Security, LLC
Free / Open Source .NET Options
• CAT.NET
• FxCop
• Visual Studio Code Analysis
• Web Config Security Analyzer
• Custom Roslyn Analyzers
©2017 – Puma Security, LLC
• Purposely vulnerable eCommerce application
• Contains over 50 different vulnerabilities
• Across two different versions:
• Web Forms
• .NET MVC 5
• Contributors:
• Louis Gardina
• Eric Johnson
The Target
©2017 – Puma Security, LLC
CAT.NET v1.1 Security Benchmark
• Widget Town scan results:
• 2 XSS, 1 Unvalidated Redirect issues
• CAT.NET is a very limited security scanner
©2017 – Puma Security, LLC
FxCop / Code Analysis Security Benchmark
• Rule target results from the “Microsoft
Security Rules” rule set
• Widget Town scan results:
• 2 SQL Injection instances, 1 is a false positive
©2017 – Puma Security, LLC
• Widget Town combined CAT.NET and VS Code
analysis scan results:
Scan Result Summary
Category Valid False Positive
Cross-Site Scripting 2 0
SQL Injection 1 1
Unvalidated Redirect 1 0
©2017 – Puma Security, LLC
• Widget Town combined CAT.NET and VS Code
analysis scan results:
Scan Result Summary
Category Valid False Positive
Cross-Site Scripting 2 0
SQL Injection 1 1
Unvalidated Redirect 1 0
©2017 – Puma Security, LLC
Introducing Roslyn
• Open-source C# and VB compilers with code
analysis APIs
• Capable of producing warnings in source code
as you type:
©2017 – Puma Security, LLC
Roslyn Diagnostic Warnings
• Roslyn diagnostics are also reported during
MSBuild compilation:
©2017 – Puma Security, LLC
Session recorded at OWASP AppSec USA 2016:
• Continuous Integration: Live Code Analysis
using Visual Studio and the Roslyn API
https://youtube.com/watch?v=Y8JKVjY-7T0
• Demonstration analyzers from the
presentation:
https://github.com/ejohn20/puma-scan-demo
Building Security Analyzers 101
©2017 – Puma Security, LLC
• Open source security source code analyzer built using
Roslyn
• 50+ application security-specific rules
• Version 1.0.6 is available via NuGet & VS Marketplace
• Install guide, rule docs, source code:
https://www.pumascan.com
https://github.com/pumasecurity
@puma_scan
Introducing the Puma Scan
©2017 – Puma Security, LLC
• SQLi via an EF Command
Creating a Puma Analyzer
©2017 – Puma Security, LLC
[…]
public void Delete(string id)
{
using (WidgetTownDBEntities context = new WidgetTownDBEntities())
{
string q = string.Format("DELETE FROM Contests WHERE Id = {0}", id);
context.Database.ExecuteSqlCommand(q);
}
}
36
37
38
39
40
41
42
43
44
45
• How can we search for this vulnerability?
• Which interface?
ISyntaxAnalyzer
Implementing the Interface
©2017 – Puma Security, LLC
public interface ISyntaxAnalyzer
{
SyntaxKind SinkKind { get; }
ConcurrentStack<VulnerableSyntaxNode> VulnerableSyntaxNodes { get; }
void GetSinks(SyntaxNodeAnalysisContext context);
}
10
11
12
13
14
15
16
17
19
• Syntax Kind Enum
SimpleAssignmentExpression, MemberAccessExpression,
InvocationExpression, ObjectCreationExpression
TrueKeyword, LiteralTextExpression, PlusToken
Choosing the Syntax Kind
©2017 – Puma Security, LLC
[…]
using (WidgetTownDBEntities context = new WidgetTownDBEntities())
{
string q = string.Format("DELETE FROM Contests WHERE Id = {0}", id);
context.Database.ExecuteSqlCommand(q);
}
23
24
25
26
27
28
29
• Configure the analyzer to only inspect InvocationExpression
types
Choosing the Syntax Kind
©2017 – Puma Security, LLC
[…]
public SyntaxKind SinkKind
{
get { return SyntaxKind.InvocationExpression; }
}
[…]
23
24
25
26
27
28
29
• Tread lightly at first – weed out nodes cheaply
Finding the Sink | Cheap Check
©2017 – Puma Security, LLC
[…]
public void GetSinks(SyntaxNodeAnalysisContext context)
{
var syntax = context.Node as InvocationExpressionSyntax;
if (!syntax.ToString().Contains("ExecuteSqlCommand"))
return;
[…]
36
37
38
39
40
41
42
43
• …then a little more aggressive
Finding the Sink | Symbol Check
©2017 – Puma Security, LLC
[…]
public void GetSinks(SyntaxNodeAnalysisContext context)
{
[…]
var symbol = context.SemanticModel
.GetSymbolInfo(syntax)
.Symbol as IMethodSymbol;
if(!symbol.IsMethod("System.Data.Entity.Database"
,"ExecuteSqlCommand"))
return;
[…]
}
43
44
45
52
53
54
55
56
57
58
62
• Symbol Types
Method symbol
Property symbol
Field symbol
Many more
Finding the Sink | Symbol Type
©2017 – Puma Security, LLC
[…]
var symbol = context.SemanticModel
.GetSymbolInfo(syntax)
.Symbol as IMethodSymbol;
[…]
43
44
45
46
47
• Add the sink to the vulnerable collection
Vulnerable Sink Collection
©2017 – Puma Security, LLC
[…]
public void GetSinks(SyntaxNodeAnalysisContext context)
{
[…]
if (VulnerableSyntaxNodes.All(p =>
p.Sink.GetLocation() != syntax?.GetLocation()))
{
VulnerableSyntaxNodes.Push(new VulnerableSyntaxNode(syntax));
}
}
55
56
57
58
59
60
61
62
63
64
65
66
• Tell Rosyln what diagnostic to report for this
Supported Diagnostic
©2017 – Puma Security, LLC
[SupportedDiagnostic(
DiagnosticId.SEC0108,
DiagnosticSeverity.Warning,
DiagnosticCategory.Security)]
public class EfExecuteSqlCommandInjectionAnalyzer : ISyntaxAnalyzer
{
[…]
}
10
11
12
13
14
15
16
50
51
52
• Add informative diagnostic description
• Diagnostic Analyzers reporting method plays nicely
with localized strings and resource files.
• Uses default Resouces.resx file
Supported Diagnostic Descriptors
©2017 – Puma Security, LLC
• Suite is a logical grouping of analyzer
• Suite base classes handle the registering of analyzers
and reporting of the results
• Examples of groupings
SQL Injection
Cross site scripting
Path tampering
Open redirects
Analyzer Suites
©2017 – Puma Security, LLC
• Add analyzer to the array of analyzers
Adding an Analyzer to the Suite
©2017 – Puma Security, LLC
[DiagnosticAnalyzer(LanguageNames.CSharp, LanguageNames.VisualBasic)]
public class SqlInjectionDiagnosticSuite : BaseSyntaxDiagnosticSuite
{
public SqlInjectionDiagnosticSuite()
{
Analyzers = new ISyntaxAnalyzer[]{
new EfExecuteSqlCommandInjectionAnalyzer(),
new LinqSqlInjectionAnalyzer(),
new SqlCommandInjectionAnalyzer()
}.ToImmutableArray();
}
}
10
11
12
13
14
15
16
17
18
19
21
22
23
24
• Widget Town Puma scan results:
56 valid issues, 10 false positives
Puma Scan Result Summary
Category Valid False Positive
Cross-Site Scripting 19 3
SQL Injection 2 3
Misconfiguration 16 0
Path Tampering 3 0
Unvalidated Redirect 2 4
Cross-Site Request Forgery 8 0
Poor Password Management 3 0
Certificate Validation Disabled 1 0
©2017 – Puma Security, LLC
Roadmap
• The DevOps Problem
• Security Unit / Integration Testing
• Static Analysis Options
• Pre-Commit
• Continuous Integration
• Conclusion
©2017 – Puma Security, LLC
Requirements for static scanning in the IDE.
q Display vulnerabilities inside the IDE
q Provide documentation on how to fix the issue
q Allow engineers to suppress false positives
IDE Static Analysis Checklist
©2017 – Puma Security, LLC
q Display vulnerabilities inside the IDE
IDE Static Analysis Checklist
©2017 – Puma Security, LLC
q Provide documentation on how to fix the issue
IDE Static Analysis Checklist
©2017 – Puma Security, LLC
q Allow engineers to suppress false positives
IDE Static Analysis Checklist
©2017 – Puma Security, LLC
Roadmap
• The DevOps Problem
• Security Unit / Integration Testing
• Static Analysis Options
• Pre-Commit
• Continuous Integration
• Conclusion
©2017 – Puma Security, LLC
Requirements for static scanning in the CI pipeline:
q Pipeline executes accurate static analysis rules
q Process and capture results in pipeline
q Configure build thresholds to mark builds as
unhealthy or failed
q Notify security when issues are suppressed by
engineers
CI Static Analysis Checklist
©2017 – Puma Security, LLC
q Pipeline executes accurate static analysis rules
CI Static Analysis Checklist
©2017 – Puma Security, LLC
q Process and capture results in pipeline
CI Static Analysis Checklist
©2017 – Puma Security, LLC
q Configure build thresholds to mark builds as
unhealthy or failed
CI Static Analysis Checklist
©2017 – Puma Security, LLC
Roadmap
• The DevOps Problem
• Security Unit / Integration Testing
• Static Analysis Options
• Pre-Commit
• Continuous Integration
• Conclusion
©2017 – Puma Security, LLC
• Welcoming contributions!
• Gather feedback and address edge cases
• Continue to build out additional rule categories:
Cleartext secrets, insecure XML processing, etc.
• Further refine results using data flow analysis to
eliminate false positives
• Identify rules that can apply suggested code fixes
Puma Scan | Future Enhancements
©2017 – Puma Security, LLC
• Scott Sauber - Puma Security Engineer
• James Kashevos – CDD Security Engineer
• Josh Brown-White - Microsoft
• Tom Meschter – Microsoft
• Manish Vasani – Microsoft
• Gitter Rosyln Channel
Acknowledgements
©2017 – Puma Security, LLC
Questions?
Contact Us:
eric.johnson@pumascan.com
@emjohn20
eric.mead@pumascan.com
@ericmmead
©2017 – Puma Security, LLC

More Related Content

What's hot

DevSecOps: Key Controls for Modern Security Success
DevSecOps: Key Controls for Modern Security SuccessDevSecOps: Key Controls for Modern Security Success
DevSecOps: Key Controls for Modern Security SuccessPuma Security, LLC
 
DevSecOps: Key Controls to Modern Security Success
DevSecOps: Key Controls to Modern Security SuccessDevSecOps: Key Controls to Modern Security Success
DevSecOps: Key Controls to Modern Security SuccessPuma Security, LLC
 
CI/CD Pipeline Security: Advanced Continuous Delivery Recommendations
CI/CD Pipeline Security: Advanced Continuous Delivery RecommendationsCI/CD Pipeline Security: Advanced Continuous Delivery Recommendations
CI/CD Pipeline Security: Advanced Continuous Delivery RecommendationsAmazon Web Services
 
Are You Ready for a Cloud Pentest?
Are You Ready for a Cloud Pentest?Are You Ready for a Cloud Pentest?
Are You Ready for a Cloud Pentest?Teri Radichel
 
Security Patterns for Microservice Architectures - SpringOne 2020
Security Patterns for Microservice Architectures - SpringOne 2020Security Patterns for Microservice Architectures - SpringOne 2020
Security Patterns for Microservice Architectures - SpringOne 2020Matt Raible
 
Maturing your organization from DevOps to DevSecOps
Maturing your organization from DevOps to DevSecOpsMaturing your organization from DevOps to DevSecOps
Maturing your organization from DevOps to DevSecOpsAmazon Web Services
 
Encode x NEAR: Technical Overview of NEAR 1
Encode x NEAR: Technical Overview of NEAR 1Encode x NEAR: Technical Overview of NEAR 1
Encode x NEAR: Technical Overview of NEAR 1KlaraOrban
 
Third Party Performance (Velocity, 2014)
Third Party Performance (Velocity, 2014)Third Party Performance (Velocity, 2014)
Third Party Performance (Velocity, 2014)Guy Podjarny
 
Containerizing your Security Operations Center
Containerizing your Security Operations CenterContainerizing your Security Operations Center
Containerizing your Security Operations CenterJimmy Mesta
 
Cloud security : Automate or die
Cloud security : Automate or dieCloud security : Automate or die
Cloud security : Automate or diePriyanka Aash
 
Hacking IoT with EXPLIoT Framework
Hacking IoT with EXPLIoT FrameworkHacking IoT with EXPLIoT Framework
Hacking IoT with EXPLIoT FrameworkPriyanka Aash
 
Introduction to DevSecOps
Introduction to DevSecOpsIntroduction to DevSecOps
Introduction to DevSecOpsSetu Parimi
 
Securing your EmberJS Application
Securing your EmberJS ApplicationSecuring your EmberJS Application
Securing your EmberJS ApplicationPhilippe De Ryck
 
Integrating security testing into your container build pipeline - SDD308 - AW...
Integrating security testing into your container build pipeline - SDD308 - AW...Integrating security testing into your container build pipeline - SDD308 - AW...
Integrating security testing into your container build pipeline - SDD308 - AW...Amazon Web Services
 
Serverless Security: What's Left To Protect
Serverless Security: What's Left To ProtectServerless Security: What's Left To Protect
Serverless Security: What's Left To ProtectGuy Podjarny
 
Automating your AWS Security Operations
Automating your AWS Security OperationsAutomating your AWS Security Operations
Automating your AWS Security OperationsEvident.io
 
Red Team vs. Blue Team on AWS ~ re:Invent 2018
Red Team vs. Blue Team on AWS ~ re:Invent 2018Red Team vs. Blue Team on AWS ~ re:Invent 2018
Red Team vs. Blue Team on AWS ~ re:Invent 2018Teri Radichel
 
Cloud Security at Netflix
Cloud Security at NetflixCloud Security at Netflix
Cloud Security at NetflixJason Chan
 

What's hot (20)

DevSecOps: Key Controls for Modern Security Success
DevSecOps: Key Controls for Modern Security SuccessDevSecOps: Key Controls for Modern Security Success
DevSecOps: Key Controls for Modern Security Success
 
DevSecOps: Key Controls to Modern Security Success
DevSecOps: Key Controls to Modern Security SuccessDevSecOps: Key Controls to Modern Security Success
DevSecOps: Key Controls to Modern Security Success
 
Become a Cloud Security Ninja
Become a Cloud Security NinjaBecome a Cloud Security Ninja
Become a Cloud Security Ninja
 
CI/CD Pipeline Security: Advanced Continuous Delivery Recommendations
CI/CD Pipeline Security: Advanced Continuous Delivery RecommendationsCI/CD Pipeline Security: Advanced Continuous Delivery Recommendations
CI/CD Pipeline Security: Advanced Continuous Delivery Recommendations
 
Are You Ready for a Cloud Pentest?
Are You Ready for a Cloud Pentest?Are You Ready for a Cloud Pentest?
Are You Ready for a Cloud Pentest?
 
Security Patterns for Microservice Architectures - SpringOne 2020
Security Patterns for Microservice Architectures - SpringOne 2020Security Patterns for Microservice Architectures - SpringOne 2020
Security Patterns for Microservice Architectures - SpringOne 2020
 
Maturing your organization from DevOps to DevSecOps
Maturing your organization from DevOps to DevSecOpsMaturing your organization from DevOps to DevSecOps
Maturing your organization from DevOps to DevSecOps
 
Encode x NEAR: Technical Overview of NEAR 1
Encode x NEAR: Technical Overview of NEAR 1Encode x NEAR: Technical Overview of NEAR 1
Encode x NEAR: Technical Overview of NEAR 1
 
Third Party Performance (Velocity, 2014)
Third Party Performance (Velocity, 2014)Third Party Performance (Velocity, 2014)
Third Party Performance (Velocity, 2014)
 
Hybrid Cloud Networking
Hybrid Cloud NetworkingHybrid Cloud Networking
Hybrid Cloud Networking
 
Containerizing your Security Operations Center
Containerizing your Security Operations CenterContainerizing your Security Operations Center
Containerizing your Security Operations Center
 
Cloud security : Automate or die
Cloud security : Automate or dieCloud security : Automate or die
Cloud security : Automate or die
 
Hacking IoT with EXPLIoT Framework
Hacking IoT with EXPLIoT FrameworkHacking IoT with EXPLIoT Framework
Hacking IoT with EXPLIoT Framework
 
Introduction to DevSecOps
Introduction to DevSecOpsIntroduction to DevSecOps
Introduction to DevSecOps
 
Securing your EmberJS Application
Securing your EmberJS ApplicationSecuring your EmberJS Application
Securing your EmberJS Application
 
Integrating security testing into your container build pipeline - SDD308 - AW...
Integrating security testing into your container build pipeline - SDD308 - AW...Integrating security testing into your container build pipeline - SDD308 - AW...
Integrating security testing into your container build pipeline - SDD308 - AW...
 
Serverless Security: What's Left To Protect
Serverless Security: What's Left To ProtectServerless Security: What's Left To Protect
Serverless Security: What's Left To Protect
 
Automating your AWS Security Operations
Automating your AWS Security OperationsAutomating your AWS Security Operations
Automating your AWS Security Operations
 
Red Team vs. Blue Team on AWS ~ re:Invent 2018
Red Team vs. Blue Team on AWS ~ re:Invent 2018Red Team vs. Blue Team on AWS ~ re:Invent 2018
Red Team vs. Blue Team on AWS ~ re:Invent 2018
 
Cloud Security at Netflix
Cloud Security at NetflixCloud Security at Netflix
Cloud Security at Netflix
 

Similar to Secure DevOps: A Puma's Tail

Take Control: Design a Complete DevSecOps Program
Take Control: Design a Complete DevSecOps ProgramTake Control: Design a Complete DevSecOps Program
Take Control: Design a Complete DevSecOps ProgramDeborah Schalm
 
Take Control: Design a Complete DevSecOps Program
Take Control: Design a Complete DevSecOps Program Take Control: Design a Complete DevSecOps Program
Take Control: Design a Complete DevSecOps Program DevOps.com
 
A Discussion of Automated Infrastructure Security with a Practical Example
A Discussion of Automated Infrastructure Security with a Practical ExampleA Discussion of Automated Infrastructure Security with a Practical Example
A Discussion of Automated Infrastructure Security with a Practical ExampleDeborah Schalm
 
A Discussion of Automated Infrastructure Security with a Practical Example
A Discussion of Automated Infrastructure Security with a Practical Example A Discussion of Automated Infrastructure Security with a Practical Example
A Discussion of Automated Infrastructure Security with a Practical Example DevOps.com
 
Modern Web 2019 從零開始加入自動化資安測試
Modern Web 2019 從零開始加入自動化資安測試Modern Web 2019 從零開始加入自動化資安測試
Modern Web 2019 從零開始加入自動化資安測試Secview
 
Justin Fox_NuData Security_A Master_Card_Company_June 9 2017_presentation
Justin Fox_NuData Security_A Master_Card_Company_June 9 2017_presentationJustin Fox_NuData Security_A Master_Card_Company_June 9 2017_presentation
Justin Fox_NuData Security_A Master_Card_Company_June 9 2017_presentationTriNimbus
 
Making DevSecOps a Reality in your Spring Applications
Making DevSecOps a Reality in your Spring ApplicationsMaking DevSecOps a Reality in your Spring Applications
Making DevSecOps a Reality in your Spring ApplicationsHdiv Security
 
Continuous Security Testing with Devops - OWASP EU 2014
Continuous Security Testing  with Devops - OWASP EU 2014Continuous Security Testing  with Devops - OWASP EU 2014
Continuous Security Testing with Devops - OWASP EU 2014Stephen de Vries
 
Overcoming Security Challenges in DevOps
Overcoming Security Challenges in DevOpsOvercoming Security Challenges in DevOps
Overcoming Security Challenges in DevOpsAlert Logic
 
Moving from the Shadows to the Throne - SID310 - re:Invent 2017
Moving from the Shadows to the Throne - SID310 - re:Invent 2017Moving from the Shadows to the Throne - SID310 - re:Invent 2017
Moving from the Shadows to the Throne - SID310 - re:Invent 2017Amazon Web Services
 
Security Process in DevSecOps
Security Process in DevSecOpsSecurity Process in DevSecOps
Security Process in DevSecOpsOpsta
 
Azure 101: Shared responsibility in the Azure Cloud
Azure 101: Shared responsibility in the Azure CloudAzure 101: Shared responsibility in the Azure Cloud
Azure 101: Shared responsibility in the Azure CloudPaulo Renato
 
ABN AMRO DevSecOps Journey
ABN AMRO DevSecOps JourneyABN AMRO DevSecOps Journey
ABN AMRO DevSecOps JourneyDerek E. Weeks
 
How to Get Started with DevSecOps
How to Get Started with DevSecOpsHow to Get Started with DevSecOps
How to Get Started with DevSecOpsCYBRIC
 
Cncf checkov and bridgecrew
Cncf checkov and bridgecrewCncf checkov and bridgecrew
Cncf checkov and bridgecrewLibbySchulze
 
(SEC310) Keeping Developers and Auditors Happy in the Cloud
(SEC310) Keeping Developers and Auditors Happy in the Cloud(SEC310) Keeping Developers and Auditors Happy in the Cloud
(SEC310) Keeping Developers and Auditors Happy in the CloudAmazon Web Services
 
Digitální transformace: zabezpečení agilních prostředí
Digitální transformace: zabezpečení agilních prostředíDigitální transformace: zabezpečení agilních prostředí
Digitální transformace: zabezpečení agilních prostředíMarketingArrowECS_CZ
 
Problems with parameters b sides-msp
Problems with parameters b sides-mspProblems with parameters b sides-msp
Problems with parameters b sides-mspMike Saunders
 

Similar to Secure DevOps: A Puma's Tail (20)

Take Control: Design a Complete DevSecOps Program
Take Control: Design a Complete DevSecOps ProgramTake Control: Design a Complete DevSecOps Program
Take Control: Design a Complete DevSecOps Program
 
Take Control: Design a Complete DevSecOps Program
Take Control: Design a Complete DevSecOps Program Take Control: Design a Complete DevSecOps Program
Take Control: Design a Complete DevSecOps Program
 
A Discussion of Automated Infrastructure Security with a Practical Example
A Discussion of Automated Infrastructure Security with a Practical ExampleA Discussion of Automated Infrastructure Security with a Practical Example
A Discussion of Automated Infrastructure Security with a Practical Example
 
A Discussion of Automated Infrastructure Security with a Practical Example
A Discussion of Automated Infrastructure Security with a Practical Example A Discussion of Automated Infrastructure Security with a Practical Example
A Discussion of Automated Infrastructure Security with a Practical Example
 
Modern Web 2019 從零開始加入自動化資安測試
Modern Web 2019 從零開始加入自動化資安測試Modern Web 2019 從零開始加入自動化資安測試
Modern Web 2019 從零開始加入自動化資安測試
 
Justin Fox_NuData Security_A Master_Card_Company_June 9 2017_presentation
Justin Fox_NuData Security_A Master_Card_Company_June 9 2017_presentationJustin Fox_NuData Security_A Master_Card_Company_June 9 2017_presentation
Justin Fox_NuData Security_A Master_Card_Company_June 9 2017_presentation
 
Making DevSecOps a Reality in your Spring Applications
Making DevSecOps a Reality in your Spring ApplicationsMaking DevSecOps a Reality in your Spring Applications
Making DevSecOps a Reality in your Spring Applications
 
Continuous Security Testing with Devops - OWASP EU 2014
Continuous Security Testing  with Devops - OWASP EU 2014Continuous Security Testing  with Devops - OWASP EU 2014
Continuous Security Testing with Devops - OWASP EU 2014
 
Overcoming Security Challenges in DevOps
Overcoming Security Challenges in DevOpsOvercoming Security Challenges in DevOps
Overcoming Security Challenges in DevOps
 
Moving from the Shadows to the Throne - SID310 - re:Invent 2017
Moving from the Shadows to the Throne - SID310 - re:Invent 2017Moving from the Shadows to the Throne - SID310 - re:Invent 2017
Moving from the Shadows to the Throne - SID310 - re:Invent 2017
 
Security Process in DevSecOps
Security Process in DevSecOpsSecurity Process in DevSecOps
Security Process in DevSecOps
 
Azure 101: Shared responsibility in the Azure Cloud
Azure 101: Shared responsibility in the Azure CloudAzure 101: Shared responsibility in the Azure Cloud
Azure 101: Shared responsibility in the Azure Cloud
 
ABN AMRO DevSecOps Journey
ABN AMRO DevSecOps JourneyABN AMRO DevSecOps Journey
ABN AMRO DevSecOps Journey
 
How to Get Started with DevSecOps
How to Get Started with DevSecOpsHow to Get Started with DevSecOps
How to Get Started with DevSecOps
 
Cncf checkov and bridgecrew
Cncf checkov and bridgecrewCncf checkov and bridgecrew
Cncf checkov and bridgecrew
 
(SEC310) Keeping Developers and Auditors Happy in the Cloud
(SEC310) Keeping Developers and Auditors Happy in the Cloud(SEC310) Keeping Developers and Auditors Happy in the Cloud
(SEC310) Keeping Developers and Auditors Happy in the Cloud
 
Digitální transformace: zabezpečení agilních prostředí
Digitální transformace: zabezpečení agilních prostředíDigitální transformace: zabezpečení agilních prostředí
Digitální transformace: zabezpečení agilních prostředí
 
Problems with parameters b sides-msp
Problems with parameters b sides-mspProblems with parameters b sides-msp
Problems with parameters b sides-msp
 
Agile and Secure SDLC
Agile and Secure SDLCAgile and Secure SDLC
Agile and Secure SDLC
 
Webinar – Risk-based adaptive DevSecOps
Webinar – Risk-based adaptive DevSecOps Webinar – Risk-based adaptive DevSecOps
Webinar – Risk-based adaptive DevSecOps
 

Recently uploaded

Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
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.pdfWave PLM
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsMehedi Hasan Shohan
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
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.pdfkalichargn70th171
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyFrank van der Linden
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 

Recently uploaded (20)

Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
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
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software Solutions
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
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
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The Ugly
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 

Secure DevOps: A Puma's Tail

  • 1. Secure DevOps: A Puma’s Tail SANS Secure DevOps Summit Tuesday, October 10th 2017 Eric Johnson (@emjohn20)
  • 2. Puma Security • Principal Security Engineer • Modern static code analysis • DevSecOps automation • Secure Development Lifecycle SANS Institute • Certified Instructor DEV541: Secure Coding in Java DEV534: Secure DevOps • Course Author DEV531: Mobile App Security Essentials DEV540: Secure DevOps & Cloud Application Security DEV544: Secure Coding in .NET Eric Johnson, CISSP, AWS CD, GSSP, GWAPT ©2018 – Puma Security, LLC
  • 3. Roadmap • The DevOps Problem • Security Unit / Integration Testing • Static Analysis Options • Pre-Commit • Continuous Integration • Conclusion ©2017 – Puma Security, LLC
  • 4. Case Study | Travel Industry Breaches • Airline Company • 5,000 employees • 50 .NET C# applications • 20 software engineers • 0 application security engineers • 1 deployment / week ©2017 – Puma Security, LLC
  • 5. • Continuous Integration via Jenkins • Continuous Delivery via Jenkins pipeline plugin Case Study | State of DevOps ©2017 – Puma Security, LLC
  • 6. • External vendor performing annual code assessments • Internal security team receives 1,000 page PDF report • Internal security team performs dynamic pen testing, fuzzing, etc. Case Study | State of Security ©2017 – Puma Security, LLC
  • 7. • Security was not invited to the DevOps party • Internal security team does not have development background • Frequent deployments invalidate assessment results • Missing a huge opportunity for app sec in the pipeline Case Study | The Problem ©2017 – Puma Security, LLC
  • 8. • Published October 2016 • Release frequency up 30x • Silos still exist between Sec and DevOps HPE | AppSec & DevOps Survey 20% 38% 25% 17% Security in DevOps SecDevOps Gated Reviews Network Defenses Nothing ©2017 – Puma Security, LLC
  • 9. What is SecDevOps SecDevOps / DevSecOps / DevOpsSec is about breaking down walls between security and: • Development • Operations • Business ©2017 – Puma Security, LLC
  • 10. SecDevOps Security Controls PRE-COMMIT COMMIT ACCEPTANCE DEPLOYMENT THREAT MODELING IDE SAST CODE REVIEWS SECURITY UNIT TESTS CI SAST HIGH RISK CODE ALERTS SECURITY ACCEPTANCE TESTS CI DAST AUTOMATED SECURITY ATTACKS AUTOMATE DEPLOYMENT SECURITY MONITORING SECURITY SMOKE TESTING SECURITY STORIES • Security controls in a Continuous Integration (CI) / Continuous Delivery (CD) pipeline: SUPPLY CHAIN SCANS MANUAL PEN TESTING VIRTUAL PATCHING ©2017 – Puma Security, LLC
  • 11. SecDevOps Quick Wins PRE-COMMIT COMMIT ACCEPTANCE DEPLOYMENT THREAT MODELING IDE SAST CODE REVIEWS CI SAST HIGH RISK CODE ALERTS CI DAST AUTOMATED SECURITY ATTACKS AUTOMATE DEPLOYMENT SECURITY MONITORING SECURITY SMOKE TESTING • Narrowing the scope and identifying some quick wins for our case study: SUPPLY CHAIN SCANS MANUAL PEN TESTING VIRTUAL PATCHING ©2017 – Puma Security, LLC SECURITY UNIT TESTS SECURITY ACCEPTANCE TESTS SECURITY STORIES
  • 12. Roadmap • The DevOps Problem • Security Unit / Integration Testing • Static Analysis Options • Pre-Commit • Continuous Integration • Conclusion ©2017 – Puma Security, LLC
  • 13. Built on top of standard unit and integration tests to enforce security requirements: Security Unit / Integration Testing SECURITY STORIES UNIT / ACCEPTANCE TESTING PRE-COMMIT COMMIT ©2017 – Puma Security, LLC • Create abuse cases and evil user stories • Focus on high risk code and business logic flaws • Fast execution in the IDE / CI pipeline
  • 14. • Engineers often stay on the "happy path" • Prove the code works under normal usage • Example: positive validation testing for a normal user's name The Happy Path ©2017 – Puma Security, LLC [Fact] public void NameValidationPositiveTest() { bool isValid = Validator.IsNameValid("Bobby Tables"); Assert.Equal(isValid, true); } 1 2 3 4 5 6
  • 15. • Security works with engineers to write test cases • Prove the code is secure under abnormal usage • Example: Negative validation w/ evil injection characters Evil Security Stories ©2017 – Puma Security, LLC [Fact] public void ValidateNameNegativeTest() { string EVIL = "&<>"()|;!=~*/{}#"; foreach (char s in EVIL.ToArray()) Assert.Equal(Validator.IsNameValid(s.ToString()), false); } 1 2 3 4 5 6 7
  • 16. Security identifies high risk code performing the following functionality: • Authentication • Access control • Output encoding • Input validation • High risk business logic • Data entitlement checks • Handling confidential data • Cryptography High Risk Code Examples ©2017 – Puma Security, LLC
  • 17. • Automated and configurable security unit testing framework written by @sethlaw • Payload lists for XSS and Injection SQLi, NoSQL, LDAP, XML, XPath, OS vulnerabilities • Supports Java Spring, ASP.NET MVC, and Django • https://github.com/sethlaw/sputr Security Payload Unit Test Repository (SPUTR) ©2017 – Puma Security, LLC
  • 18. Roadmap • The DevOps Problem • Security Unit / Integration Testing • Static Analysis Options • Pre-Commit • Continuous Integration • Conclusion ©2017 – Puma Security, LLC
  • 19. Limited opportunity for static analysis in CI & CD pipelines: SecDevOps Static Analysis IDE SAST CI SAST PRE-COMMIT COMMIT • Speed matters (< 10 minutes) • High accuracy rules • Low false positive rates ©2017 – Puma Security, LLC
  • 20. Free / Open Source .NET Options • CAT.NET • FxCop • Visual Studio Code Analysis • Web Config Security Analyzer • Custom Roslyn Analyzers ©2017 – Puma Security, LLC
  • 21. • Purposely vulnerable eCommerce application • Contains over 50 different vulnerabilities • Across two different versions: • Web Forms • .NET MVC 5 • Contributors: • Louis Gardina • Eric Johnson The Target ©2017 – Puma Security, LLC
  • 22. CAT.NET v1.1 Security Benchmark • Widget Town scan results: • 2 XSS, 1 Unvalidated Redirect issues • CAT.NET is a very limited security scanner ©2017 – Puma Security, LLC
  • 23. FxCop / Code Analysis Security Benchmark • Rule target results from the “Microsoft Security Rules” rule set • Widget Town scan results: • 2 SQL Injection instances, 1 is a false positive ©2017 – Puma Security, LLC
  • 24. • Widget Town combined CAT.NET and VS Code analysis scan results: Scan Result Summary Category Valid False Positive Cross-Site Scripting 2 0 SQL Injection 1 1 Unvalidated Redirect 1 0 ©2017 – Puma Security, LLC
  • 25. • Widget Town combined CAT.NET and VS Code analysis scan results: Scan Result Summary Category Valid False Positive Cross-Site Scripting 2 0 SQL Injection 1 1 Unvalidated Redirect 1 0 ©2017 – Puma Security, LLC
  • 26. Introducing Roslyn • Open-source C# and VB compilers with code analysis APIs • Capable of producing warnings in source code as you type: ©2017 – Puma Security, LLC
  • 27. Roslyn Diagnostic Warnings • Roslyn diagnostics are also reported during MSBuild compilation: ©2017 – Puma Security, LLC
  • 28. Session recorded at OWASP AppSec USA 2016: • Continuous Integration: Live Code Analysis using Visual Studio and the Roslyn API https://youtube.com/watch?v=Y8JKVjY-7T0 • Demonstration analyzers from the presentation: https://github.com/ejohn20/puma-scan-demo Building Security Analyzers 101 ©2017 – Puma Security, LLC
  • 29. • Open source security source code analyzer built using Roslyn • 50+ application security-specific rules • Version 1.0.6 is available via NuGet & VS Marketplace • Install guide, rule docs, source code: https://www.pumascan.com https://github.com/pumasecurity @puma_scan Introducing the Puma Scan ©2017 – Puma Security, LLC
  • 30. • SQLi via an EF Command Creating a Puma Analyzer ©2017 – Puma Security, LLC […] public void Delete(string id) { using (WidgetTownDBEntities context = new WidgetTownDBEntities()) { string q = string.Format("DELETE FROM Contests WHERE Id = {0}", id); context.Database.ExecuteSqlCommand(q); } } 36 37 38 39 40 41 42 43 44 45
  • 31. • How can we search for this vulnerability? • Which interface? ISyntaxAnalyzer Implementing the Interface ©2017 – Puma Security, LLC public interface ISyntaxAnalyzer { SyntaxKind SinkKind { get; } ConcurrentStack<VulnerableSyntaxNode> VulnerableSyntaxNodes { get; } void GetSinks(SyntaxNodeAnalysisContext context); } 10 11 12 13 14 15 16 17 19
  • 32. • Syntax Kind Enum SimpleAssignmentExpression, MemberAccessExpression, InvocationExpression, ObjectCreationExpression TrueKeyword, LiteralTextExpression, PlusToken Choosing the Syntax Kind ©2017 – Puma Security, LLC […] using (WidgetTownDBEntities context = new WidgetTownDBEntities()) { string q = string.Format("DELETE FROM Contests WHERE Id = {0}", id); context.Database.ExecuteSqlCommand(q); } 23 24 25 26 27 28 29
  • 33. • Configure the analyzer to only inspect InvocationExpression types Choosing the Syntax Kind ©2017 – Puma Security, LLC […] public SyntaxKind SinkKind { get { return SyntaxKind.InvocationExpression; } } […] 23 24 25 26 27 28 29
  • 34. • Tread lightly at first – weed out nodes cheaply Finding the Sink | Cheap Check ©2017 – Puma Security, LLC […] public void GetSinks(SyntaxNodeAnalysisContext context) { var syntax = context.Node as InvocationExpressionSyntax; if (!syntax.ToString().Contains("ExecuteSqlCommand")) return; […] 36 37 38 39 40 41 42 43
  • 35. • …then a little more aggressive Finding the Sink | Symbol Check ©2017 – Puma Security, LLC […] public void GetSinks(SyntaxNodeAnalysisContext context) { […] var symbol = context.SemanticModel .GetSymbolInfo(syntax) .Symbol as IMethodSymbol; if(!symbol.IsMethod("System.Data.Entity.Database" ,"ExecuteSqlCommand")) return; […] } 43 44 45 52 53 54 55 56 57 58 62
  • 36. • Symbol Types Method symbol Property symbol Field symbol Many more Finding the Sink | Symbol Type ©2017 – Puma Security, LLC […] var symbol = context.SemanticModel .GetSymbolInfo(syntax) .Symbol as IMethodSymbol; […] 43 44 45 46 47
  • 37. • Add the sink to the vulnerable collection Vulnerable Sink Collection ©2017 – Puma Security, LLC […] public void GetSinks(SyntaxNodeAnalysisContext context) { […] if (VulnerableSyntaxNodes.All(p => p.Sink.GetLocation() != syntax?.GetLocation())) { VulnerableSyntaxNodes.Push(new VulnerableSyntaxNode(syntax)); } } 55 56 57 58 59 60 61 62 63 64 65 66
  • 38. • Tell Rosyln what diagnostic to report for this Supported Diagnostic ©2017 – Puma Security, LLC [SupportedDiagnostic( DiagnosticId.SEC0108, DiagnosticSeverity.Warning, DiagnosticCategory.Security)] public class EfExecuteSqlCommandInjectionAnalyzer : ISyntaxAnalyzer { […] } 10 11 12 13 14 15 16 50 51 52
  • 39. • Add informative diagnostic description • Diagnostic Analyzers reporting method plays nicely with localized strings and resource files. • Uses default Resouces.resx file Supported Diagnostic Descriptors ©2017 – Puma Security, LLC
  • 40. • Suite is a logical grouping of analyzer • Suite base classes handle the registering of analyzers and reporting of the results • Examples of groupings SQL Injection Cross site scripting Path tampering Open redirects Analyzer Suites ©2017 – Puma Security, LLC
  • 41. • Add analyzer to the array of analyzers Adding an Analyzer to the Suite ©2017 – Puma Security, LLC [DiagnosticAnalyzer(LanguageNames.CSharp, LanguageNames.VisualBasic)] public class SqlInjectionDiagnosticSuite : BaseSyntaxDiagnosticSuite { public SqlInjectionDiagnosticSuite() { Analyzers = new ISyntaxAnalyzer[]{ new EfExecuteSqlCommandInjectionAnalyzer(), new LinqSqlInjectionAnalyzer(), new SqlCommandInjectionAnalyzer() }.ToImmutableArray(); } } 10 11 12 13 14 15 16 17 18 19 21 22 23 24
  • 42. • Widget Town Puma scan results: 56 valid issues, 10 false positives Puma Scan Result Summary Category Valid False Positive Cross-Site Scripting 19 3 SQL Injection 2 3 Misconfiguration 16 0 Path Tampering 3 0 Unvalidated Redirect 2 4 Cross-Site Request Forgery 8 0 Poor Password Management 3 0 Certificate Validation Disabled 1 0 ©2017 – Puma Security, LLC
  • 43. Roadmap • The DevOps Problem • Security Unit / Integration Testing • Static Analysis Options • Pre-Commit • Continuous Integration • Conclusion ©2017 – Puma Security, LLC
  • 44. Requirements for static scanning in the IDE. q Display vulnerabilities inside the IDE q Provide documentation on how to fix the issue q Allow engineers to suppress false positives IDE Static Analysis Checklist ©2017 – Puma Security, LLC
  • 45. q Display vulnerabilities inside the IDE IDE Static Analysis Checklist ©2017 – Puma Security, LLC
  • 46. q Provide documentation on how to fix the issue IDE Static Analysis Checklist ©2017 – Puma Security, LLC
  • 47. q Allow engineers to suppress false positives IDE Static Analysis Checklist ©2017 – Puma Security, LLC
  • 48. Roadmap • The DevOps Problem • Security Unit / Integration Testing • Static Analysis Options • Pre-Commit • Continuous Integration • Conclusion ©2017 – Puma Security, LLC
  • 49. Requirements for static scanning in the CI pipeline: q Pipeline executes accurate static analysis rules q Process and capture results in pipeline q Configure build thresholds to mark builds as unhealthy or failed q Notify security when issues are suppressed by engineers CI Static Analysis Checklist ©2017 – Puma Security, LLC
  • 50. q Pipeline executes accurate static analysis rules CI Static Analysis Checklist ©2017 – Puma Security, LLC
  • 51. q Process and capture results in pipeline CI Static Analysis Checklist ©2017 – Puma Security, LLC
  • 52. q Configure build thresholds to mark builds as unhealthy or failed CI Static Analysis Checklist ©2017 – Puma Security, LLC
  • 53. Roadmap • The DevOps Problem • Security Unit / Integration Testing • Static Analysis Options • Pre-Commit • Continuous Integration • Conclusion ©2017 – Puma Security, LLC
  • 54. • Welcoming contributions! • Gather feedback and address edge cases • Continue to build out additional rule categories: Cleartext secrets, insecure XML processing, etc. • Further refine results using data flow analysis to eliminate false positives • Identify rules that can apply suggested code fixes Puma Scan | Future Enhancements ©2017 – Puma Security, LLC
  • 55. • Scott Sauber - Puma Security Engineer • James Kashevos – CDD Security Engineer • Josh Brown-White - Microsoft • Tom Meschter – Microsoft • Manish Vasani – Microsoft • Gitter Rosyln Channel Acknowledgements ©2017 – Puma Security, LLC