SlideShare a Scribd company logo
Reversing Microsoft Patches to reveal Vulnerable codeHarsimranWaliahttp://null.co.in/http://nullcon.net/
nullcon 2011 - Reversing MicroSoft patches to reveal vulnerable code
http://null.co.in/http://nullcon.net/IntroductionFinding a 0day vulnerability Vulnerability reaches the vendorVendor finds a fixReleases a patch to fix the vulnerabilityMicrosoft patchesReverse engineer the patchLocate the vulnerability patchedHighlight the difficultiesBirth of a security patchDiscussion 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 figureTo generate diffing resultsBinaries are disassembled in IDA Pro in the	background and darungrim IDA plugin is run	which creates the sqlite databaseDiffing 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 mapEach basic block is 1 entity whose fingerprint is generated from the instruction sequenceFingerprint hash generated by IDA ProTwo fingerprint hash tables one each for unpatched and patched binaryFor finding the binary difference, each unique fingerprint from original binary is searched against the fingerprints of patched binary for a matchAll fingerprints in the original binary hash tables are either matched or unmatchedhttp://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 matchingFor unmatched functions DarunGrim calculates percentage matchMatch rate based on fingerprint string matchSimilar to GNU Diff algorithm which is finding longest common subsequencehttp://null.co.in/http://nullcon.net/Introduction
 Vulnerability Vs Exploit based signatures	Exploit signaturesCreated by using byte string patterns or regular expressions These are exploit specific They are used widely mainly because of the ease of their creationCater to only one type of input satisfying that vulnerability conditionFail: different attacks can exploit the same vulnerability, so exploit based signatures will fail For eg. Exploit based signatureESig = “docx?AAAAAAAAAAA...”It will fail if some exploit uses a long string of B’s instead of A’shttp://null.co.in/http://nullcon.net/Introduction
http://null.co.in/http://nullcon.net/Introduction Vulnerability Vs Exploit based signatures	Vulnerability signaturesBased on the properties of the vulnerability and not on the properties of the exploitIt is a superset of all the inputs satisfying a particular vulnerability conditionFor eg. Vulnerability based signature for previous caseVSig = MATCH_STR (Buffer,"docx?(.*)$",limit)Matches string in buffer with the regexIt is effective against any alphabet unlike exploit signatureVulnerabilitySignatureExploit Signature
 Vulnerability Vs Exploit based signatures	 Vulnerability signatures contd..For a good vulnerability signatureIt 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 patchesPick a vulnerability and download its patchPick a vulnerability just before this one that patched the same program or dllIf unavailable, use the same dll from your systemProcessQuick-fixUse open source ms-patch-tools to easily get the file versions to compareProblemGDR or QFE/LDR ??
FileVersioninghttp://null.co.in/http://nullcon.net/Finding patchesDEMOProcess
http://null.co.in/http://nullcon.net/Finding patchesExtraction of filesThe traditional way of extracting file from patch <patchfilename>.exe /xWorks only till Windows XP and earlier versions of WindowsProcessProblemAbove method cannot be used on Win7 and Vista patches delivered as msuhttp://null.co.in/http://nullcon.net/Finding patchesExtraction of filesSolutionProcessUse expand commandexpand -F:*  <Saved_MSU_File_Name>.msu C:\<Folder_to_extract_in> expand -F:*  <Saved_MSU_File_Name>.cab  C:\<Folder_to_extract_in>
http://null.co.in/http://nullcon.net/Finding patchesExtraction of filesDEMOProcess
Finding patcheshttp://null.co.in/http://nullcon.net/Extraction of filesBinary DifferencingDarunGrim v2 used for binary differenceFeed in the two binaries to be comparedGenerates a list of functions with the %age match between the two files ProcessProblemNot every function %age < 100 is changed
Includes false positives which requires manual analysisFinding patcheshttp://null.co.in/http://nullcon.net/Extraction of filesBinary DifferencingProcessDEMO
Finding patcheshttp://null.co.in/http://nullcon.net/Extraction of filesBinary DifferencingDifferencing AnalysisProcessManual inspection of functions with less than 100% matchRemove false positives generated by problems likeInstruction reorderingLot of reordering happening over different releases marks even the same blocks as unmatchedSplit blocksBlock 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 processCan be improved by merging the two blocks and treating as a single block.
http://null.co.in/http://nullcon.net/Finding patchesExtraction of filesBinary DifferencingDifferencing AnalysisProcessHot patchingInstructions like moveax, eax at the start of functions are a sign of hot patching leading to a mismatch in the blockBy just ignoring the instruction we can get a matchCompiler optimizations Different compilers and even different versions of the same compiler perform different optimizations which also creates problems in getting proper differenceEventually reach a function which is indeed modified and might be the fix to the vulnerability being patched
Finding patcheshttp://null.co.in/http://nullcon.net/Extraction of filesBinary DifferencingDifferencing AnalysisProcessDEMO
Finding patcheshttp://null.co.in/http://nullcon.net/Extraction of filesBinary DifferencingDifferencing AnalysisProcesspush 	[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 patcheshttp://null.co.in/http://nullcon.net/Extraction of filesBinary DifferencingDifferencing AnalysisProcessDebuggingTo validate our finding of analysis by debuggingGetting a crash of the applicationCreating a malformed file to get the crashWould be using Immunity Debugger
Finding patcheshttp://null.co.in/http://nullcon.net/Extraction of filesBinary DifferencingDifferencing AnalysisProcessDebuggingDEMO
ConclusionPresented an overview of how the 1-day exploits and Vulnerability signatures can be createdAttempt was made to understand the process involved in reversing and the problems faced during the execution of the processOnly 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/
ThanksQuestions??http://null.co.in/http://nullcon.net/
nullcon 2011 - Reversing MicroSoft patches to reveal vulnerable code

More Related Content

What's hot (20)

PDF
We Continue Exploring Tizen: C# Components Proved to be of High Quality
PVS-Studio
 
PDF
Testing Legacy Rails Apps
Rabble .
 
ODP
Mastering Mock Objects - Advanced Unit Testing for Java
Denilson Nastacio
 
PPTX
TDD and the Legacy Code Black Hole
Noam Kfir
 
KEY
iOS Unit Testing
sgleadow
 
PDF
New Year PVS-Studio 6.00 Release: Scanning Roslyn
PVS-Studio
 
PPTX
Applying TDD to Legacy Code
Alexander Goida
 
PDF
Unit Testing 101
Dave Bouwman
 
PPTX
PVS-Studio and static code analysis technique
Andrey Karpov
 
PDF
Living With Legacy Code
Rowan Merewood
 
PDF
Write readable tests
Marian Wamsiedel
 
PPT
Unit Testing in iOS
Long Weekend LLC
 
PPTX
TDD with Visual Studio 2010
Stefano Paluello
 
PDF
The why and how of moving to php 8
Wim Godden
 
PPTX
Unit Testing Android Applications
Rody Middelkoop
 
PDF
Java bad coding practices
Gustavo Carrion, MiT
 
PPT
Presentation_C++UnitTest
Raihan Masud
 
PPTX
Exception handling in ASP .NET
baabtra.com - No. 1 supplier of quality freshers
 
PPT
JMockit
Angad Rajput
 
We Continue Exploring Tizen: C# Components Proved to be of High Quality
PVS-Studio
 
Testing Legacy Rails Apps
Rabble .
 
Mastering Mock Objects - Advanced Unit Testing for Java
Denilson Nastacio
 
TDD and the Legacy Code Black Hole
Noam Kfir
 
iOS Unit Testing
sgleadow
 
New Year PVS-Studio 6.00 Release: Scanning Roslyn
PVS-Studio
 
Applying TDD to Legacy Code
Alexander Goida
 
Unit Testing 101
Dave Bouwman
 
PVS-Studio and static code analysis technique
Andrey Karpov
 
Living With Legacy Code
Rowan Merewood
 
Write readable tests
Marian Wamsiedel
 
Unit Testing in iOS
Long Weekend LLC
 
TDD with Visual Studio 2010
Stefano Paluello
 
The why and how of moving to php 8
Wim Godden
 
Unit Testing Android Applications
Rody Middelkoop
 
Java bad coding practices
Gustavo Carrion, MiT
 
Presentation_C++UnitTest
Raihan Masud
 
Exception handling in ASP .NET
baabtra.com - No. 1 supplier of quality freshers
 
JMockit
Angad Rajput
 

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

PPTX
Reversing Microsoft patches to reveal vulnerable code
Harsimran Walia
 
PDF
nullcon 2011 - Reversing MicroSoft patches to reveal vulnerable code
n|u - The Open Security Community
 
PPTX
Netwitness RT - Don’t scratch that patch.pptx
Stefano Maccaglia
 
PDF
Bruh! Do you even diff?—Diffing Microsoft Patches to Find Vulnerabilities
Priyanka Aash
 
PDF
CanSecWest (1)
Abhishek Singh
 
PDF
Cansec West 2009
abhicc285
 
PDF
Ani hilate this week
UltraUploader
 
PPTX
Reversing malware analysis training part10 exploit development basics
Cysinfo Cyber Security Community
 
PPT
MIT-6-determina-vps.ppt
webhostingguy
 
PPTX
Malware 101 by saurabh chaudhary
Saurav Chaudhary
 
PPTX
The Hacking Games - Operation System Vulnerabilities Meetup 29112022
lior mazor
 
PDF
The (Memory) Safety Dance - SAS 2017 keynote
MarkDowd13
 
PPTX
On non existent 0-days, stable binary exploits and
Alisa Esage Шевченко
 
PDF
Reversing & malware analysis training part 10 exploit development basics
Abdulrahman Bassam
 
ODP
Call Graph Agnostic Malware Indexing (EuskalHack 2017)
Joxean Koret
 
PDF
Software Security Engineering (Learnings from the past to fix the future) - B...
DebasisMohanty43
 
PPS
Nibin - Reverse Engineering for exploit writers - ClubHack2008
ClubHack
 
PPS
Reverse Engineering for exploit writers
amiable_indian
 
PPTX
Vulnerability, exploit to metasploit
Tiago Henriques
 
PDF
Inbot10 vxclass
zynamics GmbH
 
Reversing Microsoft patches to reveal vulnerable code
Harsimran Walia
 
nullcon 2011 - Reversing MicroSoft patches to reveal vulnerable code
n|u - The Open Security Community
 
Netwitness RT - Don’t scratch that patch.pptx
Stefano Maccaglia
 
Bruh! Do you even diff?—Diffing Microsoft Patches to Find Vulnerabilities
Priyanka Aash
 
CanSecWest (1)
Abhishek Singh
 
Cansec West 2009
abhicc285
 
Ani hilate this week
UltraUploader
 
Reversing malware analysis training part10 exploit development basics
Cysinfo Cyber Security Community
 
MIT-6-determina-vps.ppt
webhostingguy
 
Malware 101 by saurabh chaudhary
Saurav Chaudhary
 
The Hacking Games - Operation System Vulnerabilities Meetup 29112022
lior mazor
 
The (Memory) Safety Dance - SAS 2017 keynote
MarkDowd13
 
On non existent 0-days, stable binary exploits and
Alisa Esage Шевченко
 
Reversing & malware analysis training part 10 exploit development basics
Abdulrahman Bassam
 
Call Graph Agnostic Malware Indexing (EuskalHack 2017)
Joxean Koret
 
Software Security Engineering (Learnings from the past to fix the future) - B...
DebasisMohanty43
 
Nibin - Reverse Engineering for exploit writers - ClubHack2008
ClubHack
 
Reverse Engineering for exploit writers
amiable_indian
 
Vulnerability, exploit to metasploit
Tiago Henriques
 
Inbot10 vxclass
zynamics GmbH
 
Ad

More from n|u - The Open Security Community (20)

PDF
Hardware security testing 101 (Null - Delhi Chapter)
n|u - The Open Security Community
 
PPTX
SSRF exploit the trust relationship
n|u - The Open Security Community
 
PDF
Metasploit primary
n|u - The Open Security Community
 
PDF
Api security-testing
n|u - The Open Security Community
 
PDF
Introduction to TLS 1.3
n|u - The Open Security Community
 
PDF
Gibson 101 -quick_introduction_to_hacking_mainframes_in_2020_null_infosec_gir...
n|u - The Open Security Community
 
PDF
Talking About SSRF,CRLF
n|u - The Open Security Community
 
PPTX
Building active directory lab for red teaming
n|u - The Open Security Community
 
PPTX
Owning a company through their logs
n|u - The Open Security Community
 
PPTX
Introduction to shodan
n|u - The Open Security Community
 
PDF
Detecting persistence in windows
n|u - The Open Security Community
 
PPTX
Frida - Objection Tool Usage
n|u - The Open Security Community
 
PDF
OSQuery - Monitoring System Process
n|u - The Open Security Community
 
PDF
DevSecOps Jenkins Pipeline -Security
n|u - The Open Security Community
 
PDF
Extensible markup language attacks
n|u - The Open Security Community
 
PPTX
Linux for hackers
n|u - The Open Security Community
 
PDF
Android Pentesting
n|u - The Open Security Community
 
Hardware security testing 101 (Null - Delhi Chapter)
n|u - The Open Security Community
 
SSRF exploit the trust relationship
n|u - The Open Security Community
 
Api security-testing
n|u - The Open Security Community
 
Introduction to TLS 1.3
n|u - The Open Security Community
 
Gibson 101 -quick_introduction_to_hacking_mainframes_in_2020_null_infosec_gir...
n|u - The Open Security Community
 
Talking About SSRF,CRLF
n|u - The Open Security Community
 
Building active directory lab for red teaming
n|u - The Open Security Community
 
Owning a company through their logs
n|u - The Open Security Community
 
Introduction to shodan
n|u - The Open Security Community
 
Detecting persistence in windows
n|u - The Open Security Community
 
Frida - Objection Tool Usage
n|u - The Open Security Community
 
OSQuery - Monitoring System Process
n|u - The Open Security Community
 
DevSecOps Jenkins Pipeline -Security
n|u - The Open Security Community
 
Extensible markup language attacks
n|u - The Open Security Community
 
Ad

Recently uploaded (20)

PDF
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
Learn Computer Forensics, Second Edition
AnuraShantha7
 
PDF
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
PPT
Interview paper part 3, It is based on Interview Prep
SoumyadeepGhosh39
 
PDF
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
PPTX
MSP360 Backup Scheduling and Retention Best Practices.pptx
MSP360
 
PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PDF
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
PDF
July Patch Tuesday
Ivanti
 
PDF
Complete JavaScript Notes: From Basics to Advanced Concepts.pdf
haydendavispro
 
PPTX
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
PDF
SFWelly Summer 25 Release Highlights July 2025
Anna Loughnan Colquhoun
 
PPTX
✨Unleashing Collaboration: Salesforce Channels & Community Power in Patna!✨
SanjeetMishra29
 
PDF
Smart Air Quality Monitoring with Serrax AQM190 LITE
SERRAX TECHNOLOGIES LLP
 
PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PDF
Predicting the unpredictable: re-engineering recommendation algorithms for fr...
Speck&Tech
 
PDF
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
Learn Computer Forensics, Second Edition
AnuraShantha7
 
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
Interview paper part 3, It is based on Interview Prep
SoumyadeepGhosh39
 
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
MSP360 Backup Scheduling and Retention Best Practices.pptx
MSP360
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
July Patch Tuesday
Ivanti
 
Complete JavaScript Notes: From Basics to Advanced Concepts.pdf
haydendavispro
 
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
SFWelly Summer 25 Release Highlights July 2025
Anna Loughnan Colquhoun
 
✨Unleashing Collaboration: Salesforce Channels & Community Power in Patna!✨
SanjeetMishra29
 
Smart Air Quality Monitoring with Serrax AQM190 LITE
SERRAX TECHNOLOGIES LLP
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
Predicting the unpredictable: re-engineering recommendation algorithms for fr...
Speck&Tech
 
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 

nullcon 2011 - Reversing MicroSoft patches to reveal vulnerable code