SignalSEC Corp. Zafiyet Araştırma Yöntemleri [Bug Hunting]

Transkript

SignalSEC Corp. Zafiyet Araştırma Yöntemleri [Bug Hunting]
Reversing
Celil ÜNÜVER
Siber Güvenlik Buluşmaları
24 Ağustos 2013
$whoami
• Geek @ SignalSEC Ltd.
• Vulnerability Research, Intelligence , Pentest
• Vulns affects Adobe, IBM, Microsoft, SCADA ,
Novell etc.
• Speaker at Hackfest, CONFidence, Swiss Cyber
Storm, c0c0n, Kuwait etc.
• Organizer of NOPcon Hacker Conference
Who The F*ck is Reverse Engineer?
There are 10 types of people in the world: Those
who understand binary and those who don’t.
Jargon
•
•
•
•
•
Vulnerability
Exploit
Zeroday
Malware
Cracking
Underground
• Cracking
• Malware
• Exploit Packs
Güvenlik Endüstrisi
• Malware Analiz
- AV ve Forensics Şirketleri
• Patch, Zafiyet Analizi
- IPS/IDS Şirketleri
• Exploit Geliştirme
- Penetrasyon Testleri
Siber Silah Endüstrisi
Criminals
• TJX
Devlet Destekli Saldırılar
Devlet Destekli Saldırılar
US DoD Contractors
ENDGAME
ENDGAME
....
Gerçek tehdit Defacement Grupları mı?
Nasıl Tersine Mühendis Olunur?
Windows ve Uygulama
Çalışma Mimarisi
• Bir uygulama (exe) windows’da çalıştığında ,
process yaratılır ve bu process’e bir sanal
hafıza (virtual memory) tahsis edilir.
• Bu processin hafıza blokları kullanılarak
uygulama çalışır.
• Process’in hafızası 3 ana bileşenden oluşur;
- Code Segment, Data Segment, Stack Segment
Windows ve Uygulama
Çalışma Mimarisi
• Code Segment:
İşlemcinin çalıştıracağı kodlardan (assembly
instructionlarından) oluşan segment.
• Data Segment:
Değişkenlerin ve dinamik hafızaların tutulduğu segment.
• Stack Segment:
Fonksiyonlara data/argüman kopyalama ve değişkenler için
yer ayırma işlemlerinde kullanılır.
Nasıl Tersine Mühendis Olunur?
İşlemci / Assembly / Stack
- Herşey işlemcide biter.
- 1ler ve 0lar  Hex/Opcode  Assembly
Assembly
•
•
•
•
•
•
•
•
mov eax, ebx ; eax = ebx
Mov ecx, 1234; ecx = 1234
Jmp 123456; 123456 adresine zıpla
Jmp esp; Stack’e zıpla
Call printf
Call MessageBox
Push 123456 (stack’ e veri yolla)
NOP (0x90) = No Operation
Assembly
Şartlı Zıplamalar (Conditional Branches)
cmp eax, 2 ; eax’ı 2 ile karşılaştır
Je fonksiyon1 ; if ( eax==2 ) fonksiyon 1 ‘e zıpla
Ja fonksiyon2 ; if ( eax>2) fonksiyon2 ‘ ye zıpla
Jb fonksiyon3 ; if ( eax<2) fonksiyon3’ e zıpla
Jne fonksiyon4 ; if ( eax!=2 ) fonksiyon4’e zıpla
STACK (LIFO)
LAST IN FIRST OUT
Push e1
Push e2
Push e3
Push e4
Push e5
Windows API
• Windows İşletim Sisteminin bize sunduğu
fonksiyonlar
• Dosya Okuma , Yazma , Pencereler, Mesaj
Kutuları, Socket İşlemleri
MessageBox API
int WINAPI MessageBox(
_In_opt_ HWND hWnd,
_In_opt_ LPCTSTR lpText, - Are You Sure?
_In_opt_ LPCTSTR lpCaption,  Confirmation
_In_ UINT uType
);
MessageBox API
push uType
push lpCaption
push lpText
push hWnd
call MessageBox
Exploit Geliştiricinin Alet Çantası
1-) Debugger:
- Windbg, Immunity Debugger, GDB
2-) Disassembler:
- IDA Pro
WinDBG
WinDBG
Komutlar:
G = Run
Bp = Breakpoint
T= Run step by step
D = Dump
S = Search memory
IDA Disassembler
IDA Disassembler
Reversing
Static Reversing
Static Reversing
Static Reversing
• Bol
• BOL ŞANS 
Dynamic Reversing
Into The Wild!
Dynamic Reversing
Dynamic Reversing
Dynamic Reversing
Breakpoints (windbg)
Dynamic Reversing
Dump (d , db, da etc.)
Dynamic Reversing
Call Stack : k , kc
Dynamic Reversing
BreakPoint on some “juicy” instructions:
REP MOVSD = memcpy (edi , esi, ecx)
REP STOSD = memset (edi, eax, ecx)
Dynamic Reversing
Intelligent BreakPoints :
BA : Breakpoint Access (ba r 0x1234 , ba w 0x1234 )
Breakpoint when a function reads recv() ‘ s buffer
argument 
Soru
Microsoft Exchange, IBM Lotus Notes gibi mail
clientlarda 0day arasam nerelere bakardım? 
EML formatı ???  Zaman kaybı
Malware Analiz
Teşekkürler
•
•
•
•
[email protected]
Twitter : @celilunuver
Kurumsal: www.signalsec.com
Kişisel: blog.securityarchitect.org

Benzer belgeler

Reverse Engineering Bootcamp Eğitim İçeriği

Reverse Engineering Bootcamp Eğitim İçeriği - Use After Free - Double Free - Logical Errors

Detaylı