SlideShare a Scribd company logo
1 of 23
Download to read offline
Let’s Check Let’s
Encrypt
Fraser Scott
Christopher A. Wood*
*Caveat: I don't work in InfoSec
Agenda
● Threat modeling overview
○ Objectives
○ Difficulties and pain points in practice
● Inside-out vs outside-in
● ThreatSpec overview
● Examples
● Let’s Encrypt threat model
● Lessons learned
● Going Forward
Getting Started
Threat Modeling
● Systematic identification of threats, actions, and mitigation strategies
○ What are you building?
○ What can go wrong?
○ What should you do about things that can go wrong?
○ Are you doing a good job?
● STRIDE
● DREAD
Threat Modeling
● Systematic identification of threats, actions, and mitigation strategies
○ What are you building?
○ What can go wrong?
○ What should you do about things that can go wrong?
○ Are you doing a good job?
● STRIDE
● DREAD
Threat Modeling
● Systematic identification of threats, actions, and mitigation strategies
○ What are you building?
○ What can go wrong?
○ What should you do about things that can go wrong?
○ Are you doing a good job?
● STRIDE
● DREAD
Go read Threat Modeling: Designing for Security
by Adam Shostack
Objectives
● Build secure products and services
● Secure by design rather than bolting on controls
Pain Points
● Model can become out of sync with implementation
● Threat modeling isn’t continuous
● Additional documentation needs to be maintained
Inside-out vs Outside-in
● The threat model generally works from the outside in (towards the assets)
○ This helps reduce redundant or unnecessary work internally
○ If an asset is never exposed, do you need to include it in the model?
○ Only model what's actually in play
● We advocate working from the inside out
○ Assets (code) are modeled directly
○ Models are joined and merged to form larger models for a system
○ The full picture emerges organically
ThreatSpec: Code-Driven
Threat Modeling
ThreatSpec
● R-Spec for Threat Modeling
● Add threat model context to code
● Generate reports dynamically
● Security, QA, Developers etc
working closely together (peer
review)
Some Vocabulary
● Component - Individual part of the system
● Boundary - Separation of trust
● Threat - The thing that could go wrong
● Mitigation - Fixing or working around the threat
● Exposure - Not fixing the threat
● Acceptance - Accepting the risk of the threat
Grammar Overview
@alias boundary|component|threat ID to NAME
@describe boundary|component|threat ID as DESCRIPTION
@mitigates BOUNDARY:COMPONENT against THREAT with MITIGATION [(REFERENCES)]
@exposes BOUNDARY:COMPONENT to THREAT with EXPOSURE [(REFERENCES)]
@transfers THREAT to BOUNDARY:COMPONENT with TRANSFER [(REFERENCES)]
@accepts THREAT to BOUNDARY:COMPONENT with ACCEPTANCE [(REFERENCES)]
@review ???
Example code
@mitigates @webapp:FileSystem against unauthorised access with strict file
permissions (#122)
@exposes @webapp:App to XSS with insufficient input validation (#124,#133)
@transfers @cwe_319_cleartext_transmission to User:Browser with non-sensitive
information (#125)
@accepts arbitrary file writes to @webapp:FileSystem with filename restrictions
(#106)
from threatspec.org
Example report
Let’s Encrypt Threat Model
● Code base and protocol overview
● Our task (read it, understand it, try to model it)
Snippets from Let’s Encrypt
acme/clent.py
# @mitigates @acme:@client against @cwe_693_protection_mechanism_failure with loads better library if old python version detected
if sys.version_info < (2, 7, 9): # pragma: no cover
requests.packages.urllib3.contrib.pyopenssl.inject_into_urllib3()
acme/clent.py
"""
@transfers @cwe_320_key_management_errors to @app:@caller with no key validation or checks carried out
@mitigates @acme:@client against @cwe_295_improper_certificate_validation with verifies SSL by default
@review alg makes sense? RS256?
"""
DER_CONTENT_TYPE = 'application/pkix-cert'
Unchecked Deserialization
acme/messages.py
def __init__(self, jobj):
"""
@exposes @acme:@directory to @cwe_36_absolute_path_traversal with possible relative URLs
@exposes @acme:@directory to @cwe_502_deserialization_of_untrusted_data with deserialization of 
data that's not defined in the ACME spec
"""
canon_jobj = util.map_keys(jobj, self._canon_key)
if not set(canon_jobj).issubset(self._REGISTERED_TYPES):
# TODO: acme-spec is not clear about this: 'It is a JSON
# dictionary, whose keys are the "resource" values listed
# in {{https-requests}}'z
raise ValueError('Wrong directory fields')
# TODO: check that everything is an absolute URL; acme-spec is
# not clear on that
self._jobj = canon_jobj
JWK Loading Concerns
acme/jose/jwk.py
@classmethod
def load(cls, data, password=None, backend=None):
"""Load serialized key as JWK.
<snip>
@review So if this fails to load asymmetric keys, it assumes use of 
symmetric and loads that instead? Sounds a bit surprising. If the 
key was corrupted, it could contain something relatively predictable 
that might end up be used as a symmetric key without the user noticing
"""
try:
key = cls._load_cryptography_key(data, password, backend)
except errors.Error as error:
logger.debug('Loading symmetric key, asymmetric failed: %s', error)
return JWKOct(key=data)
<snip>
Key Leakage
acme/jose/jwk.py
def fields_to_partial_json(self):
"""
@exposes @acme:@client to @cwe_320_key_management_errors by leaking private key material in JSON structure
"""
if isinstance(self.key._wrapped, rsa.RSAPublicKey):
<snip>
else: # rsa.RSAPrivateKey
private = self.key.private_numbers()
public = self.key.public_key().public_numbers()
params = {
'n': public.n,
'e': public.e,
'd': private.d,
'p': private.p,
<snip>
}
return dict((key, self._encode_param(value))
for key, value in six.iteritems(params))
Notable Outcomes
● Identified some possible problems with the code (need to check with LE
folks)
● Transfers are pretty common - libraries don’t always check stuff
● ThreatSpec could aid general code review
Lessons Learned
● Up-front investment is steep
● Continual maintenance is easy (with educated developers)
● ThreatSpec needs more work (e.g. @review tag, grammatical tweaks,
languages)
● Dynamic DFDs from call-graphs would have been very helpful
Going Forward
● Make the threat model an artifact of assets -- code!
● Allow models to be generated inside-out and merged across projects,
teams, and within an enterprise
● Let the treat model grow organically along with the code
● Generate dynamic DFDs using call-graphs
● Test in real systems and in real teams
● Experiment with developers
ThreatSpec.org
@ThreatSpec

More Related Content

Viewers also liked

Manipulated Images
Manipulated ImagesManipulated Images
Manipulated Imagesgoldenj234
 
Impianti fotovoltaici di qualità
Impianti fotovoltaici di qualità Impianti fotovoltaici di qualità
Impianti fotovoltaici di qualità Andrea Antonini
 
21 Content Marketing Tools and Tactics by @staceycav at #TTLPresents - Septem...
21 Content Marketing Tools and Tactics by @staceycav at #TTLPresents - Septem...21 Content Marketing Tools and Tactics by @staceycav at #TTLPresents - Septem...
21 Content Marketing Tools and Tactics by @staceycav at #TTLPresents - Septem...Stacey MacNaught
 
Pace and challenge
Pace and challengePace and challenge
Pace and challengeMrsMcGinty
 
Cpd differentiation presentation
Cpd differentiation presentationCpd differentiation presentation
Cpd differentiation presentationMrsMcGinty
 
Personal and professional Attributes
Personal and professional AttributesPersonal and professional Attributes
Personal and professional AttributesGlaiza Gubaton
 
Lease and ijarah
Lease and ijarahLease and ijarah
Lease and ijarahKhalid Aziz
 
40412259 drept-civil-contracte-speciale
40412259 drept-civil-contracte-speciale40412259 drept-civil-contracte-speciale
40412259 drept-civil-contracte-specialeexodumuser
 
215053691 curs-de-drept-civil-contracre-liviu-stanciulescu
215053691 curs-de-drept-civil-contracre-liviu-stanciulescu215053691 curs-de-drept-civil-contracre-liviu-stanciulescu
215053691 curs-de-drept-civil-contracre-liviu-stanciulescuexodumuser
 

Viewers also liked (14)

interview
interviewinterview
interview
 
Manipulated Images
Manipulated ImagesManipulated Images
Manipulated Images
 
Impianti fotovoltaici di qualità
Impianti fotovoltaici di qualità Impianti fotovoltaici di qualità
Impianti fotovoltaici di qualità
 
PRINT AND POWER
PRINT AND POWERPRINT AND POWER
PRINT AND POWER
 
21 Content Marketing Tools and Tactics by @staceycav at #TTLPresents - Septem...
21 Content Marketing Tools and Tactics by @staceycav at #TTLPresents - Septem...21 Content Marketing Tools and Tactics by @staceycav at #TTLPresents - Septem...
21 Content Marketing Tools and Tactics by @staceycav at #TTLPresents - Septem...
 
Islamic finance presentation
Islamic finance presentationIslamic finance presentation
Islamic finance presentation
 
Pace and challenge
Pace and challengePace and challenge
Pace and challenge
 
Cpd differentiation presentation
Cpd differentiation presentationCpd differentiation presentation
Cpd differentiation presentation
 
Personal and professional Attributes
Personal and professional AttributesPersonal and professional Attributes
Personal and professional Attributes
 
Public sphere
Public sphere Public sphere
Public sphere
 
Let's Encrypt
Let's EncryptLet's Encrypt
Let's Encrypt
 
Lease and ijarah
Lease and ijarahLease and ijarah
Lease and ijarah
 
40412259 drept-civil-contracte-speciale
40412259 drept-civil-contracte-speciale40412259 drept-civil-contracte-speciale
40412259 drept-civil-contracte-speciale
 
215053691 curs-de-drept-civil-contracre-liviu-stanciulescu
215053691 curs-de-drept-civil-contracre-liviu-stanciulescu215053691 curs-de-drept-civil-contracre-liviu-stanciulescu
215053691 curs-de-drept-civil-contracre-liviu-stanciulescu
 

Similar to Let’s Check Let’s Encrypt: A Tool for Code-Driven Threat Modeling

OWASP Poland Day 2018 - Pedro Fortuna - Are your Java Script based protection...
OWASP Poland Day 2018 - Pedro Fortuna - Are your Java Script based protection...OWASP Poland Day 2018 - Pedro Fortuna - Are your Java Script based protection...
OWASP Poland Day 2018 - Pedro Fortuna - Are your Java Script based protection...OWASP
 
Scaling security in a cloud environment v0.5 (Sep 2017)
Scaling security in a cloud environment  v0.5 (Sep 2017)Scaling security in a cloud environment  v0.5 (Sep 2017)
Scaling security in a cloud environment v0.5 (Sep 2017)Dinis Cruz
 
OWASP SB -Threat modeling 101
OWASP SB -Threat modeling 101OWASP SB -Threat modeling 101
OWASP SB -Threat modeling 101Jozsef Ottucsak
 
DevSecOps at Agile 2019
DevSecOps at   Agile 2019 DevSecOps at   Agile 2019
DevSecOps at Agile 2019 Elizabeth Ayer
 
Story about module management with angular.js
Story about module management with angular.jsStory about module management with angular.js
Story about module management with angular.jsDavid Amend
 
Secure development in .NET with EPiServer Solita
Secure development in .NET with EPiServer SolitaSecure development in .NET with EPiServer Solita
Secure development in .NET with EPiServer SolitaJoona Immonen
 
JSMVCOMFG - To sternly look at JavaScript MVC and Templating Frameworks
JSMVCOMFG - To sternly look at JavaScript MVC and Templating FrameworksJSMVCOMFG - To sternly look at JavaScript MVC and Templating Frameworks
JSMVCOMFG - To sternly look at JavaScript MVC and Templating FrameworksMario Heiderich
 
Node.js for enterprise - JS Conference
Node.js for enterprise - JS ConferenceNode.js for enterprise - JS Conference
Node.js for enterprise - JS ConferenceTimur Shemsedinov
 
An Abusive Relationship with AngularJS by Mario Heiderich - CODE BLUE 2015
An Abusive Relationship with AngularJS by Mario Heiderich - CODE BLUE 2015An Abusive Relationship with AngularJS by Mario Heiderich - CODE BLUE 2015
An Abusive Relationship with AngularJS by Mario Heiderich - CODE BLUE 2015CODE BLUE
 
Security hole #5 application security science or quality assurance
Security hole #5 application security   science or quality assuranceSecurity hole #5 application security   science or quality assurance
Security hole #5 application security science or quality assuranceTjylen Veselyj
 
The innerHTML Apocalypse
The innerHTML ApocalypseThe innerHTML Apocalypse
The innerHTML ApocalypseMario Heiderich
 
How my team is applying JS framework for PHP projects.
How my team is applying JS framework for PHP projects.How my team is applying JS framework for PHP projects.
How my team is applying JS framework for PHP projects.Damon Hung Tran
 
MobSecCon 2015 - Dynamic Analysis of Android Apps
MobSecCon 2015 - Dynamic Analysis of Android AppsMobSecCon 2015 - Dynamic Analysis of Android Apps
MobSecCon 2015 - Dynamic Analysis of Android AppsRon Munitz
 
What the Struts?
What the Struts?What the Struts?
What the Struts?Joe Kutner
 
StHack 2014 - Mario "@0x6D6172696F" Heiderich - JSMVCOMFG
StHack 2014 - Mario "@0x6D6172696F" Heiderich - JSMVCOMFGStHack 2014 - Mario "@0x6D6172696F" Heiderich - JSMVCOMFG
StHack 2014 - Mario "@0x6D6172696F" Heiderich - JSMVCOMFGStHack
 

Similar to Let’s Check Let’s Encrypt: A Tool for Code-Driven Threat Modeling (20)

Null meet Code Review
Null meet Code ReviewNull meet Code Review
Null meet Code Review
 
OWASP Poland Day 2018 - Pedro Fortuna - Are your Java Script based protection...
OWASP Poland Day 2018 - Pedro Fortuna - Are your Java Script based protection...OWASP Poland Day 2018 - Pedro Fortuna - Are your Java Script based protection...
OWASP Poland Day 2018 - Pedro Fortuna - Are your Java Script based protection...
 
Scaling security in a cloud environment v0.5 (Sep 2017)
Scaling security in a cloud environment  v0.5 (Sep 2017)Scaling security in a cloud environment  v0.5 (Sep 2017)
Scaling security in a cloud environment v0.5 (Sep 2017)
 
OWASP SB -Threat modeling 101
OWASP SB -Threat modeling 101OWASP SB -Threat modeling 101
OWASP SB -Threat modeling 101
 
Introduction to threat_modeling
Introduction to threat_modelingIntroduction to threat_modeling
Introduction to threat_modeling
 
DevSecOps at Agile 2019
DevSecOps at   Agile 2019 DevSecOps at   Agile 2019
DevSecOps at Agile 2019
 
Story about module management with angular.js
Story about module management with angular.jsStory about module management with angular.js
Story about module management with angular.js
 
Secure development in .NET with EPiServer Solita
Secure development in .NET with EPiServer SolitaSecure development in .NET with EPiServer Solita
Secure development in .NET with EPiServer Solita
 
Secure Code Review 101
Secure Code Review 101Secure Code Review 101
Secure Code Review 101
 
Robots in Swift
Robots in SwiftRobots in Swift
Robots in Swift
 
JSMVCOMFG - To sternly look at JavaScript MVC and Templating Frameworks
JSMVCOMFG - To sternly look at JavaScript MVC and Templating FrameworksJSMVCOMFG - To sternly look at JavaScript MVC and Templating Frameworks
JSMVCOMFG - To sternly look at JavaScript MVC and Templating Frameworks
 
Node.js for enterprise - JS Conference
Node.js for enterprise - JS ConferenceNode.js for enterprise - JS Conference
Node.js for enterprise - JS Conference
 
An Abusive Relationship with AngularJS by Mario Heiderich - CODE BLUE 2015
An Abusive Relationship with AngularJS by Mario Heiderich - CODE BLUE 2015An Abusive Relationship with AngularJS by Mario Heiderich - CODE BLUE 2015
An Abusive Relationship with AngularJS by Mario Heiderich - CODE BLUE 2015
 
Thinking In Swift
Thinking In SwiftThinking In Swift
Thinking In Swift
 
Security hole #5 application security science or quality assurance
Security hole #5 application security   science or quality assuranceSecurity hole #5 application security   science or quality assurance
Security hole #5 application security science or quality assurance
 
The innerHTML Apocalypse
The innerHTML ApocalypseThe innerHTML Apocalypse
The innerHTML Apocalypse
 
How my team is applying JS framework for PHP projects.
How my team is applying JS framework for PHP projects.How my team is applying JS framework for PHP projects.
How my team is applying JS framework for PHP projects.
 
MobSecCon 2015 - Dynamic Analysis of Android Apps
MobSecCon 2015 - Dynamic Analysis of Android AppsMobSecCon 2015 - Dynamic Analysis of Android Apps
MobSecCon 2015 - Dynamic Analysis of Android Apps
 
What the Struts?
What the Struts?What the Struts?
What the Struts?
 
StHack 2014 - Mario "@0x6D6172696F" Heiderich - JSMVCOMFG
StHack 2014 - Mario "@0x6D6172696F" Heiderich - JSMVCOMFGStHack 2014 - Mario "@0x6D6172696F" Heiderich - JSMVCOMFG
StHack 2014 - Mario "@0x6D6172696F" Heiderich - JSMVCOMFG
 

Recently uploaded

Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 

Recently uploaded (20)

Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 

Let’s Check Let’s Encrypt: A Tool for Code-Driven Threat Modeling

  • 1. Let’s Check Let’s Encrypt Fraser Scott Christopher A. Wood* *Caveat: I don't work in InfoSec
  • 2. Agenda ● Threat modeling overview ○ Objectives ○ Difficulties and pain points in practice ● Inside-out vs outside-in ● ThreatSpec overview ● Examples ● Let’s Encrypt threat model ● Lessons learned ● Going Forward
  • 4. Threat Modeling ● Systematic identification of threats, actions, and mitigation strategies ○ What are you building? ○ What can go wrong? ○ What should you do about things that can go wrong? ○ Are you doing a good job? ● STRIDE ● DREAD
  • 5. Threat Modeling ● Systematic identification of threats, actions, and mitigation strategies ○ What are you building? ○ What can go wrong? ○ What should you do about things that can go wrong? ○ Are you doing a good job? ● STRIDE ● DREAD
  • 6. Threat Modeling ● Systematic identification of threats, actions, and mitigation strategies ○ What are you building? ○ What can go wrong? ○ What should you do about things that can go wrong? ○ Are you doing a good job? ● STRIDE ● DREAD Go read Threat Modeling: Designing for Security by Adam Shostack
  • 7. Objectives ● Build secure products and services ● Secure by design rather than bolting on controls
  • 8. Pain Points ● Model can become out of sync with implementation ● Threat modeling isn’t continuous ● Additional documentation needs to be maintained
  • 9. Inside-out vs Outside-in ● The threat model generally works from the outside in (towards the assets) ○ This helps reduce redundant or unnecessary work internally ○ If an asset is never exposed, do you need to include it in the model? ○ Only model what's actually in play ● We advocate working from the inside out ○ Assets (code) are modeled directly ○ Models are joined and merged to form larger models for a system ○ The full picture emerges organically
  • 11. ThreatSpec ● R-Spec for Threat Modeling ● Add threat model context to code ● Generate reports dynamically ● Security, QA, Developers etc working closely together (peer review)
  • 12. Some Vocabulary ● Component - Individual part of the system ● Boundary - Separation of trust ● Threat - The thing that could go wrong ● Mitigation - Fixing or working around the threat ● Exposure - Not fixing the threat ● Acceptance - Accepting the risk of the threat
  • 13. Grammar Overview @alias boundary|component|threat ID to NAME @describe boundary|component|threat ID as DESCRIPTION @mitigates BOUNDARY:COMPONENT against THREAT with MITIGATION [(REFERENCES)] @exposes BOUNDARY:COMPONENT to THREAT with EXPOSURE [(REFERENCES)] @transfers THREAT to BOUNDARY:COMPONENT with TRANSFER [(REFERENCES)] @accepts THREAT to BOUNDARY:COMPONENT with ACCEPTANCE [(REFERENCES)] @review ???
  • 14. Example code @mitigates @webapp:FileSystem against unauthorised access with strict file permissions (#122) @exposes @webapp:App to XSS with insufficient input validation (#124,#133) @transfers @cwe_319_cleartext_transmission to User:Browser with non-sensitive information (#125) @accepts arbitrary file writes to @webapp:FileSystem with filename restrictions (#106) from threatspec.org
  • 16. Let’s Encrypt Threat Model ● Code base and protocol overview ● Our task (read it, understand it, try to model it)
  • 17. Snippets from Let’s Encrypt acme/clent.py # @mitigates @acme:@client against @cwe_693_protection_mechanism_failure with loads better library if old python version detected if sys.version_info < (2, 7, 9): # pragma: no cover requests.packages.urllib3.contrib.pyopenssl.inject_into_urllib3() acme/clent.py """ @transfers @cwe_320_key_management_errors to @app:@caller with no key validation or checks carried out @mitigates @acme:@client against @cwe_295_improper_certificate_validation with verifies SSL by default @review alg makes sense? RS256? """ DER_CONTENT_TYPE = 'application/pkix-cert'
  • 18. Unchecked Deserialization acme/messages.py def __init__(self, jobj): """ @exposes @acme:@directory to @cwe_36_absolute_path_traversal with possible relative URLs @exposes @acme:@directory to @cwe_502_deserialization_of_untrusted_data with deserialization of data that's not defined in the ACME spec """ canon_jobj = util.map_keys(jobj, self._canon_key) if not set(canon_jobj).issubset(self._REGISTERED_TYPES): # TODO: acme-spec is not clear about this: 'It is a JSON # dictionary, whose keys are the "resource" values listed # in {{https-requests}}'z raise ValueError('Wrong directory fields') # TODO: check that everything is an absolute URL; acme-spec is # not clear on that self._jobj = canon_jobj
  • 19. JWK Loading Concerns acme/jose/jwk.py @classmethod def load(cls, data, password=None, backend=None): """Load serialized key as JWK. <snip> @review So if this fails to load asymmetric keys, it assumes use of symmetric and loads that instead? Sounds a bit surprising. If the key was corrupted, it could contain something relatively predictable that might end up be used as a symmetric key without the user noticing """ try: key = cls._load_cryptography_key(data, password, backend) except errors.Error as error: logger.debug('Loading symmetric key, asymmetric failed: %s', error) return JWKOct(key=data) <snip>
  • 20. Key Leakage acme/jose/jwk.py def fields_to_partial_json(self): """ @exposes @acme:@client to @cwe_320_key_management_errors by leaking private key material in JSON structure """ if isinstance(self.key._wrapped, rsa.RSAPublicKey): <snip> else: # rsa.RSAPrivateKey private = self.key.private_numbers() public = self.key.public_key().public_numbers() params = { 'n': public.n, 'e': public.e, 'd': private.d, 'p': private.p, <snip> } return dict((key, self._encode_param(value)) for key, value in six.iteritems(params))
  • 21. Notable Outcomes ● Identified some possible problems with the code (need to check with LE folks) ● Transfers are pretty common - libraries don’t always check stuff ● ThreatSpec could aid general code review
  • 22. Lessons Learned ● Up-front investment is steep ● Continual maintenance is easy (with educated developers) ● ThreatSpec needs more work (e.g. @review tag, grammatical tweaks, languages) ● Dynamic DFDs from call-graphs would have been very helpful
  • 23. Going Forward ● Make the threat model an artifact of assets -- code! ● Allow models to be generated inside-out and merged across projects, teams, and within an enterprise ● Let the treat model grow organically along with the code ● Generate dynamic DFDs using call-graphs ● Test in real systems and in real teams ● Experiment with developers ThreatSpec.org @ThreatSpec