SlideShare una empresa de Scribd logo
1 de 26
Reversing Microsoft Patches to reveal Vulnerable code HarsimranWalia http://null.co.in/ http://nullcon.net/
http://null.co.in/ http://nullcon.net/ Introduction Finding a 0day vulnerability  Vulnerability reaches the vendor Vendor finds a fix Releases a patch to fix the vulnerability Microsoft patches Reverse engineer the patch Locate the vulnerability patched Highlight the difficulties Birth of a security patch Discussion in the presentation
For reversing and obtaining binary difference in my demos I would be using DarunGrim2 	How DarunGrim works? The schema of DarunGrim is shown in  	 the figure To generate diffing results Binaries are disassembled in IDA Pro in the 	background and darungrim IDA plugin is run 	which creates the sqlite database Diffing Engine, the heart of DarunGrim2. 	The sqlite db from IDA and the binaries from GUI 	are fed into this engine as inputs  http://null.co.in/ http://nullcon.net/ Introduction
 Algorithm ? Main algorithm of DarunGrim is Basic block fingerprint hash map Each basic block is 1 entity whose fingerprint is generated from the instruction sequence Fingerprint hash generated by IDA Pro Two fingerprint hash tables one each for unpatched and patched binary For finding the binary difference, each unique fingerprint from original binary is searched against the fingerprints of patched binary for a match All fingerprints in the original binary hash tables are either matched or unmatched http://null.co.in/ http://nullcon.net/ Introduction
 Algorithm ? Contd.. For a function to be called matching, all the basic blocks in the function should be matching For unmatched functions DarunGrim calculates percentage match Match rate based on fingerprint string match Similar to GNU Diff algorithm which is finding longest common subsequence http://null.co.in/ http://nullcon.net/ Introduction
 Vulnerability Vs Exploit based signatures 	Exploit signatures Created by using byte string patterns or regular expressions  These are exploit specific  They are used widely mainly because of the ease of their creation Cater to only one type of input satisfying that vulnerability condition Fail: different attacks can exploit the same vulnerability, so exploit based signatures will fail  For eg. Exploit based signature ESig = “docx?AAAAAAAAAAA...” It will fail if some exploit uses a long string of B’s instead of A’s http://null.co.in/ http://nullcon.net/ Introduction
http://null.co.in/ http://nullcon.net/ Introduction  Vulnerability Vs Exploit based signatures 	Vulnerability signatures Based on the properties of the vulnerability and not on the properties of the exploit It is a superset of all the inputs satisfying a particular vulnerability condition For eg. Vulnerability based signature for previous case VSig = MATCH_STR (Buffer,"docx?(.*)$",limit) Matches string in buffer with the regex It is effective against any alphabet unlike exploit signature Vulnerability Signature Exploit Signature
 Vulnerability Vs Exploit based signatures 	 Vulnerability signatures contd.. For a good vulnerability signature It should strictly not allow any false negatives as even one exploit can pwn the system and create a gateway for the attacker into the network. It should allow very few false positives, as too many false positives may lead to a DoS attack for the system. The signature matching time should not create a considerable delay for the software and services. http://null.co.in/ http://nullcon.net/ Introduction
The first step of creating an undisclosed exploit is to find the vulnerability to exploit it. To verify if the patch released by Microsoft is working as per it is designed. To create vulnerability based signatures. http://null.co.in/ http://nullcon.net/ Need
http://null.co.in/ http://nullcon.net/ Process
http://null.co.in/ http://nullcon.net/ Finding patches Pick a vulnerability and download its patch Pick a vulnerability just before this one that patched the same program or dll If unavailable, use the same dll from your system Process Quick-fix Use open source ms-patch-tools to easily get the file versions to compare Problem ,[object Object]
FileVersioning,[object Object]
http://null.co.in/ http://nullcon.net/ Finding patches Extraction of files The traditional way of extracting file from patch  <patchfilename>.exe /x Works only till Windows XP and earlier versions of Windows Process Problem ,[object Object],[object Object]
http://null.co.in/ http://nullcon.net/ Finding patches Extraction of files DEMO Process
Finding patches http://null.co.in/ http://nullcon.net/ Extraction of files Binary Differencing DarunGrim v2 used for binary difference Feed in the two binaries to be compared Generates a list of functions with the %age match between the two files  Process Problem ,[object Object]
Includes false positives which requires manual analysis,[object Object]
Finding patches http://null.co.in/ http://nullcon.net/ Extraction of files Binary Differencing Differencing Analysis Process Manual inspection of functions with less than 100% match Remove false positives generated by problems like Instruction reordering Lot of reordering happening over different releases marks even the same blocks as unmatched Split blocks Block in the graph which has only parent and the parent has only one child leads to a split block. causing a problem in the matching process Can be improved by merging the two blocks and treating as a single block.
http://null.co.in/ http://nullcon.net/ Finding patches Extraction of files Binary Differencing Differencing Analysis Process Hot patching Instructions like moveax, eax at the start of functions are a sign of hot patching leading to a mismatch in the block By just ignoring the instruction we can get a match Compiler optimizations  Different compilers and even different versions of the same compiler perform different optimizations which also creates problems in getting proper difference Eventually reach a function which is indeed modified and might be the fix to the vulnerability being patched
Finding patches http://null.co.in/ http://nullcon.net/ Extraction of files Binary Differencing Differencing Analysis Process DEMO
Finding patches http://null.co.in/ http://nullcon.net/ Extraction of files Binary Differencing Differencing Analysis Process push 	[ebp-2Ch] 	  ; unsigned intcall 	??2@YAPAXI@Z    ; operator new(uint)mov  	ebx, eaxpop  	ecxmov  	[ebp-18h], ebxmov  	[ebp-3Ch], ebxmov  	byte ptr [ebp-4], 1push 	dwordptr [ebp-2Ch]mov  	ecx, esipush 	ebxpush    [ebp-30h] call    sub_118000C func(const *,void *,long)mov     edi, eaxtest    edi, edijge     short  push    [ebp-2Ch] 	  ; unsigned intcall    ??2@YAPAXI@Z    ; operator new(uint)pop     ecxmov     [ebp-14h], eax ;  ebp-14h = pBuffermov     [ebp-40h], eaxmov     byte ptr [ebp-4], 2push    [ebp-2Ch]mov     ecx, esipush    ebxpush    edicall    sub_118000C func(const *,void *,long)mov     esi, eaxtest    esi, esijge     short loc_118158A
Finding patches http://null.co.in/ http://nullcon.net/ Extraction of files Binary Differencing Differencing Analysis Process Debugging To validate our finding of analysis by debugging Getting a crash of the application Creating a malformed file to get the crash Would be using Immunity Debugger
Finding patches http://null.co.in/ http://nullcon.net/ Extraction of files Binary Differencing Differencing Analysis Process Debugging DEMO
Conclusion Presented an overview of how the 1-day exploits and Vulnerability signatures can be created Attempt was made to understand the process involved in reversing and the problems faced during the execution of the process Only talked about Microsoft patches but concept not limited to this. Concepts presented can be perfected by interested audience  http://null.co.in/ http://nullcon.net/
Thanks Questions?? http://null.co.in/ http://nullcon.net/
nullcon 2011 - Reversing MicroSoft patches to reveal vulnerable code

Más contenido relacionado

La actualidad más candente

We Continue Exploring Tizen: C# Components Proved to be of High Quality
We Continue Exploring Tizen: C# Components Proved to be of High QualityWe Continue Exploring Tizen: C# Components Proved to be of High Quality
We Continue Exploring Tizen: C# Components Proved to be of High QualityPVS-Studio
 
Testing Legacy Rails Apps
Testing Legacy Rails AppsTesting Legacy Rails Apps
Testing Legacy Rails AppsRabble .
 
Mastering Mock Objects - Advanced Unit Testing for Java
Mastering Mock Objects - Advanced Unit Testing for JavaMastering Mock Objects - Advanced Unit Testing for Java
Mastering Mock Objects - Advanced Unit Testing for JavaDenilson Nastacio
 
TDD and the Legacy Code Black Hole
TDD and the Legacy Code Black HoleTDD and the Legacy Code Black Hole
TDD and the Legacy Code Black HoleNoam Kfir
 
iOS Unit Testing
iOS Unit TestingiOS Unit Testing
iOS Unit Testingsgleadow
 
New Year PVS-Studio 6.00 Release: Scanning Roslyn
New Year PVS-Studio 6.00 Release: Scanning RoslynNew Year PVS-Studio 6.00 Release: Scanning Roslyn
New Year PVS-Studio 6.00 Release: Scanning RoslynPVS-Studio
 
Applying TDD to Legacy Code
Applying TDD to Legacy CodeApplying TDD to Legacy Code
Applying TDD to Legacy CodeAlexander Goida
 
PVS-Studio and static code analysis technique
PVS-Studio and static code analysis techniquePVS-Studio and static code analysis technique
PVS-Studio and static code analysis techniqueAndrey Karpov
 
Living With Legacy Code
Living With Legacy CodeLiving With Legacy Code
Living With Legacy CodeRowan Merewood
 
TDD with Visual Studio 2010
TDD with Visual Studio 2010TDD with Visual Studio 2010
TDD with Visual Studio 2010Stefano Paluello
 
The why and how of moving to php 8
The why and how of moving to php 8The why and how of moving to php 8
The why and how of moving to php 8Wim Godden
 
Unit Testing Android Applications
Unit Testing Android ApplicationsUnit Testing Android Applications
Unit Testing Android ApplicationsRody Middelkoop
 
Presentation_C++UnitTest
Presentation_C++UnitTestPresentation_C++UnitTest
Presentation_C++UnitTestRaihan Masud
 

La actualidad más candente (20)

We Continue Exploring Tizen: C# Components Proved to be of High Quality
We Continue Exploring Tizen: C# Components Proved to be of High QualityWe Continue Exploring Tizen: C# Components Proved to be of High Quality
We Continue Exploring Tizen: C# Components Proved to be of High Quality
 
Testing Legacy Rails Apps
Testing Legacy Rails AppsTesting Legacy Rails Apps
Testing Legacy Rails Apps
 
Mastering Mock Objects - Advanced Unit Testing for Java
Mastering Mock Objects - Advanced Unit Testing for JavaMastering Mock Objects - Advanced Unit Testing for Java
Mastering Mock Objects - Advanced Unit Testing for Java
 
TDD and the Legacy Code Black Hole
TDD and the Legacy Code Black HoleTDD and the Legacy Code Black Hole
TDD and the Legacy Code Black Hole
 
iOS Unit Testing
iOS Unit TestingiOS Unit Testing
iOS Unit Testing
 
New Year PVS-Studio 6.00 Release: Scanning Roslyn
New Year PVS-Studio 6.00 Release: Scanning RoslynNew Year PVS-Studio 6.00 Release: Scanning Roslyn
New Year PVS-Studio 6.00 Release: Scanning Roslyn
 
Applying TDD to Legacy Code
Applying TDD to Legacy CodeApplying TDD to Legacy Code
Applying TDD to Legacy Code
 
Unit Testing 101
Unit Testing 101Unit Testing 101
Unit Testing 101
 
PVS-Studio and static code analysis technique
PVS-Studio and static code analysis techniquePVS-Studio and static code analysis technique
PVS-Studio and static code analysis technique
 
Living With Legacy Code
Living With Legacy CodeLiving With Legacy Code
Living With Legacy Code
 
Write readable tests
Write readable testsWrite readable tests
Write readable tests
 
Unit Testing in iOS
Unit Testing in iOSUnit Testing in iOS
Unit Testing in iOS
 
TDD with Visual Studio 2010
TDD with Visual Studio 2010TDD with Visual Studio 2010
TDD with Visual Studio 2010
 
The why and how of moving to php 8
The why and how of moving to php 8The why and how of moving to php 8
The why and how of moving to php 8
 
Unit Testing Android Applications
Unit Testing Android ApplicationsUnit Testing Android Applications
Unit Testing Android Applications
 
Anti Debugging
Anti DebuggingAnti Debugging
Anti Debugging
 
Java bad coding practices
Java bad coding practicesJava bad coding practices
Java bad coding practices
 
Presentation_C++UnitTest
Presentation_C++UnitTestPresentation_C++UnitTest
Presentation_C++UnitTest
 
Exception handling in ASP .NET
Exception handling in ASP .NETException handling in ASP .NET
Exception handling in ASP .NET
 
JMockit
JMockitJMockit
JMockit
 

Similar a nullcon 2011 - Reversing MicroSoft patches to reveal vulnerable code

Reversing Microsoft patches to reveal vulnerable code
Reversing Microsoft patches to reveal vulnerable codeReversing Microsoft patches to reveal vulnerable code
Reversing Microsoft patches to reveal vulnerable codeHarsimran Walia
 
nullcon 2011 - Reversing MicroSoft patches to reveal vulnerable code
nullcon 2011 - Reversing MicroSoft patches to reveal vulnerable codenullcon 2011 - Reversing MicroSoft patches to reveal vulnerable code
nullcon 2011 - Reversing MicroSoft patches to reveal vulnerable coden|u - The Open Security Community
 
.NET Debugging Tips and Techniques
.NET Debugging Tips and Techniques.NET Debugging Tips and Techniques
.NET Debugging Tips and TechniquesBala Subra
 
.Net Debugging Techniques
.Net Debugging Techniques.Net Debugging Techniques
.Net Debugging TechniquesBala Subra
 
Writing simple buffer_overflow_exploits
Writing simple buffer_overflow_exploitsWriting simple buffer_overflow_exploits
Writing simple buffer_overflow_exploitsD4rk357 a
 
2600 av evasion_deuce
2600 av evasion_deuce2600 av evasion_deuce
2600 av evasion_deuceDb Cooper
 
Role of .NET in Exception Handling
Role of .NET in Exception HandlingRole of .NET in Exception Handling
Role of .NET in Exception HandlingAsrarulhaq Maktedar
 
Exploit Frameworks
Exploit FrameworksExploit Frameworks
Exploit Frameworksphanleson
 
Production Debugging at Code Camp Philly
Production Debugging at Code Camp PhillyProduction Debugging at Code Camp Philly
Production Debugging at Code Camp PhillyBrian Lyttle
 
What's the Difference Between Static Analysis and Compiler Warnings?
What's the Difference Between Static Analysis and Compiler Warnings?What's the Difference Between Static Analysis and Compiler Warnings?
What's the Difference Between Static Analysis and Compiler Warnings?Andrey Karpov
 
SMI - Introduction to Java
SMI - Introduction to JavaSMI - Introduction to Java
SMI - Introduction to JavaSMIJava
 
Jbossworld Presentation
Jbossworld PresentationJbossworld Presentation
Jbossworld PresentationDan Hinojosa
 
香港六合彩 &raquo; SlideShare
香港六合彩 &raquo; SlideShare香港六合彩 &raquo; SlideShare
香港六合彩 &raquo; SlideShareyayao
 
PVS-Studio in the Clouds: Azure DevOps
PVS-Studio in the Clouds: Azure DevOpsPVS-Studio in the Clouds: Azure DevOps
PVS-Studio in the Clouds: Azure DevOpsAndrey Karpov
 
Introductiontoasp netwindbgdebugging-100506045407-phpapp01
Introductiontoasp netwindbgdebugging-100506045407-phpapp01Introductiontoasp netwindbgdebugging-100506045407-phpapp01
Introductiontoasp netwindbgdebugging-100506045407-phpapp01Camilo Alvarez Rivera
 
MCS,BCS-7(A,B) Visual programming Syllabus for Final exams @ ISP
MCS,BCS-7(A,B) Visual programming Syllabus for Final exams @ ISPMCS,BCS-7(A,B) Visual programming Syllabus for Final exams @ ISP
MCS,BCS-7(A,B) Visual programming Syllabus for Final exams @ ISPAli Shah
 

Similar a nullcon 2011 - Reversing MicroSoft patches to reveal vulnerable code (20)

Reversing Microsoft patches to reveal vulnerable code
Reversing Microsoft patches to reveal vulnerable codeReversing Microsoft patches to reveal vulnerable code
Reversing Microsoft patches to reveal vulnerable code
 
nullcon 2011 - Reversing MicroSoft patches to reveal vulnerable code
nullcon 2011 - Reversing MicroSoft patches to reveal vulnerable codenullcon 2011 - Reversing MicroSoft patches to reveal vulnerable code
nullcon 2011 - Reversing MicroSoft patches to reveal vulnerable code
 
.NET Debugging Tips and Techniques
.NET Debugging Tips and Techniques.NET Debugging Tips and Techniques
.NET Debugging Tips and Techniques
 
.Net Debugging Techniques
.Net Debugging Techniques.Net Debugging Techniques
.Net Debugging Techniques
 
Srgoc dotnet
Srgoc dotnetSrgoc dotnet
Srgoc dotnet
 
C# tutorial
C# tutorialC# tutorial
C# tutorial
 
Writing simple buffer_overflow_exploits
Writing simple buffer_overflow_exploitsWriting simple buffer_overflow_exploits
Writing simple buffer_overflow_exploits
 
2600 av evasion_deuce
2600 av evasion_deuce2600 av evasion_deuce
2600 av evasion_deuce
 
IDAPRO
IDAPROIDAPRO
IDAPRO
 
Role of .NET in Exception Handling
Role of .NET in Exception HandlingRole of .NET in Exception Handling
Role of .NET in Exception Handling
 
Exploit Frameworks
Exploit FrameworksExploit Frameworks
Exploit Frameworks
 
Production Debugging at Code Camp Philly
Production Debugging at Code Camp PhillyProduction Debugging at Code Camp Philly
Production Debugging at Code Camp Philly
 
What's the Difference Between Static Analysis and Compiler Warnings?
What's the Difference Between Static Analysis and Compiler Warnings?What's the Difference Between Static Analysis and Compiler Warnings?
What's the Difference Between Static Analysis and Compiler Warnings?
 
SMI - Introduction to Java
SMI - Introduction to JavaSMI - Introduction to Java
SMI - Introduction to Java
 
Jbossworld Presentation
Jbossworld PresentationJbossworld Presentation
Jbossworld Presentation
 
香港六合彩 &raquo; SlideShare
香港六合彩 &raquo; SlideShare香港六合彩 &raquo; SlideShare
香港六合彩 &raquo; SlideShare
 
PVS-Studio in the Clouds: Azure DevOps
PVS-Studio in the Clouds: Azure DevOpsPVS-Studio in the Clouds: Azure DevOps
PVS-Studio in the Clouds: Azure DevOps
 
Introductiontoasp netwindbgdebugging-100506045407-phpapp01
Introductiontoasp netwindbgdebugging-100506045407-phpapp01Introductiontoasp netwindbgdebugging-100506045407-phpapp01
Introductiontoasp netwindbgdebugging-100506045407-phpapp01
 
Bb Tequila Coding Style (Draft)
Bb Tequila Coding Style (Draft)Bb Tequila Coding Style (Draft)
Bb Tequila Coding Style (Draft)
 
MCS,BCS-7(A,B) Visual programming Syllabus for Final exams @ ISP
MCS,BCS-7(A,B) Visual programming Syllabus for Final exams @ ISPMCS,BCS-7(A,B) Visual programming Syllabus for Final exams @ ISP
MCS,BCS-7(A,B) Visual programming Syllabus for Final exams @ ISP
 

Más de n|u - The Open Security Community

Gibson 101 -quick_introduction_to_hacking_mainframes_in_2020_null_infosec_gir...
Gibson 101 -quick_introduction_to_hacking_mainframes_in_2020_null_infosec_gir...Gibson 101 -quick_introduction_to_hacking_mainframes_in_2020_null_infosec_gir...
Gibson 101 -quick_introduction_to_hacking_mainframes_in_2020_null_infosec_gir...n|u - The Open Security Community
 

Más de n|u - The Open Security Community (20)

Hardware security testing 101 (Null - Delhi Chapter)
Hardware security testing 101 (Null - Delhi Chapter)Hardware security testing 101 (Null - Delhi Chapter)
Hardware security testing 101 (Null - Delhi Chapter)
 
Osint primer
Osint primerOsint primer
Osint primer
 
SSRF exploit the trust relationship
SSRF exploit the trust relationshipSSRF exploit the trust relationship
SSRF exploit the trust relationship
 
Nmap basics
Nmap basicsNmap basics
Nmap basics
 
Metasploit primary
Metasploit primaryMetasploit primary
Metasploit primary
 
Api security-testing
Api security-testingApi security-testing
Api security-testing
 
Introduction to TLS 1.3
Introduction to TLS 1.3Introduction to TLS 1.3
Introduction to TLS 1.3
 
Gibson 101 -quick_introduction_to_hacking_mainframes_in_2020_null_infosec_gir...
Gibson 101 -quick_introduction_to_hacking_mainframes_in_2020_null_infosec_gir...Gibson 101 -quick_introduction_to_hacking_mainframes_in_2020_null_infosec_gir...
Gibson 101 -quick_introduction_to_hacking_mainframes_in_2020_null_infosec_gir...
 
Talking About SSRF,CRLF
Talking About SSRF,CRLFTalking About SSRF,CRLF
Talking About SSRF,CRLF
 
Building active directory lab for red teaming
Building active directory lab for red teamingBuilding active directory lab for red teaming
Building active directory lab for red teaming
 
Owning a company through their logs
Owning a company through their logsOwning a company through their logs
Owning a company through their logs
 
Introduction to shodan
Introduction to shodanIntroduction to shodan
Introduction to shodan
 
Cloud security
Cloud security Cloud security
Cloud security
 
Detecting persistence in windows
Detecting persistence in windowsDetecting persistence in windows
Detecting persistence in windows
 
Frida - Objection Tool Usage
Frida - Objection Tool UsageFrida - Objection Tool Usage
Frida - Objection Tool Usage
 
OSQuery - Monitoring System Process
OSQuery - Monitoring System ProcessOSQuery - Monitoring System Process
OSQuery - Monitoring System Process
 
DevSecOps Jenkins Pipeline -Security
DevSecOps Jenkins Pipeline -SecurityDevSecOps Jenkins Pipeline -Security
DevSecOps Jenkins Pipeline -Security
 
Extensible markup language attacks
Extensible markup language attacksExtensible markup language attacks
Extensible markup language attacks
 
Linux for hackers
Linux for hackersLinux for hackers
Linux for hackers
 
Android Pentesting
Android PentestingAndroid Pentesting
Android Pentesting
 

Último

Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
[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
 
🐬 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
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
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
 
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
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
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
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
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
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
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
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 

Último (20)

Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
[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
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
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
 
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
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
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
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
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...
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
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...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 

nullcon 2011 - Reversing MicroSoft patches to reveal vulnerable code

  • 1. Reversing Microsoft Patches to reveal Vulnerable code HarsimranWalia http://null.co.in/ http://nullcon.net/
  • 2.
  • 3. http://null.co.in/ http://nullcon.net/ Introduction Finding a 0day vulnerability Vulnerability reaches the vendor Vendor finds a fix Releases a patch to fix the vulnerability Microsoft patches Reverse engineer the patch Locate the vulnerability patched Highlight the difficulties Birth of a security patch Discussion in the presentation
  • 4. For reversing and obtaining binary difference in my demos I would be using DarunGrim2 How DarunGrim works? The schema of DarunGrim is shown in the figure To generate diffing results Binaries are disassembled in IDA Pro in the background and darungrim IDA plugin is run which creates the sqlite database Diffing Engine, the heart of DarunGrim2. The sqlite db from IDA and the binaries from GUI are fed into this engine as inputs http://null.co.in/ http://nullcon.net/ Introduction
  • 5. Algorithm ? Main algorithm of DarunGrim is Basic block fingerprint hash map Each basic block is 1 entity whose fingerprint is generated from the instruction sequence Fingerprint hash generated by IDA Pro Two fingerprint hash tables one each for unpatched and patched binary For finding the binary difference, each unique fingerprint from original binary is searched against the fingerprints of patched binary for a match All fingerprints in the original binary hash tables are either matched or unmatched http://null.co.in/ http://nullcon.net/ Introduction
  • 6. Algorithm ? Contd.. For a function to be called matching, all the basic blocks in the function should be matching For unmatched functions DarunGrim calculates percentage match Match rate based on fingerprint string match Similar to GNU Diff algorithm which is finding longest common subsequence http://null.co.in/ http://nullcon.net/ Introduction
  • 7. Vulnerability Vs Exploit based signatures Exploit signatures Created by using byte string patterns or regular expressions These are exploit specific They are used widely mainly because of the ease of their creation Cater to only one type of input satisfying that vulnerability condition Fail: different attacks can exploit the same vulnerability, so exploit based signatures will fail For eg. Exploit based signature ESig = “docx?AAAAAAAAAAA...” It will fail if some exploit uses a long string of B’s instead of A’s http://null.co.in/ http://nullcon.net/ Introduction
  • 8. http://null.co.in/ http://nullcon.net/ Introduction Vulnerability Vs Exploit based signatures Vulnerability signatures Based on the properties of the vulnerability and not on the properties of the exploit It is a superset of all the inputs satisfying a particular vulnerability condition For eg. Vulnerability based signature for previous case VSig = MATCH_STR (Buffer,"docx?(.*)$",limit) Matches string in buffer with the regex It is effective against any alphabet unlike exploit signature Vulnerability Signature Exploit Signature
  • 9. Vulnerability Vs Exploit based signatures Vulnerability signatures contd.. For a good vulnerability signature It should strictly not allow any false negatives as even one exploit can pwn the system and create a gateway for the attacker into the network. It should allow very few false positives, as too many false positives may lead to a DoS attack for the system. The signature matching time should not create a considerable delay for the software and services. http://null.co.in/ http://nullcon.net/ Introduction
  • 10. The first step of creating an undisclosed exploit is to find the vulnerability to exploit it. To verify if the patch released by Microsoft is working as per it is designed. To create vulnerability based signatures. http://null.co.in/ http://nullcon.net/ Need
  • 12.
  • 13.
  • 14.
  • 15. http://null.co.in/ http://nullcon.net/ Finding patches Extraction of files DEMO Process
  • 16.
  • 17.
  • 18. Finding patches http://null.co.in/ http://nullcon.net/ Extraction of files Binary Differencing Differencing Analysis Process Manual inspection of functions with less than 100% match Remove false positives generated by problems like Instruction reordering Lot of reordering happening over different releases marks even the same blocks as unmatched Split blocks Block in the graph which has only parent and the parent has only one child leads to a split block. causing a problem in the matching process Can be improved by merging the two blocks and treating as a single block.
  • 19. http://null.co.in/ http://nullcon.net/ Finding patches Extraction of files Binary Differencing Differencing Analysis Process Hot patching Instructions like moveax, eax at the start of functions are a sign of hot patching leading to a mismatch in the block By just ignoring the instruction we can get a match Compiler optimizations Different compilers and even different versions of the same compiler perform different optimizations which also creates problems in getting proper difference Eventually reach a function which is indeed modified and might be the fix to the vulnerability being patched
  • 20. Finding patches http://null.co.in/ http://nullcon.net/ Extraction of files Binary Differencing Differencing Analysis Process DEMO
  • 21. Finding patches http://null.co.in/ http://nullcon.net/ Extraction of files Binary Differencing Differencing Analysis Process push  [ebp-2Ch]  ; unsigned intcall  ??2@YAPAXI@Z    ; operator new(uint)mov   ebx, eaxpop   ecxmov   [ebp-18h], ebxmov   [ebp-3Ch], ebxmov   byte ptr [ebp-4], 1push  dwordptr [ebp-2Ch]mov   ecx, esipush  ebxpush    [ebp-30h] call    sub_118000C func(const *,void *,long)mov     edi, eaxtest    edi, edijge     short  push    [ebp-2Ch]  ; unsigned intcall    ??2@YAPAXI@Z    ; operator new(uint)pop     ecxmov     [ebp-14h], eax ;  ebp-14h = pBuffermov     [ebp-40h], eaxmov     byte ptr [ebp-4], 2push    [ebp-2Ch]mov     ecx, esipush    ebxpush    edicall    sub_118000C func(const *,void *,long)mov     esi, eaxtest    esi, esijge     short loc_118158A
  • 22. Finding patches http://null.co.in/ http://nullcon.net/ Extraction of files Binary Differencing Differencing Analysis Process Debugging To validate our finding of analysis by debugging Getting a crash of the application Creating a malformed file to get the crash Would be using Immunity Debugger
  • 23. Finding patches http://null.co.in/ http://nullcon.net/ Extraction of files Binary Differencing Differencing Analysis Process Debugging DEMO
  • 24. Conclusion Presented an overview of how the 1-day exploits and Vulnerability signatures can be created Attempt was made to understand the process involved in reversing and the problems faced during the execution of the process Only talked about Microsoft patches but concept not limited to this. Concepts presented can be perfected by interested audience http://null.co.in/ http://nullcon.net/