Skip to content

Commit d6ecd9d

Browse files
authored
Land rapid7#19021, update admin/mysql/mysql_enum for newer versions of mysql
2 parents 8d3bfc0 + c5e98d9 commit d6ecd9d

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

modules/auxiliary/admin/mysql/mysql_enum.rb

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,17 @@ def run
111111
query = "use mysql"
112112
mysql_query(query)
113113

114+
# Starting from MySQL 5.7, the 'password' column was changed to 'authentication_string'.
115+
if vparm['version'][0..2].to_f > 5.6
116+
password_field = 'authentication_string'
117+
else
118+
password_field = 'password'
119+
end
120+
114121
# Account Enumeration
115122
# Enumerate all accounts with their password hashes
116123
print_status("Enumerating Accounts:")
117-
query = "select user, host, password from mysql.user"
124+
query = "select user, host, #{password_field} from mysql.user"
118125
res = mysql_query(query)
119126
if res and res.size > 0
120127
print_status("\tList of Accounts with Password Hashes:")
@@ -229,7 +236,7 @@ def run
229236
end
230237

231238
# Blank Password Check
232-
queryblankpass = "select user, host, password from mysql.user where length(password) = 0 or password is null"
239+
queryblankpass = "select user, host, #{password_field} from mysql.user where length(#{password_field}) = 0 or #{password_field} is null"
233240
res = mysql_query(queryblankpass)
234241
if res and res.size > 0
235242
print_status("\tThe following accounts have empty passwords:")

0 commit comments

Comments
 (0)