一键导入
rtos-analysis
Real-Time Operating System vulnerability analysis for embedded devices running FreeRTOS, VxWorks, ThreadX, eCos, and other RTOS platforms
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Real-Time Operating System vulnerability analysis for embedded devices running FreeRTOS, VxWorks, ThreadX, eCos, and other RTOS platforms
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Authentication bypass vulnerability hunting in IoT firmware. Use when analyzing login mechanisms, session management, access control, or authentication logic in web interfaces, APIs, or network services of embedded devices. Triggers on auth bypass, login bypass, session hijacking, or access control analysis tasks.
U-Boot and embedded bootloader security analysis — environment variable attacks, secure boot bypass, boot sequence exploitation, and firmware integrity verification
Buffer overflow vulnerability hunting in IoT embedded binaries. Use when reverse-engineering ARM/MIPS/x86 binaries for stack-based or heap-based overflow vulnerabilities, analyzing unsafe memory operations (strcpy, sprintf, gets, memcpy), checking binary protections (NX, ASLR, canary), or building overflow PoCs for embedded targets.
Command injection vulnerability hunting in IoT firmware. Use when analyzing CGI binaries, web server handlers, SOAP/UPnP interfaces, or any user-input-to-system-call path in embedded devices. Triggers on searching for OS command injection (CWE-78), argument injection (CWE-88), or code injection in firmware binaries and scripts.
Cryptographic weakness and insecure crypto implementation hunting in IoT firmware. Use when analyzing encryption implementations, TLS/SSL configurations, key management, random number generation, or any cryptographic operations in embedded device firmware. Triggers on crypto analysis, weak encryption, insecure TLS, or key management tasks.
Firmware decryption, deobfuscation, and unpacking for encrypted IoT firmware images. Use when firmware entropy analysis reveals encrypted/obfuscated content, when binwalk extraction fails due to encryption, when decrypting vendor-specific firmware encryption (D-Link, Netgear, TP-Link, Hikvision, Dahua, ZTE), or when reversing custom XOR/AES/DES encryption applied to firmware update files.
| name | rtos-analysis |
| description | Real-Time Operating System vulnerability analysis for embedded devices running FreeRTOS, VxWorks, ThreadX, eCos, and other RTOS platforms |
# Search for RTOS identifiers in firmware
strings firmware.bin | grep -iE "freertos|vxworks|threadx|ecos|nucleus|zephyr|rtems|ucos|liteos|mbed.os"
# FreeRTOS-specific markers
strings firmware.bin | grep -iE "xTaskCreate|vTaskDelay|xQueue|xSemaphore|pvPortMalloc|FreeRTOS"
# VxWorks-specific markers
strings firmware.bin | grep -iE "taskSpawn|semTake|msgQSend|wdbAgent|VxWorks|Wind River"
# ThreadX-specific markers
strings firmware.bin | grep -iE "tx_thread_create|tx_queue|tx_semaphore|ThreadX|Express Logic"
| RTOS | Version Strings | Key Functions |
|---|---|---|
| FreeRTOS | FreeRTOS V, FreeRTOS Kernel V | xTaskCreate, vTaskStartScheduler |
| VxWorks | VxWorks, Wind River, WIND version | taskSpawn, taskInit |
| ThreadX | ThreadX, _tx_version_id | tx_thread_create, tx_kernel_enter |
| eCos | eCos, Red Hat eCos | cyg_thread_create, cyg_mutex_lock |
| Zephyr | zephyr, Zephyr RTOS | k_thread_create, k_sem_give |
| LiteOS | Huawei LiteOS, LOS_ | LOS_TaskCreate, LOS_SemCreate |
Priority Inversion & Starvation
xSemaphoreCreateMutex vs xSemaphoreCreateBinaryStack Overflow in Tasks
# FreeRTOS: Check configured stack sizes
# Look for xTaskCreate calls — 4th parameter is stack depth
# Typical vulnerable pattern: stack depth < 256 words for complex tasks
# VxWorks: taskSpawn stack size (parameter 5)
# If stack size < 4096 for tasks handling network input → potential overflow
Unsafe Task Deletion
vTaskDelete() without cleaning up held mutexes → deadlockstaskDelete() in VxWorks without releasing semaphores → resource leaksHeap Overflow
# FreeRTOS heap implementations (heap_1 through heap_5)
# heap_1: No free — safest but wasteful
# heap_2: No coalescing — fragmentation attacks
# heap_3: Wraps malloc — inherits libc vulnerabilities
# heap_4: First-fit with coalescing — metadata corruption possible
# heap_5: Like heap_4 with non-contiguous regions
# Check which heap implementation is used:
strings firmware.bin | grep -i "heap_[1-5]"
grep -c "pvPortMalloc\|vPortFree" disassembly.txt
Double Free
vPortFree() calls on same pointer without reassignmentfree() on same block → heap metadata corruptionUse-After-Free
vPortFreeMessage Queue Overflow
xQueueSend without timeout → task blocks indefinitelyShared Memory Without Synchronization
Unsafe Callback Registration
# Look for function pointer tables that can be overwritten
# Timer callbacks: xTimerCreate → callback address in heap
# Software watchdog callbacks
# Interrupt handler tables in writable memory
lwIP (Lightweight IP) — Common in FreeRTOS
# Version detection
strings firmware.bin | grep -i "lwip\|lwIP"
# Check for known CVEs against detected version
# Common issues: buffer overflow in DHCP, DNS rebinding, TCP sequence prediction
VxWorks Network Stack
strings firmware.bin | grep -i "ipnet\|interpeak"| Stack | Common CVEs | Detection |
|---|---|---|
| lwIP | CVE-2020-22283, CVE-2020-22284 | lwip, LWIP_ macros |
| uIP | CVE-2020-17437, CVE-2020-17440 | uip_, UIP_CONF |
| FNET | CVE-2020-17467, CVE-2020-17468 | fnet_, FNET_CFG |
| PicoTCP | CVE-2020-17441, CVE-2020-17443 | pico_, PICO_ |
| Nut/Net | CVE-2020-25107 | Nut/OS, NutTcp |
Unsigned Firmware Updates
mbedtls_pk_verify, RSA_verify, crypto verification functionsSecure Boot Bypass
Attack Surface Priority:
1. Network input handlers (lwIP callbacks, MQTT parsers, HTTP handlers)
2. pvPortMalloc/vPortFree → heap metadata corruption
3. Task stack overflow → control flow hijack
4. Timer callback pointers → overwrite for code execution
Exploitation Notes:
- FreeRTOS heap metadata is simpler than glibc → easier to exploit
- No ASLR on most MCU targets (Cortex-M, etc.)
- No NX/DEP on Cortex-M0/M3 → stack buffer overflow = direct shellcode
- Cortex-M4/M7 with MPU: check if MPU is actually configured
Attack Surface Priority:
1. WDB agent (debug agent, often left enabled in production)
2. RPC services (portmapper, mountd)
3. Web server (typically on port 80)
4. SNMP agent
5. FTP/Telnet services
Key Checks:
- WDB agent on UDP port 17185 → remote code execution
nmap -sU -p 17185 <target>
- taskSpawn via WDB → spawn arbitrary task with any function
- Memory read/write via WDB → dump credentials, modify config
Attack Surface:
1. NetX/NetX Duo network stack
2. FileX filesystem handling
3. USBX USB stack
4. GUIX graphics (if GUI-enabled device)
Memory Layout:
- ThreadX byte pools / block pools
- tx_byte_allocate → similar to malloc, first-fit
- Metadata corruption in byte pool → arbitrary write primitive
# Find FreeRTOS task creation calls and extract task parameters
# In Ghidra Python console:
from ghidra.program.model.symbol import SymbolType
fm = currentProgram.getFunctionManager()
for func in fm.getFunctions(True):
if "TaskCreate" in func.getName() or "taskSpawn" in func.getName():
refs = getReferencesTo(func.getEntryPoint())
for ref in refs:
print(f"Task created at: {ref.getFromAddress()}")