COSCUP x UbuCon Asia 2026 標誌
  • 關於我們
  • 議程
  • 交通
  • 會場地圖
  • 社群
  • 贊助夥伴
    • 參與指南
    • 第一次參與
    • 活動參與
    • 講者參與
    • 前夜派對
    • 海外參與者
    • 開源社群、攤位及議程軌
    • 贊助夥伴
    • 邀請函申請指南
  • 工作人員
  • 周邊活動 / BoF
  • 部落格
  • 社群守則
English

USB MITM: Building a Transparent USB Proxy with raw-gadget and libusb

時間
2026-08-08 14:10 ~ 14:40
講者
Aristo Chen
位置
TR213
共筆
System Software 中階中文

議程簡介

The USB protocol is everywhere: keyboards, webcams, storage devices, embedded hardware test fixtures. Yet most developers treat it as a black box. What if you could sit transparently between a USB host and device, observe every packet, and selectively modify, drop, or inject traffic using nothing but open-source software running on a Raspberry Pi?

This talk walks through the design and implementation of usb-proxy, an open-source USB man-in-the-middle proxy built on the Linux kernel's raw-gadget driver and libusb.

What is usb-proxy?

usb-proxy positions a Linux machine with a USB OTG port between a real USB device and its host. The host sees a synthetic device reconstructed in real time via raw-gadget, while the real device is accessed through libusb on the other side. All traffic flows through the proxy, where it can be logged, modified, or dropped using JSON-based rules.

The Injection Rule Engine

injection.json defines per-endpoint rules for control, interrupt, and bulk transfers. Each rule can modify, ignore, or stall a matched packet. Three levels of transform are supported and can be combined within a single rule, in order of increasing flexibility:

  • Pattern replacement: matches fixed hex byte sequences and substitutes them. Ideal for simple, fixed substitutions such as swapping mouse button bytes.
  • Declarative operations: applies arithmetic transforms in order on byte offsets, such as negating a movement axis or scaling cursor speed, without any scripting.
  • Lua scripting: for logic that cannot be expressed declaratively, a rule can point to a Lua script. Each script maintains its own state across packets, enabling conditionals, loops, and stateful transforms like dead zones or speed caps.

What Will Be Coverd

  • How the Linux USB stack is layered: UDC driver, gadget framework, and userspace
  • How raw-gadget and libusb work together to build a transparent C++ proxy
  • The injection rule engine in action with a live demo

Talk Outline

SectionTime
USB protocol and motivation5 min
raw-gadget + libusb architecture deep-dive10 min
Injection rule engine: live demo on how to modify and inject USB packets10 min
QA5 min

Source: https://github.com/AristoChen/usb-proxy (Apache-2.0 license)

講者

Aristo Chen

Aristo Chen is an embedded Linux engineer with a strong interest in low-level systems programming and open-source development.

usb-proxy is a personal open-source project he built to deepen his understanding of the Linux USB stack from the ground up. The project combines the Linux kernel's raw-gadget driver, libusb, and a Lua scripting engine to create a transparent USB man-in-the-middle proxy that runs on hardware such as a Raspberry Pi. It has gathered over 250 stars and 40 forks on GitHub.

Beyond usb-proxy, he actively contributes to upstream open-source projects in the embedded Linux ecosystem, including U-Boot and the Linux kernel, with a focus on bootloader enablement and hardware bringup.

鑽石級

Canonical

黃金級

連續贊助2 年中華民國資訊經理人協會連續贊助2 年國泰金融控股公司連續贊助5 年玉山銀行累計贊助12 年MySQL累計贊助6 年華捷智能股份有限公司Nitra

白銀級

累計贊助16 年慧邦科技股份有限公司  Gamesofa Inc.

青銅級

華娛網路娛樂股份有限公司財團法人國家實驗研究院國家高速網路與計算中心ONLYOFFICEQNAP Systems, Inc. 威聯通科技連續贊助16 年祐生研究基金會源鋼技術顧問有限公司 SUN SQUARE Co., Ltd

好朋友級

連續贊助3 年晶心科技股份有限公司沛星互動科技股份有限公司

特別感謝

連續贊助2 年臺北市政府資訊局美商賽發馥股份有限公司臺灣分公司Rozeta AI

共同主辦單位

累計合作9 年臺灣科技大學 電子工程系

協辦單位

累計合作12 年開放文化基金會

COSCUP x UbuCon Asia 2026

Conference for Open Source Coders, Users, and Promoters | 亞洲最大開源年會,由社群自發舉辦。

聯絡我們

  • 會眾服務
  • 贊助合作
  • 議程投稿
  • 行銷方案

相關資源

  • COSCUP 部落格
  • 訂閱電子報
  • 活動照片

網站導覽

  • 首頁
  • 關於我們
  • 交通資訊
  • 贊助夥伴
20062007200820092010201120122013201420152016201720182019202020212022202320242025