nccgroup / umap2

Umap2 is the second revision of NCC Group's python based USB host security assessment tool.
GNU Affero General Public License v3.0
251 stars 70 forks source link

GadgetFsPhy does not handle OUT control requests with data #11

Open BinyaminSharet opened 8 years ago

BinyaminSharet commented 8 years ago

The reason for this issue is not clear yet, however, but some of the OUT control messages that has data are often not received by the phy, and when they do, an attempt to read the data cause OSError 43 (Identifier removed):

[INFO  ] [GadgetFsPhy] length of events buffer: 0xc
[DEBUG ] [GadgetFsPhy] EP0 event type SETUP(0x3)
[INFO  ] [GadgetFsPhy] expecting additional data on control ep - 0x2 bytes
[INFO  ] [GadgetFsPhy] dir=0x0 (out), type=0x1 (class), rec=0x1 (interface), req=0x4, val=0x200, idx=0xd00, len=0x2
[ERROR ] Got exception while connecting/running device
[ERROR ] Traceback (most recent call last):
  File "/root/umap2/umap2/apps/emulate.py", line 39, in run
    self.dev.run()
  File "/root/umap2/umap2/core/usb_device.py", line 143, in run
    self.phy.run()
  File "/root/umap2/umap2/phy/gadgetfs/gadgetfs_phy.py", line 185, in run
    self._handle_ep0()
  File "/root/umap2/umap2/phy/gadgetfs/gadgetfs_phy.py", line 248, in _handle_ep0
    self._handle_ep0_setup(event)
  File "/root/umap2/umap2/phy/gadgetfs/gadgetfs_phy.py", line 275, in _handle_ep0_setup
    data = os.read(self.control_fd, req.length)
OSError: [Errno 43] Identifier removed

[INFO  ] [GadgetFsPhy] Disconnected device AudioDevice
huntergregal commented 1 year ago

Bit of a necro thread here - but any update on this? So far Umap2 is the best gadgetfs python abstraction I have seen.

There is also raw_gadget - https://github.com/xairy/raw-gadget - which if implemented could fix this issue