当前位置:网站首页>路由器固件解密思路
路由器固件解密思路
2022-07-28 09:17:00 【biyusr】
前期接触iot我们遇到固件基本都是binwalk一把梭,但有时候会遇到固件信息混乱,或者分析出来一堆zlma的文件,没有发现有rtos或者文件系统的标志。
这时候会考虑到是否加密,上网查会发现有用 binwalk 的 -E 参数来判断。
那么这个判断的原理是啥?
原理是信息熵。
熵:泛指某些物质系统状态的一种量度,某些物质系统状态可能出现的程度。
初高中应该都学过,熵值越大,说明系统越混乱。
信息熵:1948年C.E.Shannon(香农)从热力学中借用过来提出的概念,解决了对信息的量化度量问题
信息中,重复的内容越多,系统越稳定,能获得的信息越多。
对于没有加密的二进制文件来说,某些指令出现的频率通常很高(如序言、nop序列等),并且数据结构几乎没有随机性。重复概率很高
所以,对于未加密的数据来说熵值一般会比较低。
对于经过加密的文件来说,都会想尽办法隐藏自己的信息,而导致很少有重复的内容,也就导致重复概率低
所以,加密的熵值一般都会高。
上面就是通过信息熵来判断是否加密,binwalk使用相关算法来整理信息熵

一般来说固件加密有三种情况:
初始版本未加密,后续某个版本加密了 在加密与初始版本中间某个版本附带了解密程序

获取中间版本,从中分析解密程序。
老版有加密,后续更换加密方式,中间发布未加密的过渡版本固件

与1类似,也是同样获取带有解密程序的过渡版本固件分析提取解密程序
老版有加密,后续更换加密方式,中间更换了新的未加密的解密程序

如果清楚早期加密方式,或者拥有早期解密程序,可以去分析更换解密程序的中间版本,来获取解密程序。
如果没有早期相关解密信息,则无法使用上面方式,更多是购买设备,从硬件直接提取未加密的固件。
理论上,可以使用二进制对比分析工具,来分析尝试提取复原解密程序。
案例:
这是选用某款的路由器固件进行分析:
从固件时间顺序往早期查验


发现DIR882A1_FW104B02_Middle_FW_Unencrypt.bin就是我们所说的过渡版本。
提取,分析,要通过它来查找解密程序。
或者复现根据升级路径来查找。
这里比较幸运通过关键字查到在bin下的imgdecrypt,但不能确定他一定是正确的解密程序
尝试执行他。



跟上面对比,能够正确被识别出uImage。
尝试将其他固件也都测试下


上面是命名比较规范的一种,有些命名不规范可能需要去根据前端升级去寻找相应的文件名称。
例子只用了一种,之后遇到相关问题会持续更新,可以关注一下。
边栏推荐
- CakePHP 4.4.3 release, PHP rapid development framework
- [autosar-rte] - 3-runnable and its task mapping mapping
- Salted fish esp32 instance - mqtt lit LED
- 常用工具函数 持续更新
- pycharm使用conda调用远程服务器
- 2022牛客多校第一场补题
- 2022 supplementary questions for the first session of Niuke multi school
- ActivityRouter源码解析
- HashSet内部原理解析
- Analysis of the internal principle of LinkedList
猜你喜欢

Database core system

Dn-detr paper accuracy, and analyze its model structure & 2022 CVPR paper

SQL server, MySQL master-slave construction, EF core read-write separation code implementation

21天学习挑战赛-《Autosar从入门到精通-实战篇》
![[C language] detailed explanation sequence table (seqlist)](/img/60/c8cee6a6afe57247aba583291cc99b.png)
[C language] detailed explanation sequence table (seqlist)
![[vscode] vscode usage](/img/0d/d6edbad047ecd7a092d4d7aa06e04d.png)
[vscode] vscode usage
![Rgb-t tracking: [multimodal fusion] visible thermal UAV tracking: a large scale benchmark and new baseline](/img/9b/b8b1148406e8e521f12ddd5c12bf89.png)
Rgb-t tracking: [multimodal fusion] visible thermal UAV tracking: a large scale benchmark and new baseline

SQL Server、MySQL主从搭建,EF Core读写分离代码实现

IJCAI 2022 | the latest overview of graph structure learning: research progress and future prospects

时序分析41 - 时序预测 TBATS模型
随机推荐
[Guangxi University] information sharing of postgraduate entrance examination and re examination
Business visualization - make your flowchart'run'(4. Actual business scenario test)
这款微信插件太好用了
Changes in the relationship between data and application in IT industry
脉冲风采|Committer 专访——腾讯工程师张大伟喊你吃“螃蟹”啦
2.9.5 Ext JS的Object类型处理及便捷方法
JDBC connection database
数据库高级学习笔记--游标
ARouter源码解析(一)
[multithreading] non atomic agreement of long and double
数据库高级学习笔记--系统包
My vivado practice - single cycle CPU instruction analysis
2.9.5 ext JS object type processing and convenient methods
LeetCode - 哈希表专题
Sequence and limit operation of MATLAB
[log] what does a log do? What is a log factory? Configuration and use of log4j? log4j. Properties file configuration, log4j jar package coordinates
[package deployment]
译文推荐 | 调试 BookKeeper 协议 - 无界 Ledger
Introduction to shardingsphere's concept of sub database and sub table (2)
Regular expressions are hexadecimal digits?
