Easy Pentesting: Metasploit's db_autopwn

http://allanfeid.com/content/easy-pentesting-metasploits-dbautopwn


Everyday, life gets easier for script kiddies. These days everything is pretty much automated. I came across the db_autopwn feature of the Metasploit Framework a few semesters ago and I think it's definitely something that security professionals should know about and administrators should use as a quick way to find holes in their network. Try it now before someone else on the Internet does.

Prerequisites

I assume the following:

  • You have the latest version of Metasploit Framework installed
  • You have MySQL, or other database server running and configured properly

How it works (the simple version)

This command works by using some sort of database. I will be using MySQL as I am most familiar with it, but PostgresSQL is an excellent alternative especially when dealing with large networks. The information stored in the database can vary. There is more than one way to get information into the database that Metasploit will be able to read.

You may choose from an NBE file from Nessus, the Nmap XML output files, or use the built in Nmap wrapper command (db_nmap). For a more thorough test I would highly recommend using a Nessus scan as it matches exploits based on actual vulnerabilities, while the Nmap results match exploits based solely on port numbers. Really though you should be fine using the Nmap scans as long as your services are running on standard ports. Once all the data is in the database, it's then just a matter of executing the db_autopwn command. It will read through the database and automatically try to exploit vulnerabilities based on the IPs on your network as well as the open ports.

Performing the Pentest

First you must load up the MySQL plugin so that connections to the database are possible.

msf > load db_mysql

[*] Successfully loaded plugin: db_mysql

Now go ahead and create a database within MySQL. Insert your own credentials as necessary.
msf > db_create root:password@localhost/pentest

[*] Database creation complete (check for errors)

It says to check for errors, so why not? Login to the MySQL console and take a look.
$ mysql -u root -p

mysql> show databases;

+--------------------+

| Database             |

+--------------------+

| pentest              |

+--------------------+

5 rows in set (0.10 sec)

mysql> use pentest

mysql> show tables;

+-------------------+

| Tables_in_pentest |

+-------------------+

| hosts               |

| notes               |

| refs                |

| services            |

| vulns               |

| vulns_refs          |

+-------------------+

6 rows in set (0.00 sec)

As you can see the pentest database exists and the proper tables exist within. Next you need to fill up the database. I'm going to use the db_nmap wrapper because that's keeps this pentest very simple and quick. You can throw any nmap options at this command as it is just a wrapper. I do a quick scan of my entire network with the following:

msf > db_nmap -A 192.168.1.0/24

Once that finishes running find out if the hosts on your network were loaded into the database.
msf  > db_hosts

[*]  Time: Thu May 21  22:52:48 -0700 2009 Host: 192.168.1.1 Status: alive OS:

[*]  Time: Thu May 21  22:52:49 -0700 2009 Host: 192.168.1.2 Status: alive OS:

[*]  Time: Thu May 21  22:52:49 -0700 2009 Host: 192.168.1.103 Status: alive OS:

[*]  Time: Thu May 21  22:52:49 -0700 2009 Host: 192.168.1.120 Status: alive OS:

[*]  Time: Thu May 21  22:52:49 -0700 2009 Host: 192.168.1.140 Status: alive OS:

Your database is now set up and you can run the db_autopwn command against your network. You can find out all the options for the command by running db_autopwn with no options. Something that should be noted, the x switch is for use with information loaded from a Nessus scan. It uses vulnerability references instead of relying on ports. Here we will be relying on port numbers.

msf > db_autopwn -pb

The options I used tell the command to match vulnerabilities based on open ports and to bind using a random port. This command may take some time to run depending on the number of ports open on each device as well as the number of hosts you are running through. If you read the help options you will find ways to only run against certain hosts, which is highly recommended since your workstations probably do not need to be scanned as they should not have any ports available to the outside. To find out if any exploits were successful, use the sessions command. You should be familiar with this command if you're using Metasploit, but to give you a hint take a look at sessions -lv to list all current shell connections as well as the exploit that allowed for remote shell access. Then you can use -i to connect to the session numbers shell.

Why is this important?

As I stated in the beginning, script kiddies are going rampant trying to build bot nets. Don't let your systems become part of this. Just run a quick pentest because that will show you what is open and exploitable by script kiddies. This is a great way to show improvement to your bosses as well. That way they can stop thinking that you're not doing anything.


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
本系统的研发具有重大的意义,在安全性方面,用户使用浏览器访问网站时,采用注册和密码等相关的保护措施,提高系统的可靠性,维护用户的个人信息和财产的安全。在方便性方面,促进了校园失物招领网站的信息化建设,极大的方便了相关的工作人员对校园失物招领网站信息进行管理。 本系统主要通过使用Java语言编码设计系统功能,MySQL数据库管理数据,AJAX技术设计简洁的、友好的网址页面,然后在IDEA开发平台中,编写相关的Java代码文件,接着通过连接语言完成与数据库的搭建工作,再通过平台提供的Tomcat插件完成信息的交互,最后在浏览器中打开系统网址便可使用本系统。本系统的使用角色可以被分为用户和管理员,用户具有注册、查看信息、留言信息等功能,管理员具有修改用户信息,发布寻物启事等功能。 管理员可以选择任一浏览器打开网址,输入信息无误后,以管理员的身份行使相关的管理权限。管理员可以通过选择失物招领管理,管理相关的失物招领信息记录,比如进行查看失物招领信息标题,修改失物招领信息来源等操作。管理员可以通过选择公告管理,管理相关的公告信息记录,比如进行查看公告详情,删除错误的公告信息,发布公告等操作。管理员可以通过选择公告类型管理,管理相关的公告类型信息,比如查看所有公告类型,删除无用公告类型,修改公告类型,添加公告类型等操作。寻物启事管理页面,此页面提供给管理员的功能有:新增寻物启事,修改寻物启事,删除寻物启事。物品类型管理页面,此页面提供给管理员的功能有:新增物品类型,修改物品类型,删除物品类型。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值