SlideShare a Scribd company logo
©2018TrustInSoft
Benjamin Monate
Co-founder of TrustInSoft and CTO
Applying formal
methods to
existing
software: what
can you expect?
6/27/2018
©2018TrustInSoft
2
Sound Static Analysis
aka formal methods to prove properties of software
Works for Safety Critical Software
• Consequences of failures are analyzed fromthe beginning
• Regulation is strong: standards and associated liability
• Adapted development process: specific languages/dev. cycles
• Software errors mitigated with systemarchitecture
àconsidering probability of failure
©2018TrustInSoft
3
Sound Static Analysisfor Security Critical
Software?
• Meanings of failure probability?
àadversary defies standard distributions of the software input
• One single error àarbitrary corruption
• Confidentiality: secrets must not escape software
• Software already deployed in production: barely tested for security
- Because testing security is hard: looking for behaviors that have undefined
consequences but are most of the time invisible
- Observing a data leak is difficult: where shall it be observed? How shall one
recognize that some bits are part of a secret?
©2018TrustInSoft
4
TrustInSoft pragmatic and incremental security
Each level requires someprevious ones to bemeaningful
TrustInSoft Analyzer addresses Level 2 up to Level 5
Confidence
Level
Property Tool Guaranteed properties
Level 1 Each compilation
unit compiles
Compilers with warnings Statictypingand syntacticcompliance
Level 2 Integrity of link Sound SourceLinker Consistency of compilationunits (ODR/static inline/weak)
Level 3 Only defined
behaviors
Sound StaticAnalyzer Absenceof undefined behaviors/Integrity
Compilers optimizations makes the consequences more and more
dangerous
Level 4 Dataflowintegrity Sound StaticAnalyzer Absenceof unwanted data flows/Confidentiality
Level 5 Functional
correctness
Sound Functional
Verification
Programfulfills its functional specification
©2018TrustInSoft
5
Howto reach these levels on legacy code?
• Level 1 for free
• Level 2 automatic with TrustInSoft Analyzer: just provide all source files
May be detected by modern binary-level LTO
Reduced example fromXen
file1.c: int GlobalConfig[255] = { 0 };
file2.c: extern int *Globalconfig;
• Level 3 not easy to get because
- Soundness: false alarms, not the most important problem
- Programs contain bugs: must be fixed to give semantics
©2018TrustInSoft
6
Methodology toward Level 3 security
Do not explore all execution paths at once, but
• Explore simple path: rely on existing test-suite
• Fix all discovered bugs
- Unliketesting: detect invisibleundefined behaviors
àInvisiblebut may hidesecurity bugs thanks to compiler optimization/platform
specificities
- No need to befully deterministic: external functions/hardwareare stubbed
- Useanexistingtest to reach somedifficult-to-reach programpoints (after SSL
certificatevalidation) and theninvent newtests by mutating the input data that do not
changetheinitial paths (fuzzing, manual testing)
- Generalizethetests progressively àfix bugs one after the other
- Maybe one reaches a state where all behaviors are covered
àBut if onedoes not, thesecurity is still vastly improved, step-by-step
©2018TrustInSoft
7
Howlong does it take to get a proof of
absence of undefined behaviors?
• Major industrial question: ROI, Time To Market, Total Cost of Ownership
• Important but flawed question:
- It takes the time that one needs to fix all the discovered bugs
- No one knows howto evaluate this soundly
• Cyber-security is incremental
- Soundness does not mean: “all questions answered”
- Soundness does mean: “some questions answered definitively”
Not necessarily “the” whole question
©2018TrustInSoft
8
Examples: tooling funded for zero false positive
and zero false negative source code analysis
Hundreds of security bugs discovered: most of themfixed upstream
• Initial analysis: existing test-suites
• Further analysis: AFL fuzzing
• Next steps: generalized input to reach more behaviors
Invalid memory accesses, signed overflows, uninitialized data, double free, strict aliasing violations,
constant execution time…
OpenSSL, Amazon S2N, Google Libwebp, expat, libpng, SQLite, musl,
libjpg, libsodium, LibreSSL, tiny ssh, libxml, zlib, ntpd, libbzip2,
dpdk, nova, libksba
©2018TrustInSoft
9
Examples: subtle bug in Google’s libwebp
• Invalid pointer computation: invisible UB
• Followed by invalid pointer comparison
- result depends on memory layout
- If the result is wrong, out-of-bound access occurs
• LLVMASan statistically uses the memory layout without consequences
• TrustInSoft Analyzer’s soundness means: all memory layouts are explored
©2018TrustInSoft
10
Full Level 3 is reachable
Proof of absence of UBs for some configurations of mbed TLS
Read the full technical report at https: //trust-in-soft.com/polarssl-verification-kit/
©2018TrustInSoft
11
Good news for cyber-security
• These examples are the most difficult software to analyze
- Huge legacy, multi-purpose code bases
- No developer was involved in the analysis: only bug reports
- Time to convince developers/maintainers that fixing issues is important
• And still: it works!
Security is improved: fewer bugs and unmodified dev. process
• In the industry, this is much simpler!
©2018TrustInSoft
12
Level 4 : Dataflowintegrity
Example: look for the sources of randomnumbers in OpenSSL
Explicit security property: Random generators seeds are acceptable
- Customer knows what "acceptable" means
- Tools can extract the origin of the data: sound means exhaustive
Findings: a dozen of sources are used, including the private certificate
Customer conclusion: we must configure the stack to avoid this
Classical security analysis: define attack surfaces and implement proper mitigations
This works onthesourcecode, if security expressed interms of programs behaviors
©2018TrustInSoft
13
Level 5: full specifications for all functions
Kind of a Grail for programcorrectness
• We support this usage
• Impacts the dev. Cycle:
- Produce specifications
- Check specifications
àsoftware developed to make it provable maybe with dedicated languages/methodology
• Adopted only for very specific parts of very specific safety/security critical
software
©2018TrustInSoft
14
Conclusion
• Soundness of tools is a definitive improvement for security
• Do not try to reach the highest integrity levels instantly
• Stopping in the middle of any level is worth it
àone reduces its hidden technical debt
• Difference with unsound tools
àeach step is a definitive improvement for security
àWhen it is done, it is for real
©2018TrustInSoft
15
Thank you
Benjamin.Monate@trust-in-soft.com

More Related Content

PPTX
Cyber security - It starts with the embedded system
PDF
Create code confidence for better application security
PPTX
Programming languages and techniques for today’s embedded andIoT world
PDF
BlueHat v18 || Go build a tool - best practices for building a robust & e...
PDF
Open Source Security for Newbies - Best Practices
PPTX
Agile and Secure SDLC
PDF
Proving the Security of Low-Level Software Components & TEEs
PPTX
A Brief Insight into Penetration Testing
Cyber security - It starts with the embedded system
Create code confidence for better application security
Programming languages and techniques for today’s embedded andIoT world
BlueHat v18 || Go build a tool - best practices for building a robust & e...
Open Source Security for Newbies - Best Practices
Agile and Secure SDLC
Proving the Security of Low-Level Software Components & TEEs
A Brief Insight into Penetration Testing

What's hot (20)

PDF
Shift Left Security
PPTX
DevSecOps Beginners Guide : How to secure process in DevOps with OpenSource
PPTX
Integrating security into Continuous Delivery
PDF
Flight East 2018 Presentation–Continuous Integration––An Overview
PPTX
Securing the continuous integration
PPT
Introducing: Klocwork Insight Pro | November 2009
PPTX
Application Security from the Inside Out
PDF
Flight East 2018 Presentation–Black Duck at Docusign
PPTX
Shifting the conversation from active interception to proactive neutralization
PDF
Static Analysis Techniques For Testing Application Security - Houston Tech Fest
PPTX
Perforce on Tour 2015 - Grab Testing By the Horns and Move
PDF
Are Agile And Secure Development Mutually Exclusive?
PPTX
Speeding Up Secure Software Development
PDF
Devops security-An Insight into Secure-SDLC
PDF
How to Manage the Risk of your Polyglot Environments
PDF
Integrating Black Duck into your Agile DevOps Environment
PPTX
Security Services and Approach by Nazar Tymoshyk
PPTX
Static Code Analysis
PPTX
Automating Your Tools: How to Free Up Your Security Professionals for Actual ...
PDF
A Successful SAST Tool Implementation
Shift Left Security
DevSecOps Beginners Guide : How to secure process in DevOps with OpenSource
Integrating security into Continuous Delivery
Flight East 2018 Presentation–Continuous Integration––An Overview
Securing the continuous integration
Introducing: Klocwork Insight Pro | November 2009
Application Security from the Inside Out
Flight East 2018 Presentation–Black Duck at Docusign
Shifting the conversation from active interception to proactive neutralization
Static Analysis Techniques For Testing Application Security - Houston Tech Fest
Perforce on Tour 2015 - Grab Testing By the Horns and Move
Are Agile And Secure Development Mutually Exclusive?
Speeding Up Secure Software Development
Devops security-An Insight into Secure-SDLC
How to Manage the Risk of your Polyglot Environments
Integrating Black Duck into your Agile DevOps Environment
Security Services and Approach by Nazar Tymoshyk
Static Code Analysis
Automating Your Tools: How to Free Up Your Security Professionals for Actual ...
A Successful SAST Tool Implementation
Ad

Similar to Applying formal methods to existing software by B.Monate (20)

PPTX
Zero-bug Software, Mathematically Guaranteed
PDF
Mathematically Guaranteeing Code Correctness with TrustInSoft
PDF
Secure Programming With Static Analysis
PDF
Mise en œuvre des méthodes de vérification de modèle et d'analyse statique de...
PPTX
BUSTED! How to Find Security Bugs Fast!
PPTX
Static Code Analysis
PDF
Introduction to Software Testing
PDF
Applying Software Quality Models to Software Security
PDF
ISSRE 2008 Trip Report
PDF
Software reliability
PPTX
Software Testing
PDF
SCA del Software Open Source: come interpretarlo per evitare problemi di sicu...
PDF
O0181397100
PPTX
basic concepts & preliminaries Testing.pptx
PDF
Software Testing.pdf
DOCX
Softwaretestingstrategies
PDF
Secure software chapman
PPT
Lecture18- Testing Strategy.ppt by aiman
PDF
Software Security Engineering (Learnings from the past to fix the future) - B...
PPTX
How to achieve security, reliability, and productivity in less time
Zero-bug Software, Mathematically Guaranteed
Mathematically Guaranteeing Code Correctness with TrustInSoft
Secure Programming With Static Analysis
Mise en œuvre des méthodes de vérification de modèle et d'analyse statique de...
BUSTED! How to Find Security Bugs Fast!
Static Code Analysis
Introduction to Software Testing
Applying Software Quality Models to Software Security
ISSRE 2008 Trip Report
Software reliability
Software Testing
SCA del Software Open Source: come interpretarlo per evitare problemi di sicu...
O0181397100
basic concepts & preliminaries Testing.pptx
Software Testing.pdf
Softwaretestingstrategies
Secure software chapman
Lecture18- Testing Strategy.ppt by aiman
Software Security Engineering (Learnings from the past to fix the future) - B...
How to achieve security, reliability, and productivity in less time
Ad

Recently uploaded (20)

PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PPTX
Operating system designcfffgfgggggggvggggggggg
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PDF
AI in Product Development-omnex systems
PPTX
Reimagine Home Health with the Power of Agentic AI​
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
Understanding Forklifts - TECH EHS Solution
PDF
System and Network Administration Chapter 2
PDF
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
PDF
Nekopoi APK 2025 free lastest update
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PDF
medical staffing services at VALiNTRY
PDF
Digital Strategies for Manufacturing Companies
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PPTX
Odoo POS Development Services by CandidRoot Solutions
Upgrade and Innovation Strategies for SAP ERP Customers
Operating system designcfffgfgggggggvggggggggg
VVF-Customer-Presentation2025-Ver1.9.pptx
Internet Downloader Manager (IDM) Crack 6.42 Build 41
AI in Product Development-omnex systems
Reimagine Home Health with the Power of Agentic AI​
Softaken Excel to vCard Converter Software.pdf
Design an Analysis of Algorithms I-SECS-1021-03
Understanding Forklifts - TECH EHS Solution
System and Network Administration Chapter 2
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
Nekopoi APK 2025 free lastest update
Which alternative to Crystal Reports is best for small or large businesses.pdf
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
medical staffing services at VALiNTRY
Digital Strategies for Manufacturing Companies
How to Migrate SBCGlobal Email to Yahoo Easily
Wondershare Filmora 15 Crack With Activation Key [2025
Odoo POS Development Services by CandidRoot Solutions

Applying formal methods to existing software by B.Monate

  • 1. ©2018TrustInSoft Benjamin Monate Co-founder of TrustInSoft and CTO Applying formal methods to existing software: what can you expect? 6/27/2018
  • 2. ©2018TrustInSoft 2 Sound Static Analysis aka formal methods to prove properties of software Works for Safety Critical Software • Consequences of failures are analyzed fromthe beginning • Regulation is strong: standards and associated liability • Adapted development process: specific languages/dev. cycles • Software errors mitigated with systemarchitecture àconsidering probability of failure
  • 3. ©2018TrustInSoft 3 Sound Static Analysisfor Security Critical Software? • Meanings of failure probability? àadversary defies standard distributions of the software input • One single error àarbitrary corruption • Confidentiality: secrets must not escape software • Software already deployed in production: barely tested for security - Because testing security is hard: looking for behaviors that have undefined consequences but are most of the time invisible - Observing a data leak is difficult: where shall it be observed? How shall one recognize that some bits are part of a secret?
  • 4. ©2018TrustInSoft 4 TrustInSoft pragmatic and incremental security Each level requires someprevious ones to bemeaningful TrustInSoft Analyzer addresses Level 2 up to Level 5 Confidence Level Property Tool Guaranteed properties Level 1 Each compilation unit compiles Compilers with warnings Statictypingand syntacticcompliance Level 2 Integrity of link Sound SourceLinker Consistency of compilationunits (ODR/static inline/weak) Level 3 Only defined behaviors Sound StaticAnalyzer Absenceof undefined behaviors/Integrity Compilers optimizations makes the consequences more and more dangerous Level 4 Dataflowintegrity Sound StaticAnalyzer Absenceof unwanted data flows/Confidentiality Level 5 Functional correctness Sound Functional Verification Programfulfills its functional specification
  • 5. ©2018TrustInSoft 5 Howto reach these levels on legacy code? • Level 1 for free • Level 2 automatic with TrustInSoft Analyzer: just provide all source files May be detected by modern binary-level LTO Reduced example fromXen file1.c: int GlobalConfig[255] = { 0 }; file2.c: extern int *Globalconfig; • Level 3 not easy to get because - Soundness: false alarms, not the most important problem - Programs contain bugs: must be fixed to give semantics
  • 6. ©2018TrustInSoft 6 Methodology toward Level 3 security Do not explore all execution paths at once, but • Explore simple path: rely on existing test-suite • Fix all discovered bugs - Unliketesting: detect invisibleundefined behaviors àInvisiblebut may hidesecurity bugs thanks to compiler optimization/platform specificities - No need to befully deterministic: external functions/hardwareare stubbed - Useanexistingtest to reach somedifficult-to-reach programpoints (after SSL certificatevalidation) and theninvent newtests by mutating the input data that do not changetheinitial paths (fuzzing, manual testing) - Generalizethetests progressively àfix bugs one after the other - Maybe one reaches a state where all behaviors are covered àBut if onedoes not, thesecurity is still vastly improved, step-by-step
  • 7. ©2018TrustInSoft 7 Howlong does it take to get a proof of absence of undefined behaviors? • Major industrial question: ROI, Time To Market, Total Cost of Ownership • Important but flawed question: - It takes the time that one needs to fix all the discovered bugs - No one knows howto evaluate this soundly • Cyber-security is incremental - Soundness does not mean: “all questions answered” - Soundness does mean: “some questions answered definitively” Not necessarily “the” whole question
  • 8. ©2018TrustInSoft 8 Examples: tooling funded for zero false positive and zero false negative source code analysis Hundreds of security bugs discovered: most of themfixed upstream • Initial analysis: existing test-suites • Further analysis: AFL fuzzing • Next steps: generalized input to reach more behaviors Invalid memory accesses, signed overflows, uninitialized data, double free, strict aliasing violations, constant execution time… OpenSSL, Amazon S2N, Google Libwebp, expat, libpng, SQLite, musl, libjpg, libsodium, LibreSSL, tiny ssh, libxml, zlib, ntpd, libbzip2, dpdk, nova, libksba
  • 9. ©2018TrustInSoft 9 Examples: subtle bug in Google’s libwebp • Invalid pointer computation: invisible UB • Followed by invalid pointer comparison - result depends on memory layout - If the result is wrong, out-of-bound access occurs • LLVMASan statistically uses the memory layout without consequences • TrustInSoft Analyzer’s soundness means: all memory layouts are explored
  • 10. ©2018TrustInSoft 10 Full Level 3 is reachable Proof of absence of UBs for some configurations of mbed TLS Read the full technical report at https: //trust-in-soft.com/polarssl-verification-kit/
  • 11. ©2018TrustInSoft 11 Good news for cyber-security • These examples are the most difficult software to analyze - Huge legacy, multi-purpose code bases - No developer was involved in the analysis: only bug reports - Time to convince developers/maintainers that fixing issues is important • And still: it works! Security is improved: fewer bugs and unmodified dev. process • In the industry, this is much simpler!
  • 12. ©2018TrustInSoft 12 Level 4 : Dataflowintegrity Example: look for the sources of randomnumbers in OpenSSL Explicit security property: Random generators seeds are acceptable - Customer knows what "acceptable" means - Tools can extract the origin of the data: sound means exhaustive Findings: a dozen of sources are used, including the private certificate Customer conclusion: we must configure the stack to avoid this Classical security analysis: define attack surfaces and implement proper mitigations This works onthesourcecode, if security expressed interms of programs behaviors
  • 13. ©2018TrustInSoft 13 Level 5: full specifications for all functions Kind of a Grail for programcorrectness • We support this usage • Impacts the dev. Cycle: - Produce specifications - Check specifications àsoftware developed to make it provable maybe with dedicated languages/methodology • Adopted only for very specific parts of very specific safety/security critical software
  • 14. ©2018TrustInSoft 14 Conclusion • Soundness of tools is a definitive improvement for security • Do not try to reach the highest integrity levels instantly • Stopping in the middle of any level is worth it àone reduces its hidden technical debt • Difference with unsound tools àeach step is a definitive improvement for security àWhen it is done, it is for real