Analysis
Decompile a binary and provide full source
- Analysis:
- Parsed ESP32 image, rebuilt Xtensa ELF, ran headless Ghidra decompilation and packaged outputs.
- Conclusion:
- Complete decompilation of MeshCore v1.17.1 app (6,271 functions) with reports and artifacts; no backdoors or hard-coded credentials found; one GATT handler flag
Tools: todo_write, run_sandbox, skill, skill:ghidra-analysis, inspect_binary, dump_data, semantic_function_search, write_file
Run it yourselfDecompile this binary fully, and provide full source
I'll start by inspecting the file and loading the appropriate analysis skill.
The file is a merged ESP32-S3 flash image (bootloader + partition table + app + FS partitions) — this naming matches a MeshCore companion radio build. Let me load the analysis skill and identify the app image contents.
Now let me confirm the firmware project (MeshCore) and carve out the application image.
Confirmed: this is MeshCore v1.17.1 (commit d929643) for Heltec V3 (ESP32-S3), the BLE companion-radio build — an Arduino/ESP-IDF app. The interesting part is the app image at 0x10000. Now I'll convert the raw ESP32 app image into a proper Xtensa ELF (so Ghidra can map and decompile it), and check the remaining partitions.
Only bootloader + app0 contain code (app1/SPIFFS/NVS are blank, otadata points at OTA0). Building the Xtensa ELF now:
Small ELF-header field swap to fix (e_ehsize/e_phentsize/e_phnum). Rebuilding:
Off-by-one in my pack args — fixing precisely (13 fields: …, e_shstrndx=0):
Valid Xtensa ELF now. Following the ghidra-analysis workflow — step 1, lightweight inspection:
Stripped Xtensa monolithic firmware, no symbols — as expected for a raw flash image. Now the full Ghidra dump (this is the long step — ~1 MB of code, thousands of functions):
Dump completed. Let me check what was produced and verify decompilation quality:
Full dump complete: 6,272 decompiled functions (.c) + matching disassembly (.asm), 113 MB. Let me orient via the TOC, sanity-check decompilation quality, and then package everything as deliverables in the workspace.
Good TOC and 57 heuristic-suspicious functions flagged. Let me sanity-check decompiler output quality and confirm version strings are visible in the decompiled code:
Decompiler output is high quality. (The grep timed out scanning 6k files — I'll use a single-pass approach.) Now packaging the full decompiled source into the workspace:
File-by-file copy is too slow for 12k files. I'll tar it instead and build the combined source directly:
The combined source (5.0 MB, all 6,271 functions) and index landed. Now copying metadata + attempting the bulk per-function archive with max timeout:
tar syntax failed and the combined file has 4,611 of 6,271 functions — some functions have no .c. Let me diagnose:
Diagnosis: the earlier 300s timeout killed Python mid-write (4,611/~6,271 done). Rebuilding the combined file with the max timeout:
Resumable approach — append only the remaining ~270 functions:
Combined source complete: 6,271/6,271 functions. Now the supplementary per-function archive + extracting firmware artifacts for the report:
All deliverables staged. Now triage for the report — pulling firmware artifacts (strings with virtual addresses) and examining the flagged functions:
Build provenance confirmed (built on macOS via PlatformIO, Arduino-ESP32 + Bluedroid BLE). Now the security triage — reviewing all 57 flagged functions:
Most flags look like heuristics over ESP-IDF/BT internals, but several are MeshCore app-level. Verifying the key ones against actual code and callers:
Both verified — the GATT handler shows a real 510-into-24-byte memcpy pattern (Bluedroid internals), parse_and_store_chunk is bounded (<0x41) with byte-derived lengths. Let me extract the app-level artifacts (AT commands, BLE UUIDs) and map core MeshCore components semantically:
Key artifacts found: Nordic UART BLE service UUIDs (6E400001-B5A3-F393-E0A9-E50E24DCCA9E), CLI rescue strings, radio status formats. Now mapping the core MeshCore components semantically:
Two more quick verifications on app-level flags, then I'll write the final report:
0x42010978's loops are bounded by internally-derived bit-length fields (& 0xff masks), and 0x4200a35c's memcpy is actually guarded by < 0xa7 before it runs — both heuristic noise. I have everything needed for the final report:
Done. The firmware is fully decompiled — here's what you have:
What the binary is
MeshCore v1.17.1-d929643 — BLE companion-radio firmware for the Heltec V3 (ESP32-S3), built with PlatformIO/Arduino-ESP32. The merged image contains a 2nd-stage bootloader + partition table + the app (app0); app1/SPIFFS/NVS partitions are blank.
How it was decompiled
- Parsed the ESP32 image headers and carved
app0.bin(6 segments, entry0x40377720) - Rebuilt a valid Xtensa ELF (
meshcore_heltec_v3_app.elf) so every segment maps to its real runtime address - Ghidra headless decompilation of all 6,271 functions (one
.c+ one.asmeach, 113 MB raw)
Deliverables in decompiled_source/
| File | What it is |
|---|---|
MESHCORE_full_decompiled_source.c | The full source reconstruction — all 6,271 functions in one 6.9 MB file, ordered by address, each with a /* ===== [0xADDR] name ===== */ banner |
function_index.csv | Address + name + file + suspicious-flag for every function |
per_function_decompiled_c.tar | All per-function .c files individually |
ANALYSIS_REPORT.md | Full analysis report: identity, architecture, artifacts, security triage |
analysis.json / suspicious.json / toc.json | Function reference, 57 heuristic flags, semantic TOC |
Key findings
- Identified surfaces: Nordic-UART BLE service (
6E400001-B5A3-F393-E0A9-E50E24DCCA9E, advertised asMeshCore-…), serial/BLE CLI with filesystem paths restricted toUserData/andExtraFS/, SX1262 LoRa mesh flood/relay logic, packet reassembly with a 64-byte chunk bound - Triage of the 57 heuristic flags: verified
parse_and_store_chunkis properly bounded, several flags are ESP-IDF/ROM idioms (false positives), one Bluedroid GATT handler (0x42096194) shows a genuine overflow-shaped pattern (510→24-byte memcpy) that would need dynamic confirmation - No backdoors or hard-coded credentials found in this pass
One honest caveat: with no symbols, this is reconstructed pseudo-C faithful to the machine code — not the original C++ (MeshCore is open source on GitHub if you need the true source). Happy to run reachability/taint analysis on the flagged functions, or dig into any specific component.
