SlideShare a Scribd company logo
1 of 36
Binary vulnerability

       Alex Bazhanyuk, @Abazhanyuk


“RE” school, DefCon-UA, 2012
vulnerability
●   Binary, Logic, Web
●   Why vulnerabilities is so interesting?
●   Why we need patched our OS? (project MIT)
●   Math models for vulnerabilities
●   Lang without vulnerabilities




                                                2
Metrics
●   CVSS
●   LPE/RCE
●   User/Kernel space
●   Probability (0-100%)




                               3
Identifier
●   CVE (http://cve.mitre.org/cve/cve.html)
●   SA (http://secunia.com/advisories/search)
●   Vupen(http://www.vupen.com/english/security-advisories/)

●   Vendors




                                                               4
Web vulnerabilities (not here)
●   Cross Site Scripting (XSS)
●   Injection Flaws (SQLi)
●   Malicious File Execution (RFI)
●   Insecure Direct Object Reference
●   Cross Site Request Forgery (CSRF)
●   Information Leakage and Improper Error Handling
●   Broken Authentication and Session Management
●   Failure to Restrict URL Access


                                                      5
Logic vulnerabilities
●   Int rand(){return 4;}
●   Client decide if authorization successful or not


●   [Ch-ch-ch-ch-ching!!! $60,000] [117226] [117230] Critical CVE-2011-3046:
    UXSS and bad history navigation. Credit to Sergey Glazunov.


●   GNU C library dynamic linker $ORIGIN expansion Vulnerability
    Tavis Ormandy.




                                                                               6
Binary vulnerabilities




                         7
Exploiting
    1) rewrite
    2) transfer of control


●   Bypass:
    - DEP/ASLR/safeSEH/SEHOP
    - HeapSpray - Nozzle/Bubble
    - Sandbox
    - Protection NPD
    - ROP in win8
●   Doesn't have protection:
    - SCADA
    - Embedded
    - Network device
                                            8
Generic/Not Generic
●   Generic – attacker try to change heap structure.
●   Not Generic – attacker try to change object info.




                                                    9
meta/data-data
●   Meta-data = header, checksum,...
●   Data-data = user data.




●   95% bugs in meta-data processing
●   5% bugs in user-data processing
                                       10
Level vulnerabilities




                        11
overflow
●   Stack
●   Heap (pool)
●   Integer




                             12
Example stack overflow
#include <string.h>

void foo (char *bar)
{
  char c[12];

    strcpy(c, bar); // no bounds checking...
}

int main (int argc, char **argv)
{
  foo(argv[1]);
}




                                               13
14
15
Example Heap overflow
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#define BUFSIZE 16
#define OVERSIZE 8 /* overflow buf2 by OVERSIZE bytes */
int main(){
u_long diff;
char *buf1 = (char *) malloc(BUFSIZE), *buf2 = (char *) malloc(BUFSIZE);
diff = (u_long) buf2 -(u_long) buf1;
printf("buf 1 = %p, buf2 = %p, diff = 0x% x bytesn", buf1, buf2, diff);
memset(buf2, 'A ', BUFSIZE - 1), buf2[BUFSIZE - 1] = '0';
printf("before overflow: buf2 = %sn", buf2);
memset(buf1, 'B(u_int) (diff + OVERSIZE));
printf("after overflow: buf2 = %sn", buf2);
 return 0;
 }


                                                                           16
Result of example
./heap
buf1 = 0x804e000, buf2 = 0x804eff0, diff = 0xff0
bytes
before overflow: buf2 = AAAAAAAAAAAAAAA
after overflow: buf2 = BBBBBBBBAAAAAAA




                                                   17
Overflow in disasm
●   Rep movsb
●   Rep movsd
●   Mov in loop




                                  18
Integer overflow




                   19
Integer overflow
Integer overflow -> heap or stack overflow
Integer overflow != vulnerability




                                             20
Example integer overflow
int main(int argc, char **argv) {
char chLogin[100];
 char chPassword[100];
 int intPasswordLength;
 strcpy(chLogin, argv[1]);
 strcpy(chPassword, argv[2]);
 intPasswordLength=atoi(argv[3]);
  int admin=0;
 char chOriginalPassword[100]="administrator";
if(intPasswordLength<1) intPasswordLength=0;
 intPasswordLength++;
 if(chLogin="admin"){
admin=1;
for(i=0;i<=intPasswordLength;i++)
if((chPassword[i])!=chOriginalPassword[i])
admin=0;
 }
 setUserStastusAdmin(admin);
}



                                                 21
Result of example
intPasswordLength = 2147483647(0xFFFFFFFF)

2147483647(0xFFFFFFFF) + 1 =
Not 2147483648, It's: - 2147483648




                                             22
Pointer vulnerability
●   Heap/Jit Spray
●   NPD in user space: 1) Rewrite SEH -handler 2) [eax+bit_value]
                                      .




                                                                    23
Example NPD
Registers:
eax=00000000 ebx=0000003b ecx=0be0f1c0 edx=00000000 esi=0be0f1c0 edi=0bfa3058
eip=6a606e58 esp=02333000 ebp=0233300c iopl=0          no up ei pl nz na po nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000                efl=00010202


Code disassembly:
 6A606E48 |     80cc04 | or ah, 0x4
 6A606E4B |         0000 | add [eax], al
 6A606E4D |     8d4dff | lea ecx, [ebp-0x1]
 6A606E50 |          51 | push ecx
 6A606E51 |          52 | push edx
 6A606E52 |         8bce | mov ecx, esi
 6A606E54 |   c645ff00 | mov byte [ebp-0x1], 0x0
 6A606E58 |         ffd0 | call eax
 6A606E5A |    807dff00 | cmp byte [ebp-0x1], 0x0
 6A606E5E |         750c | jnz mshtml!createhtmlpropertypage+0x31ec1
 6A606E60 |         8b16 | mov edx, [esi]
 6A606E62 | 8b82c8040000 | mov eax, [edx+0x4c8]

                                                                                 24
Use after free
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
eax=008a0000 ebx=0011ff7c ecx=00000000 edx=00000000 esi=00c12408 edi=05b71000
eip=6bdff979 esp=0011fee8 ebp=0011ff88 iopl=0        nv up ei pl zr na pe nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000                  efl=00010246
SharedOFFICE14MSPTLS.DLL -
MSPTLS!LssbFIsSublineEmpty+0x2fdb9:
6bdff979 ff943888020000 call dword ptr <Unloaded_0.DLL>+0x287 (00000288)[eax+edi] ds:0023:06411288=????????
0:000> K
ChildEBP RetAddr
WARNING: Stack unwind information not available. Following frames may be wrong.
0011ff88 6bdce474 MSPTLS!LssbFIsSublineEmpty+0x2fdb9
0011ffb4 3179dc17 MSPTLS!LsQueryLineCpPpoint+0xb0
0011ffe0 3179dbad wwlib!GetAllocCounters+0xb6e4f
00120010 319a2cf4 wwlib!GetAllocCounters+0xb6de5
0012003c 319a2875 wwlib!DllGetLCID+0xc52fe
001200bc 31a94d48 wwlib!DllGetLCID+0xc4e7f
001204ec 31a9a05d wwlib!DllGetLCID+0x1b7352
0012052c 31a9aab5 wwlib!DllGetLCID+0x1bc667
0012064c 31785b8c wwlib!DllGetLCID+0x1bd0bf
001207a0 3176fab7 wwlib!GetAllocCounters+0x9edc4
001207c4 3176f1e5 wwlib!GetAllocCounters+0x88cef
00120808 3176b644 wwlib!GetAllocCounters+0x8841d
00120834 317691e4 wwlib!GetAllocCounters+0x8487c
00120890 31769016 wwlib!GetAllocCounters+0x8241c
001209b0 31768f9a wwlib!GetAllocCounters+0x8224e
001209d4 317642cd wwlib!GetAllocCounters+0x821d2
00120ad4 31761e22 wwlib!GetAllocCounters+0x7d505
00120afc 31761deb wwlib!GetAllocCounters+0x7b05a
00120d64 31732d59 wwlib!GetAllocCounters+0x7b023
001212b4 31926f9a wwlib!GetAllocCounters+0x4bf91
6bdff979 ff943888020000 call dword ptr <Unloaded_0.DLL>+0x287 (00000288)[eax+edi] ds:0023:06411288=????????

                                                                                                              25
Race Condition
int wmain(int argc, wchar_t *argv[])                                                   DWORD WINAPI Crack(LPVOID Context)
{                                                                                      {
  ZwOpenKey = (_ZwOpenKey *) GetProcAddress(GetModuleHandle(L"ntdll.dll"),                  POBJECT_ATTRIBUTES oa = (POBJECT_ATTRIBUTES) Context;
"ZwOpenKey");

                                                                                             DWORD *ptr = (DWORD*)&oa->ObjectName->Buffer;
        OBJECT_ATTRIBUTES oa;
        wchar_t wcKeyName[] = L"REGISTRYMACHINESOFTWAREMicrosoftDrWatson";
        UNICODE_STRING KeyName = {                                                           SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST);
                   sizeof wcKeyName - sizeof wcKeyName[0],                                   SetEvent(hStartEvent);
                   sizeof wcKeyName,
                   wcKeyName
                                                                                             while ( true ) {
                   };
                                                                                                  *ptr = 0x90909090;
                                                                                                  if ( WaitForSingleObject(hStopEvent, 1) == WAIT_OBJECT_0 ) break;
        DWORD ptr = (DWORD)KeyName.Buffer;
                                                                                             }

        InitializeObjectAttributes(&oa, &KeyName, OBJ_CASE_INSENSITIVE, NULL, NULL);

                                                                                           return 0;
        DWORD ThreadId;
                                                                                       }
        HANDLE hThread = CreateThread(NULL, 0, Crack, &oa, 0, &ThreadId);


        while ( !_kbhit() ) {
              HANDLE hKey;
              oa.ObjectName->Buffer
            NTSTATUS rc = ZwOpenKey(&hKey, STANDARD_RIGHTS_READ, &oa);
              if ( !NT_SUCCESS(rc) )
                   printf("Error: %xn", rc);
              else {
                   CloseHandle(hKey);
             }}
...
      return 0;}

                                                                                                                                                                 26
RE vs tester
●   Tester:
    - QA: look at and spit on the ceiling
    - Functional: Performance and Optimization,
    take part in development loop.
●   RE: exception, bug, disasm and another crap.




                                                   27
tools
●   Source code:                    ●   Binary
                                        - static : IDA
    - frama-c
                                        - dynamic:
    - Coverity                          1) mutation fuzzer, smart fuzzer
    - bddbddb                           2) peach, sulley
                                        3) hotfuzz
    - Saturn
                                        4) inmemfuzzer, fuzzgrind
    - PathFinder                        5) KLEE
    - CoreDet                           6) S2E
                                        7) Bitblaze
    - Coccinelle
                                        8) BAP
    - http://www.checkmycode.org/
                                                                           28
mutation fuzzer
    Simple mutation fuzzer
    Smart mutation fuzzer

●   Flash: 400 – Tavis Ormandy
●   Adobe Reader: 120 – Charlie Miller




                                         29
COMRaider
Company iDefense
Target: ActiveX
https://github.com/dzzie/COMRaider




                                     30
peach, sulley, hotfuzz
●   Exception monitor
●   Mutation fuzzer
●   Configuration schema protocol



●   Hotfuzz = peach + wireshark (tshark)
    http://peachfuzzer.com/
    http://hotfuzz.sourceforge.net/
    https://github.com/OpenRCE/sulley
                                           31
Fuzzgrind, fuzzball
●   Based on Valgrind
●   It's dbi with solver
●   “on-the-spot symbolic execution”
●   http://esec-lab.sogeti.com/pages/Fuzzgrind




                                                 32
BitBlaze, BAP
●   Dynamic analysis
●   Static analysis
●   Taint analysis
●   Symbolic analysis

●   Bitblaze is QEMU-based tracing system.
    http://bitblaze.cs.berkeley.edu/
●   BAP is PIN-based tracing system.
    http://bap.ece.cmu.edu/
                                             33
Real World
●   Browser = ~ 4*10^9 insns
●   Not code-based method.
●   Not input-based method.
●   Only human-based test-case: cross_fuzz




                                             34
The potential vulnerability.
●   Static – very bad (~0.1%).
●   Dynamic (taint, symbolic execution) – bad
    (~2%).
●   Dynamic (fuzzing, debugger) – not bad (~5%).




                                                   35
Thanks :)




virvdova@gmail.com

                     36

More Related Content

What's hot

Самые вкусные баги из игрового кода: как ошибаются наши коллеги-программисты ...
Самые вкусные баги из игрового кода: как ошибаются наши коллеги-программисты ...Самые вкусные баги из игрового кода: как ошибаются наши коллеги-программисты ...
Самые вкусные баги из игрового кода: как ошибаются наши коллеги-программисты ...DevGAMM Conference
 
20110424 action scriptを使わないflash勉強会
20110424 action scriptを使わないflash勉強会20110424 action scriptを使わないflash勉強会
20110424 action scriptを使わないflash勉強会Hiroki Mizuno
 
Down to Stack Traces, up from Heap Dumps
Down to Stack Traces, up from Heap DumpsDown to Stack Traces, up from Heap Dumps
Down to Stack Traces, up from Heap DumpsAndrei Pangin
 
Csw2016 gawlik bypassing_differentdefenseschemes
Csw2016 gawlik bypassing_differentdefenseschemesCsw2016 gawlik bypassing_differentdefenseschemes
Csw2016 gawlik bypassing_differentdefenseschemesCanSecWest
 
SFO15-500: VIXL
SFO15-500: VIXLSFO15-500: VIXL
SFO15-500: VIXLLinaro
 
Architecture for Massively Parallel HDL Simulations
Architecture for Massively Parallel HDL Simulations Architecture for Massively Parallel HDL Simulations
Architecture for Massively Parallel HDL Simulations DVClub
 
[2007 CodeEngn Conference 01] seaofglass - Linux Virus Analysis
[2007 CodeEngn Conference 01] seaofglass - Linux Virus Analysis[2007 CodeEngn Conference 01] seaofglass - Linux Virus Analysis
[2007 CodeEngn Conference 01] seaofglass - Linux Virus AnalysisGangSeok Lee
 
Безопасность интернет-приложений осень 2013 лекция 10
Безопасность интернет-приложений осень 2013 лекция 10Безопасность интернет-приложений осень 2013 лекция 10
Безопасность интернет-приложений осень 2013 лекция 10Technopark
 
PHP Object Injection Vulnerability in WordPress: an Analysis
PHP Object Injection Vulnerability in WordPress: an AnalysisPHP Object Injection Vulnerability in WordPress: an Analysis
PHP Object Injection Vulnerability in WordPress: an AnalysisPositive Hack Days
 
Teaching Your Machine To Find Fraudsters
Teaching Your Machine To Find FraudstersTeaching Your Machine To Find Fraudsters
Teaching Your Machine To Find FraudstersIan Barber
 
Everything you wanted to know about Stack Traces and Heap Dumps
Everything you wanted to know about Stack Traces and Heap DumpsEverything you wanted to know about Stack Traces and Heap Dumps
Everything you wanted to know about Stack Traces and Heap DumpsAndrei Pangin
 
HotSpot template interpreter memos
HotSpot template interpreter memosHotSpot template interpreter memos
HotSpot template interpreter memosytoshima
 
Oxygine 2 d objects,events,debug and resources
Oxygine 2 d objects,events,debug and resourcesOxygine 2 d objects,events,debug and resources
Oxygine 2 d objects,events,debug and resourcescorehard_by
 
Rootkit on Linux X86 v2.6
Rootkit on Linux X86 v2.6Rootkit on Linux X86 v2.6
Rootkit on Linux X86 v2.6fisher.w.y
 
Debugging: Rules And Tools - PHPTek 11 Version
Debugging: Rules And Tools - PHPTek 11 VersionDebugging: Rules And Tools - PHPTek 11 Version
Debugging: Rules And Tools - PHPTek 11 VersionIan Barber
 
Security Meetup 22 октября. «Реверс-инжиниринг в Enterprise». Алексей Секрето...
Security Meetup 22 октября. «Реверс-инжиниринг в Enterprise». Алексей Секрето...Security Meetup 22 октября. «Реверс-инжиниринг в Enterprise». Алексей Секрето...
Security Meetup 22 октября. «Реверс-инжиниринг в Enterprise». Алексей Секрето...Mail.ru Group
 
C++ game development with oxygine
C++ game development with oxygineC++ game development with oxygine
C++ game development with oxyginecorehard_by
 
CROCHET - Checkpoint Rollback in JVM (ECOOP 2018)
CROCHET - Checkpoint Rollback in JVM (ECOOP 2018)CROCHET - Checkpoint Rollback in JVM (ECOOP 2018)
CROCHET - Checkpoint Rollback in JVM (ECOOP 2018)jon_bell
 

What's hot (19)

Самые вкусные баги из игрового кода: как ошибаются наши коллеги-программисты ...
Самые вкусные баги из игрового кода: как ошибаются наши коллеги-программисты ...Самые вкусные баги из игрового кода: как ошибаются наши коллеги-программисты ...
Самые вкусные баги из игрового кода: как ошибаются наши коллеги-программисты ...
 
20110424 action scriptを使わないflash勉強会
20110424 action scriptを使わないflash勉強会20110424 action scriptを使わないflash勉強会
20110424 action scriptを使わないflash勉強会
 
Down to Stack Traces, up from Heap Dumps
Down to Stack Traces, up from Heap DumpsDown to Stack Traces, up from Heap Dumps
Down to Stack Traces, up from Heap Dumps
 
Lecture16
Lecture16Lecture16
Lecture16
 
Csw2016 gawlik bypassing_differentdefenseschemes
Csw2016 gawlik bypassing_differentdefenseschemesCsw2016 gawlik bypassing_differentdefenseschemes
Csw2016 gawlik bypassing_differentdefenseschemes
 
SFO15-500: VIXL
SFO15-500: VIXLSFO15-500: VIXL
SFO15-500: VIXL
 
Architecture for Massively Parallel HDL Simulations
Architecture for Massively Parallel HDL Simulations Architecture for Massively Parallel HDL Simulations
Architecture for Massively Parallel HDL Simulations
 
[2007 CodeEngn Conference 01] seaofglass - Linux Virus Analysis
[2007 CodeEngn Conference 01] seaofglass - Linux Virus Analysis[2007 CodeEngn Conference 01] seaofglass - Linux Virus Analysis
[2007 CodeEngn Conference 01] seaofglass - Linux Virus Analysis
 
Безопасность интернет-приложений осень 2013 лекция 10
Безопасность интернет-приложений осень 2013 лекция 10Безопасность интернет-приложений осень 2013 лекция 10
Безопасность интернет-приложений осень 2013 лекция 10
 
PHP Object Injection Vulnerability in WordPress: an Analysis
PHP Object Injection Vulnerability in WordPress: an AnalysisPHP Object Injection Vulnerability in WordPress: an Analysis
PHP Object Injection Vulnerability in WordPress: an Analysis
 
Teaching Your Machine To Find Fraudsters
Teaching Your Machine To Find FraudstersTeaching Your Machine To Find Fraudsters
Teaching Your Machine To Find Fraudsters
 
Everything you wanted to know about Stack Traces and Heap Dumps
Everything you wanted to know about Stack Traces and Heap DumpsEverything you wanted to know about Stack Traces and Heap Dumps
Everything you wanted to know about Stack Traces and Heap Dumps
 
HotSpot template interpreter memos
HotSpot template interpreter memosHotSpot template interpreter memos
HotSpot template interpreter memos
 
Oxygine 2 d objects,events,debug and resources
Oxygine 2 d objects,events,debug and resourcesOxygine 2 d objects,events,debug and resources
Oxygine 2 d objects,events,debug and resources
 
Rootkit on Linux X86 v2.6
Rootkit on Linux X86 v2.6Rootkit on Linux X86 v2.6
Rootkit on Linux X86 v2.6
 
Debugging: Rules And Tools - PHPTek 11 Version
Debugging: Rules And Tools - PHPTek 11 VersionDebugging: Rules And Tools - PHPTek 11 Version
Debugging: Rules And Tools - PHPTek 11 Version
 
Security Meetup 22 октября. «Реверс-инжиниринг в Enterprise». Алексей Секрето...
Security Meetup 22 октября. «Реверс-инжиниринг в Enterprise». Алексей Секрето...Security Meetup 22 октября. «Реверс-инжиниринг в Enterprise». Алексей Секрето...
Security Meetup 22 октября. «Реверс-инжиниринг в Enterprise». Алексей Секрето...
 
C++ game development with oxygine
C++ game development with oxygineC++ game development with oxygine
C++ game development with oxygine
 
CROCHET - Checkpoint Rollback in JVM (ECOOP 2018)
CROCHET - Checkpoint Rollback in JVM (ECOOP 2018)CROCHET - Checkpoint Rollback in JVM (ECOOP 2018)
CROCHET - Checkpoint Rollback in JVM (ECOOP 2018)
 

Similar to 3

Windbg랑 친해지기
Windbg랑 친해지기Windbg랑 친해지기
Windbg랑 친해지기Ji Hun Kim
 
4Developers 2018: Evolution of C++ Class Design (Mariusz Łapiński)
4Developers 2018: Evolution of C++ Class Design (Mariusz Łapiński)4Developers 2018: Evolution of C++ Class Design (Mariusz Łapiński)
4Developers 2018: Evolution of C++ Class Design (Mariusz Łapiński)PROIDEA
 
An Embedded Error Recovery and Debugging Mechanism for Scripting Language Ext...
An Embedded Error Recovery and Debugging Mechanism for Scripting Language Ext...An Embedded Error Recovery and Debugging Mechanism for Scripting Language Ext...
An Embedded Error Recovery and Debugging Mechanism for Scripting Language Ext...David Beazley (Dabeaz LLC)
 
ISCA Final Presentaiton - Compilations
ISCA Final Presentaiton -  CompilationsISCA Final Presentaiton -  Compilations
ISCA Final Presentaiton - CompilationsHSA Foundation
 
Apache Commons - Don\'t re-invent the wheel
Apache Commons - Don\'t re-invent the wheelApache Commons - Don\'t re-invent the wheel
Apache Commons - Don\'t re-invent the wheeltcurdt
 
JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?Doug Hawkins
 
NYU hacknight, april 6, 2016
NYU hacknight, april 6, 2016NYU hacknight, april 6, 2016
NYU hacknight, april 6, 2016Mikhail Sosonkin
 
DEF CON 24 - Patrick Wardle - 99 problems little snitch
DEF CON 24 - Patrick Wardle - 99 problems little snitchDEF CON 24 - Patrick Wardle - 99 problems little snitch
DEF CON 24 - Patrick Wardle - 99 problems little snitchFelipe Prado
 
Silicon Valley JUG: JVM Mechanics
Silicon Valley JUG: JVM MechanicsSilicon Valley JUG: JVM Mechanics
Silicon Valley JUG: JVM MechanicsAzul Systems, Inc.
 
Return Oriented Programming, an introduction
Return Oriented Programming, an introductionReturn Oriented Programming, an introduction
Return Oriented Programming, an introductionPatricia Aas
 
Presto anatomy
Presto anatomyPresto anatomy
Presto anatomyDongmin Yu
 
node.js - Eventful JavaScript on the Server
node.js - Eventful JavaScript on the Servernode.js - Eventful JavaScript on the Server
node.js - Eventful JavaScript on the ServerDavid Ruiz
 
Locks? We Don't Need No Stinkin' Locks - Michael Barker
Locks? We Don't Need No Stinkin' Locks - Michael BarkerLocks? We Don't Need No Stinkin' Locks - Michael Barker
Locks? We Don't Need No Stinkin' Locks - Michael BarkerJAX London
 
Lock? We don't need no stinkin' locks!
Lock? We don't need no stinkin' locks!Lock? We don't need no stinkin' locks!
Lock? We don't need no stinkin' locks!Michael Barker
 
C++ CoreHard Autumn 2018. Concurrency and Parallelism in C++17 and C++20/23 -...
C++ CoreHard Autumn 2018. Concurrency and Parallelism in C++17 and C++20/23 -...C++ CoreHard Autumn 2018. Concurrency and Parallelism in C++17 and C++20/23 -...
C++ CoreHard Autumn 2018. Concurrency and Parallelism in C++17 and C++20/23 -...corehard_by
 
Writing Metasploit Plugins
Writing Metasploit PluginsWriting Metasploit Plugins
Writing Metasploit Pluginsamiable_indian
 
ExperiencesSharingOnEmbeddedSystemDevelopment_20160321
ExperiencesSharingOnEmbeddedSystemDevelopment_20160321ExperiencesSharingOnEmbeddedSystemDevelopment_20160321
ExperiencesSharingOnEmbeddedSystemDevelopment_20160321Teddy Hsiung
 
Intravert Server side processing for Cassandra
Intravert Server side processing for CassandraIntravert Server side processing for Cassandra
Intravert Server side processing for CassandraEdward Capriolo
 

Similar to 3 (20)

Windbg랑 친해지기
Windbg랑 친해지기Windbg랑 친해지기
Windbg랑 친해지기
 
4Developers 2018: Evolution of C++ Class Design (Mariusz Łapiński)
4Developers 2018: Evolution of C++ Class Design (Mariusz Łapiński)4Developers 2018: Evolution of C++ Class Design (Mariusz Łapiński)
4Developers 2018: Evolution of C++ Class Design (Mariusz Łapiński)
 
An Embedded Error Recovery and Debugging Mechanism for Scripting Language Ext...
An Embedded Error Recovery and Debugging Mechanism for Scripting Language Ext...An Embedded Error Recovery and Debugging Mechanism for Scripting Language Ext...
An Embedded Error Recovery and Debugging Mechanism for Scripting Language Ext...
 
ISCA Final Presentaiton - Compilations
ISCA Final Presentaiton -  CompilationsISCA Final Presentaiton -  Compilations
ISCA Final Presentaiton - Compilations
 
Apache Commons - Don\'t re-invent the wheel
Apache Commons - Don\'t re-invent the wheelApache Commons - Don\'t re-invent the wheel
Apache Commons - Don\'t re-invent the wheel
 
JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?
 
NYU hacknight, april 6, 2016
NYU hacknight, april 6, 2016NYU hacknight, april 6, 2016
NYU hacknight, april 6, 2016
 
DEF CON 24 - Patrick Wardle - 99 problems little snitch
DEF CON 24 - Patrick Wardle - 99 problems little snitchDEF CON 24 - Patrick Wardle - 99 problems little snitch
DEF CON 24 - Patrick Wardle - 99 problems little snitch
 
Silicon Valley JUG: JVM Mechanics
Silicon Valley JUG: JVM MechanicsSilicon Valley JUG: JVM Mechanics
Silicon Valley JUG: JVM Mechanics
 
Return Oriented Programming, an introduction
Return Oriented Programming, an introductionReturn Oriented Programming, an introduction
Return Oriented Programming, an introduction
 
Presto anatomy
Presto anatomyPresto anatomy
Presto anatomy
 
Verifikation - Metoder og Libraries
Verifikation - Metoder og LibrariesVerifikation - Metoder og Libraries
Verifikation - Metoder og Libraries
 
Message in a bottle
Message in a bottleMessage in a bottle
Message in a bottle
 
node.js - Eventful JavaScript on the Server
node.js - Eventful JavaScript on the Servernode.js - Eventful JavaScript on the Server
node.js - Eventful JavaScript on the Server
 
Locks? We Don't Need No Stinkin' Locks - Michael Barker
Locks? We Don't Need No Stinkin' Locks - Michael BarkerLocks? We Don't Need No Stinkin' Locks - Michael Barker
Locks? We Don't Need No Stinkin' Locks - Michael Barker
 
Lock? We don't need no stinkin' locks!
Lock? We don't need no stinkin' locks!Lock? We don't need no stinkin' locks!
Lock? We don't need no stinkin' locks!
 
C++ CoreHard Autumn 2018. Concurrency and Parallelism in C++17 and C++20/23 -...
C++ CoreHard Autumn 2018. Concurrency and Parallelism in C++17 and C++20/23 -...C++ CoreHard Autumn 2018. Concurrency and Parallelism in C++17 and C++20/23 -...
C++ CoreHard Autumn 2018. Concurrency and Parallelism in C++17 and C++20/23 -...
 
Writing Metasploit Plugins
Writing Metasploit PluginsWriting Metasploit Plugins
Writing Metasploit Plugins
 
ExperiencesSharingOnEmbeddedSystemDevelopment_20160321
ExperiencesSharingOnEmbeddedSystemDevelopment_20160321ExperiencesSharingOnEmbeddedSystemDevelopment_20160321
ExperiencesSharingOnEmbeddedSystemDevelopment_20160321
 
Intravert Server side processing for Cassandra
Intravert Server side processing for CassandraIntravert Server side processing for Cassandra
Intravert Server side processing for Cassandra
 

Recently uploaded

Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Neo4j
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsAndrey Dotsenko
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfjimielynbastida
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsPrecisely
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfngoud9212
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 

Recently uploaded (20)

Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdf
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power Systems
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdf
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 

3

  • 1. Binary vulnerability Alex Bazhanyuk, @Abazhanyuk “RE” school, DefCon-UA, 2012
  • 2. vulnerability ● Binary, Logic, Web ● Why vulnerabilities is so interesting? ● Why we need patched our OS? (project MIT) ● Math models for vulnerabilities ● Lang without vulnerabilities 2
  • 3. Metrics ● CVSS ● LPE/RCE ● User/Kernel space ● Probability (0-100%) 3
  • 4. Identifier ● CVE (http://cve.mitre.org/cve/cve.html) ● SA (http://secunia.com/advisories/search) ● Vupen(http://www.vupen.com/english/security-advisories/) ● Vendors 4
  • 5. Web vulnerabilities (not here) ● Cross Site Scripting (XSS) ● Injection Flaws (SQLi) ● Malicious File Execution (RFI) ● Insecure Direct Object Reference ● Cross Site Request Forgery (CSRF) ● Information Leakage and Improper Error Handling ● Broken Authentication and Session Management ● Failure to Restrict URL Access 5
  • 6. Logic vulnerabilities ● Int rand(){return 4;} ● Client decide if authorization successful or not ● [Ch-ch-ch-ch-ching!!! $60,000] [117226] [117230] Critical CVE-2011-3046: UXSS and bad history navigation. Credit to Sergey Glazunov. ● GNU C library dynamic linker $ORIGIN expansion Vulnerability Tavis Ormandy. 6
  • 8. Exploiting 1) rewrite 2) transfer of control ● Bypass: - DEP/ASLR/safeSEH/SEHOP - HeapSpray - Nozzle/Bubble - Sandbox - Protection NPD - ROP in win8 ● Doesn't have protection: - SCADA - Embedded - Network device 8
  • 9. Generic/Not Generic ● Generic – attacker try to change heap structure. ● Not Generic – attacker try to change object info. 9
  • 10. meta/data-data ● Meta-data = header, checksum,... ● Data-data = user data. ● 95% bugs in meta-data processing ● 5% bugs in user-data processing 10
  • 12. overflow ● Stack ● Heap (pool) ● Integer 12
  • 13. Example stack overflow #include <string.h> void foo (char *bar) { char c[12]; strcpy(c, bar); // no bounds checking... } int main (int argc, char **argv) { foo(argv[1]); } 13
  • 14. 14
  • 15. 15
  • 16. Example Heap overflow #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <string.h> #define BUFSIZE 16 #define OVERSIZE 8 /* overflow buf2 by OVERSIZE bytes */ int main(){ u_long diff; char *buf1 = (char *) malloc(BUFSIZE), *buf2 = (char *) malloc(BUFSIZE); diff = (u_long) buf2 -(u_long) buf1; printf("buf 1 = %p, buf2 = %p, diff = 0x% x bytesn", buf1, buf2, diff); memset(buf2, 'A ', BUFSIZE - 1), buf2[BUFSIZE - 1] = '0'; printf("before overflow: buf2 = %sn", buf2); memset(buf1, 'B(u_int) (diff + OVERSIZE)); printf("after overflow: buf2 = %sn", buf2); return 0; } 16
  • 17. Result of example ./heap buf1 = 0x804e000, buf2 = 0x804eff0, diff = 0xff0 bytes before overflow: buf2 = AAAAAAAAAAAAAAA after overflow: buf2 = BBBBBBBBAAAAAAA 17
  • 18. Overflow in disasm ● Rep movsb ● Rep movsd ● Mov in loop 18
  • 20. Integer overflow Integer overflow -> heap or stack overflow Integer overflow != vulnerability 20
  • 21. Example integer overflow int main(int argc, char **argv) { char chLogin[100]; char chPassword[100]; int intPasswordLength; strcpy(chLogin, argv[1]); strcpy(chPassword, argv[2]); intPasswordLength=atoi(argv[3]); int admin=0; char chOriginalPassword[100]="administrator"; if(intPasswordLength<1) intPasswordLength=0; intPasswordLength++; if(chLogin="admin"){ admin=1; for(i=0;i<=intPasswordLength;i++) if((chPassword[i])!=chOriginalPassword[i]) admin=0; } setUserStastusAdmin(admin); } 21
  • 22. Result of example intPasswordLength = 2147483647(0xFFFFFFFF) 2147483647(0xFFFFFFFF) + 1 = Not 2147483648, It's: - 2147483648 22
  • 23. Pointer vulnerability ● Heap/Jit Spray ● NPD in user space: 1) Rewrite SEH -handler 2) [eax+bit_value] . 23
  • 24. Example NPD Registers: eax=00000000 ebx=0000003b ecx=0be0f1c0 edx=00000000 esi=0be0f1c0 edi=0bfa3058 eip=6a606e58 esp=02333000 ebp=0233300c iopl=0 no up ei pl nz na po nc cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00010202 Code disassembly: 6A606E48 | 80cc04 | or ah, 0x4 6A606E4B | 0000 | add [eax], al 6A606E4D | 8d4dff | lea ecx, [ebp-0x1] 6A606E50 | 51 | push ecx 6A606E51 | 52 | push edx 6A606E52 | 8bce | mov ecx, esi 6A606E54 | c645ff00 | mov byte [ebp-0x1], 0x0 6A606E58 | ffd0 | call eax 6A606E5A | 807dff00 | cmp byte [ebp-0x1], 0x0 6A606E5E | 750c | jnz mshtml!createhtmlpropertypage+0x31ec1 6A606E60 | 8b16 | mov edx, [esi] 6A606E62 | 8b82c8040000 | mov eax, [edx+0x4c8] 24
  • 25. Use after free First chance exceptions are reported before any exception handling. This exception may be expected and handled. eax=008a0000 ebx=0011ff7c ecx=00000000 edx=00000000 esi=00c12408 edi=05b71000 eip=6bdff979 esp=0011fee8 ebp=0011ff88 iopl=0 nv up ei pl zr na pe nc cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00010246 SharedOFFICE14MSPTLS.DLL - MSPTLS!LssbFIsSublineEmpty+0x2fdb9: 6bdff979 ff943888020000 call dword ptr <Unloaded_0.DLL>+0x287 (00000288)[eax+edi] ds:0023:06411288=???????? 0:000> K ChildEBP RetAddr WARNING: Stack unwind information not available. Following frames may be wrong. 0011ff88 6bdce474 MSPTLS!LssbFIsSublineEmpty+0x2fdb9 0011ffb4 3179dc17 MSPTLS!LsQueryLineCpPpoint+0xb0 0011ffe0 3179dbad wwlib!GetAllocCounters+0xb6e4f 00120010 319a2cf4 wwlib!GetAllocCounters+0xb6de5 0012003c 319a2875 wwlib!DllGetLCID+0xc52fe 001200bc 31a94d48 wwlib!DllGetLCID+0xc4e7f 001204ec 31a9a05d wwlib!DllGetLCID+0x1b7352 0012052c 31a9aab5 wwlib!DllGetLCID+0x1bc667 0012064c 31785b8c wwlib!DllGetLCID+0x1bd0bf 001207a0 3176fab7 wwlib!GetAllocCounters+0x9edc4 001207c4 3176f1e5 wwlib!GetAllocCounters+0x88cef 00120808 3176b644 wwlib!GetAllocCounters+0x8841d 00120834 317691e4 wwlib!GetAllocCounters+0x8487c 00120890 31769016 wwlib!GetAllocCounters+0x8241c 001209b0 31768f9a wwlib!GetAllocCounters+0x8224e 001209d4 317642cd wwlib!GetAllocCounters+0x821d2 00120ad4 31761e22 wwlib!GetAllocCounters+0x7d505 00120afc 31761deb wwlib!GetAllocCounters+0x7b05a 00120d64 31732d59 wwlib!GetAllocCounters+0x7b023 001212b4 31926f9a wwlib!GetAllocCounters+0x4bf91 6bdff979 ff943888020000 call dword ptr <Unloaded_0.DLL>+0x287 (00000288)[eax+edi] ds:0023:06411288=???????? 25
  • 26. Race Condition int wmain(int argc, wchar_t *argv[]) DWORD WINAPI Crack(LPVOID Context) { { ZwOpenKey = (_ZwOpenKey *) GetProcAddress(GetModuleHandle(L"ntdll.dll"), POBJECT_ATTRIBUTES oa = (POBJECT_ATTRIBUTES) Context; "ZwOpenKey"); DWORD *ptr = (DWORD*)&oa->ObjectName->Buffer; OBJECT_ATTRIBUTES oa; wchar_t wcKeyName[] = L"REGISTRYMACHINESOFTWAREMicrosoftDrWatson"; UNICODE_STRING KeyName = { SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST); sizeof wcKeyName - sizeof wcKeyName[0], SetEvent(hStartEvent); sizeof wcKeyName, wcKeyName while ( true ) { }; *ptr = 0x90909090; if ( WaitForSingleObject(hStopEvent, 1) == WAIT_OBJECT_0 ) break; DWORD ptr = (DWORD)KeyName.Buffer; } InitializeObjectAttributes(&oa, &KeyName, OBJ_CASE_INSENSITIVE, NULL, NULL); return 0; DWORD ThreadId; } HANDLE hThread = CreateThread(NULL, 0, Crack, &oa, 0, &ThreadId); while ( !_kbhit() ) { HANDLE hKey; oa.ObjectName->Buffer NTSTATUS rc = ZwOpenKey(&hKey, STANDARD_RIGHTS_READ, &oa); if ( !NT_SUCCESS(rc) ) printf("Error: %xn", rc); else { CloseHandle(hKey); }} ... return 0;} 26
  • 27. RE vs tester ● Tester: - QA: look at and spit on the ceiling - Functional: Performance and Optimization, take part in development loop. ● RE: exception, bug, disasm and another crap. 27
  • 28. tools ● Source code: ● Binary - static : IDA - frama-c - dynamic: - Coverity 1) mutation fuzzer, smart fuzzer - bddbddb 2) peach, sulley 3) hotfuzz - Saturn 4) inmemfuzzer, fuzzgrind - PathFinder 5) KLEE - CoreDet 6) S2E 7) Bitblaze - Coccinelle 8) BAP - http://www.checkmycode.org/ 28
  • 29. mutation fuzzer Simple mutation fuzzer Smart mutation fuzzer ● Flash: 400 – Tavis Ormandy ● Adobe Reader: 120 – Charlie Miller 29
  • 31. peach, sulley, hotfuzz ● Exception monitor ● Mutation fuzzer ● Configuration schema protocol ● Hotfuzz = peach + wireshark (tshark) http://peachfuzzer.com/ http://hotfuzz.sourceforge.net/ https://github.com/OpenRCE/sulley 31
  • 32. Fuzzgrind, fuzzball ● Based on Valgrind ● It's dbi with solver ● “on-the-spot symbolic execution” ● http://esec-lab.sogeti.com/pages/Fuzzgrind 32
  • 33. BitBlaze, BAP ● Dynamic analysis ● Static analysis ● Taint analysis ● Symbolic analysis ● Bitblaze is QEMU-based tracing system. http://bitblaze.cs.berkeley.edu/ ● BAP is PIN-based tracing system. http://bap.ece.cmu.edu/ 33
  • 34. Real World ● Browser = ~ 4*10^9 insns ● Not code-based method. ● Not input-based method. ● Only human-based test-case: cross_fuzz 34
  • 35. The potential vulnerability. ● Static – very bad (~0.1%). ● Dynamic (taint, symbolic execution) – bad (~2%). ● Dynamic (fuzzing, debugger) – not bad (~5%). 35