Prerequisite

  • a physical android devices
    • rooted
    • termux app

As mentioned, the android devices must be rooted in order to work like a rubber ducky. I’ll be using my old devices that I have rooted as demonstration purposes.

Here’s a quick evidence that my devices is rooted.

alt text

Setting up

Now that the android devices is rooted, I’ll need to download some useful files and application that has been created by others

Install the android usb gadget and prepare both the hid-gadget-test and poc_pc_gadget in your devices. After everything is ready, open the android usb gadget application.

alt text

It should have a popup where it ask about superuser rights. After that, scroll down and use the second option or add another one if there’s no second option. In the second option, add keyboard will do.

alt text

After adding it, remember to turn on by pressing the “Gadget status” and process to android terminal (termux).

alt text

Make sure to place the both the file in a same directory and both the file has execute permission.

alt text

Basically, hid-gadget-test is a binary and poc_pc_gadget is a script.

alt text

One last thing is to take note is the /dev/hidg1. In some cases, the hidg number will be different make sure to have a look. Somehow, I’ll need to give all permission to everyone in order to make this works. /dev/hidg1 will only appear if you have turn on the “Gadget status”.

alt text

Since it does not have execute permission by default, I’ll need to change the permission myself.

alt text

After everything is done, I could just run the poc_pc_gadget to perform HID attack. remember to give it some try and error

POC

Here’s a demonstration on how it works.

References