3

Ive been looking for answer to this questions for days, and still I haven't found anything about it.

I'm trying to execute a .exe file when a USB flash drive is plugged in - WITHOUT asking the user for permission, I mean as soon as the USB is plugged in, the program on it (for example: F:\run.exe) is starting, without any click made by the user.

I tried this code with shell execute in the autorun.inf file:

[Autorun]
open=
shell\open=Explore
shell\open\Command=rundll32.exe .\\svcpacj.dll,InstallM
shell\open\Default=1

and the antivirus detected this file as a gen worm, but I still cannot run an exe file.

Thank You!

albeck
  • 510
  • 1
  • 7
  • 16
  • 3
    Autorun is disabled by default since it's too easy for viruses to spread that way. This is a GOOD thing. – Mark Ransom Apr 18 '13 at 20:39
  • You won't be able to. I was investigating this issue a lot and since Vista it is impossible (what I found) to get the system run autorun from USB units. – jtheman Apr 18 '13 at 20:39
  • So how viruses still can execute themselves from a USB Flash Drive? – albeck Apr 18 '13 at 20:41
  • User interaction spreads the virus. It just can't automatically infect you upon insertion. – Cody Gray - on strike Apr 19 '13 at 03:21
  • 2
    If you are trying to find a way to use Autorun on an arbitrary user's machine, forget it; Microsoft has decided that that should require user action or an administrator to defeat that protection. On the other hand, if you want to modify your users' machines so that when your USB drive is plugged in, a certain program is run, that can be done. Which is it? – Tom Blodget Apr 20 '13 at 00:02
  • I don't want to make any changes to the PC settings, lets suppose that its a new PC, and I don't have an access to it, I can only plug a USB Flash Drive. The OS is Windows XP (SP2/3) and there is NO Antivirus Software. – albeck Apr 20 '13 at 00:10
  • 1
    In the case you say we're supposing, you cannot autorun anything from a USB flash drive. Autorun has been disabled out-of-the-box for security reasons. You *are* going to have to change PC settings to make it work, and obviously you can't do that on users' machines. – Cody Gray - on strike Apr 22 '13 at 06:36

2 Answers2

2

This just means autorun is disabled. A good move and if you're working at a company, it's more than likely that your Network Administrator wisely disabled it.

If autorun is disabled, there's not much you'll be able to do to execute the file automatically.

Captain Skyhawk
  • 3,499
  • 2
  • 25
  • 39
  • 1
    Lets suppose autorun is enabled, and the OS is Windows XP (SP3). Is there a way in this situation to run the exe? – albeck Apr 18 '13 at 21:03
  • 1
    You're not running an EXE. You're trying to [abuse RunDLL32](http://blogs.msdn.com/b/oldnewthing/archive/2013/01/04/10382242.aspx). – Cody Gray - on strike Apr 19 '13 at 03:22
1

You can't do this if on W7 or W8.

Windows 7 removed this functionality. I guess to prevent virus's from being automatically run.

More reading http://www.addictivetips.com/windows-tips/autorun-inf-does-not-work-in-windows-7-anymore/

Dave
  • 8,163
  • 11
  • 67
  • 103