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 yourself
Heltec_v3_companion_radio_ble-v1.17.1-d929643-merged.bin

Decompile this binary fully, and provide full source

Dr.Binary

I'll start by inspecting the file and loading the appropriate analysis skill.

todo_write
run_sandbox

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.

run_sandbox

Now let me confirm the firmware project (MeshCore) and carve out the application image.

run_sandbox
run_sandbox

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.

run_sandbox

Only bootloader + app0 contain code (app1/SPIFFS/NVS are blank, otadata points at OTA0). Building the Xtensa ELF now:

run_sandbox

Small ELF-header field swap to fix (e_ehsize/e_phentsize/e_phnum). Rebuilding:

run_sandbox
run_sandbox

Off-by-one in my pack args — fixing precisely (13 fields: …, e_shstrndx=0):

run_sandbox

Valid Xtensa ELF now. Following the ghidra-analysis workflow — step 1, lightweight inspection:

inspect_binary

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_data

Dump completed. Let me check what was produced and verify decompilation quality:

run_sandbox

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.

todo_write
run_sandbox
run_sandbox

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:

run_sandbox

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:

run_sandbox
run_sandbox

File-by-file copy is too slow for 12k files. I'll tar it instead and build the combined source directly:

run_sandbox
run_sandbox

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:

run_sandbox

tar syntax failed and the combined file has 4,611 of 6,271 functions — some functions have no .c. Let me diagnose:

run_sandbox

Diagnosis: the earlier 300s timeout killed Python mid-write (4,611/~6,271 done). Rebuilding the combined file with the max timeout:

run_sandbox
run_sandbox

Resumable approach — append only the remaining ~270 functions:

run_sandbox

Combined source complete: 6,271/6,271 functions. Now the supplementary per-function archive + extracting firmware artifacts for the report:

run_sandbox

All deliverables staged. Now triage for the report — pulling firmware artifacts (strings with virtual addresses) and examining the flagged functions:

run_sandbox

Build provenance confirmed (built on macOS via PlatformIO, Arduino-ESP32 + Bluedroid BLE). Now the security triage — reviewing all 57 flagged functions:

run_sandbox

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:

run_sandbox
run_sandbox

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:

run_sandbox

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:

semantic_function_search
semantic_function_search
semantic_function_search
semantic_function_search

Two more quick verifications on app-level flags, then I'll write the final report:

run_sandbox

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:

todo_write
write_file
run_sandbox
todo_write

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

  1. Parsed the ESP32 image headers and carved app0.bin (6 segments, entry 0x40377720)
  2. Rebuilt a valid Xtensa ELF (meshcore_heltec_v3_app.elf) so every segment maps to its real runtime address
  3. Ghidra headless decompilation of all 6,271 functions (one .c + one .asm each, 113 MB raw)

Deliverables in decompiled_source/

FileWhat it is
MESHCORE_full_decompiled_source.cThe full source reconstruction — all 6,271 functions in one 6.9 MB file, ordered by address, each with a /* ===== [0xADDR] name ===== */ banner
function_index.csvAddress + name + file + suspicious-flag for every function
per_function_decompiled_c.tarAll per-function .c files individually
ANALYSIS_REPORT.mdFull analysis report: identity, architecture, artifacts, security triage
analysis.json / suspicious.json / toc.jsonFunction reference, 57 heuristic flags, semantic TOC

Key findings

  • Identified surfaces: Nordic-UART BLE service (6E400001-B5A3-F393-E0A9-E50E24DCCA9E, advertised as MeshCore-…), serial/BLE CLI with filesystem paths restricted to UserData/ and ExtraFS/, SX1262 LoRa mesh flood/relay logic, packet reassembly with a 64-byte chunk bound
  • Triage of the 57 heuristic flags: verified parse_and_store_chunk is 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.