Share
Embed
ROOTCON 15 (2021) - Fuzzing: Revisiting Software Security
Talk in Rootcon 15 on topic "Fuzzing: Revisiting Software Security"
Nafiez
October 15, 2021
Transcript
60 slides
-
About Me An independent security practitioner located in Malaysia with
passion in vulnerability research, fuzzing, reverse engineering and exploit development. I play RC Drift. Some of my notable works can be found here - https://zeifan.my -
Why It Still Failed? • Lack of Secure Development Lifecycle
• Ignorance from vendor by trying to avoid fixes • Security is expensive • Third party software developer do not follow mitigations built by Microsoft • Security ain’t priority -
What Are We Seeing Here? • Microsoft has improved the
security in their operating systems by killing and eliminating bug classes • Exploit mitigations on different aspects, vulnerability become useless • Finding vulnerability is HARD • Competitor between researchers, vendors and boutique firm • Exploit development costly -
General (1/2) • Started from lowest hanging fruit to the
complex part. My previous work on hunting vulnerability in Antivirus covering various security issue and methods. • Methods are similar, depending on the target • Study other researchers write ups and analyzed from scratch to understand how it works. It helps to identify bugs and ideas on how to exploiting it. • Reverse engineer patches and updates -
General (2/2) • Easiest way to hunt for vulnerability is
the access to source code. • However it is impossible to have access to source code when it comes to closed source program. Heavily involved in reverse engineering. • Reverse engineering is HARD! • One way to approach is to fuzz. Fuzzing is fun but hard too and may cause disappointment :D -
Fuzzing Approach (1/2) • Rely on traditional method such file
format fuzzing ◦ Byte and Bit mutation FTW! • Perform variant hunting ◦ APIs, Functions, etc. • Dumb & Smart Fuzzers ◦ Custom & Public -
Fuzzing Approach (2/2) • Number of CVEs assigned • Custom
fuzzer built to work on specific cases such file format ◦ Limited to the target itself • Public fuzzer, we used any available fuzzers such as WinAFL and CERT BFF • WinAFL supports coverage guided, APIs • CERT BFF only file format, support custom Python plugin -
Public Fuzzer (1/2) • WinAFL and CERT Basic Fuzzing Framework
(BFF) are the main options on publicly available fuzzer • WinAFL is powerful and smart fuzzer ◦ Fast (depends on you harness) and it supports instrumentation too • CERT BFF using traditional methods without coverage guided or instrumentation ◦ It supports Python plugin and you can write your own fuzzer ◦ The longer it runs, the slower it become :D • Found numbers of vulnerability and assigned with CVEs for public record on vulnerability reported • Next page shows the numbers of issue found ◦ Not everything included due to some don’t have public advisory from vendors ◦ I reported numbers of issue however only couple of it has CVEs assigned -
Public Fuzzer (2/2) MSRC Case 58680 - Windows GDI MSRC
Case 58593 - Windows GDI MSRC Case 58745 - Windows GDI MSRC Case 58843 - Windows GDI CVE-2020-10222 - Nitro PDF Software CVE-2020-10223 - Nitro PDF Software CVE-2020-25290 - Nitro PDF Software CVE-2019-19817 - Nitro PDF Software CVE-2019-19818 - Nitro PDF Software CVE-2019-19819 - Nitro PDF Software * there are more… -
Custom Fuzzer (1/5) • File format fuzzing still effective these
days, although it slow but we do found numbers of vulnerabilities • Main idea is to find bug as much it can • Heavily focus on C / C++ types of application • Capable to fuzz complex software • Able to catch bugs and minimize results • Purely written in Python -
Custom Fuzzer (2/5) • Mutation on input file ◦ e.g.
file.exe input.test • Covering bit flip ◦ Randomize range values ◦ Strings, special characters • Detecting crashes via debugger, slow but it works :) ◦ cdb, PyKD or WinAppDBG ◦ Page Heap enabled -
Custom Fuzzer (3/5) • Integers ◦ Signed and Unsigned byte
◦ Signed and Unsigned word ◦ Signed and Unsigned dword ◦ Signed and Unsigned qword ◦ Negative numbers (ranging from 0x80000000 to 0xffffffff) ◦ Positive numbers (ranging from 0x10000000 to 0x7fffffff) -
Custom Fuzzer (4/5) • Strings and ASCII ◦ Large string
s ◦ Empty strings ◦ Length tags modifications ◦ NULL terminator ◦ Append and prepend on tagged strings -
Custom Fuzzer (5/5) • Detecting crashes could trigger false alarm
• Split out the result by performing a better filtering ◦ Check last exceptions e.g. address NULL or has something on memory / register • Important info ◦ Access violation ▪ Last crash disassembly code, Register value, Stack trace (sometimes inaccurate) ◦ Manual verification, debugging FTW -
What’s Inside the Custom Fuzzer? • No special code or
techniques, just a “copy cat” code from the Internet with major modification • Bit flip FTW :) • No taint or guided features, fully file format fuzzer • Initial idea is to build a framework, but looks hard LOL • It caught real vulnerability on complex software such Microsoft Office • Too slow but satisfied with its results XD -
Test Case - Fuzzing Example • Targeting Hancom Word processing
application. Vulnerability reported to KISA. • Corpus size around 25 KB • Bit Flip mutation ◦ Covering random range of values starting from 0x0 until 0x7FFFFFFF • Bug found after 4 hours running, there are three different vulnerability found • Example of fuzzing test case in next page -
File Format Fuzzed Original File Mutated File When the Word
started to process and parse for the contents of the DOC file, crash will trigger due to malformed contents on the file formatting. -
Before that... • We need to understand how the mitigations
takes place • Are the targets are really protected with the current mitigations? • How far can we demonstrate the impact of the bug? Exploitable? Partially exploitable? Non-exploitable? • Understand your target is very important -
State the Art • Finding memory corruption used to be
easy with exploitable results • Historically exploited for decades (we can observe in the wild exploits) • Attack surface is always there it’s just the matter of the understanding how it works • Heavily involved reverse engineering process -
After... • Finding bugs ain’t easy task nowadays • Modern
exploitation is hard and expensive • One has to chain multiple bugs to achieve powerful exploitation • Exploit development costs continue growing -
Attack Surface • Bugs are exist, the entry point is
important to hunt • Patches and fixes let us understand what have been fix previously and could introduce another bug • Variant hunting indeed important however it’s pretty hard without proper guided fuzzing • Input, processing and parsing are the common attack surface -
Real World Vulnerabilities • Found numbers of bug on various
software • In this talk, I’ll present case study on Microsoft Access and Hancom Word Processor • Microsoft did a great job on fixing and future plan release to eliminate the bugs that reported • Fun fact about Hancom, I reported vulnerability to KISA however no further updates / news from them on the reported bug -
Case Study #1 : (CVE-2020-16957) Microsoft Access Connectivity Engine Remote
Code Execution Vulnerability -
Summary The bug was found with my custom fuzzer and
Microsoft acknowledge me on their portal along with the CVE-2020-16957. The idea fuzzing Microsoft Access is by feed the fuzzer with 10MB+ file size A heap corruption was detected when handling a specially crafted Access database and the bug reproducible on Windows 10 x64 version 1909. Affected version of Microsoft Access 2016 with version 16.0.13029.20308. -
Case Study #2 - (MSRC Case 60509) Microsoft Access 2016
Heap-Based Out-of-Bounds Read -
Summary An Out-of-Bounds Read vulnerability has been detected when handling
a specially crafted Access database. The following crash was observed in Microsoft Access 2016 with Windbg. The vulnerability was found during fuzzing activity. Microsoft consider this bug as moderate info disclosure meaning no fix and it will only included in the next product cycle (not the monthly patch) -
Case Study #3 - (MSRC Case) Microsoft Access 2016 Out-of-Bounds
Read Vulnerability -
Summary An Out-of-Bounds Read vulnerability has been detected when handling
a specially crafted Access database. The following crash was observed in Microsoft Access 2016 with Windbg. The vulnerability was found during fuzzing activity. Microsoft does not consider this OOB Read as exploitable. -
Case Study #4 - (MSRC Case 62010) Microsoft Access 2016
Heap Corruption -
Summary An heap corruption (invalid pointer) has been detected when
handling a specially crafted Access database. The following crash was observed in Microsoft Access 2016 and 2019 with Windbg. The vulnerability was found during fuzzing activity. No fix for this issue as Microsoft stated user are required to run VBScript. -
Summary An heap out-of-bounds read vulnerability exists in Hancom Word
software that is caused when the Office software improperly handles objects in memory while parsing specially crafted Office files. An attacker who successfully exploited the vulnerability remotely and could run arbitrary code in the context of the current user. Failure could lead to denial-of-service. Product and version affected was Hancom Office 2020 with version 11.0.0.1. The vulnerability was found with fuzzing. -
Disclosure • Were still seeing debates on vulnerability disclosure •
Painful processes, both party researchers and vendors • We do see most vendors have vulnerability disclosure process • Some offered bounty and some don’t, there’s debate on this too -
Do’s & Don’ts! • Provide as much information to ease
the vendors task • If necessary, use all the mediums to inform vendors • Get some feedback from other researchers on disclosing vulnerability • Follow the standard vulnerability disclosure (90 days perhaps?) • Get CERTs involved • Avoid public disclosure without notifying vendors • Do not talk publicly on what you found not until it gets fix -
Conclusion • Best defense is offense • Finding bugs =
needle in a haystack • Proper disclosure with vendors for bugs fixes • Long live file format fuzzing :)