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
255 stars 71 forks source link

[MtpDevice] request not handled: dir=0x1 (in), type=0x2 (vendor), rec=0x0 (device), req=0x33, val=0x0, idx=0x0, len=0x2 #24

Open suchyto opened 6 years ago

suchyto commented 6 years ago

Using command: umap2stages -P fd:/dev/ttyUSB0 -C mtp -s mtp I receive the following errors:

[INFO ] [DeviceVendor] Calling handle_msos_vendor_extended_config_descriptor (stage: "msos_vendor_extended_config_descriptor") [INFO ] [DeviceVendor] Response: 2800000000010000010000000000000000014d545000000000000000000000000000000000000000 [ERROR ] [MtpDevice] request not handled: dir=0x1 (in), type=0x2 (vendor), rec=0x0 (device), req=0x33, val=0x0, idx=0x0, len=0x2 [ERROR ] [MtpDevice] handler entity type: <class 'umap2.dev.mtp.USBMsosVendor'> [ERROR ] [MtpDevice] handler entity: <umap2.dev.mtp.USBMsosVendor object at 0x7f8191518dd0> [ERROR ] [MtpDevice] handler_entity.request_handlers: {0: <bound method USBMsosVendor.handle_all of <umap2.dev.mtp.USBMsosVendor object at 0x7f8191518dd0>>} [ERROR ] [MtpDevice] 0x00: <bound method USBMsosVendor.handle_all of <umap2.dev.mtp.USBMsosVendor object at 0x7f8191518dd0>> [ERROR ] [MtpDevice] invalid handler, stalling Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/umap2/core/usb_device.py", line 249, in handle_request handler(req) TypeError: 'NoneType' object is not callable [ERROR ] Got exception while connecting/running device [ERROR ] Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/umap2/apps/emulate.py", line 39, in run self.dev.run() File "/usr/local/lib/python2.7/dist-packages/umap2/core/usb_device.py", line 143, in run self.phy.run() File "/usr/local/lib/python2.7/dist-packages/umap2/phy/facedancer/max342x_phy.py", line 194, in run self.service_irqs() File "/usr/local/lib/python2.7/dist-packages/umap2/phy/facedancer/max342x_phy.py", line 217, in service_irqs self.connected_device.handle_request(b) File "/usr/local/lib/python2.7/dist-packages/umap2/core/usb_device.py", line 249, in handle_request handler(req) TypeError: 'NoneType' object is not callable

[INFO ] [Max342xPhy] Disconnected device MtpDevice

Same error is received whe trying to emulate mtp or mass_storage

BinyaminSharet commented 6 years ago

Thanks for reporting this. We should probably handle unsupported requests in a more graceful way, and I will work on that. It seems like this is one of several AOA (Android Open Accessory) commands which I was not aware of before, but we'll add support for them. Are you testing an Android device?

suchyto commented 6 years ago

No, I am testing an automotive USB hub.

BinyaminSharet commented 6 years ago

I added default handler for unsupported requests (see commit 6cf9d79) please update the code, retry and update me whether it works or not.

suchyto commented 6 years ago

Retested today with the old codes. It worked fine for emulating mtp using command "umap2emulate -P fd:/dev/ttyUSB0 -C mtp". I dont know why it didnt work before, maybe the mistake was with me. The device was recognized by the host (even though the host said that it is not supported).

When i tried emulating a mass storage, after calling the initial descriptors the same message is looped: [INFO ] [ScsiDevice] Calling handle_test_unit_ready (stage: "scsi_test_unit_ready_response"). The host doesn't recognize the device. Am I supposed to enter additional commands?

When tested with the new codes, the same behavior is observed both for mtp and mass_storage emulation.

BinyaminSharet commented 6 years ago

By "the same behaviour" you mean that they are not recognised?