Skip to content

Commit 3e771f4

Browse files
committed
Add human-readable descriptions to CheckCode returns in remaining multi exploit modules
1 parent 9efc727 commit 3e771f4

52 files changed

Lines changed: 238 additions & 226 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

modules/exploits/multi/elasticsearch/script_mvel_rce.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@ def initialize(info = {})
6060
end
6161

6262
def check
63-
result = Exploit::CheckCode::Safe
63+
result = Exploit::CheckCode::Safe('Elasticsearch does not appear to be vulnerable')
6464

6565
if vulnerable?
66-
result = Exploit::CheckCode::Vulnerable
66+
result = Exploit::CheckCode::Vulnerable('Arbitrary Java execution confirmed via MVEL scripting')
6767
end
6868

6969
result

modules/exploits/multi/elasticsearch/search_groovy_script.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ module has been tested successfully on ElasticSearch 1.4.2 on Ubuntu Server 12.0
5858
end
5959

6060
def check
61-
result = Exploit::CheckCode::Safe
61+
result = Exploit::CheckCode::Safe('Elasticsearch does not appear to be vulnerable')
6262

6363
if vulnerable?
64-
result = Exploit::CheckCode::Vulnerable
64+
result = Exploit::CheckCode::Vulnerable('Arbitrary Java execution confirmed via Groovy scripting')
6565
end
6666

6767
result

modules/exploits/multi/ftp/pureftpd_bash_env_exec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,17 +85,17 @@ def check
8585
command = "echo auth_ok:1; echo uid:#{random_id}; echo gid:#{random_id}; echo dir:/tmp; echo end"
8686
if send_command(username, command) =~ /^2\d\d ok./i
8787
disconnect
88-
return CheckCode::Safe if banner !~ /pure-ftpd/i
88+
return CheckCode::Safe('Target does not appear to be running Pure-FTPd') if banner !~ /pure-ftpd/i
8989

9090
command = "echo auth_ok:0; echo end"
9191
if send_command(username, command) =~ /^5\d\d login authentication failed/i
9292
disconnect
93-
return CheckCode::Vulnerable
93+
return CheckCode::Vulnerable('Pure-FTPd bash environment variable injection confirmed')
9494
end
9595
end
9696
disconnect
9797

98-
CheckCode::Safe
98+
CheckCode::Safe('Pure-FTPd not vulnerable to bash environment variable injection')
9999
end
100100

101101
def execute_command(cmd, _opts)

modules/exploits/multi/ftp/wuftpd_site_exec_format.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,21 +120,21 @@ def check
120120

121121
# We just want the banner to check against our targets..
122122
vprint_status("FTP Banner: #{banner.strip}")
123-
status = Exploit::CheckCode::Safe
123+
status = Exploit::CheckCode::Safe('WU-FTPD not detected or version is not vulnerable')
124124
if banner =~ /Version wu-2\.(4|5)/
125-
status = Exploit::CheckCode::Appears
125+
status = Exploit::CheckCode::Appears('WU-FTPD 2.x version detected')
126126
elsif banner =~ /Version wu-2\.6\.0/
127-
status = Exploit::CheckCode::Appears
127+
status = Exploit::CheckCode::Appears('WU-FTPD 2.6.0 detected')
128128
end
129129

130130
# If we've made it this far, we care if login succeeded.
131131
if (ret)
132132
# NOTE: vulnerable and exploitable might not mean the same thing here :)
133133
if not fmtstr_detect_vulnerable
134-
status = Exploit::CheckCode::Safe
134+
status = Exploit::CheckCode::Safe('Format string vulnerability not detected')
135135
end
136136
if not fmtstr_detect_exploitable
137-
status = Exploit::CheckCode::Safe
137+
status = Exploit::CheckCode::Safe('Format string vulnerability not exploitable')
138138
end
139139
end
140140

modules/exploits/multi/local/xorg_x11_suid_server.rb

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,12 @@ def check
118118
user = cmd_exec('id -un')
119119
unless exist?("/var/run/console/#{user}")
120120
vprint_error("No console lock for #{user}")
121-
return CheckCode::Safe
121+
return CheckCode::Safe("No console lock for #{user}")
122122
end
123123
vprint_good("Console lock for #{user}")
124124
end
125125

126126
return CheckCode::Safe('SELinux is enforcing') if selinux_installed? && selinux_enforcing?
127-
128-
vprint_good('SELinux is not an issue')
129127
end
130128

131129
# suid program check
@@ -148,27 +146,27 @@ def check
148146
v = Rex::Version.new(x_version.scan(/\d\.\d+\.\d+/).first)
149147
unless v.between?(Rex::Version.new('1.19.0'), Rex::Version.new('1.20.2'))
150148
vprint_error "Xorg version #{v} not supported"
151-
return CheckCode::Safe
149+
return CheckCode::Safe("Xorg version #{v} is not in the vulnerable range")
152150
end
153151
elsif x_version.include?('Fatal server error')
154152
vprint_error 'User probably does not have console auth'
155153
vprint_error 'Below is Xorg -version output'
156154
vprint_error x_version
157-
return CheckCode::Safe
155+
return CheckCode::Safe('User does not have console auth')
158156
else
159157
vprint_warning('Could not parse Xorg -version output')
160-
return CheckCode::Appears
158+
return CheckCode::Appears('Could not parse Xorg version, but Xorg is SUID')
161159
end
162160
vprint_good("Xorg version #{v} is vulnerable")
163161

164162
# process check for /X
165163
proc_list = cmd_exec 'ps ax'
166164
if proc_list.include?('/X ')
167165
vprint_warning('Xorg in process list')
168-
return CheckCode::Appears
166+
return CheckCode::Appears("Xorg version #{v} is vulnerable but Xorg is already running")
169167
end
170168
vprint_good('Xorg does not appear running')
171-
return CheckCode::Vulnerable
169+
return CheckCode::Vulnerable("Xorg version #{v} is vulnerable and not currently running")
172170
end
173171

174172
def on_new_session(session)

modules/exploits/multi/local/xorg_x11_suid_server_modulepath.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def check
102102
user = cmd_exec('id -un')
103103
unless exist?("/var/run/console/#{user}")
104104
vprint_error("No console lock for #{user}")
105-
return CheckCode::Safe
105+
return CheckCode::Safe("No console lock for #{user}")
106106
end
107107
vprint_good("Console lock for #{user}")
108108
end
@@ -132,21 +132,21 @@ def check
132132
vprint_error 'User probably does not have console auth'
133133
vprint_error 'Below is Xorg -version output'
134134
vprint_error x_version
135-
return CheckCode::Safe
135+
return CheckCode::Safe('User does not have console auth')
136136
else
137137
vprint_warning('Could not parse Xorg -version output')
138-
return CheckCode::Appears
138+
return CheckCode::Appears('Could not parse Xorg version, but Xorg is SUID')
139139
end
140140
vprint_good("Xorg version #{v} is vulnerable")
141141

142142
# process check for /X
143143
proc_list = cmd_exec 'ps ax'
144144
if proc_list.include?('/X ')
145145
vprint_warning('Xorg in process list')
146-
return CheckCode::Appears
146+
return CheckCode::Appears("Xorg version #{v} is vulnerable but Xorg is already running")
147147
end
148148
vprint_good('Xorg does not appear to be running')
149-
return CheckCode::Vulnerable
149+
return CheckCode::Vulnerable("Xorg version #{v} is vulnerable and not currently running")
150150
end
151151

152152
def check_arch_and_compile(path, data)

modules/exploits/multi/misc/apache_activemq_rce_cve_2023_46604.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,21 +81,21 @@ def check
8181

8282
len = sock.timed_read(4)&.unpack1('N')
8383

84-
return CheckCode::Unknown if len.nil? || len > 0x2000 # upper limit in case the service isn't ActiveMQ
84+
return CheckCode::Unknown('Invalid or unexpected response length') if len.nil? || len > 0x2000 # upper limit in case the service isn't ActiveMQ
8585

8686
res = sock.timed_read(len)
8787

8888
disconnect
8989

90-
return CheckCode::Unknown unless res
90+
return CheckCode::Unknown('No response received from target') unless res
9191

9292
_, magic = res.unpack('CZ*')
9393

94-
return CheckCode::Unknown unless res.length == len
94+
return CheckCode::Unknown('Response length mismatch') unless res.length == len
9595

96-
return CheckCode::Unknown unless magic == 'ActiveMQ'
96+
return CheckCode::Unknown('Target is not an ActiveMQ service') unless magic == 'ActiveMQ'
9797

98-
return CheckCode::Detected unless res =~ /ProviderVersion...(\d+\.\d+\.\d+)/
98+
return CheckCode::Detected('ActiveMQ detected but version could not be determined') unless res =~ /ProviderVersion...(\d+\.\d+\.\d+)/
9999

100100
version = Rex::Version.new(::Regexp.last_match(1))
101101

@@ -114,7 +114,7 @@ def check
114114

115115
Exploit::CheckCode::Safe("Apache ActiveMQ #{version}")
116116
rescue ::Timeout::Error
117-
CheckCode::Unknown
117+
CheckCode::Unknown('Could not determine vulnerability status')
118118
end
119119

120120
def exploit

0 commit comments

Comments
 (0)