본문으로 건너뛰기
Skillpedia
보안6.5k · #14100

lorawan-otaa

하는 일

이 가이드는 계량기, 추적기, 산업용 센서에 쓰이는 LoRaWAN 네트워크의 보안 검토를 다룹니다. 네트워크를 운영하거나 배포하며 가입과 재전송 방지를 확인하려는 팀을 위한 것입니다.

사용하는 경우

  • ✓회사가 LoRaWAN 센서를 운영하며 장치가 네트워크에 가입하는 방식을 확인하려는 경우.
  • ✓장치가 고정 세션 설정을 쓰고 팀이 재전송 방지를 확인하려는 경우.
  • ✓네트워크 팀이 장치 키가 안전하게 저장되는지 확인하려는 경우.

스킬 링크

https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/iot/lorawan-otaa/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/iot/lorawan-otaa/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“우리는 지역 전체에 LoRaWAN 계량기를 운영합니다. 가입 절차와 재전송 방지가 올바르게 설정되었는지 확인해 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

에이전트는 가입 방식과 키 처리를 검토하고, 프레임 카운터가 강제되는지 확인하며, 설정이 보호를 약화하는 부분을 보고합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

LoRaWAN OTAA / ABP Security Assessment

LoRaWAN is deployed globally for smart meters, asset tracking, agriculture, and industrial sensors. OTAA (Over-The-Air Activation) derives session keys per join; ABP (Activation By Personalization) hardcodes them. Both have documented attack surface: OTAA AppKeys are often extracted from the device firmware or exposed via insecure provisioning, and ABP devices commonly disable the frame-counter check, enabling full replay.

Prerequisites

  • Hardware: LILYGO TTGO T-Beam (SX1276 + GPS, programmable SDR-LoRa node), RAK831 / RAK2247 gateway concentrator, or HackRF One with gr-lora. RTL-SDR is receive-only (works for capture on EU 868 MHz).
  • Software: ChirpStack (rogue gateway NS), lorawansniffer / gr-lora, LoRaWAN Auditing Framework (LAF), Scapy-LoRa, lorawan-parser.
# Install LoRaWAN Auditing Framework:
git clone https://github.com/IOActive/laf
cd laf && pip install -r requirements.txt

# Install gr-lora (GNU Radio LoRa decoder):
git clone https://github.com/rpp0/gr-lora
cd gr-lora && mkdir build && cd build && cmake .. && make && sudo make install

# lorawan-parser for offline frame analysis:
pip install lorawan-parser

LoRaWAN Frequency Reference

Region Uplink (MHz) Downlink (MHz) Spreading Factors
EU868 868.1, 868.3, 868.5 869.525 SF7–SF12
US915 902.3–914.9 (8 ch) 923.3–927.5 SF7–SF10
AU915 915.2–927.8 923.3–927.5 SF7–SF12
AS923 923.2, 923.4 923.2, 923.4 SF7–SF12

Phase 1: Passive Air Capture

# RTL-SDR capture on EU868 primary channel, SF7 (fastest, most common):
rtl_sdr -f 868100000 -s 1000000 -g 40 /tmp/lora_raw.iq

# Decode with gr-lora offline:
python3 gr-lora/apps/rx_file.py --freq 868.1e6 --sf 7 --bw 125000 \
    --input /tmp/lora_raw.iq --output /tmp/lora_frames.txt

# Online decode with TTGO T-Beam running LoRa sniffer firmware:
# Flash: https://github.com/claudiodangelis/lora-sniffer
# Serial output at 115200:
screen /dev/ttyUSB0 115200

LAF spectrum scan (scans all EU868 channels across SF7-SF12):

python3 laf/laf.py scan --freq 868.1,868.3,868.5 --sf all --bw 125 \
    --device /dev/ttyACM0 | tee /tmp/laf_scan.txt

Phase 2: OTAA Join Analysis

OTAA JoinRequest contains DevEUI (8 bytes), AppEUI/JoinEUI (8 bytes), and DevNonce (2 bytes), all in plaintext. Only the MIC is keyed with AppKey.

# Parse a captured JoinRequest frame:
python3 - <<'EOF'
from lorawan import LoRaWANMessage
# hex of a raw captured PHY payload:
payload_hex = "00AABBCCDDEEFF001122334455667701234501"
msg = LoRaWANMessage.from_hex(payload_hex)
print(f"MType: {msg.mhdr.mtype}")
print(f"AppEUI: {msg.join_request.app_eui.hex()}")
print(f"DevEUI: {msg.join_request.dev_eui.hex()}")
print(f"DevNonce: {msg.join_request.dev_nonce.hex()}")
EOF

AppKey extraction from firmware (if binary is available):

# binwalk extracts the firmware; AppKey is a 16-byte value near DevEUI in flash.
binwalk -eM firmware.bin
# Search for DevEUI (known from OTA capture) ± 32 bytes:
python3 - <<'EOF'
import re, sys
dev_eui = bytes.fromhex("AABBCCDDEEFF0011")  # from captured JoinRequest
fw = open("_firmware.bin.extracted/0.bin", "rb").read()
offset = fw.find(dev_eui)
if offset >= 0:
    print(f"DevEUI at 0x{offset:08x}")
    print(f"Surrounding 48 bytes: {fw[offset-16:offset+32].hex()}")
    # AppKey is likely 16 bytes before or after DevEUI in the provisioning struct.
EOF

Phase 3: AppKey Brute-Force / Known-Key Verification

With a known AppKey, verify and derive session keys:

import hmac, hashlib
from Crypto.Cipher import AES

APP_KEY = bytes.fromhex("2B7E151628AED2A6ABF7158809CF4F3C")  # known/extracted key

def verify_join_request_mic(phypayload: bytes, app_key: bytes) -> bool:
    """Verify MIC of LoRaWAN JoinRequest. MIC = CMAC(AppKey, MHDR||AppEUI||DevEUI||DevNonce)[0:4]"""
    from Crypto.Hash import CMAC
    msg = phypayload[:-4]  # strip 4-byte MIC
    claimed_mic = phypayload[-4:]
    cobj = CMAC.new(app_key, ciphermod=AES)
    cobj.update(msg)
    return cobj.digest()[:4] == claimed_mic

def derive_session_keys(app_key: bytes, app_nonce: bytes, net_id: bytes, dev_nonce: bytes):
    """Derive NwkSKey and AppSKey from OTAA join-accept parameters."""
    def aes_ecb(key, data):
        return AES.new(key, AES.MODE_ECB).encrypt(data)
    nwk_s_key = aes_ecb(app_key, b'\x01' + app_nonce + net_id + dev_nonce + b'\x00'*7)
 
자주 묻는 질문

OTAA란 무엇인가요?

무선 가입 방식으로, 장치가 가입할 때마다 새 세션 키를 만듭니다.

ABP란 무엇인가요?

세션 키를 미리 설정하는 방식이며, 가이드는 이것이 보호를 약화할 수 있다고 말합니다.

프레임 카운터가 왜 중요한가요?

기록되었다가 다시 보내진 오래된 메시지를 네트워크가 거부하도록 돕습니다.

상세 정보

작성자의 원본 설명

LoRaWAN OTAA join-procedure analysis (DevEUI/AppEUI/AppKey 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.

repo: BitterSecurity/Decepticon

인기도

GitHub 스타
6.5k
순위
#14100
라이선스
Apache-2.0
업데이트
2026. 11. 1.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬