Report MySQL application-level protocol errors (such as host not allowed messages).

git-svn-id: file:///home/svn/framework3/trunk@8767 4d416f70-5f16-0410-b530-b9f4589650da
unstable
Tod Beardsley 2010-03-10 17:56:03 +00:00
parent bd3d6b55f6
commit 542a9a0617
1 changed files with 22 additions and 9 deletions

View File

@ -58,15 +58,28 @@ class Metasploit3 < Msf::Auxiliary
proto = data[offset, 1].unpack('C')[0]
# Error condition
return if proto == 255
offset += 1
version = data[offset..-1].unpack('Z*')[0]
print_status("#{rhost}:#{rport} is running MySQL #{version} (protocol #{proto})")
report_service(:host => rhost, :port => rport, :name => "mysql", :info => version)
# Application-level error condition
if proto == 255
offset += 2
err_msg = data[offset..-1].to_s.gsub(/[\x00-\x19\x7f-\xff]/) {|s| "\\x%02x" % s[0].ord}
print_status("#{rhost}:#{rport} is running MySQL, but responds with an error: #{err_msg}")
report_service(
:host => rhost,
:port => rport,
:name => "mysql",
:info => "Error: #{err_msg}"
)
else
offset += 1
version = data[offset..-1].unpack('Z*')[0]
print_status("#{rhost}:#{rport} is running MySQL #{version} (protocol #{proto})")
report_service(
:host => rhost,
:port => rport,
:name => "mysql",
:info => version
)
end
end
end