Firmware Decompile - nicholasaleks/Damn-Vulnerable-Drone GitHub Wiki
Reverse engineering the ArduPilot firmware used in Damn Vulnerable Drone
Damn Vulnerable Drone > Attack Scenarios > Firmware Attacks > Firmware Decompile
Firmware decompilation allows attackers to reverse engineer the flight control logic, parameter logic, and security flaws embedded in the compiled autopilot firmware. This technique is crucial for identifying hardcoded behaviors, exploitable functions, or undocumented MAVLink commands.
In Damn Vulnerable Drone, we’ll extract the running firmware binary used by the ArduPilot SITL instance, decompile it with Ghidra, and explore its internal structure for hacking opportunities.
⚠️ Solution Guide
Access the flight-controller
Docker container:
docker exec -it flight-controller bash
Search for the arducopter
binary:
find / -name "arducopter" 2>/dev/null
Expected output:
/home/ardupilot/ArduCopter/build/sitl/bin/arducopter
From your host terminal, copy the file out:
docker cp ardupilot:/home/ardupilot/ArduCopter/build/sitl/bin/arducopter ./arducopter.bin
Use the file
utility:
file arducopter.bin
Expected output:
ELF 64-bit LSB executable, x86-64, dynamically linked
Quick static recon with strings
:
strings arducopter.bin | less
Dump disassembly (optional):
objdump -D -M intel arducopter.bin > arducopter.asm
- Open Ghidra
- Create a new non-shared project
- Import
arducopter.bin
- Accept default analysis options
- Begin reversing
Search for MAVLink handlers, param_find()
, strcpy
, flight mode logic, and state machine transitions.
Download a real .apj
firmware image:
wget https://firmware.ardupilot.org/Copter/stable/Pixhawk1/arducopter.apj
Extract using binwalk:
binwalk -e arducopter.apj
Explore extracted ELF binaries using the same steps above.