SlideShare a Scribd company logo
1 of 43
Finding the Weak
Link in Windows
Binaries
Source Conference, Boston – April 18, 2012
Overview

•What?
•Why?
•How?
•Conclusions
What?
What?

   Without debug symbols or source
   code identify Windows binaries
   that do not leverage the
   available defenses
What?
• OS provided defenses
• Compiler provided defenses
• Compiler enabled defenses
• Linker enabled defenses
• Developer enabled defenses
• Developer secure coding practices
What?
• Version of compiler / linker
• Compiler / linker enabled protections
 • ASLR
 • DEP (NX)
 • Stack cookies
 • Safe Structured Exception Handling
• Developer used defensive APIs
 • Heap corruption behavior, DEP policy
 • DLL planting, pointer encoding
What?
• SDL banned APIs
• Dangerous APIs
 • undermining compiler/linker protections
• UAC / Integrity Level - Developer
• .NET security - Developer
 • Unmanaged code
 • Strong names
 • Partially trusted callers
Why?
Why? - Defensive
• A product == many vendors
 • e.g. Adobe Reader 10.0 == [guess?]
• License != source code
• License != private symbols
• SDL assurance…
 • getting the free security features enabled
• End user assurance / threat awareness
 • Understanding where you need EMET
Or put another way
• A vendors SDL is not enough
 • doesn’t always flow upstream
• A vendor who ships doesn’t assure
 • all third party components
• End user organisations taking ownership
 • of risk
 • of mitigations
Why? - Offensive
• Mitigations are expensive / difficult
• Application specific bugs are expensive
• Maximize research ROI
 • if your goal is to exploit
 • … find the weak link
 • … reduce headaches
Or put another way
• IIS 7.5 FTP DoS
• Chris Valasek / Ryan Smith school us
 • ‘Modern Heap Exploitation using the Low
   Fragmentation Heap’
• Achieved EIP
• … still no win … ASLR
• … lets minimize the tears …
• … unless you want to info leak to win …
How?
Version of Compiler / Linker
• Linker version in the PE header


• ‘Rich’ header
 • Microsoft compiler specific
 • documented in 29a virus e-zine in 2004
 • further documented in 2008
 • embeds compiler IDs
 • XOR encoded
Version of Compiler / Linker
Version of Compiler / Linker
• Version mapping exercise undertaken in
  January 2010
• Visual Studio 6 -> Visual Studio 2010 mapped
• Why?
 • Missing compiler protections
 • Weaker compiler protections
Compiler / Linker Protections
• ASLR compatibility – PE header



• Data Execution Prevention – PE header




 • always on for 64bit no matter what
Compiler / Linker Protections
• Stack Cookies – PE Header, Imports and
  Heuristics



 • imports
   • _crt_debugger_hook
 • heuristics – GS function epilogue / prologue
   • allows versioning
   • using FLIRT like signatures
Compiler / Linker Protections
• SafeSEH – PE header (32bit only)
 • SEH == Structured Exception Handling
Compiler / Linker Protections
• Load Configuration Directory size
 • If size of directory entry <> 64 then MS12-001
    • NOT the size field in the LCD!
 • Microsoft Visual C msvcr71.dll == 72
 • Anything built with Microsoft Visual C++ .NET
   2003 RTM
    • suprising amount of stuff
Default Process Heap
• Default process heap executable
 • PE header
Shared Sections
• Shared sections executable & writeable
 • PE header
 • would be mapped across processes
Defensive APIs
• HeapSetInformation
  • HeapEnableTerminationOnCorr
    uption
• SetProcessDEPPolicy
 • PROCESS_DEP_ENABLE
• EncodePointer
SDL Banned APIs
• Microsoft SDL banned APIs
 • parse the Import Address Table
 • 145 or them
 • indication of security awareness
Dangerous APIs
• VirtualAlloc
 • doesn’t benefit from ASLR
 • if mapping pages executable == win
 • we released VirtualAlloc_s.h
• LoadLibrary
 • if DLL planting mitigations aren’t used
DLL / Executable Planting
• Use of LoadLibrary /
  CreateProcess
• But doesn’t use
 • SetDLLDirectory
 • SetDefaultDllDirectories
 • AddDllDirectory
• There is also a registry key
 • more on this later
UAC / Integrity Level
• In the binaries manifest
.NET Security
• Strong name checks
• Allow partially trusted callers
 • AllowPartiallyTrustedCallersA
   ttribute
.NET Security
App Containers
• New for Windows 8
 • a new DLL characteristic
• Manifest
 • detailing capabilities
• … for more information refer to our blog …
Miscellaneous
• Force Integrity



• Company
 • File Version resource section
• Signer
• Signature type
Existing tools….
Existing Tools - LookingGlass
• from Errata Security
 • http://www.erratasec.com/
• .NET Based PE Scanner
 • Scans the file system or running processes
• Limitations in checks
 • No /SafeSEH
 • No /GS
 • No HeapSetInformation /
   SetProcessDEPPolicy
Existing Tools - BinScope
• from Microsoft
  • http://www.microsoft.com/download/en/d
    etails.aspx?id=11910
• Lots of checks
 • some of what I’ve discussed, but not all!
• Some Extra
  • non-GS friendly initialization / coverage
  • ATL version and vulnerable check
• Needs private symbols!
New tool…
Demo Recx SDL Binary Assure
Beyond binaries
• Defense in depth features via the registry
• Needs installer teams buy-in
• or after market adoption
• Image Execution Options
 • MitigationOptions
 • CWDIllegalInDllSearch
 • DisableExceptionChainValidation
But ….
But even with all these…
Bonus Material - ELF
• Similar(ish) tool exists for ELF
  • readelf && a
    shell script (checksec.h
    @ trapkit.de)
• RPATH / RUNPATH
  • contained in a section of an ELF
  • can override library locations
  • path doesn’t exist and
    you can create == win
  • added to checksec.sh
Conclusions….
Conclusions
• Lot of information available in binaries
• Help with assurance / assessment
 • for vendors and / or end organisations
• Help with target identification
 • target lower hanging fruit
 • less SDL aware components
• Without the use of symbols…
Thanks! Questions?




 Research, Develop, Assess, Consult & Educate
  https://www.surveymonkey.com/sourceboston12


  @RecxLtd                       ollie@recx.co.uk

More Related Content

Recently uploaded

🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
[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
 
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
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
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 Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
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
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
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
 

Recently uploaded (20)

🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
[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
 
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
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
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 Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
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
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
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
 

Featured

AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 

Featured (20)

AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 

2012 04-18 --source_boston_-_finding_the_weak_link_in_windows_binaries

  • 1. Finding the Weak Link in Windows Binaries Source Conference, Boston – April 18, 2012
  • 4. What? Without debug symbols or source code identify Windows binaries that do not leverage the available defenses
  • 5. What? • OS provided defenses • Compiler provided defenses • Compiler enabled defenses • Linker enabled defenses • Developer enabled defenses • Developer secure coding practices
  • 6. What? • Version of compiler / linker • Compiler / linker enabled protections • ASLR • DEP (NX) • Stack cookies • Safe Structured Exception Handling • Developer used defensive APIs • Heap corruption behavior, DEP policy • DLL planting, pointer encoding
  • 7. What? • SDL banned APIs • Dangerous APIs • undermining compiler/linker protections • UAC / Integrity Level - Developer • .NET security - Developer • Unmanaged code • Strong names • Partially trusted callers
  • 9. Why? - Defensive • A product == many vendors • e.g. Adobe Reader 10.0 == [guess?] • License != source code • License != private symbols • SDL assurance… • getting the free security features enabled • End user assurance / threat awareness • Understanding where you need EMET
  • 10. Or put another way • A vendors SDL is not enough • doesn’t always flow upstream • A vendor who ships doesn’t assure • all third party components • End user organisations taking ownership • of risk • of mitigations
  • 11. Why? - Offensive • Mitigations are expensive / difficult • Application specific bugs are expensive • Maximize research ROI • if your goal is to exploit • … find the weak link • … reduce headaches
  • 12. Or put another way • IIS 7.5 FTP DoS • Chris Valasek / Ryan Smith school us • ‘Modern Heap Exploitation using the Low Fragmentation Heap’ • Achieved EIP • … still no win … ASLR • … lets minimize the tears … • … unless you want to info leak to win …
  • 13. How?
  • 14. Version of Compiler / Linker • Linker version in the PE header • ‘Rich’ header • Microsoft compiler specific • documented in 29a virus e-zine in 2004 • further documented in 2008 • embeds compiler IDs • XOR encoded
  • 16. Version of Compiler / Linker • Version mapping exercise undertaken in January 2010 • Visual Studio 6 -> Visual Studio 2010 mapped • Why? • Missing compiler protections • Weaker compiler protections
  • 17. Compiler / Linker Protections • ASLR compatibility – PE header • Data Execution Prevention – PE header • always on for 64bit no matter what
  • 18. Compiler / Linker Protections • Stack Cookies – PE Header, Imports and Heuristics • imports • _crt_debugger_hook • heuristics – GS function epilogue / prologue • allows versioning • using FLIRT like signatures
  • 19. Compiler / Linker Protections • SafeSEH – PE header (32bit only) • SEH == Structured Exception Handling
  • 20. Compiler / Linker Protections • Load Configuration Directory size • If size of directory entry <> 64 then MS12-001 • NOT the size field in the LCD! • Microsoft Visual C msvcr71.dll == 72 • Anything built with Microsoft Visual C++ .NET 2003 RTM • suprising amount of stuff
  • 21. Default Process Heap • Default process heap executable • PE header
  • 22. Shared Sections • Shared sections executable & writeable • PE header • would be mapped across processes
  • 23. Defensive APIs • HeapSetInformation • HeapEnableTerminationOnCorr uption • SetProcessDEPPolicy • PROCESS_DEP_ENABLE • EncodePointer
  • 24. SDL Banned APIs • Microsoft SDL banned APIs • parse the Import Address Table • 145 or them • indication of security awareness
  • 25. Dangerous APIs • VirtualAlloc • doesn’t benefit from ASLR • if mapping pages executable == win • we released VirtualAlloc_s.h • LoadLibrary • if DLL planting mitigations aren’t used
  • 26. DLL / Executable Planting • Use of LoadLibrary / CreateProcess • But doesn’t use • SetDLLDirectory • SetDefaultDllDirectories • AddDllDirectory • There is also a registry key • more on this later
  • 27. UAC / Integrity Level • In the binaries manifest
  • 28. .NET Security • Strong name checks • Allow partially trusted callers • AllowPartiallyTrustedCallersA ttribute
  • 30. App Containers • New for Windows 8 • a new DLL characteristic • Manifest • detailing capabilities • … for more information refer to our blog …
  • 31. Miscellaneous • Force Integrity • Company • File Version resource section • Signer • Signature type
  • 33. Existing Tools - LookingGlass • from Errata Security • http://www.erratasec.com/ • .NET Based PE Scanner • Scans the file system or running processes • Limitations in checks • No /SafeSEH • No /GS • No HeapSetInformation / SetProcessDEPPolicy
  • 34. Existing Tools - BinScope • from Microsoft • http://www.microsoft.com/download/en/d etails.aspx?id=11910 • Lots of checks • some of what I’ve discussed, but not all! • Some Extra • non-GS friendly initialization / coverage • ATL version and vulnerable check • Needs private symbols!
  • 36. Demo Recx SDL Binary Assure
  • 37. Beyond binaries • Defense in depth features via the registry • Needs installer teams buy-in • or after market adoption • Image Execution Options • MitigationOptions • CWDIllegalInDllSearch • DisableExceptionChainValidation
  • 39. But even with all these…
  • 40. Bonus Material - ELF • Similar(ish) tool exists for ELF • readelf && a shell script (checksec.h @ trapkit.de) • RPATH / RUNPATH • contained in a section of an ELF • can override library locations • path doesn’t exist and you can create == win • added to checksec.sh
  • 42. Conclusions • Lot of information available in binaries • Help with assurance / assessment • for vendors and / or end organisations • Help with target identification • target lower hanging fruit • less SDL aware components • Without the use of symbols…
  • 43. Thanks! Questions? Research, Develop, Assess, Consult & Educate https://www.surveymonkey.com/sourceboston12 @RecxLtd ollie@recx.co.uk