AutoGadgetFS:一款针对USB设备的安全测试工具

李肖遥 2022-09-04 22:03
    关注、星标公众号,直达精彩内容

来源:Alpha_h4ck



关于AutoGadgetFS

AutoGadgetFS是一款开源框架,它可以帮助广大研究人员在无需深入了解USB协议的情况下对USB设备以及相关的主机/驱动器/软件进行评估。该工具基于Python 3开发,并且使用了RabbitMQ和WiFi访问来帮助研究人员对远程USB设备进行安全审计。在ConfigFS的帮助下,AutoGadgetFS允许用户迅速克隆和模拟设备而无需深入研究每一个实现细节。除此之外,该框架还允许用户创建自己的模糊测试器。

功能介绍

轻松查找、选择并连接到USB设备。

模拟任何USB HID设备。

以中间件设备身份执行AGFS嗅探HID设备(将通信保存到磁盘)。

设备嗅探(任何设备)。

多个Fuzzer允许您对设备或主机进行模糊测试。

随机Fuzzer(具有固定或随机长度的数据包)。

智能Fuzzer,可以从以前的USB通信中学习。

可以告诉Fuzzer哪些字节要模糊化,使包的其余部分保持不变。

小工具Fuzzer。

顺序Fuzzer。

控制传输枚举器。

从文件中重放数据包。

从保存的USBLyzer捕获重放数据包。

显示数据包的可视方式,以便于对通信信息进行逆向分析。

DFU模式下的设备警报,或者设备泄漏信息。

支持对USB设备和主机进行远程调试。

监控突然的界面变化。

工具要求

一台运行了Linux的主机(Debian/Ubuntu/Kali);

支持WiFi访问的树莓派Raspberry Pi Zero;

目标设备选择:虚拟机或单一主机;

两条USB线缆;

目标USB设备;

硬件调试器(可选);

工具配置图

设备测试

设置中间件

设置中间件并支持设备调试

工具安装

Linux设备

sudo apt install python3 ipython3 git python3-pip rabbitmq-server dfu-util

sudo service rabbitmq-server start

git clone https://github.com/ehabhussein/AutoGadgetFS

cd AutoGadgetFS

sudo -H pip3 install -r requirements.txt

sudo python3 -m pip install prompt-toolkit~=2.0

sudo rabbitmq-plugins enable rabbitmq_management

http://localhost:15672/ to reach the web interface

sudo rabbitmqctl add_user autogfs usb4ever

sudo rabbitmqctl set_user_tags autogfs administrator

sudo service rabbitmq-server restart

安装完成后,请按照下列方式测试安装结果

sudo ipython3

Python 3.7.7 (default, Apr 1 2020, 13:48:52)

Type 'copyright', 'credits' or 'license' for more information

IPython 7.9.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import libagfs

In [2]: x = libagfs.agfs()

***************************************

AutoGadgetFS: USB testing made easy

***************************************

Enter IP address of the rabbitmq server: 127.0.0.1

In [3]: exit

sudo `python3` agfsconsole.py

***************************************

AutoGadgetFS: USB testing made easy

***************************************

Enter IP address of the rabbitmq server: 127.0.0.1

Give your project a name?!:

工具运行截图

中间人攻击

USB设备模糊测试

主机端基于代码覆盖的模糊测试

基于字节的模糊测试

AutoGadgetFS命令行终端

基于流量学习的智能Fuzzer

In [44]: x.devSmartFuzz(engine="smart",samples=5,filename="/home/raindrop/PycharmProjects/AutoGadgetFs/binariesdb/Nud-Nuvoton-1046-20764-1590421333.5169587-Nuvoton-1046-20764-1590421600.8067

...: 274-device.bin")

[+]General Statistics

Full charset : !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~

Discarded charset : !"#$%&'()*+,-./:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`ghijklmnopqrstuvwxyz{|}~

Final charset : 0123456789abcdef

Word Length : 128

Lower Case index usage : 92%

Lower Case index locations : [1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 121, 122, 124, 125, 127]

Upper Case index usage : 0%

Upper Case index locations : []

Digit index usage : 96%

Digit index locations : [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 123, 126]

NonAN index usage : 0%

NonAN index locations : []

Counter statistics : Uppercase: 0 , Lowercase: 133071, Digits:212017 , NonAlphaNumeric:0

All char Frequencies :

character:5 found:5012 times

character:2 found:22563 times

character:3 found:12197 times

character:8 found:15008 times

character:4 found:13275 times

character:0 found:98056 times

character:1 found:17861 times

character:f found:87823 times

character:d found:7221 times

character:7 found:9614 times

character:a found:11148 times

character:6 found:10472 times

character:b found:8189 times

character:9 found:7959 times

character:c found:9172 times

character:e found:9518 times

***********************

generated:5 Packets

***********************

Out[44]:

['5608305852bf2ffd61770e2c827542f20be0b0fcba09db916bd07e1734b04cb0352b1d278068064d19f033bfad6fa90e53d865693fd4fee0214f00000eb0aa2c',

'3b083595f276e2f1353a535c32f0f59516fc9328f7673bb80262c4da11c93683afe6dcff8a7a83018d78f41498a0da4d141ebd39c361b1724f2b00000eb0aa2c',

'0120961963495c4dab9470738b497eddde07b0d70b357795ad9554d7964761969a6d997205e17eada6fa84eb33dcfb11412f75e04c195001283900000eb0aa2c',

'091065d52127bbc6e840e02f8e1316f1c4d9c92a23931c00cdbb8c158368852ef8fabd461b98812b51ec84e1ccc5c04aaa366fbafabec623bd3500000eb0aa2c',

'7300cc61151b7af27a578e766f49bebb2de68c48b37a00df1030ae464f456928eedd035303e697208bf58217af728a2a346fda5c8aef0335b82e00000eb0aa2c'

In [46]: x.edap.packets

Out[46]:

['5608305852bf2ffd61770e2c827542f20be0b0fcba09db916bd07e1734b04cb0352b1d278068064d19f033bfad6fa90e53d865693fd4fee0214f00000eb0aa2c',

'3b083595f276e2f1353a535c32f0f59516fc9328f7673bb80262c4da11c93683afe6dcff8a7a83018d78f41498a0da4d141ebd39c361b1724f2b00000eb0aa2c',

'0120961963495c4dab9470738b497eddde07b0d70b357795ad9554d7964761969a6d997205e17eada6fa84eb33dcfb11412f75e04c195001283900000eb0aa2c',

'091065d52127bbc6e840e02f8e1316f1c4d9c92a23931c00cdbb8c158368852ef8fabd461b98812b51ec84e1ccc5c04aaa366fbafabec623bd3500000eb0aa2c',

'7300cc61151b7af27a578e766f49bebb2de68c48b37a00df1030ae464f456928eedd035303e697208bf58217af728a2a346fda5c8aef0335b82e00000eb0aa2c']

帮助模式

In [15]: x.help("")                                
Currently supported methods:
__________________________________________________________________________________________________________________________________________________________________

Method ||-->Description

----------------------------------------------------------------------------------------------------------------------------

MITMproxy ||-->This method creates a connection to the RabbitMQ and listen on received messages on the todev queue

____________________________________________________________________________________________________________________________

MITMproxyRQueues ||-->This method reads from the queue todev and sends the request to the device its self.
____________________________________________________________________________________________________________________________

SmartFuzz ||-->This method is generates packets based on what it has learned from a sniff from either the host or the device
____________________________________________________________________________________________________________________________

chgIntrfs ||-->This method allows you to change and select another interface
____________________________________________________________________________________________________________________________

clearqueues ||-->this method clears all the queues on the rabbitMQ queues that are set up

____________________________________________________________________________________________________________________________

clonedev ||-->This method does not need any parameters it only saves a backup of the device incase you need to share it or use it later.

____________________________________________________________________________________________________________________________

createctrltrsnfDB ||-->creates a SQLite database containing values that were enumerated from control transfer enumeration

____________________________________________________________________________________________________________________________

createdb ||-->create the sqlite table and columns from usblyzer captures

____________________________________________________________________________________________________________________________

decodePacketAscii ||-->This method decodes packet bytes back to Ascii

____________________________________________________________________________________________________________________________

describeFuzz ||-->This method allows you to describe a packet and select which bytes will be fuzzed

____________________________________________________________________________________________________________________________

devEnumCtrltrnsf ||-->This method enumerates all possible combinations of a control transfer request

____________________________________________________________________________________________________________________________

devReset ||-->This method Resets the device

____________________________________________________________________________________________________________________________

devWrite ||-->To use this with a method you would write to a device make sure to run the startSniffReadThread(self,endpoint=None, pts=None, queue=None,channel=None)

____________________________________________________________________________________________________________________________

devctrltrnsf ||-->This method allows you to send ctrl transfer requests to the target device

____________________________________________________________________________________________________________________________

deviceInfo ||-->gets the complete info only for any usb connected to the host

____________________________________________________________________________________________________________________________

deviceInterfaces ||-->get all interfaces and endpoints on the device

____________________________________________________________________________________________________________________________

devrandfuzz ||-->this method allows you to create fixed or random size packets created using urandom

____________________________________________________________________________________________________________________________

devseqfuzz ||-->This method allows you to create sequential incremented packets and send them to the device

____________________________________________________________________________________________________________________________

findSelect ||-->This method enumerates all USB devices connected and allows you to select it as a target device as well as its endpoints

____________________________________________________________________________________________________________________________

help ||-->AutogadgetFS Help method

____________________________________________________________________________________________________________________________

hostwrite ||-->This method writes packets to the host either targeting a software or a driver in control of the device

____________________________________________________________________________________________________________________________

hstrandfuzz ||-->this method allows you to create fixed or random size packets created using urandom and send them to the host queue

____________________________________________________________________________________________________________________________

monInterfaceChng ||-->Method in charge of monitoring interfaces for changes this is called from def startMonInterfaceChng(self)

____________________________________________________________________________________________________________________________

newProject ||-->creates a new project name if you were testing something else

____________________________________________________________________________________________________________________________

releasedev ||-->releases the device and re-attaches the kernel driver

____________________________________________________________________________________________________________________________

removeGadget ||-->This method removes the gadget from the raspberryPI

____________________________________________________________________________________________________________________________

replaymsgs ||-->This method searches the USBLyzer parsed database and give you the option replay a message or all messages from host to device

____________________________________________________________________________________________________________________________

searchmsgs ||-->This method allows you to search and select all messages for a pattern which were saved from a USBlyzer database creation

____________________________________________________________________________________________________________________________

setupGadgetFS ||-->setup variables for gadgetFS : Linux Only, on Raspberry Pi Zero best option

____________________________________________________________________________________________________________________________

showMessage ||-->shows messages if error or warn or info

____________________________________________________________________________________________________________________________

sniffdevice ||-->read the communication between the device to hosts

____________________________________________________________________________________________________________________________

startMITMusbWifi ||-->Starts a thread to monitor the USB target Device

____________________________________________________________________________________________________________________________

startMonInterfaceChng||-->This method Allows you to monitor a device every 10 seconds in case it suddenly changes its interface configuration.

____________________________________________________________________________________________________________________________

startQueuewrite ||-->initiates a connection to the queue to communicate with the host

____________________________________________________________________________________________________________________________

startSniffReadThread ||-->This is a thread to continuously read the replies from the device and dependent on what you pass to the method either pts or queue

____________________________________________________________________________________________________________________________

stopMITMusbWifi ||-->Stops the man in the middle thread between the host and the device

____________________________________________________________________________________________________________________________

stopMonInterfaceChang||-->Stops the interface monitor thread

____________________________________________________________________________________________________________________________

stopQueuewrite ||-->stop the thread incharge of communicating with the host machine

____________________________________________________________________________________________________________________________

stopSniffing ||-->Kills the sniffing thread strted by startSniffReadThread()

____________________________________________________________________________________________________________________________

usblyzerparse ||-->This method will parse your xml exported from usblyzer and then import them into a database

____________________________________________________________________________________________________________________________

In [16]: x.help("findSelect")

****

[+]Help for findSelect Method:

[-]Signature: findSelect(self, chgint=None)

[+]findSelect Help:

This method enumerates all USB devices connected and allows you to select it as a target device as well as its endpoints

版权声明:本文来源网络,免费传达知识,版权归原作者所有。如涉及作品版权问题,请联系我进行删除。

‧‧‧‧‧‧‧‧‧‧‧‧‧‧‧‧  END  ‧‧‧‧‧‧‧‧‧‧‧‧‧‧‧

关注我的微信公众号,回复“加群”按规则加入技术交流群。


点击“阅读原文”查看更多分享,欢迎点分享、收藏、点赞、在看。

李肖遥 公众号“技术让梦想更伟大”,作者:李肖遥,专注嵌入式,只推荐适合你的博文,干货,技术心得,与君共勉。
评论
  • 【萤火工场CEM5826-M11测评】OLED显示雷达数据本文结合之前关于串口打印雷达监测数据的研究,进一步扩展至 OLED 屏幕显示。该项目整体分为两部分: 一、框架显示; 二、数据采集与填充显示。为了减小 MCU 负担,采用 局部刷新 的方案。1. 显示框架所需库函数 Wire.h 、Adafruit_GFX.h 、Adafruit_SSD1306.h . 代码#include #include #include #include "logo_128x64.h"#include "logo_
    无垠的广袤 2024-12-10 14:03 69浏览
  • 一、SAE J1939协议概述SAE J1939协议是由美国汽车工程师协会(SAE,Society of Automotive Engineers)定义的一种用于重型车辆和工业设备中的通信协议,主要应用于车辆和设备之间的实时数据交换。J1939基于CAN(Controller Area Network)总线技术,使用29bit的扩展标识符和扩展数据帧,CAN通信速率为250Kbps,用于车载电子控制单元(ECU)之间的通信和控制。小北同学在之前也对J1939协议做过扫盲科普【科普系列】SAE J
    北汇信息 2024-12-11 15:45 77浏览
  • 全球知名半导体制造商ROHM Co., Ltd.(以下简称“罗姆”)宣布与Taiwan Semiconductor Manufacturing Company Limited(以下简称“台积公司”)就车载氮化镓功率器件的开发和量产事宜建立战略合作伙伴关系。通过该合作关系,双方将致力于将罗姆的氮化镓器件开发技术与台积公司业界先进的GaN-on-Silicon工艺技术优势结合起来,满足市场对高耐压和高频特性优异的功率元器件日益增长的需求。氮化镓功率器件目前主要被用于AC适配器和服务器电源等消费电子和
    电子资讯报 2024-12-10 17:09 87浏览
  • 天问Block和Mixly是两个不同的编程工具,分别在单片机开发和教育编程领域有各自的应用。以下是对它们的详细比较: 基本定义 天问Block:天问Block是一个基于区块链技术的数字身份验证和数据交换平台。它的目标是为用户提供一个安全、去中心化、可信任的数字身份验证和数据交换解决方案。 Mixly:Mixly是一款由北京师范大学教育学部创客教育实验室开发的图形化编程软件,旨在为初学者提供一个易于学习和使用的Arduino编程环境。 主要功能 天问Block:支持STC全系列8位单片机,32位
    丙丁先生 2024-12-11 13:15 49浏览
  • 近日,搭载紫光展锐W517芯片平台的INMO GO2由影目科技正式推出。作为全球首款专为商务场景设计的智能翻译眼镜,INMO GO2 以“快、准、稳”三大核心优势,突破传统翻译产品局限,为全球商务人士带来高效、自然、稳定的跨语言交流体验。 INMO GO2内置的W517芯片,是紫光展锐4G旗舰级智能穿戴平台,采用四核处理器,具有高性能、低功耗的优势,内置超微高集成技术,采用先进工艺,计算能力相比同档位竞品提升4倍,强大的性能提供更加多样化的应用场景。【视频见P盘链接】 依托“
    紫光展锐 2024-12-11 11:50 47浏览
  • 我的一台很多年前人家不要了的九十年代SONY台式组合音响,接手时只有CD功能不行了,因为不需要,也就没修,只使用收音机、磁带机和外接信号功能就够了。最近五年在外地,就断电闲置,没使用了。今年9月回到家里,就一个劲儿地忙着收拾家当,忙了一个多月,太多事啦!修了电气,清理了闲置不用了的电器和电子,就是一个劲儿地扔扔扔!几十年的“工匠式”收留收藏,只能断舍离,拆解不过来的了。一天,忽然感觉室内有股臭味,用鼻子的嗅觉功能朝着臭味重的方向寻找,觉得应该就是这台组合音响?怎么会呢?这无机物的东西不会腐臭吧?
    自做自受 2024-12-10 16:34 136浏览
  •         霍尔传感器是根据霍尔效应制作的一种磁场传感器。霍尔效应是磁电效应的一种,这一现象是霍尔(A.H.Hall,1855—1938)于1879年在研究金属的导电机构时发现的。后来发现半导体、导电流体等也有这种效应,而半导体的霍尔效应比金属强得多,利用这现象制成的各种霍尔元件,广泛地应用于工业自动化技术、检测技术及信息处理等方面。霍尔效应是研究半导体材料性能的基本方法。通过霍尔效应实验测定的霍尔系数,能够判断半导体材料的导电类型、载流子浓度及载流子
    锦正茂科技 2024-12-10 11:07 64浏览
  •         在有电流流过的导线周围会感生出磁场,再用霍尔器件检测由电流感生的磁场,即可测出产生这个磁场的电流的量值。由此就可以构成霍尔电流、电压传感器。因为霍尔器件的输出电压与加在它上面的磁感应强度以及流过其中的工作电流的乘积成比例,是一个具有乘法器功能的器件,并且可与各种逻辑电路直接接口,还可以直接驱动各种性质的负载。因为霍尔器件的应用原理简单,信号处理方便,器件本身又具有一系列的du特优点,所以在变频器中也发挥了非常重要的作用。  &nb
    锦正茂科技 2024-12-10 12:57 76浏览
  • 概述 通过前面的研究学习,已经可以在CycloneVGX器件中成功实现完整的TDC(或者说完整的TDL,即延时线),测试结果也比较满足,解决了超大BIN尺寸以及大量0尺寸BIN的问题,但是还是存在一些之前系列器件还未遇到的问题,这些问题将在本文中进行详细描述介绍。 在五代Cyclone器件内部系统时钟受限的情况下,意味着大量逻辑资源将被浪费在于实现较大长度的TDL上面。是否可以找到方法可以对此前TDL的长度进行优化呢?本文还将探讨这个问题。TDC前段BIN颗粒堵塞问题分析 将延时链在逻辑中实现后
    coyoo 2024-12-10 13:28 101浏览
  • 习学习笔记&记录学习学习笔记&记录学习学习笔记&记录学习学习笔记&记录学习笔记&记录学习习笔记&记学习学习笔记&记录学习学习笔记&记录学习习笔记&记录学习学习笔记&记录学习学习笔记记录学习学习笔记&记录学习学习笔记&记录学习学习笔记&记录学习学习笔记&记录学习学习笔记&记录学习习笔记&记录学习学习笔记&记录学习学习笔记&记录学习学习笔记&记录学习学习笔记&记录学习学习笔记&记录学习学习笔记&记录学习学习笔记&学习学习笔记&记录学习学习笔记&记录学习学习笔记&记录学习学习笔记&记录学习学习笔记&记
    youyeye 2024-12-10 16:13 105浏览
  • 智能汽车可替换LED前照灯控制运行的原理涉及多个方面,包括自适应前照灯系统(AFS)的工作原理、传感器的应用、步进电机的控制以及模糊控制策略等。当下时代的智能汽车灯光控制系统通过车载网关控制单元集中控制,表现特殊点的有特斯拉,仅通过前车身控制器,整个系统就包括了灯光旋转开关、车灯变光开关、左LED前照灯总成、右LED前照灯总成、转向柱电子控制单元、CAN数据总线接口、组合仪表控制单元、车载网关控制单元等器件。变光开关、转向开关和辅助操作系统一般连为一体,开关之间通过内部线束和转向柱装置连接为多,
    lauguo2013 2024-12-10 15:53 81浏览
  • RK3506 是瑞芯微推出的MPU产品,芯片制程为22nm,定位于轻量级、低成本解决方案。该MPU具有低功耗、外设接口丰富、实时性高的特点,适合用多种工商业场景。本文将基于RK3506的设计特点,为大家分析其应用场景。RK3506核心板主要分为三个型号,各型号间的区别如下图:​图 1  RK3506核心板处理器型号场景1:显示HMIRK3506核心板显示接口支持RGB、MIPI、QSPI输出,且支持2D图形加速,轻松运行QT、LVGL等GUI,最快3S内开
    万象奥科 2024-12-11 15:42 68浏览
  • 时源芯微——RE超标整机定位与解决详细流程一、 初步测量与问题确认使用专业的电磁辐射测量设备,对整机的辐射发射进行精确测量。确认是否存在RE超标问题,并记录超标频段和幅度。二、电缆检查与处理若存在信号电缆:步骤一:拔掉所有信号电缆,仅保留电源线,再次测量整机的辐射发射。若测量合格:判定问题出在信号电缆上,可能是电缆的共模电流导致。逐一连接信号电缆,每次连接后测量,定位具体哪根电缆或接口导致超标。对问题电缆进行处理,如加共模扼流圈、滤波器,或优化电缆布局和屏蔽。重新连接所有电缆,再次测量
    时源芯微 2024-12-11 17:11 74浏览
我要评论
0
点击右上角,分享到朋友圈 我知道啦
请使用浏览器分享功能 我知道啦