概述
在智能设备漏洞挖掘过程中,固件提取是分析的第一步,也是迈向成功的第一步。
以前分析的设备,固件存储于tsop8角封装的nor flash,可以直接通过芯片夹夹取,或者直接焊下flash利用芯片座提取,然后无脑binwalk获得整个文件系统。但最近分析的设备,固件存储于tsop48角封装的nand flash,没有对应的芯片夹,而且要求有一定的焊接技术。此外,由于nandflash存储的特性(如OOB数据的干扰),即使成功进行了物理提取,后续的数据处理也相当复杂。
接下来,我将结合最近的实验,与各位分享下本人在nand flash固件提取过程中,摸索和总结出来的一种利用UART串口调试提取固件的方法。由于本人能力有限,如有错误,还请各位师傅提出指正。 一、前提条件
UART串口调试,可进入linux系统命令行。 二、基本概念
MTD(MemoryTechnology Device),存储技术设备,用于访问存储设备(ROM,flash)的Linux子系统。 通过proc文件系统查看mtd设备的分区情况,可以发现mtdN和mtdblockN描述的是同一个MTD分区,对应同一个硬件分区。两者是同一个MTD分区的两种不同描述:mtdN是实现MTD分区所对应的字符设备,而mtdblockN设备则是在对应生成的块设备,两者内容一致,但具体的ioctl命令操作是不同的。 三、实例
出于保密性,在这里不透露具体型号。通过简要分析和丝印查阅,可以得知固件存储于红色框的flash中,如下图所示。

def send_cmd(fp,offset,step):
crt.Screen.Synchronous = True
# Send the initial command then throw out the first linefeed that we
# see by waiting for it.
crt.Screen.Send("hexdump {} -s {} -n {}n".format("/dev/mtdN",offset,step))
crt.Screen.WaitForString("n")
# Create an array of strings to wait for.
promptStr = "root"
waitStrs = ["n", promptStr]
row = 1
while True:
# Wait for the linefeed at the end of each line, or the shell
# prompt that indicates we're done.
result = crt.Screen.WaitForStrings( waitStrs )
# If we saw the prompt, we're done.
if result == 2:
break
# The result was 1 (we got a linefeed, indicating that we
# received another line of of output). Fetch current row number
# of the cursor and read the first 20 characters from the screen
# on that row.
#
# This shows how the 'Get' function can be used to read
# line-oriented output from a command, Subtract 1 from the
# currentRow to since the linefeed moved currentRow down by one.
#
screenrow = crt.Screen.CurrentRow - 1
readline = crt.Screen.Get(screenrow, 1, screenrow, 48)
readline = readline.strip()
# NOTE: We read 48 characters from the screen 'readline' may
# contain trailing whitespace if the data was less than 48
# characters wide.
# Write the line out with an appended end-of-line sequence
fp.write(readline)
crt.Screen.Synchronous = False
offset与step则是对应hexdump的偏移以及显示字节数,可根据实际需要进行设置。
五、
总结
本文总结了一种利用UART串口调试获取设备的文件系统的方法,其关键在于通过hexdump或base64等将不可见字符转换为终端可回显的字符。 本方法的最大限制则是电路板中需要有UART调试串口并且设备存在相关的转换命令(虽然hexdump是很基本的命令了)。参考链接
1.https://bbs.pediy.com/thread-230095.htm
2.https://zhuanlan.zhihu.com/p/26745577
原文来源:ChaMd5安全团队最后
以上就是清脆柚子为你收集整理的休眠 关闭串口输出_利用UART串口调试提取360路由器固件的全部内容,希望文章能够帮你解决休眠 关闭串口输出_利用UART串口调试提取360路由器固件所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复