dbisu / pico-ducky

Create a USB Rubber Ducky like device using a Raspberry PI Pico
GNU General Public License v2.0
2.42k stars 440 forks source link

Potential to change name of USB Device in Windows Device menu? #43

Closed jmath3912 closed 2 years ago

jmath3912 commented 2 years ago

Not necessarily an issue, but rather an inquiry. Is it possible to rename the pico-ducky (or in my case the nano-rp2040-connect-ducky) so that in the Windows Devices menu, it would show up as a name that I define (for example, "Logitech Unifying Receiver") as opposed to "Arduino Nano RP2040 Connect"? And, if possible, would it be done through a setting in boot.py or would I have to modify the .UF2 file?

dbisu commented 2 years ago

That might be a better question for the CircuitPython Discord.

jmath3912 commented 2 years ago

Ah that's fair.

Bit of info in case anyone is trying to do the same thing I am (which I doubt anyone is, but it's still somewhat useful info regardless): after a bit of research and unnecessary registry noodling, it seems as if Windows pulls the name of the Pico (or in my case the nano rp2040 connect) from the USB driver that gets downloaded on the initial plug-in of the device, which means that a custom or modified driver will have to be written in order for the board to show up in the windows device menu with a custom name. Not too sure on the process of modifying or writing a custom USB driver, but I'm sure there are resources that would go more in depth

peterfritz commented 2 years ago

Hi, if you're using windows or plan to attack a Windows PC you can create a Autorun file with a label atribute.

Just create a file named AUTORUN.INF (in all caps by convention) and paste the following text into it, changing "LabelText" with the desired name. The name can even contain spaces. Mine's named A inconspicuous device, but I don't recommend using more than 11 characters.

[AutoRun]
label=LabelText

After saving you could hide the file by making it a system file (again, by convention) running the following command from PowerShell or CMD.

attrib +s AUTORUN.INF

P.S. I think it would be awesome if the code contained the Autorun file renaming the device to PicoDucky or even adding a duck icon.

jmath3912 commented 2 years ago

Hi, if you're using windows or plan to attack a Windows PC you can create a Autorun file with a label atribute.

Just create a file named AUTORUN.INF (in all caps by convention) and paste the following text into it, changing "LabelText" with the desired name. The name can even contain spaces. Mine's named A inconspicuous device, but i don't recommend using more than 11 characters.

[AutoRun]
label=LabelText

After saving you could hide the file by making it a system file (again, by convention) running the following command from PowerShell or CMD.

attrib +s AUTORUN.INF

P.S. I think it would be awesome if the code contained the Autorun file renaming the device to PicoDucky or even adding a duck icon.

I see. Would this go into the CIRCUITPY drive or in the root drive on the Pico?

peterfritz commented 2 years ago

Aren't both the same? The file goes in the root of the pico (your's probably named CIRCUITPY) so Windows can read it while mounting the device, be it a flash drive, CD-ROM, SD card, internal or external HDDs and SSDs, it works with everything (in Windows). It's magical.

By the way, there's one more magical file type in Windows that security researchers and others technical in cyber wizardry should definitely learn or at least know that it exists: desktop.ini, it's almost the same as Autorun but this one works in the folder level.

jmath3912 commented 2 years ago

Oh wait I think I understand what you mean now. I've created an autorun.inf file and passed a string for the label parameter, but that changes the name of the physical storage drive itself in File Explorer. While that presents its own use case, that wasn't what I was referring to in my original question. What I'm looking for in particular is a way to rename the pico-ducky in the Devices menu from within the settings on Windows (Settings -> Devices). As it stands right now, my device is currently listed as Arduino Nano RP2040 Connect within the Devices section in Windows settings (I modified the code a bit to suit my board). That specific name is what I am trying to modify. I appreciate your help, however, and will look more into desktop.ini as well in case that provides a solution.

peterfritz commented 2 years ago

Oh, that definitely does not help, that sounds like hardware hacking, with custom firmware and etc. That's way more difficult to do and I have no remote idea of where to start but I don't think .UF2 could help, I think this is set in the device assembly level. I'm sorry that I couldn't help and for completely misunderstanding you.

Just out of sheer curiosity, and I'm sorry for asking but what would be the use case for this? Is there software that checks the device name against a blacklist and ejects malicious hardware when plugged? If not now that you mentioned, I think that definitely should be.

dbisu commented 2 years ago

I think this would be a better question for the Adafruit Discord. Probably in the #help-with-circuitpython channel. You probably would need to modify at least the usb_hid library if not something more core to the circuitpython port to your board.

peterfritz commented 2 years ago

I found this thread regarding a similar issue, but most suggested changes seem local, and unfortunately even if you find something that works, the method would have to be translated into a completely different microprocessor then tested with CircuitPython for pico-ducky to work in every PC.

If there's a solution, I think it involves the code that loads the .UF2, way above CircuitPython but if so I don't see how and why would nano-rp2040-connect-ducky have "ducky" in it, where the hell did that come from?

I'm sorry, this really doesn't seem to be the best place for we to discuss this issue, I just feel puzzled, baffled, and challenged. Anyway if you find something that works I would love if you let me know somehow.

jmath3912 commented 2 years ago

Ah i see i see. After a bit more research in that thread and various other resources, it looks like i may just have to write my own board firmware or perhaps my own circuitpython .UF2 for my board in order to customize the name. I'm not too sure on the process for either but I'll be looking into it in the near future to see how it's done.

Just out of sheer curiosity, and I'm sorry for asking but what would be the use case for this?

Mainly just for testing purposes and further customization on my end. In practice, it could theoretically be used to rename the board into something inconspicuous like SanDisk 32GB Drive or something along the lines of that, as a means of disguising the device's true nature. I mostly plan on using the device as an automated keyboard to speed up the process of certain tasks or at least reduce typing time, so it'd be nice to rename it to something like DuckyKB as an easier way for me to differentiate between boards in case I inevitably plan on getting a second one.

In any case, I think this thread has successfully answered some of my questions or rather given me a path I could follow to answer my questions, so I will be closing this issue.