IoT设备硬件攻击技术与接口漏洞利用

IoT设备硬件攻击技术

0x01 总线与接口概述

1.1 UART

概述

UART(Universal Asynchronous Receiver/Transmitter)是一种常见的串行通信协议,广泛用于嵌入式设备中进行调试和数据传输。它通过两根信号线(TX和RX)实现异步通信。UART协议的中,包含起始位、数据位、校验位、停止位。

  1. 接口识别
    • 使用万用表或逻辑分析仪检测设备上的测试点,寻找电压为3.3V或5V的引脚。
    • 常见的UART引脚包括:TX(发送)、RX(接收)、GND(地线)和VCC(电源)。上电时,由于程序通常会输出调试信息,导致TX上会产生电压波动,所以这时可以查看接口波形,电压幅度发生较大变化的引脚即为TX,电压幅度变化较小的引脚则为RX。
  2. 波特率探测
    • 使用工具(如minicomscreenArduino)尝试不同的波特率(如9600、115200等)与设备通信。
    • 自动化工具如baudrate.py可以快速探测正确的波特率。
  3. 调试访问
    • 通过UART接口获取设备的调试Shell,可能直接进入系统命令行。
    • 利用UART日志分析设备启动过程,提取敏感信息(如引导加载程序密码、加密密钥等)。
  4. 防护绕过
    • 修改启动参数(如U-Boot参数)以禁用安全启动或加载自定义固件。
    • 通过UART注入恶意命令或脚本。

1.2 SPI && I2C

概述

SPI(Serial Peripheral Interface)和I2C(Inter-Integrated Circuit)是两种常用的同步串行通信协议,主要用于设备内部芯片之间的数据交换。

SPI
  • 特点:高速、全双工通信,通常需要4根线(MOSI、MISO、SCLK、CS)。
  • 应用场景:Flash存储器、传感器、显示屏等。

在这里插入图片描述

在这里插入图片描述

I2C
  • 特点:低速、半双工通信,仅需两根线(SDA、SCL)。
  • 应用场景:低功耗设备、传感器、EEPROM等。

img

攻击技术

  1. 接口识别
    • 使用逻辑分析仪或示波器检测信号线,确定SPI/I2C通信的时钟频率和数据模式。
    • 使用Attify Bridge等工具连接SPI闪存芯片后,可实现转储固件。
  2. 数据嗅探
    • 使用Bus Pirate、Logic Analyzer等工具捕获SPI/I2C总线上的数据流。
    • 解码捕获的数据包,提取敏感信息(如配置参数、加密密钥)。
  3. 固件提取
    • 通过SPI接口直接读取Flash芯片中的固件。
    • 使用专用工具(如flashrom)与SPI Flash芯片通信,提取或修改固件。
  4. 协议漏洞利用
    • 针对I2C协议的地址冲突或缺乏身份验证机制,伪造设备身份进行中间人攻击。
    • 利用SPI协议的简单性,篡改数据流或注入恶意指令。

1.3 JTAG

概述

JTAG(Joint Test Action Group)是一种标准化的硬件调试接口,最初用于电路板测试,后来被广泛应用于嵌入式系统的调试和编程。

其中4个最重要的引脚为**TCK(Test Clock)**JTAG的核心时钟信号,同步所有操作;**TDI(Test Data In)**数据输入通道,用于发送指令和数据;**TDO(Test Data Out)**数据输出通道,用于读取设备信息;**TMS(Test Mode Select)**控制JTAG状态机模式切换的核心信号。

目前JTAG接口有两种连接标准:14针接口及20针接口。接口定义如下所示。

14针接口定义:

引脚定义引脚功能
1、13VCC,连接电源输入
2、4、6、8、10、14GND,连接电源地
3NTRST系统复位信号
5TDI测试数据串行输入
7TMS测试模式选择
9TCK测试时钟信号
11TDO测试数据串行输出
12未连接

20针接口定义:

引脚定义引脚功能
1目标板参考电压
2VCC 电源输入
3NTRST测试系统复位信号
4、6、8、10、12、14、16、18、20GND 连接电源地
5TDI测试数据串行输入
7TMS测试模式选择
9TCK测试时钟信号
11RTCK测试时钟返回信号
13TDO测试数据串行输出
15NRESET目标系统复位信号
17、19未连接

对于开发板上元器件的JTAG接口,较多采用MOLEX的8针连接器,其体积较小,便于集成电路设计且功能齐全,其接口一般如下所示:

引脚定义引脚信号
1+3V3
2NTRST
3、63V3GND
4TDO
5TDI
7TMS
8TCK

攻击技术

  1. 接口识别

    • JTAG接口通常由多个引脚组成,包括TCK(时钟)、TDI(数据输入)、TDO(数据输出)、TMS(模式选择)和GND。
    • 使用JTAGulator或Flyswatter等工具扫描设备上的测试点,定位JTAG接口。
  2. 边界扫描

    • 利用JTAG的边界扫描功能,读取或控制设备的引脚状态。
    • 分析芯片内部寄存器,提取运行时数据或修改关键参数。
  3. 固件提取与调试

    • 通过JTAG接口连接调试器(如OpenOCD、Segger J-Link),直接读取设备内存中的固件。
    • 在运行时暂停CPU,分析寄存器和堆栈内容,查找漏洞或提取敏感信息。
  4. 安全防护绕过

    • 禁用设备的安全启动功能,加载未签名的固件。
    • 修改设备的启动流程,跳过身份验证或加密检查。
  5. 防护措施

    • 设备厂商可以通过禁用JTAG接口、熔断保险丝或加密调试通道来防止未经授权的访问。
    • 攻击者可能需要物理手段(如重新焊接芯片)绕过这些限制。

0x02 接口交互

2.1 UART接口交互与漏洞利用

UART Shell 访问步骤

  1. 识别接口 :根据 1.1 描述的方法,确认设备的 TX(发送)和 RX(接收)引脚。
  2. 硬件连接 :使用 USB 转 TTL 模块将设备连接到电脑。
  3. 波特率探测 :运行 baudrate.py 工具,自动检测正确的波特率。成功识别后,按下 Ctrl+C 中断。
  4. 进入终端 :工具会自动启动 minicom,进入串口通信界面。
  5. Shell 访问 :如果设备通过 UART 提供了 Shell 访问权限,只需按下回车键即可进入 Shell。

NAND故障注入

以下内容来自书籍《IOT PENETRATION TESTING COOKBOOK》

顾名思义,噪声干扰就是在测试的系统中引入错误。这一过程可以通过多种方式完成,并且已经有很多论文以及研究文献对此进行了探讨。噪声干扰的目的在于打乱 bootloader,更改引导参数或敏感数据,在引导过程中我们可以自定义参数以绕过系统的检测。可以通过 shell 来启动 UART 控制台,或者进入用户模式引导系统,上述两种操作都可以用来绕过验证。
在这里插入图片描述

测试流程

  1. NAND 噪声(NAND glitching),这将使设备中 NAND 闪存的一个 I/O 引脚从 GND 引脚短路。需要注意的是,短路操作的执行时机需要控制在 bootloader 已经引导并且需要进行内核引导时。(上电后一秒左右)
  2. 最后,如果线路成功,内核则会引导失败,用户进入到默认的 bootloader 命令行界面,提示用户输入命令,这时用户就能修改 bootloader 的参数了。
  3. 下面以一个实际案例介绍修改 bootloader 访问权限用户所能执行的操作,在引导参数中添加 single 参数后,用户即可进入单用户模式,从而绕过部分系统所要求的认证过程。

在这里插入图片描述

另一个例子:Nand Glitching Wink Hub For Root

参考链接:https://www.brettlischalk.com/posts/nand-glitching-wink-hub-for-root

Overview

During the Offensive Internet Of Things Exploitation course the instructor demonstrates a technique called a “NAND Glitch” on a Wink Connected Home Hub IoT device.

Wink Hub on Amazon

This technique allows a root shell to be acquired on a device which normally does not provide console access. This post outlines the process I used to replicate the NAND Glitch as well as discusses some of the “gotchas” that I encountered along the way.

Tools

The tools that I utilized to perform the NAND Glitch were:

  • Wink Connected Home Hub
  • Bus Pirate - v 3.6a
  • Bus Pirate Cable
  • Break Away Headers - Straight
  • Ubuntu Virtual Machine
  • Screen
  • Soldering Iron / Solder
Steps

The steps that I performed to gain a root shell on the Wink Hub device are as follows:

  • Disassemble the device
  • Solder headers into the UART connections
  • Hook up the Bus Pirate
  • Use screen to setup the Bus Pirate for UART mode and various other configurations
  • Use screen to connect to the Wink Hub over a UART terminal interface
  • Plug in the Wink Hub
  • Use a wire to short the 29th pin of the NAND flash chip to ground
  • Change the boot arguments to use /bin/sh
  • Reboot the hub
  • Enjoy root access!
Disassembly

Disassembly of the Wink Hub is pretty straight forward. The device has 4 hex screws that need to be removed. Once these are removed there is 1 black circuit board that makes up the whole device. Pull the board out and begin the hacking fun.

Wink Case OpenedWink Hub Circuit Board

Solder Headers

The Wink Hub circuit board does not have headers attached for UART serial interfacing but it does have the pin-outs marked. Simply solder some headers into the pin-outs using through-hole soldering and you’ll be set to connect to the device. When I did my soldering I hadn’t heard of a “Helping Hand Tool” so my soldered pins looked a bit crooked. This didn’t prevent me from getting a UART terminal connection but I learned that if I need to do more intricate soldering in the future, that one of these tools could really come in handy.

UART Headers

Hook Up The Bus Pirate

Hooking up the Bus Pirate is as simple as:

  • Connect the USB cord from the Bus Pirate device to my laptop
  • Connect the GND, MISO, and MOSI connections from the Bus Pirate to the appropriate TX, RX, and GND connections of the UART headers
  • In VirtualBox, select the usb device that was connected
  • Use ls /dev/tty* to list tty devices
  • Discover that /dev/ttyUSB0 is the device that will be used

** NOTE: I encountered a bit of trouble / confusion with the cable. I didn’t know that there were actually different cables available with the colored wires organized in different orders. I eventually came across this Wiring Diagram which illustrated that the cable that I had purchased actually had the colors reversed from what I was seeing in other diagrams.

Bus Pirate CableThe full hacking setup

Use Screen to Configure Bus Pirate UART Connection

Once the Bus Pirate was connected, the next step was to configure the Bus Pirate. To configure the device I connected using the command:

sudo screen /dev/ttyUSB0 115200

Once connected, I was presented with a prompt for the Bus Pirate. I believe I actually received a black screen which required me to hit enter to actually see the prompt. Another thing I learned in this project is that serial work can be a little flaky. Through this prompt you configure the Bus Pirate to become a “bridge” which allows UART communication to pass thru the Bus Pirate and to the device you are communicating with.

In this prompt I used “m” to configure the mode of the Bus Pirate as UART. In this configuration wizard all of the defaults are selected except for a baudrate of 115200 and 3.3v as the voltage of the device.

After the UART mode was configured, I started a “Transparent UART Bridge” via the macro (1).

** NOTE: After setting this up and booting up the Wink Hub, the text on the screen would come out looking like garbage. I did a bunch of Googling and research and it seemed that I also had to set the baudrate using the “b” menu to 115200 prior to setting the mode to UART using the “m” option and going through the wizard. I don’t remember why I had to do this but that seemed to clear up the garbage output.

Short the NAND Flash

After the Bus Pirate is all configured and a serial screen connection is setup, the next step was to actually start up the Wink Hub and glitch the NAND chip. To perform the glitch I used a piece of wire with one end touching some of the metal chip housing, and the other end touching the 29th pin of the NAND flash. It took a few tries to get to work as I found that I had to create the short in less than a second after starting up the Wink Hub. Other articles I had found on the subject said to create the short after ~1 sec but I found that it needed to happen much sooner than that. As soon as the short worked, I would receive a terminal prompt after a kernel panic message.

Kernel Panic

Update Boot Args

At this point we have a shell but not a root shell. By executing printenv we see that the arguments used during boot are:

bootargs=noinitrd console=ttyAM0,115200 rootfstype=ubifs ubi.mtd=5 root=ubi0:rootfs rw gpmi badupdater

printenv

Using setenv we can alter the bootargs that are used at startup and cause the Wink Hub to boot into a root shell. We use the following commands to accomplish this:

setenv bootargs 'noinitrd console=ttyAM0,115200 rootfstype=ubifs ubi.mtd=5 root=ubi0:rootfs rw gpmi init=/bin/sh';

And then reboot with:

nand read ${loadaddr} app-kernel 0x00400000 && bootm ${loadaddr}

How did we know init=/bin/sh needed to be added? Well, the course sort of glosses over that detail but a quick google turns up this:

The init= Argument

The kernel defaults to starting the init program at boot, which then
takes care of setting up the computer for users via launching getty
programs, running rc scripts and the like. The kernel first looks
for /sbin/init, then /etc/init (depreciated), and as a last resort, it
will try to use /bin/sh (possibly on /etc/rc). If for example, your
init program got corrupted and thus stopped you from being able to
boot, you could simply use the boot prompt init=/bin/sh which would
drop you directly into a shell at boot, allowing you to replace the
corrupted program.

So adding init=/bin/sh to the bootargs allows for booting directly into a shell.

How did we know nand read ${loadaddr} app-kernel 0x00400000 && bootm ${loadaddr} would reboot?

Well, this is glossed over in the course as well. Looking at the “app_boot” environment variable though we can get some clues. It performs appboot_args which we can guess probably sets up the boot args that are being modified with /bin/sh. It then proceeds to perform nand read. What does that do?

According to the Uboot README

nand read addr ofs|partition size
Read size bytes from ofs in NAND flash to addr.  Blocks that
are marked bad are skipped.  If a page cannot be read because an
uncorrectable data error is found, the command stops with an error.

So this command reads 0x400000 bytes from the “offset/app-kernel” to the “loadaddr” location. This seems to be loading the kernel from the NAND flash into memory. It then proceeds to do bootm ${loadaddr}.

What does the bootm command do?

According to this documentation:

“bootm - boot application image from memory”

So the proceeding commands combined load the kernel into memory and then load the kernel. This provides the reboot.

Enjoy Root!

Root ShellRoot Shell

2.2 JTAG接口的调试与漏洞利用

https://blog.csdn.net/qq_33904382/article/details/143067849

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:/a/975669.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

Windows程序设计29:对话框之间的数据传递

文章目录 前言一、父子对话框之间的数据传递1.父窗口获取子窗口数据2.子窗口获取父窗口数据 二、类外函数调用窗口的操作1.全局变量方式2.参数传递方式 总结 前言 Windows程序设计29:对话框之间的数据传递。 在Windows程序设计28:MFC模态与非模态对话框…

敏捷开发07:敏捷项目可视化管理-ScrumBoard(Scrum板)使用介绍

ScrumBoard(Scrum板)介绍 ScrumBoard(Scrum板)是敏捷项目管理中使用的可视化工具,用于跟踪和监控冲刺阶段的任务进度。 主要通过可视化的看板来管理工作,它可视化了敏捷开发中的工作流程、任务状态、团队角色。 Scrum 团队在各…

【每日八股】Redis篇(一):概述

Redis 为什么快? 一句话概括: Redis 之所以快,主要是因为它是基于内存操作的,避免了磁盘 I/O 的开销;采用单线程模型,避免了上下文切换和锁竞争;使用了高效的数据结构和紧凑的编码方式&#xf…

蓝桥杯——按键

一:按键得原理图 二:按键的代码配置 step1 按键原理图对应引脚配置为输入状态 step2 在GPIO中将对应引脚设置为上拉模式 step3 在fun.c中写按键扫描函数 写完后的扫描函数需放在主函数中不断扫描 扫描函数主要通过两个定义变量的值来判断&#xf…

语音控制热水器WTK69000离线语音识别芯片方案:迈向智能家居新时代

一、开发背景 在传统热水器使用中,人们往往需要手动调节水温、选择模式,这不仅操作繁琐,而且容易因误操作导致不必要的能源浪费。为了改善这一现状,热水器厂商开始引入语音识别技术。通过语音识别芯片,热水器能够准确识…

演示基于FPGA的视频图像去雾处理效果

我近期用FPGA开发板做了一个视频图像去雾算法模块,用于验证其能否在不进行帧缓冲的情况下实现去雾功能。 去雾算法来自一篇技术资料(私信提供篇名),其基础是近似的大气光模型。 1 算法原理概要 借助RGB直角坐标空间中的光矢量分…

UE_C++ —— Gameplay Tags

目录 一,Defining Gameplay Tags Adding Tags in Project Settings Importing Tags from Data Table Assets Defining Tags with C 二,Using Defined Gameplay Tags Applying Tags to Objects Evaluating Tags with Conditional Functions 三&am…

计算机视觉算法实战——三维重建(主页有源码)

✨个人主页欢迎您的访问 ✨期待您的三连 ✨ ✨个人主页欢迎您的访问 ✨期待您的三连 ✨ ✨个人主页欢迎您的访问 ✨期待您的三连✨ ​ 1. 三维重建领域简介 三维重建(3D Reconstruction)是计算机视觉的核心任务之一,旨在通过多视角图像、视频…

Spring5框架八:整合Mybatis

精心整理了最新的面试资料&#xff0c;有需要的可以自行获取 点击前往百度网盘获取 点击前往夸克网盘获取 1、导入相关的jar包 <dependencies><!-- https://mvnrepository.com/artifact/org.springframework/spring-webmvc --><dependency><groupId>…

AI学习第一天-什么是AI

AI的发展可以被分为四次浪潮&#xff0c;这包括符号主义、机器学习与神经网络&#xff0c;以及深度学习。在这些发展中&#xff0c;深度学习凭借其在处理非结构化复杂数据、强大的学习能力和可解释性方面的优势备受关注。深度学习技术的应用不仅提升了AI系统的性能&#xff0c;…

redis-bitmap使用场景

bitmap原理 Bitmap&#xff08;位图&#xff09;是一种基于二进制位的数据结构&#xff0c;用于高效地存储和操作大量的布尔值 可以对单个位进行读写操作 demo package org.example;import org.redisson.Redisson; import org.redisson.api.RBitSet; import org.redisson.ap…

华为 网络安全 认证

&#x1f345; 点击文末小卡片 &#xff0c;免费获取网络安全全套资料&#xff0c;资料在手&#xff0c;涨薪更快 华为 网络安全 认证&#xff1a;保障信息安全的重要一环 在数字化时代的今天&#xff0c;网络安全成为了企业和个人都需要高度重视的问题。尤其是在企业信息化的…

ubuntu22.04连接github无法访问的问题

目录 说明安装 说明 此方案只针对虚拟机, 如果是云服务器(毕竟是官方维护, github还是能访问到的)多试几次肯定能够访问到的. 国内我们无法访问外网, 所以我们目前能够访问外网的途径基本上只能开佳速器. 所以我们需要选择一款加速器来帮助我们访问外网, 目前市面上很多佳速器…

【Research Proposal】基于提示词方法的智能体工具调用研究——难点

博客主页&#xff1a; [小ᶻ☡꙳ᵃⁱᵍᶜ꙳] 本文专栏: AIGC | ChatGPT 文章目录 &#x1f4af;前言&#x1f4af;一、难点分析1. 提示词方法的多样性和组合问题2. 智能体工具调用的准确性和效率问题3. 多模态任务中的复杂性问题 &#x1f4af;二、解决思路与策略&#x1f…

Linux搭建Nginx直播流媒体服务RTMP/RTSP转Http-flv视频浏览器在线播放/Vue/Java/ffmpeg

参考文章&#xff1a; https://blog.csdn.net/whatareyouding/article/details/144317654 https://www.cnblogs.com/Gredae/p/18362900 https://www.cnblogs.com/kn-zheng/p/17422707.html https://blog.51cto.com/u_16099344/10281495 https://www.tulingxueyuan.cn/tlzx/jsp…

智慧教室与无纸化同屏技术方案探讨与实现探究

引言 随着教育信息化的不断发展&#xff0c;智慧教室和无纸化同屏技术逐渐成为提升教学效率和质量的重要手段。大牛直播SDK凭借其强大的音视频处理能力和丰富的功能特性&#xff0c;在智慧教室和无纸化同屏领域积累了众多成功案例。本文将深入探讨基于大牛直播SDK的智慧教室、…

自制操作系统前置知识汇编学习

今天要做什么&#xff1f; 为了更好的理解书中内容&#xff0c;需要学习下进制分析和汇编。 汇编语言其实应该叫叫机器指令符号化语言&#xff0c;目前的汇编语言是学习操作系统的基础。 一&#xff1a;触发器 电路触发器的锁存命令默认是断开的&#xff0c;是控制电路触发器…

嘉立创EDA一自画元件及其封装

目录 一、创建元件 &#xff08;1&#xff09;新建元件。 &#xff08;2&#xff09;绘制元件。 二、绘制封装 &#xff08;1&#xff09;新建封装。 &#xff08;2&#xff09;绘制封装。 三、关联元件与封装 四、封装设计注意事项 在嘉立创&#xff08;JLCPCB&#xff…

《深度学习实战》第2集-补充:卷积神经网络(CNN)与图像分类 实战代码解析和改进

以下是对《深度学习实战》第2集中 CIFAR-10 数据集 使用卷积神经网络进行图像分类实战 代码的详细分析&#xff0c;并增加数据探索环节&#xff0c;同时对数据探索、模型训练和评估的过程进行具体说明。所有代码都附上了运行结果配图&#xff0c;方便对比。 《深度学习实战》第…

dataframe如何在末尾添加多行

如果要在pandas的dataframe中添加多行该如何实现&#xff1f;可通过以下常见方式在DataFrame末尾添加&#xff1a; ### 方法一&#xff1a;使用loc索引器 利用loc索引器分两次操作来添加两行数据。假设已有DataFrame对象df&#xff0c;要添加的两行数据分别存储在字典new_row…