Sims_Patch_Diff_BSides_Baltimore
Sims_Patch_Diff_BSides_Baltimore
Exploitation
Stephen Sims
1
OS Market Share
• Windows 7 clearly
dominant
• XP still at 7.4%
• ATM Machines
• Embedded systems
• Windows 10 quickly
gaining traction
• Mac OS and Linux still a
small number in Taken on April 29th, 2017 from
https://www.netmarketshare.com/operating-system-
comparison market-share.aspx?qprid=10&qpcustomd=0
2
Application and OS Patching
5
Typical Patched System in an Enterprise vs. Microsoft Lab
https://docs.microsoft.com/en-us/windows/deployment/update/waas-overview
6
WaaS Servicing Branches
• Windows Update
• Automatic Updates, available in the Control Panel
• Vista, 7, 8,10 and Server 2008/2012/2016
• Automatic Updates has expanded functionality
• Windows Server Update Service (WSUS)
• Enterprise patch management solution
• Control over patch distribution
• Windows Update for Business (WUB) for Windows 10
• Third-party Patch Management Solutions
Reverse Engineering Updates
• It is important to know that good guys, bad guys, and those in-
between often reverse engineer security updates
• Exploitation frameworks such as Metasploit, Core Impact, SAINT Exploit,
and Immunity Canvas want to be able to offer their customers exploits that
are not available by their competitors
• Attackers want to quickly discover the patched vulnerability and attempt to
develop a working exploit before most organizations patch
• The above is often referred to as a “1-day exploit” since there is a race
condition between the time a patch is released and the time systems are
patched
• Reversing patches is an acquired skill and is not limited to
Microsoft updates
9
Obtaining Patches for Analysis Up Until April, 2017
https://technet.microsoft.com/en-us/security/bulletins.aspx
11
Types of Patches
Update File
• expand –F:* <.msu file> <dest>
c:\derp\MS16-106\Patched>expand -F:* Windows6.1-KB3185911-x86.msu .
Microsoft (R) File Expansion Utility Version 6.1.7600.16385
Copyright (c) Microsoft Corporation. All rights reserved.
c:\derp\MS16-106\Patched\x86_microsoft-windows-user32_31bf3856ad364e35_6.1.7601.
23528_none_cfc274bde4c0ef6f>dir
Volume in drive C has no label.
Volume Serial Number is CEF2-482A
Directory of c:\derp\MS16-106\Patched\x86_microsoft-windows-user32_31bf3856ad36
4e35_6.1.7601.23528_none_cfc274bde4c0ef6f
…but, Window 7’s update is just around 100mb Very large files
17
PatchExtract
• The above command looks quite long, but much of that is due to the long
.msu filename
• This command took ~10 minutes to complete on the 500MB file
• It extracted every folder and file from the cumulative update and
resulted in an enormous number of folders
• When randomly looking at a couple of the modified dates on
some patched files, many dated all the way back to 2015
18
PatchClean
• We will now clean up the enormous output and list only the files
changed within the past 30 days
c:\Patches\MS17-JAN\x86>Powershell -ExecutionPolicy Bypass -File c:\Patches\Patc
hClean.ps1 -Path c:\Patches\MS17-JAN\x86\
==========================================================
Low Priority Folders: 1020
Low Priority Files: 3810
High Priority Folders: 16
20
Patch Extraction Results
21
Mapping a Patched File to the Security Advisory
• MS17-001 says:
c:\Patches\MS17-JAN\x86>cd ie-htmlrendering_11.0.10240.17236
c:\Patches\MS17-JAN\x86\ie-htmlrendering_11.0.10240.17236>dir
Volume in drive C has no label.
Volume Serial Number is 6681-3E06
Directory of c:\Patches\MS17-JAN\x86\ie-htmlrendering_11.0.10240.17236
25
Example of a Patched Vulnerability – MS16-009
Unpatched
Patched
26
MS16-009 Demonstration
27
MS17-010
28
MS17-010 BinDiff Demo
29
An oldie but goodie…
30
Thanks!
Stephen Sims
@Steph3nSims
[email protected]
http://www.irongeek.com/i.php?page=videos/bsidescharm2017/bs
idescharm-2017-t111-microsoft-patch-analysis-for-exploitation-
stephen-sims
31