IoT Firmware Binary Emulation!!!

Once we have extracted the firmware we have left with the binaries so to understand their functionalities and interact with them we require debuggers which will help in analyzing them for in-depth technicalities including buffer overflows etc.

Required tools:

Qemu
Qemu - QEMU is a generic and open source machine emulator and virtualizer.

When used as a machine emulator, QEMU can run OSes and programs made for one machine (e.g. an ARM board) on a different machine (e.g. your own PC). By using dynamic translation, it achieves very good performance.
When used as a visualizer, QEMU achieves near native performance by executing the guest code directly on the host CPU. QEMU supports virtualization when executing under the Xen hyper-visor or using the KVM kernel module in Linux. When using KVM, QEMU can virtualize x86, server and embedded PowerPC, 64-bit POWER, S390, 32-bit and 64-bit ARM, and MIPS guests.
QEMU is a member of Software Freedom Conservancy.

Step 1 - For emulation we will be using below firmware:
Netgear - WNAP320 Device
http://www.downloads.netgear.com/files/GDC/WNAP320/WNAP320%20Firmware%20Version%202.0.3.zip



Try searching anything suspicious we see and we come across interesting thing here that all the binary's if required to run then we have to use busybox just like we need to append it to the required command:



Step 2 - We can use Qemu once we know which architecture we will be assessing eg:ARM, MIPS which is one of the widely used.


The architecture its running on is MIPS32

Step 3 - Once we have identified the machine architecture we need to copy the QEMU binary in the corresponding folder and run with "chroot".


Chroot: Chroot is an operation that changes the apparent root directory for the current running process and their children. A program that is run in such a modified environment cannot access files and commands outside that environmental directory tree. This modified environment is called a chroot jail.




You can also perform some operations like change password or pwd etc.




In next series we will learn backdooring a firmware and extraction with FMK(firmware modification kit)


Thanks and regards,

#Kapil_kulkarni
#Akash_chavan.


References:

http://wiki.qemu.org/Main_Page
https://en.wikibooks.org/wiki/QEMU/Installing_QEMU
Security Tube training Offensive IoT security
https://wiki.archlinux.org/index.php/change_root
https://github.com/attify/firmware-analysis-toolkit
http://blog.attify.com/2016/07/08/firmware-analysis-iot-devices/

Comments

Popular posts from this blog

Threat Hunting | Malspam Analysis | Malware Traffic Analysis - MalwareTrafficAnalysis.net Basic

IoT Firmware Analysis!!!

Exploiting The New Apache Struts2 Remote Code Execution [CVE 2017-5638]