People usually trigger programs already there on their PCs when they connect their uC. There are already things like uC that can inject keystrokes. I was thinking of something even more ambitious -

I write a program in C or Python that i want to run in the background and somehow(?) store it in the flash of the uC. As soon as the uC is plugged in, lets say it shows itself as a USB Keyboard or something similar and dumps the contents of the flash to the PC and runs that program in the background of the PC.

Is this possible? If yes, I would like to have some suggestions on how to go about accomplishing it.

  • 1
    Just out of curiosity, what would this program do? Send the user's bank details to your web site? – Nick Gammon Aug 8 '18 at 6:20
  • No, my original intentions were not that. I thought of this after going through the Square Inch challenge that opened yesterday on Hackaday and looked at my USB wireless mouse receiver. For the project i thought of just transmitting some dummy data and scoping if it is even possible. @NickGammon – jar Aug 8 '18 at 6:23
  • 1
    If you could, that would be a massive security flaw. I'm not saying it isn't possible, I just hope it isn't. Do you really, seriously, want to have something which looks like a USB fan or light be able to install a binary on your PC and then execute it? – Nick Gammon Aug 8 '18 at 7:48
  • 2
    Even if your own intentions are completely honest and above-board, any answer which describes how to do it could be exploited by a criminal as a recipe for how to install malware onto peoples' PCs. – Nick Gammon Aug 8 '18 at 7:51
  • 1
    The whole purpose of this exercise was to do this in a controlled environment. - I totally understand that. But someone reading this may try it in an uncontrolled environment. – Nick Gammon Aug 8 '18 at 10:01

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.