SlideShare une entreprise Scribd logo
1  sur  34
Télécharger pour lire hors ligne
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")
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
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/

Contenu connexe

Tendances

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
 
DevOps & Security: Here & Now
DevOps & Security: Here & NowDevOps & Security: Here & Now
DevOps & Security: Here & NowCheckmarx
 
DevSecOps: essential tooling to enable continuous security 2019-09-16
DevSecOps: essential tooling to enable continuous security 2019-09-16DevSecOps: essential tooling to enable continuous security 2019-09-16
DevSecOps: essential tooling to enable continuous security 2019-09-16Rich Mills
 
Security Testing for Containerized Applications
Security Testing for Containerized ApplicationsSecurity Testing for Containerized Applications
Security Testing for Containerized ApplicationsSoluto
 
You Build It, You Secure It: Introduction to DevSecOps
You Build It, You Secure It: Introduction to DevSecOpsYou Build It, You Secure It: Introduction to DevSecOps
You Build It, You Secure It: Introduction to DevSecOpsSumo Logic
 
DevSecOps | DevOps Sec
DevSecOps | DevOps SecDevSecOps | DevOps Sec
DevSecOps | DevOps SecRubal Jain
 
How to Get Started with DevSecOps
How to Get Started with DevSecOpsHow to Get Started with DevSecOps
How to Get Started with DevSecOpsCYBRIC
 
Security DevOps - Staying secure in agile projects // OWASP AppSecEU 2015 - A...
Security DevOps - Staying secure in agile projects // OWASP AppSecEU 2015 - A...Security DevOps - Staying secure in agile projects // OWASP AppSecEU 2015 - A...
Security DevOps - Staying secure in agile projects // OWASP AppSecEU 2015 - A...Christian Schneider
 
Better Security Testing: Using the Cloud and Continuous Delivery
Better Security Testing: Using the Cloud and Continuous DeliveryBetter Security Testing: Using the Cloud and Continuous Delivery
Better Security Testing: Using the Cloud and Continuous DeliveryGene Gotimer
 
Building a DevSecOps Pipeline Around Your Spring Boot Application
Building a DevSecOps Pipeline Around Your Spring Boot ApplicationBuilding a DevSecOps Pipeline Around Your Spring Boot Application
Building a DevSecOps Pipeline Around Your Spring Boot ApplicationVMware Tanzu
 
What it feels like to live in a Security Enabled DevOps World
What it feels like to live in a Security Enabled DevOps WorldWhat it feels like to live in a Security Enabled DevOps World
What it feels like to live in a Security Enabled DevOps WorldKarun Chennuri
 
Why should developers care about container security?
Why should developers care about container security?Why should developers care about container security?
Why should developers care about container security?Eric Smalling
 
Integrating security into Continuous Delivery
Integrating security into Continuous DeliveryIntegrating security into Continuous Delivery
Integrating security into Continuous DeliveryTom Stiehm
 
Testing in a Continuous Delivery Pipeline - Better, Faster, Cheaper
Testing in a Continuous Delivery Pipeline - Better, Faster, CheaperTesting in a Continuous Delivery Pipeline - Better, Faster, Cheaper
Testing in a Continuous Delivery Pipeline - Better, Faster, CheaperGene Gotimer
 
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
 
Monitoring Application Attack Surface to Integrate Security into DevOps Pipel...
Monitoring Application Attack Surface to Integrate Security into DevOps Pipel...Monitoring Application Attack Surface to Integrate Security into DevOps Pipel...
Monitoring Application Attack Surface to Integrate Security into DevOps Pipel...Denim Group
 
DevSecCon Singapore 2018 - System call auditing made effective with machine l...
DevSecCon Singapore 2018 - System call auditing made effective with machine l...DevSecCon Singapore 2018 - System call auditing made effective with machine l...
DevSecCon Singapore 2018 - System call auditing made effective with machine l...DevSecCon
 
Scale security for a dollar or less
Scale security for a dollar or lessScale security for a dollar or less
Scale security for a dollar or lessMohammed A. Imran
 
InSpec Workshop DevSecCon 2017
InSpec Workshop DevSecCon 2017InSpec Workshop DevSecCon 2017
InSpec Workshop DevSecCon 2017Mandi Walls
 

Tendances (20)

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
 
DevOps & Security: Here & Now
DevOps & Security: Here & NowDevOps & Security: Here & Now
DevOps & Security: Here & Now
 
DevSecOps: essential tooling to enable continuous security 2019-09-16
DevSecOps: essential tooling to enable continuous security 2019-09-16DevSecOps: essential tooling to enable continuous security 2019-09-16
DevSecOps: essential tooling to enable continuous security 2019-09-16
 
Security Testing for Containerized Applications
Security Testing for Containerized ApplicationsSecurity Testing for Containerized Applications
Security Testing for Containerized Applications
 
You Build It, You Secure It: Introduction to DevSecOps
You Build It, You Secure It: Introduction to DevSecOpsYou Build It, You Secure It: Introduction to DevSecOps
You Build It, You Secure It: Introduction to DevSecOps
 
DevSecOps | DevOps Sec
DevSecOps | DevOps SecDevSecOps | DevOps Sec
DevSecOps | DevOps Sec
 
How to Get Started with DevSecOps
How to Get Started with DevSecOpsHow to Get Started with DevSecOps
How to Get Started with DevSecOps
 
Security DevOps - Staying secure in agile projects // OWASP AppSecEU 2015 - A...
Security DevOps - Staying secure in agile projects // OWASP AppSecEU 2015 - A...Security DevOps - Staying secure in agile projects // OWASP AppSecEU 2015 - A...
Security DevOps - Staying secure in agile projects // OWASP AppSecEU 2015 - A...
 
Better Security Testing: Using the Cloud and Continuous Delivery
Better Security Testing: Using the Cloud and Continuous DeliveryBetter Security Testing: Using the Cloud and Continuous Delivery
Better Security Testing: Using the Cloud and Continuous Delivery
 
Building a DevSecOps Pipeline Around Your Spring Boot Application
Building a DevSecOps Pipeline Around Your Spring Boot ApplicationBuilding a DevSecOps Pipeline Around Your Spring Boot Application
Building a DevSecOps Pipeline Around Your Spring Boot Application
 
What it feels like to live in a Security Enabled DevOps World
What it feels like to live in a Security Enabled DevOps WorldWhat it feels like to live in a Security Enabled DevOps World
What it feels like to live in a Security Enabled DevOps World
 
Why should developers care about container security?
Why should developers care about container security?Why should developers care about container security?
Why should developers care about container security?
 
Integrating security into Continuous Delivery
Integrating security into Continuous DeliveryIntegrating security into Continuous Delivery
Integrating security into Continuous Delivery
 
Testing in a Continuous Delivery Pipeline - Better, Faster, Cheaper
Testing in a Continuous Delivery Pipeline - Better, Faster, CheaperTesting in a Continuous Delivery Pipeline - Better, Faster, Cheaper
Testing in a Continuous Delivery Pipeline - Better, Faster, Cheaper
 
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 ...
 
Monitoring Application Attack Surface to Integrate Security into DevOps Pipel...
Monitoring Application Attack Surface to Integrate Security into DevOps Pipel...Monitoring Application Attack Surface to Integrate Security into DevOps Pipel...
Monitoring Application Attack Surface to Integrate Security into DevOps Pipel...
 
DevSecCon Singapore 2018 - System call auditing made effective with machine l...
DevSecCon Singapore 2018 - System call auditing made effective with machine l...DevSecCon Singapore 2018 - System call auditing made effective with machine l...
DevSecCon Singapore 2018 - System call auditing made effective with machine l...
 
Scale security for a dollar or less
Scale security for a dollar or lessScale security for a dollar or less
Scale security for a dollar or less
 
Securing Apache Web Servers
Securing Apache Web ServersSecuring Apache Web Servers
Securing Apache Web Servers
 
InSpec Workshop DevSecCon 2017
InSpec Workshop DevSecCon 2017InSpec Workshop DevSecCon 2017
InSpec Workshop DevSecCon 2017
 

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

Using Static Binary Analysis To Find Vulnerabilities And Backdoors in Firmware
Using Static Binary Analysis To Find Vulnerabilities And Backdoors in FirmwareUsing Static Binary Analysis To Find Vulnerabilities And Backdoors in Firmware
Using Static Binary Analysis To Find Vulnerabilities And Backdoors in FirmwareLastline, Inc.
 
Reducing Redundancies in Multi-Revision Code Analysis
Reducing Redundancies in Multi-Revision Code AnalysisReducing Redundancies in Multi-Revision Code Analysis
Reducing Redundancies in Multi-Revision Code AnalysisSebastiano Panichella
 
Webinar alain-2009-03-04-clamav
Webinar alain-2009-03-04-clamavWebinar alain-2009-03-04-clamav
Webinar alain-2009-03-04-clamavthc2cat
 
Live Memory Forensics on Android devices
Live Memory Forensics on Android devicesLive Memory Forensics on Android devices
Live Memory Forensics on Android devicesNikos Gkogkos
 
Next-generation sequencing data format and visualization with ngs.plot 2015
Next-generation sequencing data format and visualization with ngs.plot 2015Next-generation sequencing data format and visualization with ngs.plot 2015
Next-generation sequencing data format and visualization with ngs.plot 2015Li Shen
 
Testing Zen
Testing ZenTesting Zen
Testing Zenday
 
Introduction to Malware Analysis
Introduction to Malware AnalysisIntroduction to Malware Analysis
Introduction to Malware AnalysisAndrew McNicol
 
Applying Provenance in APT Monitoring and Analysis Practical Challenges for S...
Applying Provenance in APT Monitoring and Analysis Practical Challenges for S...Applying Provenance in APT Monitoring and Analysis Practical Challenges for S...
Applying Provenance in APT Monitoring and Analysis Practical Challenges for S...Graeme Jenkinson
 
Building next gen malware behavioural analysis environment
Building next gen malware behavioural analysis environment Building next gen malware behavioural analysis environment
Building next gen malware behavioural analysis environment isc2-hellenic
 
RIoT (Raiding Internet of Things) by Jacob Holcomb
RIoT  (Raiding Internet of Things)  by Jacob HolcombRIoT  (Raiding Internet of Things)  by Jacob Holcomb
RIoT (Raiding Internet of Things) by Jacob HolcombPriyanka Aash
 
BSides IR in Heterogeneous Environment
BSides IR in Heterogeneous EnvironmentBSides IR in Heterogeneous Environment
BSides IR in Heterogeneous EnvironmentStefano Maccaglia
 
Attacks against Microsoft network web clients
Attacks against Microsoft network web clients Attacks against Microsoft network web clients
Attacks against Microsoft network web clients Positive Hack Days
 
(BDT402) Performance Profiling in Production: Analyzing Web Requests at Scale...
(BDT402) Performance Profiling in Production: Analyzing Web Requests at Scale...(BDT402) Performance Profiling in Production: Analyzing Web Requests at Scale...
(BDT402) Performance Profiling in Production: Analyzing Web Requests at Scale...Amazon Web Services
 
Justin collins - Practical Static Analysis for continuous application delivery
Justin collins - Practical Static Analysis for continuous application deliveryJustin collins - Practical Static Analysis for continuous application delivery
Justin collins - Practical Static Analysis for continuous application deliveryDevSecCon
 
MacOS forensics and anti-forensics (DC Lviv 2019) presentation
MacOS forensics and anti-forensics (DC Lviv 2019) presentationMacOS forensics and anti-forensics (DC Lviv 2019) presentation
MacOS forensics and anti-forensics (DC Lviv 2019) presentationOlehLevytskyi1
 
PAC 2019 virtual Christoph NEUMÜLLER
PAC 2019 virtual Christoph NEUMÜLLERPAC 2019 virtual Christoph NEUMÜLLER
PAC 2019 virtual Christoph NEUMÜLLERNeotys
 
ANOTHER BRICK OFF THE WALL: DECONSTRUCTING WEB APPLICATION FIREWALLS USING AU...
ANOTHER BRICK OFF THE WALL: DECONSTRUCTING WEB APPLICATION FIREWALLS USING AU...ANOTHER BRICK OFF THE WALL: DECONSTRUCTING WEB APPLICATION FIREWALLS USING AU...
ANOTHER BRICK OFF THE WALL: DECONSTRUCTING WEB APPLICATION FIREWALLS USING AU...Ioannis Stais
 
Web application security and Python security best practices
Web application security and Python security best practicesWeb application security and Python security best practices
Web application security and Python security best practicesPGS Software S.A.
 

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

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

Dernier

Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
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
 
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
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
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
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
(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
 
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
 
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
 
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
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
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
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
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
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 

Dernier (20)

Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
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
 
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
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
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...
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
(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...
 
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)
 
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...
 
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...
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
Exploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the ProcessExploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the Process
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
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
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
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
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 

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")
  • 9.
  • 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
  • 26.
  • 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/