What is BeEF
BeEF is a Browser Exploitation Framework. It enables an attacker/pen tester to assess the security of the browser and lets him exploit it if found vulnerable.
- It has various uses.
- It can Port scan the zombie.(BeEF framework uses word zombies for targets/victims).
- It helps to foot print the zombie for various plugins and settings.
- It can exploit the browser vulnerabilities.
- It can be used as key logger.
- It can be used as a platform to check exploit behaviour under different browsers like IE, Firefox, Safari etc.
The good thing about BeEF, is that it is designed in a modular way (which makes addition of new exploits as easy as possible). Additionally, it is cross platform.
The functionality of the framework revolves around two components namely zombies and modules.
- Zombies are the prospective targets (browsers) which can be exploited/manipulated based up on their security posture.
- Modules are the functional parts of the framework. They let us use exploits, shells, port scanner etc.
BeEF has many cool features:
BeEF is actively being developed by its developers. They have plans to incorporate many features. BeEF has following features right now in the PHP version.
- Key logger
- Bind shells
- Port scanner
- Clipboard theft
- Tor detection
- Integration with Metasploit Framework
- Many browser exploitation modules
- Browser functionality detection
- Mozilla extension exploitation support.
Who can use it?
The scope of the BeEF is very broad, it can used by Penetration testers, security researchers, information security hobbyists etc.
How does it work?
BeEF is built on a client-server architecture and has two components namely :-
- User interface
- Communication server
BeEF has a very nice and easy to use User interface. This component acts an interface between BeEF framework, zombies (BeEFframework uses word zombies for targets/victims ) and the attacker. UI lets you select zombies, select modules, and configure various settings etc.
This component is the heart (base) of the framework. The communication Server communicates with the zombies ( Targets ) via the http protocol and takes care of everything the framework does.
A typical scenario:
A attacker hosts a site using BeEF. Victim access the web page hosted by attacker. The web page triggers BeEF framework to send the instructions to the browser, to execute on the target machine. The user gets added into the zombie list of the framework. The whole process is invisible to the user.
Now attacker logs in to the BeEF server remotely and can run modules to get the desired outcome. He can redirect the victim to a malicious site, exploit vulnerable browser, log the browser activity etc. Usages are limit less and are only restricted by imagination/creativity of the attacker.
How to install BeEF:
These instructions are for php version of BeEF.
- Web server
- Download beef source from the site (checkout the source with svn client)
- Extract the source into the webroot directory of the server (usually it is /var/www/)
- Check the permissions and ownership of the BeEF directory
- Go to the location of BeEF directory through a browser
- Follow the instructions
Let us see the demo of MS09-002 exploit in BeEF. There is a nice collection of videos by Jabra atVimeo. Please see the References for video links.
Consider we have three machines.
- Attacker Machine: 192.168.1.2
- BeEF Server Machine: 192.168.1.101
- Victim (Zombie) Machine : 192.168.1.102.The victim is running a windows box with Internet Explorer.
Attacker performs the following steps which results in exploitation of victim's machine.
Attacker hosts a site (here 192.168.1.101/beef/example.html) running a BeEF framework.
Victim visits the site, assuming the site is safe. Once he access the page 192.168.1.101/beef/example.html, the browser executes a series of instructions fetched from the framework which instructs the browser to maintain connection and receive further commands. Furthermore victim's ip gets added to the zombie list of BeEF.
Attacker logs into the server through the URL 192.168.1.101/beef/ui, usually by providing username and password (default username and password are beef/beef ).
Attacker selects the desired zombie, in our case victim's machine 192.168.1.102 from the zombies list in left panel.
Attacker verifies the availability of port 28876 (Port is configurable in BeEF). As you can see in the screen-shot below, it’s available for our use, ideally it means, the port 28876 is not being used by any other process right now.
Attacker selects the MS009-002 exploit from standard modules menu.
Standard Modules –>xplt: xp sp2 iebindshell
The following page is displayed
Once Attacker clicks the Exploit button, BeEF exploits the vulnerability and opens a port 28876 on victim's machine.
Attacker connects to the victim's box using Netcat on port 28876 using following command –
nc 192.168.1.102 28876.
For more info on using Netcat see the man page of nc or “nc/?”
Thats it. Attacker now has complete access of the victim's system. The applications of BeEF are only limited by the creativity of the attacker. He can turn this system into a web server for hosting malicious sites to trap few more zombies.
BeEF is a very powerful tool in any security professional's arsenal. It creates new client side attack vectors to test/assess the security of the browser. It helps a security professional to test their exploits on various browsers to assess exploit’s functionality and restrictions
Project home :http://code.google.com/p/beef/
Jabra's BeEF Videos: http://vimeo.com/5353835