Reverse Engineering - Disassembly.pdf
(
221 KB
)
Pobierz
`
Universita degli Studi di Milano
`
Facolta di Scienze e Tecnologie
Dipartimento di Informatica
Reverse engineering:
disassembly
Lanzi Andrea
<andrew@security.di.unimi.it>
A.A. 2016–2017
Andrea Lanzi
Reverse engineering:
disassembly
A.A. 2016–2017
1/1
Tecniche statiche
Disassembly
Cos’`?
e
stream of bytes
disassembly
sequence of
assembly
instructions
Esempio
$ echo -ne "\x89\x04\x24\xc3" | ndisasm -u -
00000000 890424
mov [esp],eax
00000003 C3
ret
Andrea Lanzi
Reverse engineering:
disassembly
A.A. 2016–2017
2/1
Tecniche statiche
Disassembly
Indecidibilit` della separazione tra
codice
e
dati
a
Intel x86: 248/256 byte rappresentano l’inizio di un’istruzione valida
Esempio
...
0x81 0xc3 0x90 0x90 0x90 0x90 . . .
se consideriamo il byte
0x81
come codice:
$ echo -ne \x81\xc3\x90\x90\x90\x90 | ndisasm -b32 -
00000000 81C390909090
add ebx,0x90909090
se consideriamo il byte
0x81
come data e il byte
0xc3
come codice:
$ echo -ne \xc3\x90\x90\x90\x90 | ndisasm -b32 -
00000000 C3
ret
00000001 90
nop
00000002 90
nop
00000003 90
nop
00000004 90
nop
Andrea Lanzi
Reverse engineering:
disassembly
A.A. 2016–2017
3/1
Disassembly
Problema: esplosione di complessit`
a
1
2
3
4
5
6
7
8
9
10
11
12
13
int
main(int argc,
char
∗∗argv)
{
int
num;
scanf(”%d”, &num);
if(num
== 1234)
printf(”ok\n”);
else
printf(”no\n”);
return
0;
}
Andrea Lanzi
Reverse engineering:
disassembly
A.A. 2016–2017
4/1
Disassembly
Problema: esplosione di complessit`
a
push
mov
sub
call
call
call
leave
ret
pushl
jmp
add
jmp
push
jmp
jmp
push
jmp
jmp
push
jmp
jmp
push
jmp
xor
pop
mov
and
push
push
push
push
push
push
push
push
call
hlt
nop
nop
push
mov
%ebp
%esp,%ebp
$0x8,%esp
8048304
8048360
8048490
0x80495dc
*0x80495e0
%al,(%eax)
*0x80495e4
$0x0
8048290
*0x80495e8
$0x8
8048290
*0x80495ec
$0x10
8048290
*0x80495f0
$0x18
8048290
%ebp,%ebp
%esi
%esp,%ecx
$-16,%esp
%eax
%esp
%edx
$0x80483e0
$0x8048430
%ecx
%esi
$0x8048384
80482c0
push
sub
call
pop
add
mov
test
je
call
pop
pop
leave
ret
nop
...
push
mov
sub
cmpb
je
jmp
add
mov
call
mov
mov
test
jne
movb
leave
ret
nop
push
mov
sub
mov
test
je
mov
test
je
movl
call
leave
ret
nop
push
mov
sub
and
mov
add
add
shr
shl
sub
lea
%ebp
mov
%esp,%ebp
movl
$0x8,%esp
call
mov
$0x0,0x8049600
804834b
cmp
804835d
jne
$0x4,%eax
movl
%eax,0x80495fc
call
jmp
*%edx
movl
0x80495fc,%eax
call
(%eax),%edx
mov
%edx,%edx
leave
8048341
ret
$0x1,0x8049600
nop
...
push
mov
%ebp
push
%esp,%ebp
push
$0x8,%esp
push
0x8049508,%eax
call
%eax,%eax
add
8048381
sub
$0x0,%eax
lea
%eax,%eax
lea
8048381
sub
$0x8049508,(%esp)sar
*%eax
%ebx
$0x4,%esp
8048310
%ebx
$0x12c8,%ebx
-4(%ebx),%edx
%edx,%edx
8048326
80482d0
%eax
%ebx
lea
cmp
je
%ebp
lea
%esp,%ebp
call
$0x18,%esp
dec
$-16,%esp
cmp
$0x0,%eax
jne
$0xf,%eax
lea
$0xf,%eax
call
$0x4,%eax
add
$0x4,%eax
pop
%eax,%esp
pop
-4(%ebp),%eax
pop
%eax,0x4(%esp)
pop
$0x80484e8,(%esp)ret
80482b0
lea
-4(%ebp),%eax
push
$0x4d2,%eax
mov
80483cb
push
$0x80484eb,(%esp)push
80482a0
push
80483d7
call
$0x80484ee,(%esp)add
80482a0
sub
$0x0,%eax
call
lea
lea
sub
%ebp
sar
%esp,%ebp
mov
%edi
je
%esi
xor
%ebx
mov
8048483
lea
$0x11ed,%ebx
lea
$0xc,%esp
inc
-224(%ebx),%eax call
-224(%ebx),%edi add
%edi,%eax
cmp
$0x2,%eax
jne
-1(%eax),%esi
$-1,%esi
8048419
0x0(%esi),%esi
*(%edi,%esi,4)
%esi
$-1,%esi
8048410
0x0(%esi),%esi
80484c4
$0xc,%esp
%ebx
%esi
%edi
%ebp
0x0(%esi),%esi
%ebp
%esp,%ebp
%edi
%esi
%ebx
8048483
$0x119d,%ebx
$0xc,%esp
8048278
-224(%ebx),%eax
-224(%ebx),%edx
%edx,%eax
$0x2,%eax
%eax,-16(%ebp)
804847b
%edi,%edi
%edx,%esi
0x0(%esi),%esi
0x0(%edi),%edi
%edi
*(%esi)
$0x4,%esi
%edi,-16(%ebp)
8048470
add
pop
pop
pop
pop
ret
mov
ret
nop
...
push
mov
push
sub
mov
cmp
je
mov
lea
lea
call
mov
sub
cmp
jne
pop
pop
pop
ret
nop
...
push
mov
push
sub
call
pop
add
call
pop
pop
leave
ret
$0xc,%esp
%ebx
%esi
%edi
%ebp
(%esp),%ebx
%ebp
%esp,%ebp
%ebx
$0x4,%esp
0x80494f8,%eax
$-1,%eax
80484bd
$0x80494f8,%ebx
0x0(%esi),%esi
0x0(%edi),%edi
*%eax
-4(%ebx),%eax
$0x4,%ebx
$-1,%eax
80484b0
%eax
%ebx
%ebp
%ebp
%esp,%ebp
%ebx
$0x4,%esp
80484d0
%ebx
$0x1108,%ebx
8048330
%ecx
%ebx
%ebp
%esp,%ebp
Andrea Lanzi
Reverse engineering:
disassembly
A.A. 2016–2017
4/1
Plik z chomika:
WMatrixie
Inne pliki z tego folderu:
Syngress - Sockets, Shellcode, Porting & Coding - Reverse Engineering Exploits And Tool Coding For Security Professionals.pdf
(115030 KB)
Reverse Engineering for Beginners.pdf
(7099 KB)
Cracking - The Anti.pdf
(90 KB)
Reverse Engineering of Malware on Android.pdf
(3591 KB)
Hacking the Malware - A reverse-engineer analysis.pdf
(382 KB)
Inne foldery tego chomika:
Computer Forensics 1
Computer Forensics 2
Exploration of Mobile and Embedded Systems
Incident Response
Malware
Zgłoś jeśli
naruszono regulamin