SlideShare a Scribd company logo
Continuous Delivery Security Assurance
Vs.
By : Abdessamad TEMMAR
About me
• Abdessamad TEMMAR
• Application Security Engineer (Siris Advisory)
• Ex – full time Pentester
• OWASP Contributor
What this talk is all about ?
DevOps Teams Automated attacks
Appsec team
Appsec Toolbelt
• SCA : Dependencies Analysis
• DAST (Dynamic) : Scans interface of running application
• SAST (Static) : Scans source code / binaries
• IAST (Interactive) : Detection at runtime
• SCA : Dependencies Analysis
• DAST (Dynamic) : Scans interface of running application
• SAST (Static) : Scans source code / binaries
• IAST (Interactive) : Detection at runtime
What is static analysis ?
Source/Byte Code
Analysis Findings
Scanning rules (SQLi, XSS, etc)
Why static analysis ?
• Easy to automate/integarte
• Run anytime
• Fast
• Points directly to suspect code
Which SAST tool ?
Hunting Bugs To Extinction with Static Analysis
The problem :
• An unsecure usage of an external API : download_file
• We want to identify the same issue for the hole application, and
avoid it for future changes.
download_file(file_id = id, search_type = "file_id")
download_file(file_id = id, search_type = "path")
Sec4dev 2021  - Catch Me If You can : Continuous Delivery vs. Security Assurance
Hunting Bugs To Extinction with Static Analysis
The solution :
Changed files
File 1 File 2
PR
Success criteria
Accuracy Speed Easy
$ more scan_changed_files.sh
git checkout $@ --quiet
files=$(git diff --name-status master HEAD | grep -E "^(A|M)" | cut -f 2)
grep "download_file(.*, search_type = "path")" $files
Hunting Bugs To Extinction with Static Analysis
Option 1 : grep for the rescue
$ git diff --name-status
A README.md
M lib/blah.py
D test/new_stuff.yml
Hunting Bugs To Extinction with Static Analysis
Option 1 : grep for the rescue
• False Positives
# Remember not to use download_file(file_id, search_type = "path") !
...
def download_file(file_id, search_type = "path"):
...
Hunting Bugs To Extinction with Static Analysis
Option 1 : grep for the rescue
• Pro :
• Easy to use
• Easy to understand
• Intercative
• Cons :
• Line-oriented
• Mismatch with program structure (trees, ASTs)
Hunting Bugs To Extinction with Static Analysis
String Tree
Hunting Bugs To Extinction with Static Analysis
Option 2 : AST
Source/Byte Code Intermediate reprensentations Analysis
Abstract Syntax Tree
Parse into AST
Hunting Bugs To Extinction with Static Analysis
Option 2 : AST based
Program Text
Output
compiled code
optimize
Convert to
intermediate
form
Semantic
Analysis
Lexical
Analysis
Analyze !
Output finding
report
Compilation
AST Analysis
Rule 1 : XSS
Rule 2 : SQLi
Hunting Bugs To Extinction with Static Analysis
Option 2 : AST
Hunting Bugs To Extinction with Static Analysis
Option 2 : bandit module
import bandit
from bandit.core import test_properties as test
@test.checks('Call')
@test.test_id('B001')
def unsafe_get_userinfo(context):
if (context.call_function_name_qual == 'download_file' and context.call_args[1] == 'path'):
return bandit.Issue(
severity=bandit.HIGH,
confidence=bandit.HIGH,
text="Unsafe usage of download_file."
)
Hunting Bugs To Extinction with Static Analysis
Option 2 : AST
• Pros :
• Robust analysis
• Cons :
• Learning curve
• Where data originated from ?
Hunting Bugs To Extinction with Static Analysis
Option 3 : Dataflow
• Collect run-time (dynamic) information about data in software
while it is in a static state
• Sources :
• Origin of data
• Arbitrary inputs
• Sinks :
• Dangerous functions
• Exploitable targets
import os
def nslookup(request):
domain = request.GET['domain']
os.system("nslookup " + domain)
Hunting Bugs To Extinction with Static Analysis
Option 3 : Source & Sink example
Hunting Bugs To Extinction with Static Analysis
Option 3 : Dataflow
Analysis Findings
List of Sinks
List of Sources
Hunting Bugs To Extinction with Static Analysis
Option 3 : Dataflow
List inputs = Find_Interactive_Inputs();
List download_file_calls = All.Find_By_Name("download_file");
download_file_calls = download_file_calls.FindByParameterValue(1,"path",BinaryOperator.Equal);
List absolutePathTraversalSanitizers = Find_Absolute_PathTraversal_Sanitizers();
result = inputs.InfluencingOnAndNotSanitized(download_file_calls,
absolutePathTraversalSanitizers);
Hunting Bugs To Extinction with Static Analysis
Option 3 : Dataflow
• Pro :
• Unified syntaxe to write scanning rules for different languages
• Tracking data flow for deep analysis
• Cons :
• Learning curve : very hard to tune
• Distance between concerete code and correponding representation
• Very slow for large code base
• For projects > 2 Gb : Incremental scan = Normal scan
• Libraries/frameworks = unknown sources
Sec4dev 2021  - Catch Me If You can : Continuous Delivery vs. Security Assurance
Hunting Bugs To Extinction with Static Analysis
Option 3 : syntactical-(and semantic)-grep
• Free tool for writing lightweight checks with code patterns to find bugs
using a familiar syntax.
• An in-between solution
• Good support : Go · Java · JavaScript · JSON · Python · Ruby
• Beta : TypeScript · JSX · TSX
$ semgrep -lang python -e 'subprocess.open(...)' /path/to/my/project
Hunting Bugs To Extinction with Static Analysis
Option 3 : syntactical-(and semantic)-grep
$ more rules.yaml
rules:
- id: unsafe-usage-download_file
pattern: download_file($X, search_type = "path")
message: Unsafe usage of download_file method
languages: [python]
severity: WARNING
$ docker run --rm -v $(pwd):/home/repo returntocorp/semgrep –f rules.yaml file.py
Hunting Bugs To Extinction with Static Analysis
Technique 3 : syntactical-(and semantic)-grep
• Pros :
• Fast
• Easy to learn
• Cons :
• We can’t track data over multiple files
Lightweight / Basic Check AST/CFG/… Complexe Check
Custom security policies +++ ++
Ease of use +++ +
Speed Analysis +++ +
Code coverage ++ +++
To sum up …
It's not all about detecting issues …
• Remember : the goal is to write secure apps …
• "Tools can't find every bug (FNs) … trying to will yield way too many
FPs" - @clintgibler
• The raise of secure by default framework !
• Angular : grep dangerouslySetInnerHTML
Advances in Secure Coding Frameworks - Jim Manico - AppSec California
2016
It’s not all about detecting issues …
Lightweight / Basic Check AST/CFG/… Complexe Check
Lightweight / Basic Check
+
Secure by default
Custom security policies +++ ++ +++
Ease of use +++ + +++
Speed Analysis +++ + +++
Code coverage + +++ ++
What does the future hold for us ?
Years Years
2010 2015 2030
10
10^4
10^8
10^12
10^14
Electromechanical
Speed x Accuracy
Vaccum tube
Transistor
Integrated circuit
Computation / sec
AST/CFG Analysis
Lightweight static analysis
THANKS!
Any questions?
You can find me at :
TWITTER : @abdel_tmr
LINKEDIN : /in/abdessamad-temmar/

More Related Content

PPTX
DevSecCon Tel Aviv 2018 - End2End containers SSDLC by Vitaly Davidoff
PPT
Code Quality - Security
PPTX
DevSecCon Tel Aviv 2018 - Integrated Security Testing by Morgan Roman
PDF
DevSecOps: What Why and How : Blackhat 2019
PDF
DevSecCon London 2017: Hands-on secure software development from design to de...
PDF
Security in CI/CD Pipelines: Tips for DevOps Engineers
PDF
8 Tips for Deploying DevSecOps
PDF
DevSecCon Singapore 2018 - Remove developers’ shameful secrets or simply rem...
DevSecCon Tel Aviv 2018 - End2End containers SSDLC by Vitaly Davidoff
Code Quality - Security
DevSecCon Tel Aviv 2018 - Integrated Security Testing by Morgan Roman
DevSecOps: What Why and How : Blackhat 2019
DevSecCon London 2017: Hands-on secure software development from design to de...
Security in CI/CD Pipelines: Tips for DevOps Engineers
8 Tips for Deploying DevSecOps
DevSecCon Singapore 2018 - Remove developers’ shameful secrets or simply rem...

What's hot (20)

PPTX
Continuous Security Testing with Devops - OWASP EU 2014
PPTX
DevOps & Security: Here & Now
PDF
DevSecOps: essential tooling to enable continuous security 2019-09-16
PPTX
Security Testing for Containerized Applications
PPTX
You Build It, You Secure It: Introduction to DevSecOps
PDF
DevSecOps | DevOps Sec
PPTX
How to Get Started with DevSecOps
PDF
Security DevOps - Staying secure in agile projects // OWASP AppSecEU 2015 - A...
PDF
Better Security Testing: Using the Cloud and Continuous Delivery
PDF
Building a DevSecOps Pipeline Around Your Spring Boot Application
PPTX
What it feels like to live in a Security Enabled DevOps World
PDF
Why should developers care about container security?
PPTX
Integrating security into Continuous Delivery
PPTX
Testing in a Continuous Delivery Pipeline - Better, Faster, Cheaper
PDF
DevSecCon London 2017: Permitting agility whilst enforcing security by Alina ...
PDF
Monitoring Application Attack Surface to Integrate Security into DevOps Pipel...
PPTX
DevSecCon Singapore 2018 - System call auditing made effective with machine l...
PDF
Scale security for a dollar or less
PPT
Securing Apache Web Servers
PPTX
InSpec Workshop DevSecCon 2017
Continuous Security Testing with Devops - OWASP EU 2014
DevOps & Security: Here & Now
DevSecOps: essential tooling to enable continuous security 2019-09-16
Security Testing for Containerized Applications
You Build It, You Secure It: Introduction to DevSecOps
DevSecOps | DevOps Sec
How to Get Started with DevSecOps
Security DevOps - Staying secure in agile projects // OWASP AppSecEU 2015 - A...
Better Security Testing: Using the Cloud and Continuous Delivery
Building a DevSecOps Pipeline Around Your Spring Boot Application
What it feels like to live in a Security Enabled DevOps World
Why should developers care about container security?
Integrating security into Continuous Delivery
Testing in a Continuous Delivery Pipeline - Better, Faster, Cheaper
DevSecCon London 2017: Permitting agility whilst enforcing security by Alina ...
Monitoring Application Attack Surface to Integrate Security into DevOps Pipel...
DevSecCon Singapore 2018 - System call auditing made effective with machine l...
Scale security for a dollar or less
Securing Apache Web Servers
InSpec Workshop DevSecCon 2017
Ad

Similar to Sec4dev 2021 - Catch Me If You can : Continuous Delivery vs. Security Assurance (20)

PPTX
antoanthongtin_Lesson 3- Software Security (1).pptx
PDF
Fuzzing - Part 1
PPTX
Using Static Binary Analysis To Find Vulnerabilities And Backdoors in Firmware
PDF
Reducing Redundancies in Multi-Revision Code Analysis
PDF
Webinar alain-2009-03-04-clamav
PPT
Live Memory Forensics on Android devices
PPTX
Next-generation sequencing data format and visualization with ngs.plot 2015
KEY
Testing Zen
 
PPTX
Introduction to Malware Analysis
PPTX
Applying Provenance in APT Monitoring and Analysis Practical Challenges for S...
PPTX
Building next gen malware behavioural analysis environment
PDF
RIoT (Raiding Internet of Things) by Jacob Holcomb
PDF
BSides IR in Heterogeneous Environment
PPTX
Defending Your "Gold"
PPT
Attacks against Microsoft network web clients
PDF
Justin collins - Practical Static Analysis for continuous application delivery
PDF
MacOS forensics and anti-forensics (DC Lviv 2019) presentation
PDF
PAC 2019 virtual Christoph NEUMÜLLER
PDF
ANOTHER BRICK OFF THE WALL: DECONSTRUCTING WEB APPLICATION FIREWALLS USING AU...
PDF
Web application security and Python security best practices
antoanthongtin_Lesson 3- Software Security (1).pptx
Fuzzing - Part 1
Using Static Binary Analysis To Find Vulnerabilities And Backdoors in Firmware
Reducing Redundancies in Multi-Revision Code Analysis
Webinar alain-2009-03-04-clamav
Live Memory Forensics on Android devices
Next-generation sequencing data format and visualization with ngs.plot 2015
Testing Zen
 
Introduction to Malware Analysis
Applying Provenance in APT Monitoring and Analysis Practical Challenges for S...
Building next gen malware behavioural analysis environment
RIoT (Raiding Internet of Things) by Jacob Holcomb
BSides IR in Heterogeneous Environment
Defending Your "Gold"
Attacks against Microsoft network web clients
Justin collins - Practical Static Analysis for continuous application delivery
MacOS forensics and anti-forensics (DC Lviv 2019) presentation
PAC 2019 virtual Christoph NEUMÜLLER
ANOTHER BRICK OFF THE WALL: DECONSTRUCTING WEB APPLICATION FIREWALLS USING AU...
Web application security and Python security best practices
Ad

Recently uploaded (20)

PDF
Softaken Excel to vCard Converter Software.pdf
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
System and Network Administration Chapter 2
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PDF
top salesforce developer skills in 2025.pdf
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
PTS Company Brochure 2025 (1).pdf.......
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PPTX
Reimagine Home Health with the Power of Agentic AI​
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
How Creative Agencies Leverage Project Management Software.pdf
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PDF
Digital Strategies for Manufacturing Companies
PDF
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
PPTX
L1 - Introduction to python Backend.pptx
Softaken Excel to vCard Converter Software.pdf
Navsoft: AI-Powered Business Solutions & Custom Software Development
System and Network Administration Chapter 2
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
VVF-Customer-Presentation2025-Ver1.9.pptx
top salesforce developer skills in 2025.pdf
Odoo Companies in India – Driving Business Transformation.pdf
PTS Company Brochure 2025 (1).pdf.......
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
How to Migrate SBCGlobal Email to Yahoo Easily
Reimagine Home Health with the Power of Agentic AI​
Design an Analysis of Algorithms I-SECS-1021-03
How Creative Agencies Leverage Project Management Software.pdf
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
Digital Strategies for Manufacturing Companies
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
L1 - Introduction to python Backend.pptx

Sec4dev 2021 - Catch Me If You can : Continuous Delivery vs. Security Assurance

  • 1. Continuous Delivery Security Assurance Vs. By : Abdessamad TEMMAR
  • 2. About me • Abdessamad TEMMAR • Application Security Engineer (Siris Advisory) • Ex – full time Pentester • OWASP Contributor
  • 3. What this talk is all about ? DevOps Teams Automated attacks Appsec team
  • 4. Appsec Toolbelt • SCA : Dependencies Analysis • DAST (Dynamic) : Scans interface of running application • SAST (Static) : Scans source code / binaries • IAST (Interactive) : Detection at runtime • SCA : Dependencies Analysis • DAST (Dynamic) : Scans interface of running application • SAST (Static) : Scans source code / binaries • IAST (Interactive) : Detection at runtime
  • 5. What is static analysis ? Source/Byte Code Analysis Findings Scanning rules (SQLi, XSS, etc)
  • 6. Why static analysis ? • Easy to automate/integarte • Run anytime • Fast • Points directly to suspect code
  • 8. Hunting Bugs To Extinction with Static Analysis The problem : • An unsecure usage of an external API : download_file • We want to identify the same issue for the hole application, and avoid it for future changes. download_file(file_id = id, search_type = "file_id") download_file(file_id = id, search_type = "path")
  • 10. Hunting Bugs To Extinction with Static Analysis The solution : Changed files File 1 File 2 PR
  • 12. $ more scan_changed_files.sh git checkout $@ --quiet files=$(git diff --name-status master HEAD | grep -E "^(A|M)" | cut -f 2) grep "download_file(.*, search_type = "path")" $files Hunting Bugs To Extinction with Static Analysis Option 1 : grep for the rescue $ git diff --name-status A README.md M lib/blah.py D test/new_stuff.yml
  • 13. Hunting Bugs To Extinction with Static Analysis Option 1 : grep for the rescue • False Positives # Remember not to use download_file(file_id, search_type = "path") ! ... def download_file(file_id, search_type = "path"): ...
  • 14. Hunting Bugs To Extinction with Static Analysis Option 1 : grep for the rescue • Pro : • Easy to use • Easy to understand • Intercative • Cons : • Line-oriented • Mismatch with program structure (trees, ASTs)
  • 15. Hunting Bugs To Extinction with Static Analysis String Tree
  • 16. Hunting Bugs To Extinction with Static Analysis Option 2 : AST Source/Byte Code Intermediate reprensentations Analysis Abstract Syntax Tree
  • 17. Parse into AST Hunting Bugs To Extinction with Static Analysis Option 2 : AST based Program Text Output compiled code optimize Convert to intermediate form Semantic Analysis Lexical Analysis Analyze ! Output finding report Compilation AST Analysis Rule 1 : XSS Rule 2 : SQLi
  • 18. Hunting Bugs To Extinction with Static Analysis Option 2 : AST
  • 19. Hunting Bugs To Extinction with Static Analysis Option 2 : bandit module import bandit from bandit.core import test_properties as test @test.checks('Call') @test.test_id('B001') def unsafe_get_userinfo(context): if (context.call_function_name_qual == 'download_file' and context.call_args[1] == 'path'): return bandit.Issue( severity=bandit.HIGH, confidence=bandit.HIGH, text="Unsafe usage of download_file." )
  • 20. Hunting Bugs To Extinction with Static Analysis Option 2 : AST • Pros : • Robust analysis • Cons : • Learning curve • Where data originated from ?
  • 21. Hunting Bugs To Extinction with Static Analysis Option 3 : Dataflow • Collect run-time (dynamic) information about data in software while it is in a static state • Sources : • Origin of data • Arbitrary inputs • Sinks : • Dangerous functions • Exploitable targets
  • 22. import os def nslookup(request): domain = request.GET['domain'] os.system("nslookup " + domain) Hunting Bugs To Extinction with Static Analysis Option 3 : Source & Sink example
  • 23. Hunting Bugs To Extinction with Static Analysis Option 3 : Dataflow Analysis Findings List of Sinks List of Sources
  • 24. Hunting Bugs To Extinction with Static Analysis Option 3 : Dataflow List inputs = Find_Interactive_Inputs(); List download_file_calls = All.Find_By_Name("download_file"); download_file_calls = download_file_calls.FindByParameterValue(1,"path",BinaryOperator.Equal); List absolutePathTraversalSanitizers = Find_Absolute_PathTraversal_Sanitizers(); result = inputs.InfluencingOnAndNotSanitized(download_file_calls, absolutePathTraversalSanitizers);
  • 25. Hunting Bugs To Extinction with Static Analysis Option 3 : Dataflow • Pro : • Unified syntaxe to write scanning rules for different languages • Tracking data flow for deep analysis • Cons : • Learning curve : very hard to tune • Distance between concerete code and correponding representation • Very slow for large code base • For projects > 2 Gb : Incremental scan = Normal scan • Libraries/frameworks = unknown sources
  • 27. Hunting Bugs To Extinction with Static Analysis Option 3 : syntactical-(and semantic)-grep • Free tool for writing lightweight checks with code patterns to find bugs using a familiar syntax. • An in-between solution • Good support : Go · Java · JavaScript · JSON · Python · Ruby • Beta : TypeScript · JSX · TSX $ semgrep -lang python -e 'subprocess.open(...)' /path/to/my/project
  • 28. Hunting Bugs To Extinction with Static Analysis Option 3 : syntactical-(and semantic)-grep $ more rules.yaml rules: - id: unsafe-usage-download_file pattern: download_file($X, search_type = "path") message: Unsafe usage of download_file method languages: [python] severity: WARNING $ docker run --rm -v $(pwd):/home/repo returntocorp/semgrep –f rules.yaml file.py
  • 29. Hunting Bugs To Extinction with Static Analysis Technique 3 : syntactical-(and semantic)-grep • Pros : • Fast • Easy to learn • Cons : • We can’t track data over multiple files
  • 30. Lightweight / Basic Check AST/CFG/… Complexe Check Custom security policies +++ ++ Ease of use +++ + Speed Analysis +++ + Code coverage ++ +++ To sum up …
  • 31. It's not all about detecting issues … • Remember : the goal is to write secure apps … • "Tools can't find every bug (FNs) … trying to will yield way too many FPs" - @clintgibler • The raise of secure by default framework ! • Angular : grep dangerouslySetInnerHTML
  • 32. Advances in Secure Coding Frameworks - Jim Manico - AppSec California 2016 It’s not all about detecting issues … Lightweight / Basic Check AST/CFG/… Complexe Check Lightweight / Basic Check + Secure by default Custom security policies +++ ++ +++ Ease of use +++ + +++ Speed Analysis +++ + +++ Code coverage + +++ ++
  • 33. What does the future hold for us ? Years Years 2010 2015 2030 10 10^4 10^8 10^12 10^14 Electromechanical Speed x Accuracy Vaccum tube Transistor Integrated circuit Computation / sec AST/CFG Analysis Lightweight static analysis
  • 34. THANKS! Any questions? You can find me at : TWITTER : @abdel_tmr LINKEDIN : /in/abdessamad-temmar/