文字记录 · CC BY 3.0

Philippe Laulheret - 硬件黑客入门 - DEF CON 27 大会

本页标题、字幕、摘要和阅读笔记为已保存的 AI 译文,可能有误。时间戳与来源一致,可展开查看原始字幕,并对照原视频核对。

Philippe Laulheret 使用 VoIP 电话来讲解硬件安全研究,从侦察和调试接口到固件调查。

DEFCONConference · 发布于 · 46分钟 · 英语 · 许可证:CC BY 3.0 · 来源:在YouTube上观看

文字记录来源:YouTube上创作者上传的字幕。Vidleaf添加了AI标点;保留原始措辞和时间戳锚点。原始文字记录可在下方获取。

AI生成的摘要

Philippe Laulheret 使用一项 VoIP 电话调查来讲解硬件安全研究的过程。演讲从公开文档和电路板检查,推进到调试接口、固件分析以及过程中遇到的问题。其价值在于展示不同层面的观察如何相互启发,包括那些没有奏效的方法。后面的案例研究将设备调查与一个软件漏洞及其后果演示联系起来。最后的讨论回到防御措施,包括应用厂商补丁、监控网络以及适当隔离设备。

要点

  • [4:37] 该调查包括不成功的方法,并强调一个可能因设备而异的过程。
  • [26:19] 固件分析是理解嵌入式设备行为的一部分。
  • [45:17] 演讲最后给出了关于打补丁、监控和网络隔离的防御建议。

根据文字记录生成。请对照原始视频核查所链接的段落。简要说明和要点由 Vidleaf 于 2026-10-21 审核。

完整概述

McAfee Advanced Threat Research 的高级安全研究员 Philippe Laulheret 以 Avaya 9 系列 VoIP 电话(包括 9611g)作为贯穿示例,介绍硬件黑客技术。他认为硬件黑客技术很重要,因为它既有趣又赋予人能力,而且从实用角度看,软件正变得越来越难以攻破,而打开设备并焊接几根导线可能更容易,能提供唾手可得的成果。演讲强调过程重于结果,分享哪些方法没有奏效,并指出对一台设备有效的方法未必对另一台有效。内容涵盖通过 FCC 内部照片、手册和论坛进行侦察,硬件调试接口如 UART、JTAG 和测试点,波特率,以及上拉和下拉电阻,最后介绍工具和安全事项,包括烙铁、助焊剂、漆包线、吸锡线、热风枪和万用表。第二批内容调查了逻辑分析仪、FTDI 串口线、Bus Pirate、JTAG 调试器(如 fly swatter、J Link 和 JTagulator)以及闪存读取器等工具,并指出更昂贵的工具可能更可靠且软件更好;描述了使用 ChipWhisperer 对具有加密闪存且无 UART 或固件的电话进行故障注入,获取 shell 的三种方法(UART 控制台、闪存恢复和在线下载固件,后者因固件未加密而奏效),在线和离线闪存转储,JTAG RAM 转储,Scanlime 在 Wacom 平板上的 USB 毛刺攻击,以及 Binwalk 固件分析并附有误报警告,然后开始逆向 ARM 引导加载程序以了解控制台为何被设置为 /dev/null。演讲者随后逐步演示对 Avaya 9611g 的黑盒黑客攻击,通过 IDA 中的字符串(如“EEPROM read successful”)定位引导加载程序地址,使用逻辑分析仪和数据手册检查 SPI EEPROM,并修补控制台设置函数;在将导线焊接到微小芯片并使用 Bus Pirate 后,对 UART 焊盘进行连续性测试并用 FTDI 线缆探测引脚,获得 root shell,并将以太网线打磨以适配带键的 RJ45 MOD 端口。侦察发现 DHClient,它自身会发生段错误并带有 2007 版权;将开源原始版本与修补后的源代码进行比较,显示修补版本中 memcpy 受 4 限制,但在易受攻击的子网掩码处理中则没有,IDA 确认没有栈金丝雀且没有 magic 4。他搭建了 QEMU 全系统模拟(用户态无法工作,因为 DHCP 会修改 IP),用 Python 重新实现名称套接字端并通过 Socat 共享,然后转向基于 Scapy 的漏洞利用,发送带有模式数据的超大子网掩码选项以识别受控寄存器;确认了 PC 控制,并且由于栈似乎不可执行,使用二进制中的系统调用(可能是 Avaya 添加的),配合受控的 R4 指向通过域选项找到的字符串,同时 ASLR 已禁用。演示展示了恶意 DHCP 客户端和 Web 服务器将主扬声器的音频窃取到攻击者笔记本电脑上的 VLC,他建议进行网络监控、分段,并确认 IT 部门确实应用了 Avaya 大约一个月前发布的补丁。在结束语中,他强调嵌入式系统不是黑匣子,并鼓励大家去研究它们,然后邀请通过 Twitter 提问并感谢观众。

带时间戳的章节摘要

硬件黑客技术入门演讲

  • [0:00] 介绍 Philippe,他原籍法国,现居波特兰,将谈论入侵嵌入式设备(包括电话)。
  • [0:35] Philippe Laulheret 介绍硬件黑客技术。
  • [0:48] 他是 McAfee Advanced Threat Research 的高级安全研究员,从事软件和硬件电话研究。
  • [0:53] 他可以在 Twitter 上通过 PHLaul 找到。
  • [0:58] 在 McAfee 之前,他花了 2 年从事嵌入式安全,再之前是一名 C++ 开发者。

硬件黑客技术为何重要

  • [1:13] 关注硬件黑客技术的两个主要原因:打开设备而不是将其视为黑匣子既有趣又赋予人能力。
  • [1:30] 从实用角度看,软件正变得越来越难以攻破,因此仅靠发现 Web 服务器中的漏洞本身就相当困难。
  • [1:45] 打开设备并焊接几根导线来获取 shell 要容易得多。
  • [1:53] 硬件黑客技术很棒,因为它还提供了许多唾手可得的成果。

Avaya VoIP 电话与硬件黑客技术

  • [1:58] 演讲涵盖 Avaya 电话,尤其是 9 系列,幻灯片上展示的是 9611g 型号。
  • [2:03] Avaya 被描述为最大的 VoIP 解决方案提供商之一,随处可见。
  • [2:08] 据说 Avaya 在约 90% 家财富 100 强公司中使用,该特定电话型号始于 2006 年,并将在年底左右接近生命周期结束。
  • [2:22] 一张幻灯片截图显示旧电话固件只能由 DOD 客户下载,表明这些电话已进入许多不同场所。
  • [2:41] 硬件黑客技术的先前工作包括互联网博客文章和教程、硬件黑客村,以及用于练习较软方面的 CTF。
  • [3:02] 链接在幻灯片上,上传的幻灯片有更多文字以更具独立性。
  • [3:11] 演讲者说大约五年前他们在同一款电话中发现了 2 个 RC。

硬件黑客过程与未修补固件

  • [3:22] 演讲者推荐一个名为 Stepping P3wns 的 RSA 演讲,可在网上获取。
  • [3:26] 接下来的 40 分钟将涵盖硬件黑客技术,以电话作为辅助示例。
  • [3:36] 大约 12 年前,通过 Fox 和开源代码,安全补丁从未被应用。
  • [3:51] 通过探查设备,演讲者发现了一个约 10 年未被注意到的问题,与大约 10 年前为 Defcon 发布的 CVE 相关。
  • [4:04] 演讲涵盖了在固件中寻找某些东西,但更侧重于演讲者做事的过程和原因。
  • [4:21] 演讲者将分享哪些方法没有奏效,因为对一台设备有效的方法可能对另一台无效。
  • [4:37] 主要收获是学习检查你所拥有的任何设备的流程。
  • [4:47] 演讲者来自软件背景,他表示只要有良好的流程和耐心,硬件黑客并不难,而且在座的每个人都能做到。

黑客办公电话前的侦察

  • [5:06] 看到每个办公桌上都有基于Linux、可联网且带麦克风的电话,让人质疑它们的安全性。
  • [5:27] 早期步骤之一是物理拆解同事的电话进行检查。
  • [5:31] 带有Wi-Fi或蓝牙的设备必须出现在FCC网站上以符合合规要求,该网站提供内部照片。
  • [5:50] FCC照片揭示了一个随机调试连接器和闪存,闪存通常存储电话的文件系统。
  • [6:09] 这种检查可以了解目标是容易还是困难,例如黑色环氧树脂覆盖一切会增加难度。
  • [6:27] 收集营销手册等在线材料有助于绘制电话的能力和攻击面。
  • [6:43] 一份高级用户手册表明,连接到电话的串行连接需要特殊的盒子。
  • [7:03] 查看论坛发现电话调试接口和系统管理员的默认密码。

电话硬件调试接口

  • [7:28] 这是一场硬件黑客演讲,提供了志愿者;重点是先打开电话。
  • [7:36] 你通常期望在里面找到相同的东西;用谷歌搜索组件标签可以揭示它们是什么。
  • [7:45] 在演讲者的电话上,CPU在中央,RAM在其上方,一个标有问号的淡紫色未安装排针可能是JTAG,但没有使用,因此不确定。
  • [8:03] 板上有存储设置的EEPROM,底部有一个带键的RJ45,它是一个带有奇怪连接器的常规RJ45,因此无法插入错误的东西。
  • [8:26] UART就像一个带有暴露焊盘的串行控制台;在制造中,弹簧针通常会连接到焊盘,你会期望在那里找到串行控制台。
  • [8:43] 背面是上一张图片中看到的NAND闪存,这是设备上存储文件系统的地方。
  • [9:00] 测试点和调试排针值得关注,因为开发板通常与生产板相同,调试组件可能不会被移除,类似于用调试符号构建的软件。
  • [9:26] 测试点可能在制造中用于烧录设备或确保正确烧录,有时也用于在现实世界中设备损坏时进行事后分析。
  • [9:43] 需要寻找的东西包括UART、JTAG以及标有TP1或TP2的随机测试点;有时将TP64与地短接会重置设备,这可能有用。
  • [10:13] UART有3或4个引脚:地、发送、接收,以及可选的VCC(3或5伏),你通常不关心也不需要插入。
  • [10:36] 串行控制台使用不同的速度,称为波特率,只有少数常见值;屏幕上出现乱码可能意味着波特率错误,循环尝试可能的值最终会找到正确的。
  • [10:58] JTAG用于CPU的硬件调试,通常逐条执行指令,有多种形状和引脚数,只有几根线有趣。

上拉/下拉电阻和阅读电路板

  • [11:53] 上拉和下拉电阻将引脚连接到地或VCC。
  • [11:57] 演讲者不知道这些电阻的意义,但如果没有它们,事情可能无法正常工作,或者需要更多工作并且会出现故障。
  • [12:06] 遵循ARM规范等所需电阻的规范可能会让你跳过它们,但你可能会浪费时间理解为什么有时会奇怪地搞砸。
  • [12:19] 演讲者推荐上拉和下拉电阻。
  • [12:24] 一位随机同事的板子显示建议相当通用:左侧UART,右侧一些JTAG连接器,主CPU在屏蔽罩下。
  • [12:38] 屏蔽通常是为了防止干扰,如Wi-Fi模块。
  • [12:43] 屏蔽罩通常接地,因此屏蔽罩或以太网端口周围的 casing 在寻找地时相当有用。

硬件黑客工具和安全

  • [13:12] 安全第一:不要处理插在墙上的东西,拔掉插头,使用通风良好的房间。
  • [13:34] 烙铁有可更换的烙铁头:大烙铁头用于大焊接,小烙铁头用于小焊接。
  • [13:38] 显微镜对于微小焊接很有用;保持手臂伸直并良好接地,即使手抖也有帮助。
  • [14:12] 助焊剂是一种涂在引脚或焊盘上的粘性物质,使表面贴装焊接工作良好;永远不要忘记助焊剂。
  • [14:29] 漆包铜线避免短路,对于微小的点对点焊接很有用。
  • [14:48] 吸锡带在用烙铁加热时吸收多余的焊锡,以清理错误。
  • [15:15] 来自Home Depot的大约$60的热风枪可以通过加热和拉开来移除组件。
  • [15:27] 万用表可以找到芯片的电压(黑色接地,红色探针测量)及其通断模式会发出蜂鸣声以验证焊接连接。
  • [16:03] 逻辑分析仪(品牌Sally)将导线上的信号转换为跨多种协议的实际数据,在调试时充当你的眼睛。
  • [16:36] FTDI串行电缆插入笔记本电脑并连接到UART端口以提供控制台,例如没有HDMI的Raspberry Pi串行控制台。
  • [17:01] Bus Pirate 发送数据而不是吸收数据,支持多种协议,并且可以用 Python 编程,适用于读取闪存和编程微控制器。

硬件黑客工具概述

  • [17:26] JTAG 调试器通过 Digitech 端口连接,价格范围广泛。
  • [17:38] 一个苍蝇拍大概要 30 美元,效果还行,而上面的 J Link 更花哨。
  • [17:47] 更贵的工具可能更可靠,并且附带更好的软件。
  • [17:55] 粉色机身的 JTagulator 是由 Joe Grand 制造的,他也是制作那些徽章的人。
  • [18:04] 如果你不知道板上的 JTAG 在哪里,你可以将所有测试点连接到 JTagulator,它会暴力破解以找到所有内容。
  • [18:16] 闪存读取器是重要的工具,因为闪存包含文件系统,你需要与之交互。
  • [18:27] 闪存读取有两种方式:使用夹子或矩形夹进行在线读取,或者拆焊芯片并使用插座适配器。
  • [18:35] 树莓派是在线工作的好选择,右上角的 Flash Cat 对于矩形夹很有用。

针对手机的高级硬件攻击

  • [19:06] 当闪存被加密且没有 UART 或固件时,可以尝试更极端的攻击,如故障注入。
  • [19:14] ChipWhisperer 被描述为用于这些攻击的更困难、更厉害的设备。
  • [19:19] 该技术涉及连接到 CPU 并瞬间降低 CPU 电源以扰乱指令并绕过检查。
  • [19:30] 这就是人们用于游戏机破解的方法。
  • [19:40] 了解了手机内部的情况和可用的工具后,下一步就是继续。

UART 控制台和固件恢复尝试

  • [19:47] 三种可能的方法:搞乱 UART 串行控制台,搞乱闪存以恢复固件,或在线下载固件。
  • [19:55] 这三种方法都是有效的,根据发现的硬件在它们之间切换可能会有帮助。
  • [20:03] 他首先尝试了 UART,像之前一样将 FTDI 电缆连接到 UART 端口。
  • [20:17] 在控制台上看到点通常意味着按空格或转义键可以中断手机的启动过程,但在这里没有起作用。
  • [20:30] 设备从 EEPROM 读取了一些内容,然后将控制台设置为 Dev null,这是不可取的,因为输出无处可去。
  • [20:43] 然后它启动进入 Linux,确认这是一个 UART 端口,但之后没有更多内容出现,可能是因为 Dev null 的情况。
  • [21:07] 然后他尝试恢复固件,一个简单的在线方法居然奏效了;在这种情况下,固件没有加密。
  • [21:21] 另一种选择是嗅探固件更新,这对物联网设备通常很有用,使用网络分路器或镜像交换机上的端口。
  • [21:36] 问题是固件更新通常通过 HTTPS 进行,所以你可能会卡住,需要进行硬件黑客攻击,例如转储闪存。

闪存转储方法和技巧

  • [21:53] 有两种转储闪存的方法:在线编程和离线。
  • [21:57] 在线方式很方便,因为你不必移除或破坏东西,但主要问题是你需要给闪存供电。
  • [22:11] 当树莓派试图在闪存仍插入整个系统时读取它,它可能会尝试为同一电源线上的所有其他设备供电。
  • [22:19] USB Pi 可能不够强大,无法为 VoIP 电话供电,或者如果足够强大,CPU 可能会停止启动并与闪存通信,把事情搞乱。
  • [22:37] 在这种情况下有两种选择:抬起引脚/球引脚,或保持 CPU 处于复位状态。
  • [22:51] 另一种方法是接地板上的随机测试点,直到手机亮起但不启动。
  • [23:03] 你可以用热风枪拆焊芯片,但小心不要拉得太用力而弯曲引脚。
  • [23:17] 一个好技巧是在芯片上制作一个小锡箔帽,这样周围的组件不会太热。
  • [23:33] 在随机 USB 拇指驱动器上练习效果很好;记得使用助焊剂。
  • [23:51] U-Boot 是最常见的引导加载程序,这里没有使用,但几乎在其他所有设备上都能找到。
  • [23:56] 可以指示 U-Boot 将闪存加载到内存中并以十六进制转储,但通常开发者会锁定这种方法,这样你就不能按空格来中断启动过程。
  • [24:24] Yolo 方法:当 U-Boot 从闪存加载时,用一根接地线戳 NAND 闪存引脚,扰乱 U-Boot 正在读取的内容,尝试几次后它就会给你一个 shell。

JTAG 转储和 USB 设备故障注入

  • [25:21] 如果 JTAG 工作,你可以转储 RAM,在许多设备中这意味着转储加载到内存中的固件。
  • [25:37] 硬件黑客攻击允许疯狂的技术,例如 Scanlime 对没有攻击面的 Wacom 平板电脑的方法。
  • [25:52] Scanlime 发现将 USB 插入笔记本电脑涉及 USB 交换,可能是 USB 描述符。
  • [26:01] 在那一刻对 CPU 进行故障注入可能导致它错过二进制检查并发送更多数据。
  • [26:10] 通过那个故障,她能够恢复完整的闪存和完整的内存。

使用 Binwalk 进行固件分析

  • [26:19] 固件可以简单地通过在线下载来恢复,就像演讲者的情况一样。
  • [26:24] Binwalk 是分析固件的最佳工具,扫描二进制文件中的嵌入文件,如 zip 存档和压缩文件系统,如 Squashfs 和 JFFS2。
  • [27:01] 在一个简单的案例中,固件是一个已经分成 boot 1、boot 2 和 JFFS2 的文档文件,所以 Binwalk 几乎无事可做,文件系统可以直接提取。
  • [27:19] 一个更有趣的固件文件在 Binwalk 中产生了更多结果,包括一个可提取的文件系统和一些随机的 MySQL 数据,后者很可能是误报。
  • [27:36] Binwalk 会产生许多误报,因此不应盲目信任其输出。
  • [27:40] 对该镜像运行 strings 后发现了 U-Boot 字符串,这意味着该设备使用 U-Boot,前面描述的技术可能对它有效。
  • [27:55] 提取固件后,值得寻找的内容包括更新机制、密码和证书等机密信息、VoIP 协议栈等主要二进制文件,以及用于隐藏命令的引导加载程序。
  • [28:35] 目标是获取设备上的 shell,方法包括修复串行控制台、篡改启动参数,或者作为最后手段对固件打补丁。
  • [29:03] 在这里对固件打补丁行不通,因为它经过签名,除非你尝试故障注入,而这非常困难,但修补文件系统并将其直接重新刷写到闪存上是一种选择。

逆向 ARM 引导加载程序

  • [29:23] 演讲者计划逆向引导加载程序,以了解控制台为何被设置为 /dev/null。
  • [29:39] ARM 文字池是代码段内的小块数据,通常用于将绝对地址、立即值或魔术偏移量加载到寄存器中。
  • [30:00] 在 ARM 函数调用中,参数放在 R0 到 R3 中,返回值在 R0 中,返回地址保存在 LR(链接寄存器)中。
  • [30:15] 该引导加载程序不是真正的 ELF,因此 IDA 无法导入它,除非找到与手机加载位置相匹配的加载地址。
  • [30:34] 要找到加载地址,可以查看引导加载程序文件中的头部或中断向量,因为 ARM CPU 需要特定地址来处理中断。
  • [30:58] 文字池很有用,因为它包含绝对地址或指向字符串的指针;乱码字符串表明地址错误。
  • [31:15] 在这种情况下,地址很容易找到,因为引导加载程序在启动时会打印一条跳转消息,而 IDA 显示字符串打印正常,确认加载正确。
  • [31:41] 将引导加载程序加载到 IDA 后,演讲者搜索诸如 'EEPROM read successful' 之类的字符串,并使用交叉引用来找到处理函数。

SPI EEPROM 与引导加载程序控制台修补

  • [31:54] 该板上的 EEPROM 被称为 Spiprom,而 SPI 是前面提到的协议之一。
  • [32:00] EEPROM 是一种小型存储器,SPI 协议使用大约 4 根线,CPU 发送命令,EEPROM 进行回复。
  • [32:12] 逻辑分析仪转储显示了 SPI 流量在现实中的样子,而 EEPROM 数据手册可以通过在网上搜索其上的标签找到。
  • [32:27] 数据手册左下角的引脚图显示了如何连接到 EEPROM,右侧列出了哪些操作码对应 SPI 命令,例如 3 是读取,2 是写入。
  • [32:48] 在 IDA 和引导加载程序中,控制台被设置为 Dev null,但在其上方有一个函数可以将控制台设置为 UART 0 或 UART 1,我们希望打印这些字符串。
  • [33:08] 该函数清除堆栈上的一些字节,从魔术地址读取,比较读取的字节,如果值良好,则将控制台设置打印为 Dev ttyAMA0。
  • [33:36] 读取 EEPROM 函数很容易找到,因为有绿色高亮的日志显示 EEPROM 读取失败;否则可以寻找发送 3 的 SPI 函数。
  • [34:05] 找到 SPI 函数很困难,因为它使用内存映射 IO 魔术地址;有了 CPU 数据手册,地址是明确指定的,但没有的话就只能猜测,而这非常困难。
  • [34:49] 计划是修补 EEPROM,以便能够构建控制台,已知读取和写入命令,并希望与闪存进行接口。

焊接导线并找到 UART root shell

  • [34:59] 选择 Bus Pirate 作为连接 EEPROM 的 SPI 设备。
  • [35:09] 芯片太小,夹子夹不住,而网上的夹具价格昂贵且要等五周,所以他尝试在上面焊接细导线。
  • [35:22] 他本以为焊接永远不会成功,但碰巧真的成功了。
  • [35:30] Bus Pirate 代码非常模板化,使用了魔术值,他被要求用图片替换这些值。
  • [35:45] 控制台被设置为 root,但在尝试按空格或输入时,输入仍然不起作用。
  • [36:15] 他使用万用表对 UART 焊盘进行通断测试,以追踪它通向哪里。
  • [36:26] UART 走线通向板子的另一侧并来回折返,最终穿过带键的 RJ45 MOD 端口下方。
  • [36:54] 他将跳线的一端握在 FTDI 线的发送端,一边按控制台按键一边逐个戳引脚,第二个引脚就给出了 root shell。

以太网线破解与 root shell

  • [37:24] 作为正确设置的一部分,演讲者将以太网线插入插头。
  • [37:28] 由于不知道 RJ45 键的位置,演讲者将以太网线上的塑料磨掉以便塞进去,结果它真的能用。
  • [37:36] 获得 root shell 后,会打印大量调试字符串。

设备侦察与 DHClient 发现

  • [37:40] 如果控制台被刷屏,看门狗会重启设备,因此用于终止进程的魔术命令被高亮显示在角落。
  • [37:53] 漏洞研究从查看正在运行的进程和开放端口开始,包括新的 sequel 相关内容。
  • [38:11] 在四处探查而不是使用 IDA 时,演讲者查看了 DHClient。
  • [38:16] 运行 DHClient 会显示一个 2007 版权信息,演讲者指出这不是好事。
  • [38:20] 单独运行 DHClient 会发生段错误。
  • [38:25] 以正确方式运行时,DHClient 会打印一条调试消息,说它已被修改以在设备上更好地工作。

DHClient DHCP 选项栈溢出分析

  • [38:40] Jon Oberheide 大约在 10 年前针对那个特定的 DHClient 版本展示了一个 DEFCON 漏洞利用。
  • [38:51] 该手机在处理 DHCP 选项时存在栈溢出漏洞。
  • [38:56] 由于 DHClient 是开源的,可以将原始源代码与修补后的源代码进行比较,同时要考虑到栈 Cookie 和 ASLR 等缓解措施。
  • [39:11] 在存在漏洞的代码中,memcpy 使用 data.len 作为字段,而修补后的版本则用 4 对其进行了边界限制。
  • [39:21] 该漏洞出在子网掩码处理上:子网掩码本应为 4 字节,但 DHCP 选项最多可发送约 255 字节,而这一长度被盲目信任了。
  • [39:34] 在 IDA 中,实际函数没有栈金丝雀,也没有使用魔数 4,因此它仍然存在漏洞,且利用起来很简单。
  • [39:48] 演讲者正在研究手机操作系统 TDS,并计划搭建 QEMU 模拟环境。

QEMU 全系统 DHCP 调试

  • [39:52] QEMU 可以为 ARM 进行用户态或全系统模拟。
  • [39:58] 用户态模拟在这里行不通,因为 DHCP 涉及尝试修改 IP。
  • [40:02] 因此改用全系统模拟,并按照教程进行设置。
  • [40:11] 必须正确设置网络才能与 DHCP 对接,同时要避免使用 QEMU 内置的 DHCP。
  • [40:29] 在 QEMU 中运行时仍然发生了段错误;结果发现是 Avaya 修改了一些东西,导致了段错误。
  • [40:38] 该应用创建了一个名称套接字,以便 VOIP 协议栈能够与 DHClient 通信并显示选项。
  • [40:56] 左侧发送数据以在启动时配置 DHClient;右侧则用 Python 重新实现了。
  • [41:00] 该 Python 脚本在主机上运行,并通过 Socat 与 QEMU 镜像共享名称套接字。

使用 Scapy 和 Shellcode 的 DHCP 漏洞利用

  • [41:23] 由于原始概念验证使用了非常旧的工具,无法编译,因此改用基于 Scapy 的漏洞利用。
  • [41:32] Scapy 是一个用于低层网络数据包操作的 Python 库。
  • [41:47] 该漏洞出在子网掩码选项上,它使用 DHCP 的标签-长度-值格式;尽管 DHCP 规范有规定,但发送大于 4 的长度仍会被接受。
  • [42:12] 载荷发送带有模式化数据(AAAA、BBBB、CCCC)的子网掩码选项,以便在 GDB 中崩溃时能够识别出受控的寄存器。
  • [42:33] 他们确认了对 PC(程序计数器)的控制,从而获得了对执行流的控制。
  • [42:47] 栈似乎不可执行,因此必须以另一种方式构造 shellcode。
  • [42:57] 二进制文件中存在一个系统调用(可能是 Avaya 添加的),并且 R4 是受控的,因此将字符串放在已知地址并将其地址放入 R4 可能可行。
  • [43:12] DHClient 从服务器接收配置值,因此这些值很可能存储在某个地方;ASLR 已禁用。
  • [43:27] 发送大量填充 A 的选项并检查内存,最终通过域选项找到了该字符串。

手机漏洞利用演示与缓解措施

  • [43:49] 手机正在启动,左侧显示了 10 分钟的时间窗口。
  • [43:53] 一个恶意 DHCP 客户端在左侧通过载荷运行,而右侧的 Web 服务器则提供后利用功能。
  • [44:02] 在屏幕上 cat /dev/random 会产生类似噪声的输出,以验证数据包正在运行。
  • [44:07] 手机从 Web 服务器获取数据,加载一个名为 steve.data 的文件,该文件以演讲者的老板 Steve 命名。
  • [44:24] 音频正从主扬声器被窃取,并通过 VLC 在攻击者笔记本电脑上读取,从而将手机变成了监听设备。
  • [44:49] 所使用的所有工具,如 Netcat 和音频调暗工具,都已经在手机上,只需要 shell 或 bash 脚本即可。
  • [44:58] 作为缓解措施,请监控您的网络,以防止漏洞发送异常流量。

网络分段与补丁建议

  • [45:06] McAfee 防火墙可以检测 DHCP 数据包。
  • [45:13] 对网络进行分段,使咖啡壶之类的设备无法向您的手机发送异常的 DHCP 数据包。
  • [45:17] 确保 IT 部门确实为您的手机打了补丁,因为 Avaya 大约一个月前发布了补丁。
  • [45:31] 技术数据确实很难处理,这或许可以解释为什么会发生这类漏洞。

关于嵌入式系统的结束语

  • [45:42] 嵌入式系统不是黑盒,因此演讲者鼓励大家去研究它们。
  • [45:47] 演讲者邀请大家通过 Twitter 提问,并感谢听众的时间。

[0:00] >>废话不多说,因为我们要按日程进行。Philippe 来了,呃,据我所知,他来自呃,来自波特兰,途经呃,法国。他将和我们谈谈,谈谈呃,入侵嵌入式设备,包括手机,呃,可能是你工作桌上放的手机,我甚至不打算深入那个话题,可能是你身边的手机。让我们来了解嵌入式设备黑客技术。让我们给 Philippe 热烈的掌声。[掌声]。祝你玩得开心,伙计。>>谢谢。谢谢大家,呃,我真的很兴奋能来到这里,这是一种莫大的荣誉,呃,是的,所以今天我们将讨论硬件黑客技术,呃,我将向你们展示这方面的入门介绍,我希望呃,我能展示一些对呃,硬件黑客技术的热爱。那么呃,我是谁?我是 Philippe Laulheret,呃,我是 McAfee 呃,高级威胁研究部门的高级安全研究员。所以,我,我做呃,软件和硬件手机研究,你可以在 Twitter 上通过 PHLaul 找到我。在加入 McAfee 之前,我花了 2 年时间做呃,嵌入式安全,在那之前我是一名 C++ 开发者。所以我

[1:03]并不是来自,呃,软件背景,实际上。所以你可能会想,为什么你首先要在意,呃,硬件黑客技术呢?对吧?呃,我能看到两个主要原因,呃,第一是它实际上非常有趣且赋权,能够,呃,你知道,破解、打开一个你喜欢的设备,无论是在家里、工作场所还是任何地方。而不是把它当作一个黑盒子,你可以反而,你知道,开始戳弄它并理解它是如何工作的。然后从更务实的角度来说,呃,如果我们考虑过去几年的安全,呃,软件变得越来越难以破解。就像如果你尝试去,呃,我知道像,攻破像,呃,任何像,呃,媒体设备像Web服务器,找到Web服务器本身的漏洞是挺难的。如果相反你可以直接打开设备,焊几根线,然后从中获得一个shell,那就容易多了。所以硬件黑客技术很棒,因为它也有很多,呃,唾手可得的成果,基本上。所以,呃,今天,我们将讨论,呃,Avaya电话,呃,特别是像9。幻灯片右侧的电话图片是一个9611g型号。呃,所以Avaya就像是最大的,呃,VoIP之一

[2:08]呃,解决方案提供商,你到处都能找到它们。呃,谷歌是财富100强公司中的90%,我认为那个特定型号的电话始于2006,并且到年底或什么的将结束生命周期。有趣的是,呃,在我幻灯片的右下角有一个有趣的,呃,截图,来自这些电话的一个非常旧的软件固件的页面。呃,实际上,你可以看到,呃,你只能下载那个特定的固件,如果你是像DOD客户,所以,基本上,呃,看到这些电话会去很多不同的地方。所以,呃,我们正在获得先验知识。呃,在硬件黑客技术中,现在很多信息都在互联网上,就像你,你可以找到很多博客文章、教程,呃,总是有像硬件黑客村,你们都可以去看看。呃,CTF也是,你可以练习,呃,像是比较软的一面,而且,呃,在我的幻灯片上,我在最后放了一堆链接,呃,所以你可以稍后下载幻灯片,而且,呃,幻灯片,我上传的那个,我在上面放了更多文字。所以就像是

[3:11] 更像是一个独立的。所以你可以阅读更多,嗯,是的,我在安全方面读到过,嗯,我发现大约2个 RC 在同一个,嗯,手机里,嗯,大概五年前之类的,嗯,他们喜欢在 RSA 上演讲,叫做 Stepping P3wns,我也建议你上网看看。所以,嗯,在接下来的40分钟里,嗯,我将谈论,嗯,硬件黑客技术,并以那部手机为基础来支持这个讨论。嗯,基本上整个情况的想法是,嗯,呃,大概,12年前,也许,嗯,通过 Fox 和开源代码,嗯,他们从未对其应用安全补丁。嗯,结果发现,像我这样,通过摆弄这个设备,我发现了这一点,而且它就像,嗯,被忽视了10年,因为他们实际上就像是一个 CVE,在,是的,10年前为 Defcon 发布的。所以我要谈论,呃,我是如何发现那一点的,就像那个固件里有一些愚蠢的,你知道的,上帝。但更有趣的是,我认为是,呃,谈论整个过程,你知道的,比如,我是怎么做的,嗯,以及我为什么做我所做的,为什么?哎呀,抱歉。

[4:15]为什么我在做的时候做了我所做的事情,呃,你知道,像魔法一样分享,呃,这个过程,以便。而且,你知道,也像分享,呃,知道,如果我尝试的东西没有成功,或者,或者选择没有成功的东西,因为,你知道,对一种设备有效的东西可能对另一种设备无效。仅仅拥有那种我们可以做什么和不能做什么的心智模型,呃,对你处理任何设备都有很大帮助。而且,我真的认为我希望人们从这个演讲中带走的是更多,呃,学习你可以检查你拥有的任何设备的过程。而且,是的,我们想要坚持,呃,如果我能做到,我认为这个房间里的每个人也都能做到。正如我所说,我更多来自软件背景,硬件黑客技术仍然像,你知道,像,呃,有点吓人,对我来说有点陌生,但最终,如果你有一个好的流程,并且你知道,我耐心工作,它真的并不那么难。所以,呃,整个项目是如何开始的,呃。呃,呃,说实话,我像,你知道,在工作中,有所有这些隔间,在,在每张桌子上,我看到这个像电话一样站在,在桌子上。我想,等一下,这些电话运行Linux,它们有你知道的,网络访问,它们有像

[5:17] 麦克风和这些东西,安全性到底怎么样?你知道,就像,我知道你,你会想,这到底是怎么回事,人们有没有考虑过它的安全性?所以嗯,在你甚至还在,我还是喜欢偷我同事的手机然后把它拆开之前的第一步,你可以,那通常是[听不清],你可以查看 FCC 网站,通常任何带有 Wi-Fi 或蓝牙的设备,出于合规原因都必须嗯,出现在 FCC 网站上。所以,这就是我找到的。嗯,那不是我的手机。那像是,也是同品牌的型号,基本上,而且相当接近。所以你看到所有这些很酷的图片。但更有趣的是,手机的,内部。呃,所以我们可以接着看到它,在左侧,在右边,用红色嗯,我高亮了这个像是随机的调试连接器,我不知道它是什么,但看到它在那里很有意思。而在右侧嗯,有那个,就像嗯,用紫色标出的是那个闪存。所以那通常是手机文件系统将要存储的地方。而这一切的重点只是让你对预期有个概念,你知道,甚至在接触真实目标之前,比如搭建硬件之类的。所以那个嗯,你,你知道,就像它是会成为容易的目标还是困难的目标

[6:23] 呃,你知道,如果一切都被黑色环氧树脂覆盖,那会更难。所以另一个重要的步骤是,比如弄清楚,嗯,获取比如嗯,在线材料,比如嗯,你知道,嗯,营销手册,这样你就对手机、对围绕它的生态系统中的手机能力有个概念,这样你就对嗯,你知道,比如攻击面有个概念。你还可以找到用户手册之类的东西。例如,我找到了一个相当酷的。它像是一个用户,像是一个高级用户手册,上面说,哦,如果你想用串行连接连到手机,你需要那个奇怪的盒子。而且呃,是的,这很有意思,它告诉,它告诉我们,是的,你可以找到它的串行连接,你可能需要一些特殊硬件来实现,但是,我们待会儿会不会看到那个。而且呃,在那之后,你还想查看比如论坛和嗯,这样你就能发现可怜的用户在做什么,例如,我在调试界面里找到了手机的默认密码,因为嗯,还有系统管理员。所以这里,呃,在网上谈论那个。而且呃,如果你幸运的话,你还可以下载,如果你对呃,那里有什么更有概念的话。然后我们会

[7:23] 一会儿讲到那个。好,那么呃,我们现在做什么,呃,现在我们对里面可能是什么样子有了概念。这是一场硬件黑客演讲。所以我们会提供志愿者,重点是,你先打开手机。嗯,诀窍是,通常你总是期望在里面找到同样的东西。而且呃,如果你看元件的标签,你会看到呃,你,然后你谷歌一下呃,你就会发现它是什么。例如,那是我的手机,嗯,你可以看到中央的 CPU,在它上方像是 RAM,呈淡紫色,像是一些未焊接的排针,我用问号标记了。这个,我觉得同样的方式,有我们之前在图片里看到的那种,而且我,它可能是 JTAG,我没必要用它。所以我其实不知道。呃,在合适的地方,我们有像 EEPROM,那呃,带着整个一些设置之类的。呃,在幻灯片底部深蓝色的是带键的 RJ45。所以我看那个的时候有点,有点困惑。我甚至不知道它的术语。而概念只是一个普通的 RJ45 呃,像网线插头,但带有一个奇怪的嗯,连接器,这样你就不能把错误的东西插进去。嗯,而且呃,更有趣的是

[8:26] 黄色的呃,UART。所以 UART 有点像串行控制台,嗯,我们有像这些裸露的呃,焊盘。所以通常比如在制造过程中,你会有像弹簧针,一般会连接到焊盘上。而这个呃,那个其实真的很有意思,因为你会找到像串行控,你会期望在那上面找到串行控制台。而在背面,我们可以看到我们之前图片里见过的 NAND 闪存。而且嗯,是的,从那里就是文件系统会像,存储在设备上的地方。所以好,你有了嗯,你,我们看了里面的东西,而呃,另一个值得看的有趣东西是测试点和调试排针。所以,基本上就是元件上的所有这些类似的东西。你可以问,为什么你会期望在里面找到它们?有几个原因,比如其一就是,通常开发板,那些家伙要用的,和生产板是一样的。也许他们只是不会去掉其他调试元件。这就像如果你是做软件的,而它是用调试符号构建的,例如。而且嗯,还有作为制造过程的一部分嗯,你,这些测试点之类的可能用于像刷写

[9:30] 设备,或者确保它被正确刷写。有时,你知道,就像现实世界中有东西坏了。他们想做个事后分析来了解发生了什么。那也很有用。那么在这种情况下你想找什么样的东西?你想看我们之前喜欢看的 UART。我马上要讲的 JTAG。然后,你也可以有随便待在那里的测试点,遍布,嗯,遍布桌子,遍布板子。可能会有长的测试点,呃,像 labour,像 TP1、TP2 之类的。有时那可能对你来说不有趣,但有时你能发现有趣的东西,比如,嗯,你可能会发现,哦,如果你把 TP64 短接到地,就会重置设备,这在某种程度上可能实际上很有用。所以呃,看 UART,呃,就像我说的,是用于串行连接。它有 3 或 4 针。3 针会是呃,地、发送和接收。第四针会是 DCC,所以是 3 伏、5 伏之类的。通常你不在乎那一根,你甚至不想插它,你不必插。而且可能呃,是的,还有呃,要了解的窍门是呃,串行

[10:36] 控制台呃,以不同速度输出一些数据。而且只有几个,叫做波特率。只有几个呃,常见的波特率值,所以如果你试着把你的系统插到 UART 上,而屏幕上只看到乱码,那可能的原因就是波特率设错了,你可以试着循环遍历所有可能的、可能的值,我想最终会找到的。嗯,JTAG 是另一个嗯,有趣的。所以那是用于硬件调试,以及你可以,比如,你知道呃,通常调试 CPU,并逐条指令执行之类的。而且它,它们有很多不同的呃,形状、针数之类的。所以幻灯片底部有一些例子呃,但实际上只有几根线有趣,呃,在幻灯片末尾我有一个链接,是一篇关于更好地理解 JTAG 的文章。但基本上,比如,如果你看我幻灯片的右上角呃,有一个开发板,比如说一个不错的呃,JTAG 连接器插在那里。另一方面,比如右下角,是某个呃,我

[11:38] 当时在看的随机设备,你可以看到,那里应该有一个 JTAG,但从来没焊上去过,所以我不得不直接焊到那些东西上。这里要记住的窍门是,如果你自己焊连接器,你实际上可能需要加一些额外的电阻,叫做上拉和下拉电阻,把一个引脚连到地或把一个引脚连到 VCC。这样做的意义是,其实我不知道意义是什么,但呃,原因是如果你没有它们,可能就不好使,或者大多数时候更费劲,会不稳定。所以嗯,如果你遵循比如 ARM 的规范之类的说明,关于你需要什么电阻,那么你可能会跳过它们,但那样你可能就会浪费时间,去理解为什么它有时会奇怪地、奇怪地搞砸。所以我建议加上拉和下拉电阻。所以那只是我同事当时在看的一块随机板子呃,只是为了向你们展示我说的其实相当通用。呃,左边我们有 UART。右边有一些 JTAG 连接器。呃,上面是嗯,主要的,是主 CPU,不管那是什么,在一个屏蔽罩下面。通常你那样做是为了嗯,防止嗯,干扰。所以

[12:43] 它是一个 Wi-Fi 模块,所以是这样。而且要知道的好事是,通常屏蔽罩是接地的。所以比如,如果你在找你的东西上的地,你要么找那种东西上的屏蔽罩,要么找以太网端口周围的金属壳之类的,实际上也相当有用。所以呃,现在我们学会了如何呃,查看里面的东西,我们需要知道你需要什么硬件来嗯,与里面的东西接口。所以我要介绍一堆呃,很酷的黑客工具集,那很重要。所以第一个呃,你可能想要这个引脚或贴纸之类的,我不知道你是否熟悉那个嗯,实际上,比如,真正重要的是安全。嗯,所以你知道,不要处理插在墙上的东西。呃,记得拔掉东西,在通风良好的房间里工作,那很重要。还有呃,是的,在呃,摆弄硬件时别犯傻呃,但是是的。所以接下来呃,实验室的照片呃,我拿着一个嗯,烙铁。你通常可以换烙铁头,比如相当大的头用于大焊接,很小的头用于小焊接。我有一台显微镜,所以那对于做呃,微小焊接非常有用。窍门是,我喝很多咖啡,我会抖,所以

[13:47] 我会,我会,我以前会想我做不到这个,但实际上,如果你嗯,如果你小心一点,诀窍就是真的试着嗯,你知道,当你焊接的时候,试着让你的手臂保持伸直并且良好接地。在显微镜下,你实际上可以做很多你根本想不到的事情,你会觉得你不应该能做到,但你实际上,实际上可以做到。[呼气],抱歉,嗯。右上角嗯,它实际上更多用于微小的焊接,而嗯,中上偏右是助焊剂,所以它算是嗯,魔法胶水,魔法呃,黏糊糊的东西,它是一种你涂在嗯,引脚上的物质,呃,当你开始做表面贴装或焊盘时,这样它就能工作得非常好。所以不要,永远不要忘记助焊剂。呃,下面是嗯,焊,就像,同样的呃,尺寸,就像呃,铜线,就像一种漆包线,你通常用来做代码的,你知道,比如用于无线电之类的。嗯,诀窍是,那根线实际上嗯,涂了清漆,所以不会短路。你可以用它来做非常微小的点对点焊接,这实际上非常有用。就在它旁边,你有一些

[14:48] 吸锡带。所以就像,这个想法是,如果你放了太多焊锡,把它搞砸了,呃,你可以把吸锡带放在你弄糟的那块焊锡上,然后你嗯,把烙铁放在上面,它会变得非常热,所以你要通过塑料外壳来握住它,它会吸收所有多余的焊锡。然后你就可以清理你的东西了。然后我放了一张图片,是一些随机的呃,跳线,它们,或者通常,总是很有用。右下角,我有那个疯狂的热风呃,枪。呃,它在Home Depot只要60美元。它本来是用于嗯,帮助油漆干燥之类的,我不确定,但它实际上非常有用,如果你在芯片上,如果你想通过加热并拔下来移除元件。所以呃,更多酷炫的硬件嗯,那是一个万用表。嗯,如果你不熟悉它,很容易找到你不知道的芯片的电压,比如实际电压是多少,所以黑色接接地,红色你呃,用白色大概选择到处探测来呃,测量电压。还有一个非常酷的东西是你可以设置到通断模式,当两个探针之间有连接时,它会发出蜂鸣声。所以如果你做

[15:51] 像我刚才描述的那样糟糕的焊接工作,你可以确保你实际上做得正确,比如一切都按你认为的方式连接,通过你知道的确保两边,当你探测时,两边实际上都会发出蜂鸣声。这实际上是一个相当有用的呃,工具。另一个是,这是一个逻辑分析仪。呃,名字像是Sally,嗯,那是一个品牌。这个想法是,和软件中一样,你有进程之间通信的方式,在硬件中,你有芯片之间或CPU和芯片之间通信的方式。而且它呃,有很多不同的标准,不同的做事方式。但逻辑分析仪知道很多这些标准,它会将线路上传输的一堆信号转换成实际数据。这实际上非常有用。那会是你的眼睛,就像当你做呃,调试时,你知道。

[16:32] 这就像是你对某些SPI通信的快照,呃,它用某种随机协议进行窥探。呃,那就像一根FTDI线缆,也有很多呃,串口线,它有很多不同的形状之类的。这个想法就像,当你想做UART时,你把它插到你的笔记本电脑上,你把用户端连接到UART端口,你就得到一个控制台,它显示为一个串口。而且呃,举个例子,我在右下角嗯,放了一个树莓派,你实际上可以进入串口控制台,不需要HDMI线或任何东西来与它交互。哇。嗯,Bus Pirate呃,也是酷炫的设备嗯,它做嗯,它,它有点依赖于硬件黑客,嗯抱歉,和嗯,Sally逻辑分析仪一起,所以它不是吸收数据,而是发送数据,所以它能说一堆不同的协议,你可以用Python来编程它。所以如果你想读取闪存、编程嗯微控制器之类的事情,它非常有用。嗯,我讲过的更多酷炫的东西。我在讲JTag,那是JTag调试器,你,那就是你实际插入Digitech端口的地方。它们

[17:38] 有很多不同的呃,价格区间之类的。所以右下角是一个fly swatter,它大概,大概30美元,我想。它工作得还行,在它上面是一个J Link,更高级。这个想法就像,东西越贵,可能就越可靠。而且它附带更好的软件之类的。右下角,粉色的那些是JTagulator,后来是Joe Grand,就是制作那些徽章的同一人做的。它真的很棒。所以,如果你喜欢那块板子,你不知道它是什么,直到有一堆测试点,你会想,我敢打赌里面某处有JTag,但你不知道在哪里。你可以把所有测试点都接到JTagulator上,它会暴力破解并尝试找到一切。所以真的很酷。嗯,那些是重要,重要的工具,呃,闪存读取器。所以通常闪存内容,闪存作为文件系统之类的。嗯,所以你想与它交互。而且呃,它有两种形式,我想,你可以做在线路内的事情。所以你有要么像你的小夹子,你放在芯片上,要么一个小矩形嗯,夹上去。嗯,所以树莓派是一个很好的选择。而且在

[18:42]右上角那个,就像是一个 flash cat,呃,它对矩形的那种挺有用的。嗯,但你也可以选择,比如,实际上把芯片拆下来,那样的话你就需要一些插座适配器。这样你就可以把芯片夹上去,然后插到你的 Flash cat 之类的设备里,它就能读取了。而那个,我会在稍后讲到为什么、是什么、我的、是什么、为什么它很重要,这两方面都会讲。最后,这算是呃,最后的呃,希望。所以假设呃,你知道你的 Flash 被加密了,没有 UART,没有固件。那你可以尝试做一些更疯狂的事情,比如,故障注入之类的攻击。所以那就是芯片的耳语,更像是一种呃,更硬核、更厉害的手段。它的思路是,嗯,你可以做这样的事情,嗯,你把它呃,接到 CPU 上,然后你让 CPU 断电,就一瞬间,它就会呃,搞乱一些指令,你就能绕过检查之类的。这就是人们用来做游戏主机破解之类的事情时用的专业手段。所以呃,现在我们该怎么办呢,嗯,我们已经对手机里面有什么有了概念,而且嗯,你知道我们可以用哪些工具。所以,我觉得这是三个

[19:47] 提出了可能的路径,一个是搞 UART,也就是串口控制台,另一个是呃,搞 flash,尝试恢复固件之类的,然后也许你直接就能在网上把固件下载下来。这三条都是可行的路径,有时候从一个换到另一个再换到另一个是好的,你知道,不管你找到什么硬件,你都可以从一个换到另一个。呃,所以我先选了 UART,这就是我把 FTDI 线接到我之前弄的 UART 端口上时看到的东西。所以嗯,我们可以在左边看到,那个呃,控制台的东西,它就像点点点,通常你看到那个的时候,你可以按空格或 escape,它就会中断手机的启动过程。在那种情况下,呃,但不知怎么的这里没起作用。而我,我会在稍后讲到为什么。在幻灯片的右上角,嗯,我们可以看到它从 EEPROM 读了些东西,然后决定把控制台设为 Dev null。所以你不希望控制台是 Dev null,因为那样的话就哪儿都不去了。但知道那里有一些潜力是挺有意思的。最后,它就像是在下一步启动,所以它确,向我们确认了这是一个唯一的端口,但然后呃,

[20:48] 那之后就没有更多了。所以有好的一面,也有坏的一面。问题是,就像我们做的那样,Linux 之后什么都没显示出来,可能是因为 Dev null 的情况。而当我按键时它们会说话,嗯,我会想想为什么会那样。所以那时候,我还是觉得,好吧,我,我哪儿也去不了。所以我要尝试恢复固件,试着弄明白那到底是怎么回事。呃,恢复固件有多种方法,呃,简单的方法比如你可以在线做。实际上那奏效了,嗯,这里有个快速的截图,呃,有时候它是加密的。在我们的情况下,它不是。嗯,但是,是的。所以你还可以尝试嗅探固件更新,呃,这对 IoT 设备总体来说非常有用。你可以用网络标签页,就是幻灯片右上角图里那个东西。嗯,或者你可以在交换机上镜像你的端口之类的。呃,所有这些的问题是,固件更新往往是通过呃,HTPS 进行的,或者可能是,在这种情况下,你就卡住了。然后你就想去做更呃,硬件破解之类的事情,或者比如你要 dump 一个 flash。而且就像

[21:48] 甚至更高级的技术,我会简要地呃,讲一下。那么你怎么 dump 一个 flash 呢?有两种方法,就像我刚才提到的,你可以做在线编程,嗯,以及离线编程。所以在线编程很酷,因为你不用,你知道,拆东西、弄坏东西。但有几个问题,嗯,主要思路是读取 flash,你需要给 flash 供电。而如果你,如果它还插在整个系统里。呃,比如你的树莓派,当它尝试读取 flash 时,它会试图给所有连接到同一条电源线上的东西供电。要么你知道,USB 派不够强,没法给一个 VoIP 电话供电,这你也能预料到。在那种情况下呃,但就是不行。或者也许你的树莓派真的很强,它能做到,但那样的话问题就是 CPU 会停止启动,然后它会和 flash 通信,那就会搞乱你的东西。所以在那种情况下,你通常有两个选择,要么你可以试着把引脚、球栅引脚抬起来,这样就不会发生。要么你可以采取稍微更英雄主义的做法,让 CPU 保持在复位状态。所以我很多次都成功地做到了这一点

[22:51] 或者我就是喜欢这样开始,比如尝试在板子上随机测试点接地,祈祷不会发现任何东西。通常,在某个时刻,我会注意到,好吧,当我这样做时,手机像亮起来,它不启动,那很好。也许更好的方法你可以用它来拆焊芯片,比如热风枪之类的。不过你得小心,因为如果你拉得太用力,可能会弄弯引脚,那就没用了。嗯,一个要知道的好技巧是,你可以在芯片上做一个类似锡箔帽的东西,这样当你加热芯片时,周围的东西不会太热。呃,这样你就不会不小心碰掉一些微小的元件,那会非常麻烦,嗯,要放回去。而且呃,右下角是,我当时想我可能得在手机上这么做。所以我想先练习一下,然后随便拿了个USB拇指驱动器试了试。实际上,那效果非常好。但诀窍是要记住,我还涂了一些助焊剂,因为它有帮助。呃,是的,就是小心,当你把它取下来时。还有一些其他技巧实际上在这个上没起作用。但我知道也好。呃,U-Boot是最常见的引导加载程序,呃,这里没用到,但你会找到

[23:56] 几乎在其他所有设备上都有。其想法是,你也可以指示启动过程,并礼貌地请求,嘿,你能把闪存加载到内存中吗,然后呃,U-Boot也能够以十六进制形式转储到屏幕上,嗯。内存,这样,你就可以直接写脚本来做这件事,并从闪存中恢复一切,这真的很酷。但通常开发者不喜欢让你这么做。他们说他们锁定了这种方法,所以你不能按空格键来中断启动过程。但有一个技巧,我也称之为Yolo方法,相反,当。其想法是,U-Boot会从闪存加载新的扫描器之类的。但如果在它发生时,你开始戳,你知道,像一根线连接到地,然后开始戳NAND闪存的某些引脚,它会扰乱U-Boot正在读取的内容,经过几次尝试后,U-Boot会想,该死,那个内核坏了,我不知道该怎么办,然后它会给你一个shell。所以那真的很酷。但是的,正如我所说,那个在我们的手机上不起作用。不过呃,只是我在网上找到的一些很酷的例子,有人真的这么做了。而且呃,我在下面紫色部分划了线

[24:59] 呃,在底部紫色部分,比如你需要用来将闪存记录到内存中的命令。右边第二块文本是,嗯,抱歉,是,你如何会惊慌失措,然后说,呃,我不知道如何处理你的内核,然后给你shell。所以呃,如何,嗯,所以还有几个类似的技巧来转储闪存,你可以使用JTag。所以通常你有,如果JTag工作,你将能够转储RAM。所以在这种情况下,那不会真的像转储闪存,它会涉及转储固件,但在很多设备中,它会将整个东西加载到内存中,所以如果你能转储内存,你就,你同样意味着你在这方面相当不错。而这方面的最后希望。这是我最喜欢的硬件黑客之一,你可以做疯狂的事情,一个例子是Scanlime,互联网上的那个人,她有一个Wacom数位板,她想从中转储固件,而且似乎完全没有攻击面,她意识到当你[听不清]USB东西时,当你将USB插入笔记本电脑时,有一些USB交换,我

[26:01] 对此一无所知,但听起来像是USB描述符。如果你在那个时刻对CPU进行故障注入,嗯,它会像,错过一个二进制检查,并发送更多的数据。有了那个,她能够恢复完整的闪存、完整的内存之类的。所以这真的很令人印象深刻,但这就是硬件黑客的厉害之处。好了,所以呃,我们恢复了固件,在我的情况下,只是通过在线下载,但是,我们现在做什么?我们想分析它。嗯,最好的工具叫做Binwalk。它基本上就是一个魔法字典,会查看你的二进制数据块,然后说,嗯,一半的地方看起来像是一个zip文件,我要尝试提取它。它尝试,也许成功,也许不成功,取决于它是否真的是zip文件。它对所有东西都这样做。而且呃,它也可能找到压缩文件系统,如Squashfs、JFFS2等。有时你的固件文件可能只是以ELF头开始,或者只是随机的ARM代码,你可以看看。所以我还没开始工作。所以那就是固件文件,我不知道它来自网站。

[27:01] 再一次,这是简单模式,只是一个文档文件。而且他们已经把它分成了 boot 1、boot 2 和 JFFS2。所以,Binwalk 在这里其实没什么可做的,我可以直接提取整个文件系统。这很酷,因为从那里我可以直接查看手机上的内容。呃,但 Binwalk 更有趣的用例是,我拿了一个不同的呃,固件文件,比如一个[听不清]手机的。这个有趣多了,因为 Binwalk 找到了更多、更多的东西。呃,我标出来了,比如你找到文件系统并且能够提取它。还有那个随机的 MySQL 相关的东西,我认为是误报,然后你需要意识到会有很多误报,所以不要盲目相信 Binwalk 说的。呃,我当时在看的一个非常非常有趣的东西是,如果你对那个特定镜像运行 strings,呃,你会找到 U-Boot 字符串。所以,那个有趣的设备用的是 U-Boot,我之前描述的那些酷东西实际上可以在那个上面工作,看。那么现在你已经提取了固件文件,你想找什么?最呃,有趣的东西之一是呃,找到你,更新机制。所以假设你有呃,加密的固件,

[28:04] 如果你逆向工程那个,你可能会找到密钥以及如何提取,如何提取后续的呃,固件更新,而不需要做任何硬件相关的事情。然后你想找像秘密之类的东西,比如呃,密码、证书等等。呃,最初,我的目标是看主要的二进制文件。所以那就是处理 VoIP 协议栈的东西。呃,看看那个可能是有意义的。嗯,还有你想看引导加载程序,因为它可能有隐藏命令,解释为什么所有控制台都不工作,那种东西。所以,记住,所有这些的重点是,我想在设备上获得一个 shell,嗯,做那个的过程是什么?所以,我想走的是,我想修复串行控制台,你知道就像 Dev null 不酷。嗯,但方法也会是搞乱你的启动参数。嗯,这里显然不工作。呃,但你知道,你可以指定你想要的控制台,并且 uniscript 可以被标记,哦,我想要 Bin bash 作为我的 uniscript,然后你就有一个控制台了。呃,还有我考虑过的作为最后手段的东西是,你可以修补固件。在我们的情况下,固件是签名的。所以呃,那不会工作,除非你尝试故障注入,那真的很难。

[29:08] 但你也可以尝试修补文件系统。所以 Binwalk 提取 JFFS2 内容的方式,你可以修改它,然后重新打包并直接刷写到闪存上。这通常是准确的、万无一失的方法,在大多数情况下会有效。所以相反,我要呃,逆向呃,嗯,引导加载程序。嗯,为了那个,嗯,因为我想理解比如,为什么 Dev null,一个 con,控制台被设置为 Dev null 等等。我打算呃,更详细地讲,我会建议你查看 Azeria Labs 的教程,它们涵盖了所有内容,在这里很有用嗯。在 ARM 中有字面量池这个概念。

[29:44] 嗯,在代码段内部,你会找到一些小块数据,那通常用于呃,加载寄存器,嗯,绝对地址、立即值、魔法偏移,那种东西。呃,供参考,比如在函,在函数调用的情况下呃,参数会进入 R0 到 R3。返回值在 RVO 中。当你想要从调用者返回时,返回地址保存在 LR 寄存器中,那代表链接寄存器。嗯,这里的大技巧,大问题是嗯,我们试图加载引导加载程序。所以它呃,它不是真正的 ELF。所以如果你尝试导入 IDA,IDA 不知道该怎么处理它,所以你需要找到那个东西的加载地址,以便匹配手机加载它的位置。几个技巧嗯,所以你的加载密钥都不会打印在屏幕上,在我们的情况下,很好。嗯,但否则,你想查看引导加载程序文件中的头文件、头信息,或者最近的向量,那种东西,特别是对于 ARM,CPU 需要知道特定地址,比如发生异常或中断的地方,这很有趣,像嗯,方形一样的,

[30:50] 它是如何设置的。所以如果你找到那个,并且找到看起来像中断向量处理程序的东西,你可以找到比如,啊,那一定是地址。呃,最后,我提到的字面量池呃,真的很有用,因为它会包含绝对地址或指向字符串等。所以呃,如果,如果你有字符串,它们看起来一团糟,你可能得到了错误的地址。呃,Quarkslab,呃,多么重磅的博客,所以我建议你查看一下。所以正如我所说,在我们的情况下,它很简单。嗯,当它启动时,它会打印呃,跳转,随便什么。那实际上是 WIFI 加载的。

[31:21] 嗯,在右下角,是一堆呃,字符串,嗯,所以是一堆指向字符串的地址。呃,来自 IDA 的系统快照,嗯,我们可以看到呃,嗯,所有字符串都像打印一样正常,所以这意味着它被正确加载了。它并不是全都乱掉了。好,那么现在我们已经有了 bootloader,并且可以用 IDA 来处理它,呃,我们想搜索字符串,呃,我们之前在看,你知道,就像那句话,比如 EEPROM read successful 之类的。所以我们可以用 IDA 里的交叉引用来找到这个字符串来自哪里,并查看处理它的函数。呃,是的,顺便说一下,比如 EEPROM 和 Spi,所以板子上的 EEPROM 叫做 Spiprom,而 Spi 只是我之前提到的其中一种协议。EEPROM 只是呃,像一小块存储器,嗯,随便什么。而 spi 呃,协议就像 4 根线,嗯,还有从 CPU 发出命令的 ID,EEPROM 像回复,呃,那是用逻辑分析仪查看它在现实中会是什么样子的转储。呃,那是 EEPROM 的数据手册

[32:22] 你可以在网上找到,如果你谷歌上面的标签。嗯,很酷的一点是,在幻灯片的左下角,呃,它告诉你,比如引脚定义,所以你知道如何连接东西到它上面。而在幻灯片的右侧,嗯,它告诉你哪些,哪些,操作码是用于 Spi 命令发送的。比如,如果你发送呃,3,它就会是读,读,如果你发送 2,它就会是写。所以那是呃,那是有用的事情,对吧?哎呀,抱歉。回到嗯,回到 IDA 和呃,bootloader,我们可以看到呃,我们之前要找的字符串。而对我来说有希望的是,我们可以看到呃,控制台设置为 Dev null,但在那上面,我可以 bur,2 选项,它实际上在说,哦,将控制台设置为像 UART 0 或 UART 1。所以我们想要这些被打印出来。

[33:08] 嗯,那是一个实际上会打印那个字符串的函数。呃,它大致做的是,嗯,更干净地,清除栈上的一些位。然后你从一个魔法地址为我读取。它会比较刚刚读取的字节,嗯。如果我们有正确的值,它实际上会打印到控制台设置上,将控制台设置为呃,Dev ttyAMA0。所以我们想要那发生。呃,你可能会问我,哦,你是怎么找到那个读取 EEPROM 函数的,你知道?那里有几种方法可以做到。呃,我在截图中用绿色高亮标出的简单方法,是呃,在右下角,你可以看到一些像日志的东西说,哦,EEPROM read fails。所以我知道那个函数负责读取 EEPROM。呃,但也许,也许我接下来要看的更多不是呃,作为呃,变量。在这种情况下,嗯,就像我之前说的,比如,要从 EEPROM 读取,你知道你必须通过 SPI 发送 3。所以,如果你找到像 SPI 函数,并且你看到像发送 3,你就知道它是什么。就是黄色高亮的那个。但然后,你如何在这种呃,程序中找到 spi 函数?呃,2 种方法。

[34:07] 嗯,我的猜测再次,它被记录了,所以很容易。但通常,主要技巧是嗯,你有这个嗯,叫做嗯,映射呃,IO MMO 映射 IO 的东西。就是这种像 CPU 中的魔法地址值,如果你写入它们,它实际上会通过像你的 auto spi 之类的发送数据。如果你幸运,你会有 CPU 的数据手册。它会准确说明那些地址是什么。如果你不幸运,嗯,你必须猜测,那真的很难。而且,那时候,也许你应该去找别的东西,或者只是你知道,你会在那上面花很多时间。所以我们现在想呃,修补 EEPROM,这样我们就能呃,构建控制台。行动计划是,我们知道读、写命令,呃,我们想与闪存接口。所以要做到那一点,嗯,呃抱歉,EEPROM,我们,我们嗯,我们需要像 spi 呃,设备,而我们之前见过 Bus Pirate 是完美的候选。我们需要连接到芯片,呃,不幸的是,

[35:09] 它真的是很小的一个,所以像我展示的夹子对它来说太大了。你可以在网上买一些人做的夹具,嗯,它很贵,而且要五周才能拿到。所以相反,我有点疯了,我试着焊像嗯,小线到那东西上。我当时想,老实说,那永远不会成功,但碰巧真的成功了。那真是太好了。呃,它看起来都像十字,因为上面残留着所有助焊剂。嗯,那是 Bus Pirate 的代码。它超级像样板呃,东西。当你只是写嗯,这些魔法值,呃,抱歉,我被要求像,用图像替换它们。但呃,想法是,就在那之后,你会看到控制台被设置为呃,像你的 R0,现在我们有更多东西呃,打印到控制台上,这很棒。但不幸的是,我,我得到像这个更难的,像,输入仍然像不工作,我试着按空格或输入像,它在问,哦,你想以 root 身份登录?什么,我输入,什么都没发生,像啊,发生了什么?我是不是刚切断了走线,所以你不能发送数据?我们有板子,我们可以看看

[36:09] 弄它,嗯。所以呃,这就像是,像是把那东西放大,然后当时我就,你知道,看着 UART 焊盘,开始用我的万用表,试着用蜂鸣档测,看它通到哪里,你知道,就是做通断测试。最后它通到了右侧的一些导线上,而导线就是那个连接球的一侧到另一侧的小孔。所以诀窍在于,真正连接 UART 到某个东西的走线,会通到板子的另一侧,然后哦,来回绕。这真的,真的很繁琐。最后我有点跟丢了它到底通到哪里。

[36:39] 但它有点在那个 MOD 端口下面,呃,就是那个带键位的 RJ45。嗯,所以呃,记得那个侦察那边,呃,侦察部分,嗯,我们有个盒子,然后就像啊,该死,就是,就是那个东西。所以我又用了类似欧洲人的办法,我拿着一根插头,像一根跳线,插在我呃,FTDI 线的发送端上。呃,所以我有一根可以到处戳的线。另一边,我在控制台上按键,看会不会有什么反应。同时,我一根一根地戳那些引脚。我觉得戳到第二个的时候,居然就成功了。然后我就看到了呃,设备上的 root shell。所以那挺酷的,嗯。但诀窍是,呃,在正确配置的右侧,我把网线插进了插头。所以当时我不知道 RJ45 的键位在哪。所以我就把网线的塑料磨掉,这样我就能把它硬塞进去,嗯,结果就是能用,所以那挺好。

[37:36] 呃,现在我们有了 root shell,是不是有很多调试字符串打印在屏幕上,那很烦人。所以嗯,触发点是,我想杀掉那个进程,它就像,刷,像洪水一样刷我的控制台。呃,有个看门狗,如果发生这种情况就会重启设备,所以我高亮了角落里那些可以运行来杀掉它的魔法命令。就是些随机的、独特的东西。呃,所以现在终于可以做漏洞研究了。嗯,真正要做的是查看正在运行的进程,到处戳一戳,看看开放的端口。呃,就是一堆进程,呃,新的 SQL 之类的东西,但嗯,那时候一切开始变得有趣了。我觉得某个时候我看 IDA 看烦了,我就想,我要多戳一戳。我看了看 DHClient,然后想,嗯?真正好笑的部分是,我运行 DHClient,然后看到这个 2007 版权信息。我就想,哇,这可不是好事。如果你单独运行 DHClient,它会段错误,就像,那很奇怪。如果你像,用正确的方式运行它,它们会打印一条调试信息说,哦,我们修改了它,让它在我们的设备上更好地工作。我就想,嗯,那挺有意思。所以,如果我们

[38:36] 回头看,去找那个特定版本,结果发现,10 年前,其实,在 DEFCON 上,呃,Jon Oberheide 嗯,真的就是针对那个特定版本 DHClient 的漏洞利用,所以我就想,好吧,那,那简单。嗯,但我们想确保它实际上仍然有漏洞。所以嗯,那个手机像是在做,嗯,栈溢出,在处理 DHCP 选项时。所以我们可以比较原始源代码和补丁源代码,因为 DHClient 是开源的。并且要记住,那可能像是缓解措施,比如栈 cookie、ASLR 之类的。所以如果我们看左边的漏洞代码,可以看到一个用红色高亮的 memcpy。它使用了类似 data.len 这样的字段。或者在右边我们放置的补丁版本中,那是通过 4。所以思路是,这个 bug 是呃子网,呃,是子网掩码和链路中的 bug,子网掩码应该是 4 字节。但是,HTP 选项的工作方式是,你可以发送最多像 255 字节,我想,而它过去就盲目信任你发送的任何东西,这很糟糕。如果我们看 IDA 里那个实际的函数,呃,我们可以看到没有栈 canary,而且那个,那个,在

[39:39] 左边,在右边,它,它没有使用那个魔法 4,所以它,它显然仍然有漏洞。所以利用起来很简单。嗯,在处理手机操作系统 TDS 时,我就想,我要试着搭 QEMU,嗯,如果你不熟悉 QEMU,它有点像 ARM 东西的模拟,或者像小型系统,可以做用户态或全系统。用户态在这里不行,因为呃,DHCP 更多是,试着修改 IP 之类的,那不行。嗯,但相反,我们可以做,做全系统模拟,呃,那些教程会告诉你如何为此设置一个查询匹配。我们只想正确设置网络,呃,因为我们想与 DHCP 交互,而且自然地,嗯,QEMU 栈会给你一个 digi,给你自己一个 DHCP,所以你必须,保持,别那样做,而且,是的。所以我在 QEMU 里运行 DH,然后像 [听不清] 错误之后,它仍然段错误,就像,嗯?所以结果是,Avaya 修改了一些东西,实际上导致了段错误。嗯,我本来要太快地回去,因为我时间有点不够了。但呃,基本上它是在创建那个奇怪的 socket,呃,就像

[40:42] 一个名称套接字,呃,所以这就像是 VOIP 协议栈可以与 DHClient 通信并显示选项的主应用程序。嗯,呃,这个想法就像是,那是主应用程序,然后我们可以看看它做什么。那并不,不是特别有趣。但基本上在左侧,就像是在启动时发送数据来配置 DHClient,而在右侧,我用 Python 重新实现了它。呃,你可以用 Socat 来运行它,嗯,所以,Socat 就像是,有点像 Netcat,嗯,更像是,嗯,更多工具,所以你可以共享那个名称套接字,想法是,你在主机上运行 Python 脚本,你在套接字上,在嗯,QEMU 像二进制、镜像上,然后它就能工作。所以现在我们可以开始调试,呃,DHClients,嗯,你可以运行 GDB,我们可以试着,像,实际运行这个漏洞。我,我无法编译原始的的概念验证,它像是使用了非常旧的工具,而且就是经过像,天哪,像几个小时之后,啊,去他的,我累了。所以相反,呃,我使用了一个基于 Scapy 的,呃,漏洞利用。Scapy 是一个 Python 库,让你像,你知道,摆弄,呃,网络数据包,相当底层。嗯,所以现在我们要像到达,嗯,易受攻击的部分,易受攻击的代码,所以嗯,我

[41:47] 在解释,呃,子网掩码选项中的漏洞。以及 DHCP 的工作方式就像是,一个茶,标签长度值之类的东西。所以你说,哦,这个选项是一个,呃,子网掩码,这是长度,这是值。显然它像是,它会是 4,但如果你发送更多,也没问题。但对于 DHCP 规范来说。所以我们可以用 Scapy 来做这个。所以,呃,那是我的,像是我 Scapy 脚本的一大块,而正确地构造载荷很有趣。嗯,基本上就是发送子网掩码选项,带有,呃,像是 A、A、A、A、B、B、B、B、C、C、C、C 等等等等的数据。这样,嗯,当它在 GDB 中崩溃时,呃,我们可以看到像我们控制的所有寄存器,我们就确切地知道,嗯,你知道,如果我们想要,影响哪个寄存器,我们需要更改哪一块 shellcode。

[42:33] 我们可以看到我们实际上控制着,呃,[“pc” 也就是程序控制台,所以那很好。我们知道我们有,嗯,我们可以利用,我们有控制,控制执行。还有几个更多细节我会跳过。但是,嗯,我们现在需要,来构造 shellcode。呃,不幸的是,像是看起来栈是,呃,你不能执行栈,所以我们将不得不绕过它。那很乏味。但是,嗯,酷的地方是,如果你找,有一个像是系统调用,那个二进制文件,我认为也是 Avaya 添加的。而且我们确实控制 R4。所以如果我们放入,如果我们能把一个字符串放在内存中一个我们知道的地址,那可以是一个值,像是系统命令,然后把地址放入 R4,我们就行了。嗯,所以如果你想想,DHCP 客户端,DHClient,抱歉,从服务器接收配置值。所以可能有一些东西存储在某个地方,嗯,结果发现 ASLR 是禁用的,我,抱歉,我忘了提到那个。嗯,但是然后我们,想法就像是,我只是像,发送像 A、A、A、A 作为像,一堆,呃,选项,然后查看内存,看看我能不能在某个地方找到那个字符串。最终,域选项

[43:36] 是一个好的。所以嗯,现在我可以给你们展示,呃,一个很酷的演示,就是当你实际运行整个东西时会发生什么。所以,呃,在,嗯,在左侧,我们有正在启动的手机。手机正在启动,窗口,呃,10 分钟的窗口就像,在左侧是一个,运行我们的载荷的恶意 DHCP 客户端。在右侧是,嗯,是一个 Web 服务器,呃,将提供像,呃,实时后利用之类的东西。所以我们可以看到数据包在运行。为了确保它能工作,我在,呃,在屏幕上 cat 了 dev random。这就是为什么它看起来像噪音。它正在从,嗯,Web 服务器获取数据,而且我不知道你们能不能看到,但它正在加载像 steve.data。呃,顺便说一下,Steve 实际上是我的,呃,老板。那就是他。[笑声] 然后,呃,就在那时,嗯,呃,还在像,呃,提取,我不知道有没有声音,但我正在从主扬声器外泄音频。你可以在 VLC 中看到,当我说话和拍手时,它实际上像是在攻击者笔记本电脑上读取音频。所以那相当可怕,因为你可以把你的,嗯,手机变成,嗯,你

[44:37] 知道的,监听设备。[掌声]。谢谢。所以,嗯,是的,顺便说一下,我使用的所有工具实际上已经在手机上了,像是你的 Netcat,你用来像把音频调暗到像 SDN 之类的东西,所以你,只,只是像写一些 shell 脚本,像 bash 脚本,随便什么。所以,嗯,作为结论,呃,对于缓解措施,像是,你想确保你监控你的网络,这样你就不会有像发送,呃,你知道,像奇怪的 DHCP 数据包这样的漏洞。而且,呃,实际上像 McAfee,呃,防火墙,像是可以检测到那个。顺便说一下,你想隔离你的网络,嗯,以确保,例如,咖啡壶不能像向你的手机发送奇怪的 DHCP 数据包。并确保 IT 实际修补你的手机,因为你知道,它花了,补丁说明发布像是,Avaya 大约一个月前发布了一个补丁。所以确保它实际上被修补了。而且,呃,如果你想思考为什么这种漏洞会发生,像是,技术,技术数据真的很难处理,而且,没有 [听不清] 某人在好的方面,嗯。好吧。嗯,有人会面对,嗯,模糊了这些东西,然后他们忘记

[45:42] 了它。所以,嗯,然后作为一个非常快速的,嗯,嵌入式系统不是黑盒子,所以我只是鼓励每个人去,嗯,看看它们,呃,你现在也可以这样做。所以如果你有问题,呃,在 Twitter 上问我或随便什么,谢谢你们的时间,伙计们。[掌声]

查看英文原始字幕

[0:00] >>Without further adieu, because we stay on schedule. Philippe is here uh, from uh, from Portland, by way of uh, France from what I understand. And he is going to talk to, the, talk to us about uh, breaking into embedded devices, including phones, uh, phones that you might have on your desk at work phones that might be, I'm not even gonna get into that, phones that might be around. Let's learn about embedded device hacking. Let's give Philippe a big round of applause. [Applause]. Have a good time man. >>Thank you. Thank you, everyone um, so I’m really excited to be here, it’s like a big honor and um, yes, so today we are going to talk about hardware hacking and um, I’m going to show you this introduction to it and I hope um, I can show some love about um, hardware hacking. So uh, who am I? I’m Philippe Laulheret um, I’m a senior security researcher at McAfee, um, Advanced Threat Research. So I, I do um, software and hardware phone research, and you can find me on Twitter at PHLaul. Before doing McAfee, I spent 2 years doing uh, embedded security and before that I was a C++ Dev. So I'm

[1:03] not, not coming from a um, software background actually. So you could wonder like, why should you care about um, hardware hacking in the first place? Right? Um, I can see like two main reasons uh, first is that it's actually really fun and empowering to be able to um, you know, break op, break, open a device that you would like have in your home at work wherever. And instead of considering that it's a black box, you can instead you know, like start poking at it and understanding how it works. And then in a more like pragmatic way um, if, if we consider like security in the past couple of years uh, software is becoming much and much harder to like break. Like if you try to uh, I know like, pwn like uh, whatever like um, a media device like a web server like find, finding a vuln in the web server by itself is kind of hard. With, if instead you can just like open the device, solder a couple of wires, and get like a shell from that, that's much easier. So hardware hacking is great, because it's also like a lot of uh, low hanging fruits basically. So uh, today, we're going to talk about uh, Avaya phones um, and especially like the 9. The phone picture on the right side of the slide is a 9611g model. Uh, so Avaya is like one of the biggest uh, VoIP

[2:08] um, solution provider you can find them like all over the place. Uh, Google's like 90% of the Fortune 100 company and I think that's specific model of phone started in 2006, and is going to be enough life like at the end of the year or something. And the funny um, on the bottom right of my slides there is this a funny like um, screenshots from like a page from like a really old software firmware for these phones. Where um, actually like, you can see that um, you can only download that specific firmware, if you're like a DOD customer so um, basically then, uh, see that these phones are going to a lot of different places. So uh, we're getting prior art. Uh, in hardware hacking, it’s like a lot of information nowadays is on the internet, like you, you can find a lot of blog posts, tutorials um, there’s always like the Hardware Hacking Village that you all go, go and check out. Uh, CTF as well where you can like practice, uh, like kind of like the softer side of stuff and um, on my slides, I like a bunch of links at the end uh, so you can like download the slides at later time and um, also the slides uh, I’ve like, the one I've uploaded I’ve like, more text on them. So it's like

[3:11] a more like standalone. So you can read more um, and yeah, I read that in security uh, I found like 2 RC’s in the same uh, phone uh, something like five years ago or something, um, and they like talk at RSA called Stepping P3wns I would also recommend to check out online. So uh, for the next 40 minutes um, so I'm going to talk about um, hardware hacking and use that phone as a base to like support that conversation. Um, And basically the idea of like the whole situation is um, uh, like couple of like, 12 years ago, maybe uh, via Fox and open source codes, and um, they never applied security patches to that. And um, it turns out that like me, by poking at the device, I found that and it was like, women like unnoticed for like 10 years as they were like actually like a CV that got released like, yeah 10 years ago for Defcon. So I'm going to talk about uh, how I found that like that it was like some stupid like you know God inside that firmware. But more interesting, I think is uh, talking about the whole process, you know, like, how I did it, um, and why I did what I did it Why? Oops, sorry.

[4:15] Why I did stuff I did when I did it um, you know like, magic like sharing um, the process so that. And you know, also like sharing uh, know, what if the stuff I tried didn't work or, or selection stuff that didn't work, because, you know what, what works for one device might not work for another. And having just like that mental model of what we can do and what you cannot uh, helps you a lot approaching at any kind of device. And that's, I really think why I want people to take away from that talk is more like um, learning the process of that you can check out like whatever device you have. And yeah, we want to like insist that um, if I can do it, I think everyone in this room can do it as well. As I said I’m more from like software background, and the hardware hacking is still like, you know, like um, little scary, little foreign to me, but it's in the end, it's really not that hard if you have like a good process and you know, me work with patience. So uh, how did whole project start uh. Um, uh, to be honest, I was like, you know, working at work, and there were like all these cubicles, on the, on every desk, I see this like phone like standing on, on the desk. I’m like, wait a minute, these phones are running Linux, they have you know, network access, they have like

[5:17] mics and stuff is like, how, how secure is that? You know, like, I know, you, you wonder like, what's up with it, did people consider the security of this? So um, the first step before you know even like, I still like stealing my coworkers phone and breaking it apart, you can like, and that's generally [inaudible], you can check out the FCC websites usually like any device that has Wi Fi or Bluetooth, has to be um, on the FCC website for a compliance reason. So, that's what I found. Um, That's not my phone. That's like a, also model of same brands, basically and like pretty close. So you see all these cool pictures. But more interesting is the, the inside of the phone. Uh, so we can then see it and on the left side in right, in red um, I’ve highlighted this like random debug connector, I don't know what it is, but that's interesting to see that's there. And on the right side um, there is like that, like um, in purple there is that flash memory. So that's usually where the file system of the phone is going to be stored. And the whole point of that is just to get an idea of what to expect, you know, before even approaching a real target, like building hardware and stuff. So that um, you, you know, like if it's going to be an easy target or hard target

[6:23] uh, you know, if everything was covered in black epoxy, that will be harder. So another important step is like figure, um, getting like um, online material, like um, you know, um, marketing brochure, so you have an idea of what the phone, what are phone capabilities in the ecosystem surrounding it, so that you have an idea of um, you know, like the attack surface. And you can also find like user manuals and stuff. And for instance, I found that one that was pretty cool. It's like a user, like a, advanced user manual that says, oh, if you want a serial connection to the phone, you need that funky box. And uh, yeah, which is interesting it teach, it tells us that yeah, you can find it’s serial connection and you may have had some special hardware for that, but, are we going to see that in a bit. And uh, after that, you also want to check like forms and um, so that you can find out what poor user are doing like for instance, I found like the default passwords for the phone in debug interface, because um, and system admin. So here, uh, talk uh, talking about that online. And uh, if you're lucky, you can also download if you're more of an idea of uh, what's up there. And then we'll

[7:23] cover that in a minute. Okay, so uh, what do we do now, uh, now we have an idea of like, what it might look inside. This is a hardware hacking talk. So we're going to provide volunteers and so the point is like you open the phone first. Um, and the trick is like, usually you always expect to find the same stuff inside. And uh, if you look at the labours of the components, you will see uh, you, and you Google that uh, you will find out like what it is. So for instance that's my phone, and um, you can see the centre of the CPU a, above it like the RAM, in like a lavender ish colour, like some unpopulated like header that I marked with a question mark. This, I think the same way, there are the one we were like seeing in the picture before and I, it might be JTag, I did not have to use it. So I don't know actually. Uh, in proper, we have like the Eeprom’s that’s uh, with the whole like some settings and stuff. Uh, in dark blue in the bottom of the um, of the slide is like a keyed RJ45. So I was kind of, kind of confused when I was looking at that. And I didn't know even the term for it. And the idea is just a regular, RJ45 uh, like Internet plug, but with a weird um, connector so that you cannot plug the, the wrong stuff into it. Um, and uh, more interesting

[8:26] in yellow uh, the UART’s. So it's UART is kind of like the serial console and um, we have like these experts like uh, pads. And so usually like in manufacturing or something you would have like a pogo pins that would like generally connect to the pads. And this uh, that one is actually really interesting, because you would find like serial con, you'd expect to find the serial consol on that. And on the back, we can see the NAND flash that we've seen the previous picture. And um, yeah, from that is like where the file system would be, like stored on, on the device. So okay, you have um, you, we looked at the stuff inside and the, the like, other thing that's interesting to look at is test points and debug headers. So, and like basically all this kind of stuff that on those components. And you can ask, why would you expect to find them inside? And a couple of reasons like ones like just, usually like the Dev board that, that the guys are going to use is the same as the production board. And maybe they're not, just not going to solve the other debug components. It's the same as if you are like software, and it was built with like debug symbols, for instance. And um, also like part of the manufacturing process um, you, this test points and stuff might be used for like flashing

[9:30] the device ,or making sure it's flashed properly. And sometimes, you know, like something died on um, in, in the, in the real world. And they want to like do a post mortem to understand what happened. And that's useful as well. So what kind of stuff you want to look for in that situation? You want to look at UART that we like looking at before. JTag that I'm going to, uh, cover like in a minute. And then like you can also have like random test point that are chilling there that like all over um, the all over the table, all over the board. And there might be like long test points, er, like labour like TP1, TP2, whatever. And sometimes that, that might be like not interesting to you, but sometimes you can find interesting stuff like um, you might find that like oh if you short like TP64 uh, with ground is going to reset the device, which might be actually useful in some extent. So uh, looking at UART uh, so as I said is for like serial connection. And it comes in like 3 or 4 pins. The 3 pins will be uh, ground uh, transmit and receive. And the fourth pin would be like DCC, so 3 volts, 5 volt whatever. And usually you don't care about that one, you don't even want to plug it, you don't have to. And might uh, yeah, and uh, the, the trick to know is uh, the serial

[10:36] console uh, some data at different speed. And there are only like a couple of it's, called like Baudrates. And there was only like a few uh, common baud rates values, so if you try to plug your, your system in on, into the UART, and you just see gibberish on screen, the, probably the reason is, you just have the baud rate wrong and you could just like try to cycle through like all the possible, possible one, and it would find something eventually I think. Um, JTag is another one that's um, interesting um. So that's for like hardware debugging and ways that you could, like, you know uh, debug the CPU usually, and execute like instruction by instruction and whatnot. And it, they come in many different uh, shapes, number of pins and whatnot. So some example like on the bottom of the slides uh, but actually only a couple of wires are interesting and uh, at the end of the slides I have like a link to an article about like understanding JTag better. But basically, like, if you look on the top right side uh, of my slides, there is like a Dev board and say like a nice uh, JTag Connector like plugged there. And on the other hand, like on the bottom right, it's like some uh, random device I

[11:38] was looking at, which you can see, there should be a JTag, but it's never been soldered on and so I had to solder directly onto that stuff. And the trick to remember here, if you kind of like solder your own connector, is uh, you actually may have to add like extra resistors called like pull up and pull down resistors that connects like one pin to ground or one pin to like VCC. And the point of that is, actually, I don’t know the point of that, but uh, the reason is that if you don't have them, it might not work well or it's more work most of the time, it's going to be glitchy. So um, and if you follow the instructions from like, for instance like a arm, a specification for like what resistor you need, so, you might skip them, but then you might waste time like understanding why it's a weird, like weirdly f*****d up sometimes. So I would recommend the pull up and pull down resistors. So that's just random board that my coworker was looking at uh, just to show you that what I said is actually fairly generic. Uh, on the left side, we have like UART. On the right side there like some JTag connectors. Uh, up there is the mmm, the primary there is like, the main CPU, whatever that’s under like a shield. And usually you, you do that for um, preventing um, interferences. So

[12:43] it's like a Wi Fi module, so that's why. And the good thing to know is usually the shield is grounded. So like, if you're looking for the ground on your thing, you're like, either the shield on that kind of stuff, or like the casing around the Ethernet port or whatever is also act, actually like fairly useful. So uh,now that we learn how to uh, look into stuff, we need to know what hardware you need for um, interfacing with what's inside. So I'm going to present like a bunch of uh, cool hacking tool set that's important. So the first one uh, you may want this pin or like the stickers, I don’t know if you're familiar with that um, the actually, like, what's really important is like, safety. Um, so you know, don't work with stuff that’s plugged in the wall. Uh, remember to unplug stuff working like well ventilated room, it's important. And uh, yeah, just don't be stupid when you're like uh, messing with hardware uh, but yeah. So next uh, picture from the lab uh, I'm holding a um, soldering irons. You can usually switch tip for like a fairly large tip for like big soldering and tiny ones for small soldering. I have a microscope, so that's really useful for doing uh, tiny soldering. And the trick is I, I tend to drink a lot of coffee and I shake, so

[13:47] I will, I would, I was thinking like I couldn’t do that, but actually, if you um, if you careful and the, the trick is like really try to um, you know, when you soldering, like try to hold your arm like straight and well grounded. And under the microscope, you can actually do a lot of stuff that’s, you just don’t think, you wouldn't be able to use, you would think you shouldn't be able to do it, but you actually, actually can. [Breathes out], sorry, um. Top right side um, it's more actually used for the tiny soldering and the um, mid sec top right is like flux, so it's kind of um, magic glue, magic uh, gooey sta, it’s a substance that you put on um, pins to uh, when you start doing surface mount or pads so that it works really well. So don't, never forget, flux. Uh, bottom is um, sa, like, in the same uh, size, like uh, copper wires, like a minal wire that you use, usually for making codes, you know, for like radio or whatever. Um, and the trick is that the, the wire is actually um, coated in uh, varnish so it doesn't short. And you can use it to do like really tiny point to point like soldering, and that's actually really useful. And just next to it, you have like some

[14:48] desoldering wick. So like, the idea is, if you put too much solder and you f**k it up uh, you can put the wick on top of the solder block that you messed up with and you um, put the soldering iron on top of that, it's going to get really hot, so you want to hold it through like the plastic casing and it’s going to absorb all the like extra solder. And you can clean up your stuff. Then I put a picture of like some random like uh, jumper wires that are, are, or usually, always useful to have. And on the bottom right, I have like that crazy heat uh, gun. Uh, it's just like 60 bucks at Home Depot. It's meant to like, help paint dry or something, I'm not sure, but it's actually really useful for if you’re on the chip, if you want to remove component by just like heating them and pulling them off. So uh, more cool hardware um, that's a multimeter. Um, if you're not familiar with that, it's easy to for, find voltage of chip you don't know, like what's the actual voltage, so the black goes to ground and the, with the red you uh, with the white probably select poking around to uh, measure the voltage. And there was a really cool stuff is you can set in continuity mode and when you have like connection between the two probes, it beeps. So if you do

[15:51] like crappy soldering job, as I was describing just before, you can make sure that you actually did a proper job where like everything is connected the way you think, by you know making sure that both like, when you probably, both side it actually beeps. And that's actually fairly useful uh, tool. The other one is, this is a Logic Analyzer. Uh, the name is like a Sally, um, that's a brand. And the idea is, the same as in software, you have like ways of communicating between process, like in hardware, you have like ways of communicating between chips or the CPU and the chip. And it’s uh, it's like a lot of different standards, different ways of doing stuff. But the logic analyzer like know a lot of them and it's going to convert like a bunch of signals going , going on to wires into actual data. And that's actually really useful. That would be your eyes, like when you're doing uh, debugging, you know.

[16:32] And that's like your snapshot of like some SPI communication uh, which spies with some random protocol. Uh, that's like an FTDI cable also come in many uh, serial cable, it comes in many different shapes and stuff. And the idea is just like, when you want to do like UART, you, you plug that into your laptop, and you connect the user side to like the UART port and you get like a console, it shows up as a serial port. And uh, as an example I’ve um, on the bottom right um, like a raspberry pi that’s, you can actually get to serial console and you don't need like HDMI cable or anything to interface with that. Whoo. Um, the Bus Pirate uh, also like cool device um, it does um, It, it's kind of dependent of the hardware hacking at um sorry, with um, the Sally logic analyzer, so instead of absorbing data, it's like send data, so it speaks a bunch of different protocol and you can use Python to programme it. So it's extremely useful if you want to like read flash, programme um, microcontrollers and that kind of stuff. Um, more cool stuff I covered. I was talking about JTag, that's the JTag debuggers that you, that's where you would plug actually like the Digitech port on. They

[17:38] come in many different like uh, price range and whatnot. So on the bottom right is a fly swatter it's like, probably like 30 bucks, I think. And it works okay, and above it it's like a J Link, which is more fancy. And the idea like, the more expensive the stuff is, the more, the probably the more reliable it is. And it comes with like better software and whatnot. And on the bottom right, the pink bodies are JTagulator later that Joe Grand, the same guy who made up those badges uh, made. And it's really awesome. So, if you're like that board, you don't know what it is until like a bunch of test point and you like, I bet there is some JTag somewhere in it, but you don't know where. You can just wire like all the test points to the TJagulator and is going to brute force like and try to find everything. So it's really cool. Um, those are interest, important tool is uh, Flash readers. So usually Flash content, the Flash as the file system and stuff. And um, so you want to like interface with that. And uh, it comes in two flavour, I guess, you can do like in circuit stuff. So you have like either like your little like clamp that you put on the chip or a little rectangular one um, in to clip on. Um, so like the Raspberry Pi is a good one for that. And on

[18:42] the top right, is like a flash cat, uh, it’s like useful for the rectangular one. Um, but you can also like, choose to like, actually disorder the chip and, in that case, you would have like some socket adapter. So you can clip the chip on and then you plug it into your Flash cat and whatever, and it's going to read it. And that, I will cover like why, whats, my, whats, why it's important like both in a minute. And finally, it's kind of the um, last uh, hope. So let's say uh, you know your Flash is encrypted, there is no UART , there is no firmware. So you can try to do like the more crazy stuff like, first injection and such an attack. So that's the chips whispers like more like a kind of hard, more badass device. And the idea with that is um, it, you can do stuff like um, you are wire it um, to the CPU and you're going to drop the power on the CPU for like a split second and it’s going to like mess up some instruction and you can bypass checks and stuff. That's pro, what people use for like gaming console hacking and, and um, that kind of stuff. So uh, what do we do now um, that we have an idea of what's inside the phone and um, you know um, the tools we can use. So like, I think it's three

[19:47] posts potential track, one is messing with the UART, so the serial console, and this one is uh, messing with the flash and trying to recover the firmware or something and then maybe you can just download the firmware online. And the three are like valid approach and sometimes it's good to just go from one to another to another and you know what, whatever you find like some hardware you can like go from one to another. Uh, so I went for the UART first and that's what I'm greeted at by when I connect my FTDI cable to the UART ports that I, I was doing before. So um, we can see that on the left side, the, the um, the console thing, it's like dot dot dot, usually when you see that, you can press space or escape and it's going to interrupt the booting process of the phone. And in that situation, uh, but somehow here it didn't work. And I, I will cover that why in a minute. And on the top right side of the slide um, we can see like it read something from the EEPROM and then decided to set the console to Dev null. So you don't want console to be Dev null because if that goes nowhere. But that's interesting to know that um, there is some potential there. And finally, it's like booting in next so it con, confirm us that it's a uniques port, but then uh,

[20:48] there's nothing more uh, after that. So there's some good thing, bad things. The problems are like nothing shows up after like the Linux is as we did, probably because of the Dev null situation. And when I press keys are talking and um, I'm going to like come up with like, why that happened. So at that point, I was still like, okay, I, I cannot go anywhere. So I'm going to try to recover the firmware to try to understand what's up with that. Uh, multiple ways of recovering firmwares uh, is like an easy ways like you can do it online. And actually that worked um, there is like a quick snapshot of that, uh, sometimes it’s encrypted. On our case, it wasn't. Um, but, yeah. So you can also try to sniff a firmware update uh, that’s really useful for IoT devices in general. And you can use a network tab, which is like the thing pictured on the top right of the slide. Um, or you can mirror your port on your switch or whatever. Uh, the problem with all of that is oftentimes a firmware updates going to do over like h, HTPS, or it might be, in this case, you're like stuck. And then you want to go for like a more like uh, hardware hacking stuff or like you’re going to dump a flash, for instance. And like

[21:48] even more advanced techniques that I will briefly like uh, talk about. So how do you dump a flash? There’s two ways, as I was mentioning, just before, you can do in circuit programming and um, out of circuits. So in circuit is cool, because you don't have to, you know, like remove stuff, break stuff. But a couple of issue is that um, the main idea is to read the flash, you need to power the flash. And if you, if it's like still plugged into the whole system. Uh, it, when you're like Raspberry Pi, for instance, going to try to read the flash, it's going to tr, try to power like everything else that's connected to the same like like power line. And either you know, USB Pi is not strong enough to power like a VoIP phone, which you would expect. And in that case uh, but it's just not going to work. Or maybe your Raspberry Pi is really strong and it’s going to do it, but then the problem is the CPU stop booting and it’s going to talk with the flash and that's going onto to mess up your stuff. So in that situation, you have like two choices usually, either you can try to like lift up the pin, the ball pins, so that it doesn't happen. Or you can kind of go a little more like hero approach where you want to keep the CPU in reset. So I've been successful with that many times

[22:51] or I just like starts like trying to ground like random test points, of stuff on the boards, praying that is not going to find anything. And usually at, at some point like, I'm going to notice that okay, when I do that the phone like light up, it doesn't boot, that's good. And maybe better ways you can desolder the chip with it like to be like heatgun or whatnot. You have to be careful though, because if you like pull it too hard, you might like bend pins and is going to be like useless. Um, with a good trick to know is that you can make a little like um, tinfoil hat or whatever, like on the chip, so that like when you're heating up the chip, like the stuff around, it doesn't get too hot. Er, so you don't accidentally like knock off like some like tiny like components, that would be like a pain in the butt to um, put back. And uh, bottom right is like I was, I was, I thought I would have to do that on the phone. So I wanted to practice first and then just took like some random uh, USB thumb drive and I tried. And actually, that worked really ff, nice. But the trick is to remember, I also put some flux because it helps. And uh, yeah, just don't, be careful with, when you put it off. A few other tricks that actually didn't work on this one. But I, good to know. Uh, U-Boot is the most common boot loader uh, not used here, but it's, you would find

[23:56] that on pretty much every other device. And the idea is you can also instruct a boot process of that and asked nicely you would, hey, can you load the flash in memory, and then uh, U-Boot is also able to dump in a Hex like in the screen um. The, the memory, is this way, you can just get, write into the script to do that and recover everything from the flash, which is really cool. But usually like Dev don't like letting you do that. They said they lock that approach, so, so you cannot like press space to interrupt the boot process. But there is a trick that I also call like the Yolo approach where, instead, when. The idea is like U-Boot is going to load from the flash like the, the new scanner or something. But if while it’s happening, you start like poking with, you know, like a wired is connected into ground and they started poking the NAND flash, like some of the pins, it's going to mess up like what’s uh, u-boot is reading and after a couple of tries, u-boot is going to be like, d**n that kernel is f**ked up, I don't know what to do and it’s going to give you like a shell. So that's really cool. But yeah, as I said that one we don’t work on our phone unfortunately. But uh just some cool example that I found online was like some guy actually did that. And uh, I underlined in

[24:59] uh, in the like purple on, on the bottom, like the command you need to use to like log the, the, the flash in memory. And on the right side, the secondary block of text is um, sorry, is, how uh, you will just panicking and be like, er, I don't know how to do with your kernel and give you the, the shell. So uh, how um, so a few more like tricks for um, dum, dumping the flash, so you can use JTag. So usually you have uh, if, if JTag works, you're going have to be able to um, dump the RAM. So in this case, that won't be really like dumping the flash, it will involved dumping the firmware, but, in a lot of devices it’s going to load the whole stuff in memories, so if you can dump the memory you are, you, you the same means you pretty good there. And kind of the last hope with this. That's one of my favourite about hardware hacking is, you can do crazy uh, stuff uh, and an example is a Scanlime um, that person on the internet who um, she had a um, a Wacom tablet that she wanted to dump the um, the firmware off and there was like no attack surface at all, which she realised that like when you [inaudible] USB stuff, and when you plug your USB um, onto the laptops, there is some USB exchange that I

[26:01] don't know anything off, but it sounds like USB descriptor. And if you, if you glitch the CPU just at that time, um, it's going to like, know, miss like a binary check and is going to send a way more data. And with that uh, she was able to recover like the full flash, full memory or something. So it's really impressive, but, and that's what's kind of awesome about hardware hacking. Okay, so uh, we recovered the firmware uh, in my case, just by downloading online, but, what do we do now? We want to analyse it. Um, the best tool for that is called Binwalk. And it's just basically magic dictionary that's going to like look at your binary blog of stuff and be like, mmm, halfway through it looks like there is a zip file, I'm going to try to extract it. It tries, maybe it works, maybe it doesn't depending if it was actually zip filed or not. And it does that for everything. And uh, it might also find like compressed file system such as Squashfs, JFFS2 etc. And sometimes like your um, your firmware file might just start with like Elf headers or just like random like ARM code that you could like, look at. So I haven't been work on. So that's the firmware file, I don't know it from the website.

[27:01] And once again, it's easy mode, it's just a doc file. And they already like split it up into boot 1, boot 2 and JFFS2. So like, Binwalk has nothing to do here, really, and I can just extract the all file system. And that's cool, because from there, I can look at what's on the phone, just like that. Uh, but the more interesting, use case for Binwalk is, I took like a different uh, firmware file for like, a [inaudible] phone. And this one is way more interesting, because Binwalk for, find like a way more lot, lot of stuff. And uh, I've highlighted, like you find the file system and is able to extract it. And there's also that random like my SQL stuff, which I think is a false positive, then you need to be aware that there will be a lot of false positives, so don't blindly trust what the Binwalk says. And uh, really, really funny stuff that I was looking at uh, if you run strings on that specific image um, you will find a U-Boot strings. So, that fun is using U-Boot and the cool stuff I was describing before, would actually work on that one, look. So now that you have extracted the firmware file, what do you want to look for? One of the most uh, interesting stuff is uh, finding the you, update mechanism. So assuming you have uh, encrypted firmware,

[28:04] like if you reverse engineer that you might find the keys and how to extr, to extract like subsequent uh, firmware updates without having to do like, any hardware stuff. And then you want to look for like secrets, like uh, passwords, certificates and so and so forth. Uh, originally, my goal was to look at the main binaries. So that's just the thing and deal with like the VoIP stack. Uh, that could be make sense to look at that. And um, also you want to look at the bootloader because, it may have a hidden commands, explain why all console is not working, that kind of stuff. So, remember, the point of all of that was, I wanted to get a shell on the device and um, what's the process to do that? So, the one I want to go for is, I want to fix the serial console, you know like the Dev null was not cool. Um, but also approach will be like messing with your boot arguments. Um, not working here, obviously. Uhm but you know, you can specify the console you want and the, uniscript can be marked, oh I want Bin bash as my uniscript and you have a console. Uh, and like kind of last resort stuff that I was considering as well is, you could patch the firmware. In our case the firmware is signed. So uh, that won't work unless you try to glitch it, which really hard.

[29:08] But you can also try to patch a file system. So the way Binwalk extract the JFFS2 stuff, you could modify it and then like repackage and flush it directly onto the flash. And that's usually accurate, foolproof methods like, that would work in most cases. So instead, I'm going to uh, reverse uh, um, the Bootloader. And um, for that, um, because I wanted to understand like, why Dev null, a con, the console was set to Dev null and stuff. I'm just going to cover um, in much detail and I would be come on you to check out Azeria Labs Tutorials that cover everything, which just useful here um. There is this notion in ARM of literal pool.

[29:44] Which is um, inside the code section, you would find some little chunk of data and that's usually like used to la, loading registries, um, absolute addressees, imminent values, magic offset, that kind of stuff. And uh, FYI, like in ca, in case of function calls um, the arguments are going to R0 to R3. The rooted value is in RVO. And when you like, want to return from your caller, it's, the, the return address is saved in like the LR register, that stand for like link register. Um, and the big trick, big problem here is um, we're like trying to load the boot loader. So it's uh, it's not really Elf. So if you tried to import in IDA, IDA doesn't know what to do with it and so you need to find the loading address for that stuff, so it match what, where the phone is loading it. Couple of tricks um, so none of your load key is going to be printed on screen, that's our case, sweet. Um, but otherwise, you want to look at like header file, headers in the, in the bootloader file or maybe recent vectors so that stuff for like, specifically for ARM, like the CPU needs to know uh, specific addresses where like, a recess or an intrep happening and it's like funny like um, square like,

[30:50] how it’s being set up. So if you find that and you find like what looks like an intrep vector handle or something, you can find like, ah, that must be the address. And uh, finally, the literal pool I was mentioning uh, really useful with a because it's going to contain like absolute addresses or point to strings and stuff. So uh, if, if like you have strings, and they look like all f**ked up, you probably got the wrong address. And uh, Quarkslab, uh, what a blockbuster blog, so I would recommend you checking it out. So as I said, in our case, it was easy. Um, when it boots it prints uh, the jump, whatever. And that's actually WIFI loaded.

[31:21] And um, on the bottom right side, it's like a bunch of uh, strings um, so it's a bunch of addresses that point to strings. Uh, the system snapshot from IDA and um, we can see that uh, um,it's all the strings like prints well, so that means that it's loaded properly. It's not like all messed up. Okay, so now that we have the bootloader and we can like work it with IDA, uh, we want to search for strings uh, we were looking at, you know, like that sentence like EEPROM read successful, whatever. So we can use like cross reference in IDA to find where the string is coming from and look at the function that handles that. And uh, yeah, just as a FYI, but like EEPROM and Spi, so the EEPROM that's on the board is called a Spiprom and Spi is just one of this protocol I was mentioning before. EEPROM is just uh, like a small memory, um, whatever. And the spi uh, protocol is just like 4 wires um, and the ID to CPU in command and EEPROM like reply, and uh, and that's a dump from like using the logic analyzer to have a look at what it would look like in real life. Uh, that's the data sheets of the EEPROM

[32:22] that you can find on, online, if you google the, the label on it. Um, the cool thing is in the bottom left uh, of the slide, it tells you like, the pinouts, so you how to connect stuff to it. And on the right side of the slide um, it tells you which, which, upcodes are for Spi command would send. Like for instance, if you send uh, 3 it’s going to be read, read, if you send 2, it's going to be write. So that's uh, that's something useful to know, right? Oops, sorry. Back to the um, back to the IDA and the uh, bootloader, we can see uh, the strings we were like looking for. And something is for me promising is, we can see the uh, console set to Dev null, but above that, that I could bur, 2 of the option and it’s actually saying like, oh, setting console to like UART 0 or UART 1. So we want these ones to be printed.

[33:08] Um, that's a, that's a function that actually does print that string. And uh, what it does is roughly um, cleaner, clear some bites on the stack. And then you read for me from from a magic address. And it's going to compare like bytes um, that has just been read. When if we have the good value, it’s going to actually print on the console setting, the console for uh, Dev ttyAMA0. So we want that to happen. Uh, and something you can ask me is like, oh, how did you find that read EEPROM function, you know? And there like more a couple of ways of doing that. Uh, the easy way that I've highlighted in green, that screenshot, is uh, on the bottom right, you can see some like logging that says, oh, EEPROM read fails. So I know that function is responsible for reading EEPROM. Uh, but maybe, maybe the few more I’m going to look is not uh, as uh, variables. In which case um, as I said before, like, to read from a EEPROM you know you have to send 3over SPI. So, if you find like the SPI function, and you see like sending 3, you know what it is. This whatever highlighted in yellow. But then like, how do you find a spi function in this kind of um, programme? Uh, 2 ways for that.

[34:07] Um, my guess once again, it was logged, so it was easy. But usually like, the main trick is um, you have this um, something called um, mapped uh, IO MMO mapped IO. It's this kind of like magic address values in the CPU that like if you write to them, it's actually going to send data over like you auto spi or whatever. If you're lucky, you're going to have a data sheet for the CPU. And it specifies exactly what are those addresses. If you're unlucky um, you have to guess and that's really hard. And, at the time, maybe you should like look for something else, or just you know, you're going to spend a lot of time on that. So we want to uh, patch the EEPROM now, so we can uh, build the console. The plan of action is, we know the read, write comments uh, we want to interface with the flash. So to do that um, uh sorry, the EEPROM, we, we um, we needed like a spiuh, device and that we've seen before the Bus Pirate is a perfect candidate for that. And we need to connect to the chip, uh, unfortunately,

[35:09] like it's really tiny one and so like the clip I was showing how like too big for that. You can buy online some rigs that people make um, it's like, expensive, and it's like five weeks to get them. So instead, I went kind of crazy and I tried to solder like um, little wires onto the thing. And I was like, honestly, that's never going to work, but happened to actually work. And that was like, sweet. And uh, it's all like look like cross because it’s like all the flux that remains on that. Um, and that's the code for the Bus Pirate. It's super like boilerplate uh, thing. And when you just write um, this magic values that uh, sorry, I was asked to like, replace, them with like, images. But uh, the idea is like, just after that you're greeted with console is set to uh, like your R0 and now we have a lot of more stuff uh, printed on console, which is great. But unfortunately I, I get like this a harder like, the input are still like not working, I was like trying to press space or type like, it’s as, asking for oh, you want to look as root? What’s, I type, nothing happens, like ah, what happened? Did I just cut the trace, so you cannot send data? We have the boards, we can look

[36:09] at it, um. So uh, this just like, like a zoom up on the thing and at that time, I was like, you know, looking at the UART pad and start like with my millimetre, like trying to beep out, like where it goes, you know it’s, following the continuity testing. And eventually it reached some wires, like on the right side and wires are that little hole that's connect one side of the ball to the other. So the trick is the actual like trace that connects UART to whatever uh, goes to the other side of the board and goes oh, back and forth. And it's like really, like tedious. And eventually I kind of lost where it was going.

[36:39] But it was kind of under that MOD port, uh, that's like the keyed RJ45. Um, and so um, remember like the recon side uh, recon part, um, we have that box and it’s like ah, d**n, that’s, that’s the thing. So I kind of went via like, my euro approach again where, I was holding like a, a plug, like a jumper cable in my um, the transmit of my FTDI cable. And uh, so I had like this like wire that I could poke around. And on the other side, I was like pressing keys on the console trying to see if something happened. And meanwhile, I was poking like to the pins one by one. And I think at the second one, it actually worked. And I got greeted by uh, like a root shell on the device. So that was cool um. But the trick was um, the, on the right side of like a proper setup, where I plugged my ethernet cable into the plug. So at that time, I didn't want know where the key the RJ45 was. So I was just like sanded the plastic of the ethernet cable so I could like shove it in, and yeah, it just works, so that was nice.

[37:36] Uh, now that we have a root shell is it like uh, a lot of debug strings prin, printed on screen and that's annoying. So um, the trigger was like, I want to kill the process, it's like, sha, that's like flooding my console. Uh, there’s a watchdog that’s going to reboot the device if that happens, so I highlight in the corner, like the magic commands that you can run to kill that. It’s just like a random, unique stuff. Uh, so now we can finally do some Vuln research. Um, and really what you are going to do is look at process running, poke around, look at open ports. Uh, there's just a bunch of processes, uh, new sequel stuff, but um, that’s when it’s all getting interesting. I think at some point I was tired of looking in the IDA and I was like, I’m going to poke more. And I looked at DHClient and like huh, and the really funny parts like, I run the DHClient and I see this like 2007 copyright. I was like, woah, that's not a good thing. And if you just run DHClient by itself, it's Segfaults, like that's weird. And if you like, run it the right way, they print a debug message that say oh, we modified it to work it better on our device. I’m like, huh, that's interesting. So, if we

[38:36] look back, and we look for the specific version, it turns out that, 10 years ago, actually, for DEFCON uh, Jon Oberheide um, really is like an exploit for that specific version of the DHClient, so I was like, well, that's, that's easy. Um, but we want to make sure it's actually vil, still vulnerable. So the um, the phone was like a doing like um, Stack Overflow, like while handling DHCP options. So we can compare the original source code with the patch source code because DHClient is open source. And just keep in mind, that might be like mitigation, like stack cookies, ASLR whatnot. So if we look at the vulnerable code on the left side, we can see a memcpy like highlighted in red. That’s using like data.len as a field. Or on the patched version that we place, that by 4. So the idea is like, this bug is uh subnet, uh, it's a bug in the subnet mask and link, and the subnet mask should be like 4 bytes. But, the way the HTP option works, is that you can send up to like 255 bytes, I think, and it used to just dumly trust, whatever you're sending, which is bad. And if we look in IDA like the actual like function, uh, we can see there is no stack canary and the vinner, the, the, on the

[39:39] left, on the right side, it's, it's not using that magic 4, so it's, it’s obviously like still vulnerable. So it simple to exploit stuff. Um, working on the phone os TDS, I was like, I'm going to try to set up QEMU um, if you're not familiar with QEMU it’s kind like emulation of ARM stuff or like mini of system and can do either like Userland or Full-System. Userland wouldn't work here because uh, DHCP is um, more going, try to modify an IP and stuff and that's not cool. Um, but instead, we can do, do a Full-System emulation and uh, those tutorials tell you how to like, set up a query match for that. And we just want to set up the network properly, uh, because we want to interface with the DHCP and naturally um, the um, QEMU stack would give you a digi, DHCP for yourself, so you have to be, stay like don't do that and, yeah. So I run it in DH in QEMU and after like [inaudible] fault and it's still Segfault and it’s like, huh. So it turns out that like, Avaya modified stuff that actually causing the Segfault. And um, I was going to go back too fast, because I'm running like a little of out of time. But uh, basically it's creating that weird socket, uh, it’s like

[40:42] a name socket and uh, so that’s like the main application that the VOIP stack can talk with DHClient and show options. Um, and uh, the idea’s like, that's like the main application, then we can see what it does. That's non, not super interesting. But basically on the left side, it’s like sending data to configure DHClient at startup and on the right side, I re-implemented that in Python. And uh, you can run that with like Socat, um, so, Socat is just like, kind of like Netcat in um, in more like um, more tools, so you can share that name socket and the idea, you run the Python script on the host, you on socket on the um, QEMU like binar, image, and that just work. So now we can start debugging uh, DHClients, um, you can run GDB, we can try to like, actually run the bug. I do, I couldn't compile the original proof of concepts, it was like using a really old tools and it's just after like, hella, like couple of hours like, ah f**k that, I’m tired. So instead uh, I use a Scapy based uh, exploit. Scapy is a Python library that lets you like, you know, mess with uh, network packets, like a fairly low level. And um, so now we want to like reach the um, vulnerable part, vulnerable code, so um, I

[41:47] was explaining the bug in the uh, subnet mask option. And how, the way DHCP works is like a tea, tag length value like type of stuff. So you say, Oh, this option is a uh, subnet mask, here's the length, here’s the value. And obviously it was like, it would be 4, but if you send more, it's fine. But for the DHCP specs. And so we can use Scapy for doing that. So uh, that's my, like a chunk of my Scapy script and just the payload in properly is interesting. Um, basically just sending the subnet mask option with uh, data that will be like A, A, A, A, B, B, B, B, C, C, C, C and so on and so forth. So that um, when it crashes in GDB uh, we can see like all the register we control, and we know um, exactly um, you know, if we want to af, affect which register, which chunk of the shell code we need to change.

[42:33] And we can see that we actually controlling uh, [“pc’s” so the programme console, so that's good. We know that we have um, we can exploit, we have control, control for execution. And there like a few more details that I'm going to skip over. But um, we need to sta, to craft a shell code now. Uh, unfortunately, like it's it looks like the stack is uh, you cannot execute the stack, so we will have to work it. And that's tedious. But um, cool stuff is like if you look for there is like a system calling, that binary that I think also, Avaya added. And we do control R4. So if we put us, if we can put a string in memory in an address we know, that could be a value like, system comment, and put the address in R4, we good. Um, so if you think about it, DHCP client, DHClient, sorry, receive configuration values from the server. So probably there is going to be stuff that are stored somewhere and um, it turns out that ASLR is disabled, I, sorry, I forgot to mention that. Um, but then we, the idea is like, I just some like, sending like A, A, A, A’s as like, a bunch of uh, options and then look at memory to see if I could find that string somewhere. And eventu, eventually, the domain option

[43:36] was a good one. And so um, now I can show you uh, a cool demo that's, what happened when you actually run the whole stuff. So uh, on the, um, on the left side, we have the phone that's booting. The phone is booting and the window uh, the 10 minute window is like, on the left side is a, rog DHCP client running off payload. And on the right side is um, it's a web server that uh, will provide like uh, life post exploitation kind of stuff. So we can see the packet is running. To make sure it works, I was uh, catting dev random on the uh, on the screens. That's why it's looks like noise. It's fetching data from the um, web server and and I don’t know if you can see but it’s loading like steve.data. Uh, FYI, like, Steve is actually my uh, boss. That's him. [Laughter] And uh, just then um, uh, still like ex, I don’t know if there is sound but I’m ex- filtrating audio from the main speaker. And you can see it in VLC that when I'm speaking and clapping my hands, it's actually like reading the audio on the attacker laptop. So that's pretty scary because you can turn your um, phone into um, you

[44:37] know, listening device. [Applause]. Thank you. So um, yeah, and just FYI like all the tools I use like actually already on the phone, like you're like Netcat, your like stuff to like dim the audio to like, SDN, so you, ju, just like writing some shell script, like bash script, whatever. So um, as conclusion uh, for mitigation, like, you want to make sure you monitor your network so that you don't have like bugs like sending uh, you know, like weird DHCP packets. And uh, actually like McAfee uh, firewall, like can detect that. FYI, you want to segregate your network um, to make sure that, for instance, the coffee pot is not able to like send weird DHCP packets to your phone. And make sure IT actually patch your phone, because you know, it took, it's the patch notes release like, Avaya release a patch like a month ago. So make sure it's actually patched. And uh, if you want to think about why this kind of bug happened like, tech, technical data is really hard to handle and, no [inaudible] someone in good face um. Okay. Um, somebody would face um, fogged the stuff and they forget

[45:42] about it. So um, and just as a really quick um, embedded systems are not black boxes, so I would just encourage everyone to um, look at them and uh, you can do it now as well. So if you have question uh, ask me on Twitter or whatever and thank you for your time, guys. [Applause]

在Vidleaf工作台中打开

搜索转录文本,选择行,复制带时间戳的引文,翻译。

在工作台中打开 →

署名

《Philippe Laulheret - 硬件黑客入门 - DEF CON 27 大会》由 DEFCONConference(https://www.youtube.com/@defconconference)制作,依据 CC BY 3.0 许可(https://creativecommons.org/licenses/by/3.0/)。源视频:https://www.youtube.com/watch?v=HuCbr2588-w。本页是该视频的文本转录,添加了段落分隔和时间戳;创作者与 Vidleaf 无关联,也不为其背书。Vidleaf 添加了 AI 标点和 AI 生成的摘要;原始措辞仍可在本页查看。

您是创作者或权利持有人吗?请求更正或移除:copyright@vidleaf.app(参见关于这些页面)。

最后更新于