2009-07-14 03:55:32 +00:00
|
|
|
##
|
2017-07-24 06:26:21 -07:00
|
|
|
# This module requires Metasploit: https://metasploit.com/download
|
2013-10-15 13:50:46 -05:00
|
|
|
# Current source: https://github.com/rapid7/metasploit-framework
|
2009-07-14 03:55:32 +00:00
|
|
|
##
|
|
|
|
|
|
2016-03-08 14:02:44 +01:00
|
|
|
class MetasploitModule < Msf::Auxiliary
|
2009-07-14 03:55:32 +00:00
|
|
|
include Msf::Exploit::ORACLE
|
2013-08-30 16:28:54 -05:00
|
|
|
|
2009-07-14 03:55:32 +00:00
|
|
|
def initialize(info = {})
|
2025-05-28 00:10:48 +10:00
|
|
|
super(
|
|
|
|
|
update_info(
|
|
|
|
|
info,
|
|
|
|
|
'Name' => 'Oracle SQL Generic Query',
|
|
|
|
|
'Description' => %q{
|
2009-12-05 14:24:36 +00:00
|
|
|
This module allows for simple SQL statements to be executed
|
2017-08-24 21:38:44 -04:00
|
|
|
against an Oracle instance given the appropriate credentials
|
2009-12-05 14:24:36 +00:00
|
|
|
and sid.
|
2025-05-28 00:10:48 +10:00
|
|
|
},
|
|
|
|
|
'Author' => [ 'MC' ],
|
|
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
|
'References' => [
|
2025-02-28 09:35:28 +00:00
|
|
|
[ 'URL', 'http://web.archive.org/web/20110322124810/http://www.metasploit.com:80/users/mc/' ],
|
2009-07-14 03:55:32 +00:00
|
|
|
],
|
2025-05-28 00:10:48 +10:00
|
|
|
'DisclosureDate' => '2007-12-07',
|
|
|
|
|
'Notes' => {
|
|
|
|
|
'Stability' => [CRASH_SAFE],
|
|
|
|
|
'SideEffects' => [IOC_IN_LOGS],
|
|
|
|
|
'Reliability' => []
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
)
|
2013-08-30 16:28:54 -05:00
|
|
|
|
2025-05-28 00:10:48 +10:00
|
|
|
register_options(
|
|
|
|
|
[
|
|
|
|
|
OptString.new('SQL', [false, 'The SQL to execute.', 'select * from v$version']),
|
|
|
|
|
]
|
|
|
|
|
)
|
2009-07-14 03:55:32 +00:00
|
|
|
end
|
2013-08-30 16:28:54 -05:00
|
|
|
|
2009-07-14 03:55:32 +00:00
|
|
|
def run
|
2025-05-28 00:10:48 +10:00
|
|
|
return if !check_dependencies
|
2013-08-30 16:28:54 -05:00
|
|
|
|
2009-07-14 03:55:32 +00:00
|
|
|
query = datastore['SQL']
|
2013-08-30 16:28:54 -05:00
|
|
|
|
2009-07-14 03:55:32 +00:00
|
|
|
begin
|
2009-12-03 23:57:02 +00:00
|
|
|
print_status("Sending statement: '#{query}'...")
|
|
|
|
|
result = prepare_exec(query)
|
2015-04-03 16:12:23 +05:00
|
|
|
# Need this if statement because some statements won't return anything
|
2009-12-03 23:57:02 +00:00
|
|
|
if result
|
|
|
|
|
result.each do |line|
|
|
|
|
|
print_status(line)
|
|
|
|
|
end
|
|
|
|
|
end
|
2025-05-28 00:10:48 +10:00
|
|
|
rescue StandardError
|
2010-04-30 08:40:19 +00:00
|
|
|
return
|
2009-07-14 03:55:32 +00:00
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|