Crash Dump Analysis: Jakub Jermář Martin Děcký
Crash Dump Analysis: Jakub Jermář Martin Děcký
Crash Dump Analysis: Jakub Jermář Martin Děcký
IA-32
Jakub Jerm
Martin Dck
Crash Dump Analysis MFF UK IA-32 2
IA-32 Overview
Little-endian
Implicit stack
v = 0xAA884400
Big-Endian
big end first
most significant byte first
AA 88 !!
! " 2 3
Litte-Endian
#itt#e end first
#east significant byte first
!! 88 AA
! " 2 3
Crash Dump Analysis MFF UK IA-32 5
Little-Endian
v = 0xAA884400
Return value
Frame pointer
Hundreds of instructions
Informal classification
FPU instructions
register register
immediate register
memory register
immediate memory
AT&T syntax
Intel syntax
Memory operands
XOR, AND, OR
CMP, TEST
NOP
MOV
LEA
INC, DEC
Increment, decrement
PUSH
Push a register
content on the stack
POP
CALL
Call function
RET
Example: ret
ESP 2 ESP + 4
EIP 2 (ESP - 4)
Crash Dump Analysis MFF UK IA-32 22
Common Instructions (7)
CMP
TEST
Test bits
JMP
Unconditional jump
popl %edi
movl 4(esp), %ebx
movl %ebp, %esp
popl %ebp
ret
popl %edi
movl 4(esp), %ebx
leave
ret
Crash Dump Analysis MFF UK IA-32 26
Stack and Code Example
Initial state
No instructions executed
Performance reasons
main3 0us4# 5eb0
main6"3 mo1# 5es075eb0
main633 sub# 8!9875es0
main6:3 and# 8!9fffffff!75es0
main6;3 sub# 8!9"c75es0
main6!9c3 0us4# !98<5eb0=
main6!9f3 ca## -!93f >foo?
main6!9"3 #ea1e
main6!9"@3 ret
!98!:be!3 !98!:bec
!98!:be3 Ainit6!9"a
!98!:be83 !9feffbBdc
!98!:bec3 !98!:c!
!98!:bf!3 Astart6!98!
Crash Dump Analysis MFF UK IA-32 33
Stack and Code Example (2)
Call foo()
main3 0us4# 5eb0
main6"3 mo1# 5es075eb0
main633 sub# 8!9875es0
main6:3 and# 8!9fffffff!75es0
main6;3 sub# 8!9"c75es0
main6!9c3 0us4# !98<5eb0=
main6!9f3 ca## -!93f >foo?
main6!9"3 #ea1e
main6!9"@3 ret
!98!:bbc3 main6!9"
!98!:bc!3 "
!98!:bc3 Af0start6!92c
!98!:bc83 !92;
!98!:bcc3 Af0A4C
!98!:bd!3 !9"33f
!98!:bd3 !98!@!cda
!98!:bd83 !98!:!d3c
!98!:bdc3 !98!:bcc
!98!:be!3 !98!:bec
!98!:be3 Ainit6!9"a
!98!:be83 !9feffbBdc
!98!:bec3 !98!:c!
!98!:bf!3 Astart6!98!
Crash Dump Analysis MFF UK IA-32 36
Stack and Code Example (2)
Call bar()
foo3 0us4# 5eb0
foo6"3 mo1# 5es075eb0
foo633 sub# 8!9"75es0
foo6:3 0us4# !98<5eb0=
foo6;3 ca## 6!9@ >bar?
foo6!9e3 add# 8!9"!75es0
foo6!9""3 #ea1e
foo6!9"23 ret
!98!:b;c3 foo6!9e
!98!:ba!3 "
!98!:ba3 !98!@!;e8
!98!:ba83 dbgAdesc
!98!:bac3 8
!98!:bb!3 "
!98!:bb3 !
!98!:bb83 !98!:bec
!98!:bbc3 main6!9"
!98!:bc!3 "
!98!:bc3 Af0start6!92c
!98!:bc83 !92;
!98!:bcc3 Af0A4C
!98!:bd!3 !9"33f
!98!:bd3 !98!@!cda
!98!:bd83 !98!:!d3c
!98!:bdc3 !98!:bcc
!98!:be!3 !98!:bec
!98!:be3 Ainit6!9"a
!98!:be83 !9feffbBdc
!98!:bec3 !98!:c!
!98!:bf!3 Astart6!98!
Crash Dump Analysis MFF UK IA-32 41
Stack and Code Example (2)