All Projects → liyansong2018 → firmware-analysis-plus

liyansong2018 / firmware-analysis-plus

Licence: MIT License
Simulate firmware with one click of firmadyne (使用 firmadyne 一键模拟固件)

Programming Languages

python
139335 projects - #7 most used programming language
c
50402 projects - #5 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to firmware-analysis-plus

MK404
A functional Simulator for Prusa (Mini/Einsy) Rambo based printers
Stars: ✭ 52 (-38.1%)
Mutual labels:  simulator, firmware
TJAPlayer3
A .tja file player.(feat. DTXMania & TJAPlayer2 forPC)
Stars: ✭ 104 (+23.81%)
Mutual labels:  simulator
dose
Digital Organism Simulation Environment (DOSE)
Stars: ✭ 44 (-47.62%)
Mutual labels:  simulator
home
Monorepo for all home automation related development, including integrated firmware, PCBs, configuration, and bridges
Stars: ✭ 104 (+23.81%)
Mutual labels:  firmware
robocup-firmware
Georgia Tech RoboJackets Firmware for the RoboCup Small Size League
Stars: ✭ 22 (-73.81%)
Mutual labels:  firmware
hwt
VHDL/Verilog/SystemC code generator, simulator API written in python/c++
Stars: ✭ 145 (+72.62%)
Mutual labels:  simulator
antkeeper-source
💿🐜 Antkeeper source code (GitHub mirror)
Stars: ✭ 23 (-72.62%)
Mutual labels:  simulator
pinetime-hypnos
Zephyr firmware for the nRF52832 PineTime smartwatch
Stars: ✭ 52 (-38.1%)
Mutual labels:  firmware
firmware
The Firmware for the Freifunk Bielefeld Community
Stars: ✭ 23 (-72.62%)
Mutual labels:  firmware
learning-to-drive-in-5-minutes
Implementation of reinforcement learning approach to make a car learn to drive smoothly in minutes
Stars: ✭ 227 (+170.24%)
Mutual labels:  simulator
Tinymovr
Compact brushless motor controller with integrated absolute encoder and CAN Bus.
Stars: ✭ 90 (+7.14%)
Mutual labels:  firmware
AllYourMemoriesAreBelong2iOS
💪 Simulate iOS on-device memory warnings like a hero.
Stars: ✭ 17 (-79.76%)
Mutual labels:  simulator
react-native-boilerplate
Ready-made structure of your next React Native application within a few minutes.
Stars: ✭ 36 (-57.14%)
Mutual labels:  simulator
README
All Huawei modifications README, compilation instructions, etc
Stars: ✭ 72 (-14.29%)
Mutual labels:  firmware
SuperLEDstrip
No description or website provided.
Stars: ✭ 13 (-84.52%)
Mutual labels:  firmware
OpenWare
Firmware for OWL devices
Stars: ✭ 23 (-72.62%)
Mutual labels:  firmware
awesome-lidar
😎 Awesome LIDAR list. The list includes LIDAR manufacturers, datasets, point cloud-processing algorithms, point cloud frameworks and simulators.
Stars: ✭ 217 (+158.33%)
Mutual labels:  simulator
photontorch
Highly parallel simulation and optimization of photonic circuits in time and frequency domain based on the deep-learning framework PyTorch
Stars: ✭ 29 (-65.48%)
Mutual labels:  simulator
l2r
Open-source reinforcement learning environment for autonomous racing.
Stars: ✭ 38 (-54.76%)
Mutual labels:  simulator
FreiKey
My fully custom ergonomic two piece Bluetooth keyboard
Stars: ✭ 16 (-80.95%)
Mutual labels:  firmware

firmware-analysis-plus

Python 3.7+ issues issues license

上游项目支持:binwalkfirmadynefirmware-analysis-toolkit

firmware-analysis-plusfap)主要用于常见路由器固件的仿真,可以进行固件的安全测试。感谢以下开源项目:binwalk 提供优秀的固件提取 API,firmadyne 提供优秀的固件仿真核心支持,firmware-analysis-toolkit 提供简化流程的思想。

fap 只是站在巨人的肩膀上,做出改进和定制,提供一个更加高效的仿真平台。包括精简不必要组件,优化仿真流程,优化网络环境大幅压缩安装时间,修复若干 bug,一键仿真固件。其原理主要包括两点

  • qemu 提供多种架构指令的模拟,使用预先编译好的内核启动固件中的核心业务;
  • 多数嵌入式设备含有一个 nvram 芯片,保存一些重要的配置信息,firmadyne 实现一个新的 libnvram.so 库文件,通过代码模拟固件启动时加载 nvram 配置信息的行为。
FAP 版本 python 版本 支持系统 安装方法
v0.1 python2、python3 Ubuntu16.04、Ubuntu 18.04、Kali 2020.02 fap v0.1 版本手册
v1.0 python2、python3 Beta Beta
v2.0 python3 Kali 2020.04(不支持 Ubuntu 20.04,其他未测试) 如下所示

安装 binwalk

以编译源码的方式安装binwalk,时至今日,binwalk 构建脚本中的诸多依赖已无法正常安装,于是自己 fork 了一份新的 binwalk,进行了修改。关于修改细节的描述,可参考:https://github.com/liyansong2018/binwalk

git clone https://github.com/liyansong2018/binwalk.git
cd binwalk
./deps.sh
sudo python3 setup.py install

安装 fap

git clone https://github.com/liyansong2018/firmware-analysis-plus.git
cd firmware-analysis-plus
./setup.sh

配置

修改 fat.config 文件中的密码,改为 root 系统用户的密码

运行

┌──(lys㉿kali)-[~/Documents/IoT/firmware-analysis-plus]
└─$ ./fat.py -q ./2.5.0/ ./testcases/wnap320_V3.7.11.4_firmware.tar                

             
                ______   _                ___                 
                |  ___| (_)              / _ \                
                | |_     _   _ __ ___   / /_\ \  _ __    ___  
                |  _|   | | | '_ ` _ \  |  _  | | '_ \  / __| ++
                | |     | | | | | | | | | | | | | | | | \__ \ 
                \_|     |_| |_| |_| |_| \_| |_/ |_| |_| |___/

                Welcome to the Firmware Analysis Plus - v2.1
 By lys - https://github.com/liyansong2018/firmware-analysis-plus | @liyansong
    
[+] Firmware: wnap320_V3.7.11.4_firmware.tar
[+] Extracting the firmware...
[+] Image ID: 3
[+] Identifying architecture...
[+] Architecture: mipseb
[+] Building QEMU disk image...
[+] Setting up the network connection, please standby...
[+] Network interfaces: [('brtrunk', '192.168.0.100')]
[+] Using qemu-system-mips from /home/lys/Documents/IoT/firmware-analysis-plus/qemu-builds/2.5.0
[+] All set! Press ENTER to run the firmware...
[+] When running, press Ctrl + A X to terminate qemu

此时回车,可以进入路由器的 shell,也可以打开 Web 端路由器管理页面。

关闭

./shutdown.py

重置和删除中间文件

./reset.py

FAQ

编译 binwalk 失败怎么办?

如果已经编译好了 binwalk,可以使用如下命令进行固件仿真

./fat.py -q ./2.5.0/ ./testcases/wnap320_V3.7.11.4_firmware.tar 

如果编译 binwalk 失败,也没关系,fap 也支持不使用 binwalk 接口的模式,但是需要我们预先解压固件中的文件系统,并重新打包

tar -czvf test.tar.gz *		# 一定要在固件文件系统的根目录下重新打包
./fat.py -q ./2.5.0/ -b 0  ./testcases/test.tar.gz

支持的固件

fap 通用版(上游 firmadyne 项目提供)

  • wnap320_V3.7.11.4_firmware.tar
  • DIR-601_REVB_FIRMWARE_2.01.BIN
  • DIR890A1_FW103b07.bin
  • DIR-505L_FIRMWARE_1.01.ZIP
  • DIR-615_REVE_FIRMWARE_5.11.ZIP
  • DGL-5500_REVA_FIRMWARE_1.12B05.ZIP
  • WRT54G3G_2.11.05_ETSI_code.bin
  • NBG-416N_V1.00(USA.7)C0.zip
  • TEW-638v2%201.1.5.zip
  • Firmware_TEW-411BRPplus_2.07_EU.zip
  • DGND3700 Firmware Version 1.0.0.17(NA).zip
  • DIR-300A1_FW105b09.bin
  • HG532eV100R001C01B020_upgrade_packet.bin

fap 定制版(针对特定固件定制的版本)

相关研究

本工具的相关介绍以及一些安全研究员利用此工具发现或者复现的安全漏洞。

已发现的安全漏洞

比较幸运的是,我们也是用该工具发现了一些路由器的安全漏洞,因此,使用firmware-analysis-plus可以很方便的复现 IoT 固件安全漏洞,提供靶场和演练环境。比较典型的漏洞如下

由于个人精力有限,加之上游项目 firmadyne 不再进行架构调整,因此本项目近期不会更新。但是仍旧可以用来进行 IoT 漏洞研究。

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].