Metasploit attack Oracle environment construction

Source: Internet
Author: User
Tags redmine

 

The Oracle Attack Module in metasploit is incomplete by default. You need to do some work on your own. This article mainly records some errors in the setup environment (operating system backtrack 5 ). By default, some attack functions of Oracle may encounter the following error: ary module execution completed
 

  1. MSF>Use auxiliary/admin/Oracle/oracle_login
  2. MSF auxiliary (oracle_login)>Set rHost 192.168.0.91
  3. RHost =>192.168.0.91
  4. MSF auxiliary (oracle_login)>Run
  5. [-] Failed to load the OCI Library: no such file to load -- oci8
  6. [-] See http://www.metasploit.com/redmine/projects/framework/wiki/OracleUsage for installation instructions
  7. [*] Auxiliary module execution completed
Install Oracle instant clinet download basic, sqlplus, and SDK: http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html, unzip the three packages to the same directory and create a libclntsh. So-> libclntsh. so.11.1 link.
 

  1. >Unzip/opt/Oracle/instantclient-basic-linux32-11.2.0.2.0.zip.
  2. >Unzip/opt/Oracle/instantclient-sqlplus-linux32-11.2.0.2.0.zip.
  3. >Unzip/opt/Oracle/instantclient-sdk-linux32-11.2.0.2.0.zip.
  4. >Ln-s libclntsh. so.11.1 libclntsh. So

 

The contents in the directory are roughly as follows:
 

  1. Root @ BT:/opt/Oracle/instantclient_11_2 # ls
  2. Adrci libclntsh. So libociei. So ojdbc5.jar sqlplus_readme
  3. Basic_readme libclntsh. so.11.1 libocijdbc11.so ojdbc6.jar uidrvci
  4. Genezi libnnz11.so libsqlplusic. So SDK xstreams. Jar
  5. Glogin. SQL libocci. so.11.1 libsqlplus. So sqlplus

 

Then execute VI ~ /. Bashrc Add the following environment variables at the end of the file:
 

  1. Export Path = $ path:/opt/Oracle/instantclient_11_2
  2. Export sqlpath =/opt/Oracle/instantclient_11_2
  3. Export tns_admin =/opt/Oracle/instantclient_11_2
  4. Export LD_LIBRARY_PATH =/opt/Oracle/instantclient_11_2
  5. Export ORACLE_HOME =/opt/Oracle/instantclient_11_2
Check whether the Oracle Instant Client is successfully installed.
 

  1. Root @ BT :~ # Sqlplus Scott/tiger @ // 192.168.0.91/orcl
  2. SQL * Plus: Release 11.2.0.2.0 production on Fri Sep 23 04:39:08 2011
  3. Copyright (c) 1982,201 0, Oracle. All rights reserved.
  4. Connected:
  5. Oracle Database 10g Enterprise Edition Release 10.1.0.2.0-Production
  6. With the partitioning, OLAP and Data Mining options
  7. SQL>

 

Download oci8 installation link: http://ruby-oci8.rubyforge.org/en/, decompress the file, and run make and make install. Before running these two commands, use the Env command to check whether the environment variables set earlier have taken effect. If the environment variables have not taken effect, the preceding sqlplus cannot run, restart the computer. For more information, see http://dev.metasploit.com/redmine/projects/1/wiki/oracleusage. After the installation is complete, verify that oci8 is successfully installed. The following problems occur in the version I used.
 

  1. Root @ BT :~ # IRB
  2. IRB (main): 001: 0>Require 'ci8'
  3. Loaderror: no such file to load -- oci8lib_191
  4. From/usr/local/lib/site_ruby/1.9.2/oci8.rb: 40: In 'require'
  5. From/usr/local/lib/site_ruby/1.9.2/oci8.rb: 40: in'<Top(Required)>'
  6. From (IRB): 1: In 'require'
  7. From (IRB): 1
  8. From/usr/bin/IRB: 12: In'<Main>'

 

Because my ruby version is 1.9.2 and the oci8lib_192 file is generated during installation, you need to change the oci8.rb file.
Root @ BT:/usr/local/lib/site_ruby/1.9.2 # vi oci8.rb

 

Add one more when to use the oci8lib_192 library.
 

  1. # The suffix number indicates the ruby API version.
  2. #18-Ruby 1.8.x
  3. #191-Ruby 1.9.1 and 1.9.2
  4. # 19x-Ruby 1.9.x future version which will break the API compatibility
  5. CaseRuby_version
  6. When/^ 1 \. 9 \. 1/
  7. So_basename + = '000000'
  8. When/^ 1 \. 9 \. 2/
  9. So_basename + = '000000'
  10. When/^ 1 \. 8/
  11. So_basename + = '18'
  12. Else
  13. Raise'Unsupported Ruby version: '+ ruby_version
  14. End
  15. Require so_basename

 

Now let's confirm that the following similar information appears.
 

  1. IRB (main): 002: 0>Require 'ci8'
  2. Warning: nls_lang is not set. fallback to US-ASCII.
  3. =>True

 

On backtrack5 R1, MSF still appears
 

  1. [-] Failed to load the OCI Library: no such file to load -- oci8

 

This is because the metasploit environment variable does not contain the installed oci8. You can run the following command in metasploit to confirm
 

  1. MSF auxiliary (oracle_login)>Ruby-r rbconfig-e "puts config: config ['sitelibdir']"
  2. [*] Exec: Ruby-r rbconfig-e "puts config: config ['sitelibdir']"
  3. /Opt/framework/Ruby/lib/Ruby/site_ruby/1.9.1
 
 

  1. MSF auxiliary (oracle_login)>Env | grep rubylib
  2. [*] Exec: ENV | grep rubylib
  3. Rubylib =/opt/framework/Ruby/lib:/opt/framework/Ruby/lib/RUBY:/opt/framework/Ruby/lib/Ruby/1.9.1: /opt/framework/Ruby/lib/Ruby/1.9.1/i686-linux:/opt/framework/Ruby/lib/Ruby/site_ruby: /opt/framework/Ruby/lib/Ruby/site_ruby/1.9.1:/opt/framework/Ruby/lib/Ruby/site_ruby/1.9.1/i686-linux

 

Add the directory of your installed oci8 to the rublib of/opt/framework3/scripts/setenv. Sh.
:/Usr/local/lib/site_ruby/1.9.2:/usr/local/lib/site_ruby/1.9.2/i486-linux

 

Restart msfconsole
 

  1. MSF>Use auxiliary/admin/Oracle/oracle_login
  2. MSF auxiliary (oracle_login)>Set rHost 192.168.0.91
  3. RHost =>192.168.0.91
  4. MSF auxiliary (oracle_login)>Run
  5. [*] Starting brute force on 192.168.0.91: 1521...
  6. [*] Found user/pass of: Scott/tiger on 192.168.0.91 with Sid orcl
  7. [*] Auxiliary module execution completed
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.