Solved Suspicion about ejecting USB drives

F22 Simpilot

You are referring to the Stuxnet worm. It was in the firmware of the USB, and is not detectable with conventional AVs.
Most can be removed by flashing the bios, however, if it infects the boot code as well, it reinfects the bios.
Stuxnet - Wikipedia

 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
HP Desktop & Compaq Laptop
OS
Win 10 x64, Linux Lite, Win 7 x64, BlackArch, & Kali
Hard Drives
Samsung 850 Pro 256Gb,
Hitachi HDD 1Tb,
Crucial MX SSD 250Gb
Segate 3Tb USB 3.0 Ext. Backup HDD
Internet Speed
150Mbps dn, 20Mbps up
Antivirus
Avast Free, Malwarebytes Anti-Exploit & Anti-Ransomware
Browser
Firefox, Chrome, Opera, & VPN
Yes there's very likely some way like that to get infected. Ultimately the risk can't be quantified exactly, I just try to keep it "reasonably low" whatever that means.


If I wanted to securely delete a drive's contents, I'd probably just fill it with (non-sensitive) data till there wasn't any free space on it, then delete it if need be. I don't see how the original contents could survive that, otherwise it would be a way of doubling the capacity of a disk, which would be rather good.
 

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
HP Probook
OS
Win 7 Pro 32-bit
ToughDiamond

Not likely over the Net, most are infected before you purchase them. Like picking up a free one at an exposition, or off the ground and plugging it in with autoplay enabled (good what to get normal malware).

It takes some expertise, or a malicious BIOS update or flashing the BIOS.

There are several drive wiper apps available that overwrite, once or many times, your choice. The more the drive is overwritten, the harder to impossible it is to recover data.
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
HP Desktop & Compaq Laptop
OS
Win 10 x64, Linux Lite, Win 7 x64, BlackArch, & Kali
Hard Drives
Samsung 850 Pro 256Gb,
Hitachi HDD 1Tb,
Crucial MX SSD 250Gb
Segate 3Tb USB 3.0 Ext. Backup HDD
Internet Speed
150Mbps dn, 20Mbps up
Antivirus
Avast Free, Malwarebytes Anti-Exploit & Anti-Ransomware
Browser
Firefox, Chrome, Opera, & VPN
Anyway, back on topic, to effect the fix, my .reg file is this:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\usbhub\hubg]
"DisableOnSoftRemove"=dword:00000001


To revert to the original state (in my case), my .reg file is this:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\usbhub\hubg]
"DisableOnSoftRemove"=-


I've tested them both, and they work fine for me. I have to reboot for the effect to take place.

So I think I'll mark this issue as solved now. Thanks for your help, folks :-)

For anybody else wanting to do this, I suppose ideally it would be best to check (before adding the DWORD in the first place) whether or not your registry already contains the HubG subkey - although mine did (the HubG subkey that is, not the actual DWORD - see attached screenshot of the registry as it was before I changed anything), Microsoft's manual instructions include creating it, as if they don't expect users to already have the key. The only difference it makes is that if you don't, then to revert your registry to the exact same state as it was before the fix would require the deletion of the entire HubG key and not just the dword. Though I can't imagine it would matter. And it could be that Microsoft has just got it wrong and everybody's already got the subkey.
 

Attachments

  • Registry-USBpower.jpg
    Registry-USBpower.jpg
    87.8 KB · Views: 0

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
HP Probook
OS
Win 7 Pro 32-bit
I now see that KB from M$ is gone that was posted in post #12.
 

My Computer

Computer type
PC/Desktop
OS
Windows 7 Ultimate x64
I now see that KB from M$ is gone that was posted in post #12.
Well spotted - I see they've also put a note there to tell me to use Win10 instead :roflmao:
I suppose that means they've also pulled all their other Win7 help, damn them.

So, in the spirit of defiance, here's the "per device" method that I guess might now be hard to find elsewhere (looks to me like a lot of work for very little, but who knows?) - I've not tested it, and it is from Microsoft, so it should be regarded with suspicion:

To apply the workaround for a specific device, add a REG_DWORD value named DisableOnSoftRemove that has a value of 1 to the following registry subkey:
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\usbflags\vvvvpppprrrr
(where vvvv is the device's Vendor ID, pppp is the device's Product ID, and rrrr is the device's Revision number).
1. Click Start, click Run, type regedit in the Open box, and then click OK .
2. Locate and then click the following subkey in the registry:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\UsbFlags
3. On the Edit menu, point to New, and then click Key.
4. Type the name of the new key in the following form:
vvvvpppprrrr
where vvvv is a 4-digit hexadecimal number that identifies the vendor (idDevice from the USB Device Descriptor),
pppp is a 4-digit hexadecimal number that identifies the product (idVendor from the USB Device Descriptor), and
rrrr is a 4-digit binary-coded decimal number that contains the revision number of the device (bcdDevice from the USB Device Descriptor).
5. On the Edit menu, point to New, and then click DWORD (32-bit) Value.
6. Type DisableOnSoftRemove for the name of the DWORD Value, and then press ENTER.
7. Right-click DisableOnSoftRemove, and then click Modify.
8. In the Value data box, type 1 , and then click OK.
9. Exit Registry Editor.

 

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
HP Probook
OS
Win 7 Pro 32-bit

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
HP Desktop & Compaq Laptop
OS
Win 10 x64, Linux Lite, Win 7 x64, BlackArch, & Kali
Hard Drives
Samsung 850 Pro 256Gb,
Hitachi HDD 1Tb,
Crucial MX SSD 250Gb
Segate 3Tb USB 3.0 Ext. Backup HDD
Internet Speed
150Mbps dn, 20Mbps up
Antivirus
Avast Free, Malwarebytes Anti-Exploit & Anti-Ransomware
Browser
Firefox, Chrome, Opera, & VPN
There's also this utility I noticed:

USB Disk Ejector | Quick And Easy Software

To my mind Microsoft's ejector suffers from 2 limitations (apart from failing to power devices off):
1. Sometimes it says it can't eject the device because it's "still in use" even though you know it's not in use.
2. It doesn't give enough info about connected to allow you to quickly tell one drive from another.

So maybe that utility can do better. I haven't tried it myself yet, so use at your own risk.
 

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
HP Probook
OS
Win 7 Pro 32-bit

Attachments

  • wayback.jpg
    wayback.jpg
    46.6 KB · Views: 0

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
HP Probook
OS
Win 7 Pro 32-bit
Glad you got it sorted to your satisfaction.

For me, as long as I know there are no pending write operations, I'm good. The way a USB drive gets corrupted is when it gets yanked while performing a write operation. Interrupted read operations won't corrupt things, only writes. When I get the message that Windows can't safely eject, I just make sure that I don't have any folders or files open on that drive, I wait a few seconds after I see any activity on that drive and then pull it. Never had an issue.
 

My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Home Built desktop, Dell G15 5511 Gaming laptop,MS Surface Pro 7 tablet
OS
W10 Pro desktop, W11 laptop, W11 Pro tablet (all 64-bit)
CPU
3.7Ghz 8700K i7, i7-11800H, i7-1065G7
Motherboard
ASUS TUF Z370-Pro Gaming in desktop
Memory
16G desktop, 16G laptop, 4G tablet
Graphics Card(s)
AMD Radeon RX580, RTX 3060, Intel Iris Plus
Sound Card
High Definition Audio (Built-in to mobo)
Monitor(s) Displays
Samsung U32J59 32" (2x), 15.6", 12"
Screen Resolution
3840x2160, 3840x2160, 1920x1080, 2160x1440
Hard Drives
500G SSD for OS; 2T, 10T & 15T HDDs for Data on Desktop, 1TB SSD laptop, 128G SSD tablet.
PSU
Corsair CX 750M
Case
Antec 100
Cooling
CM 212+
Keyboard
IBM Model M - used continuously since 1986
Mouse
Microsoft Pro IntelliMouse
Internet Speed
400M down 8M up
Antivirus
Windows Defender
Browser
FireFox
Other Info
Built my first computer (8Mhz 8088cpu, 640K RAM, 20MB HDD, 2 360K floppy drives) in 1985 and have been building them for myself, relatives and friends ever since.
Glad you got it sorted to your satisfaction.

For me, as long as I know there are no pending write operations, I'm good. The way a USB drive gets corrupted is when it gets yanked while performing a write operation. Interrupted read operations won't corrupt things, only writes. When I get the message that Windows can't safely eject, I just make sure that I don't have any folders or files open on that drive, I wait a few seconds after I see any activity on that drive and then pull it. Never had an issue.
Yes that's more or less what I've been doing too, with flash drives anyway (larger drives with a motor that actually spins were another matter because of the power not going off, it really didn't feel right to yank those out and so abruptly cut the power). I don't even worry about Explorer being open on the drive as long as it's not doing anything (though I see that with Vista, the ejector refuses to eject unless you manually close Explorer - that's really stupid, like a lot of things in Vista). I gather there's some "dynamic mode" that can be switched to that makes it unsafe to remove the drive, so it's worth making sure that's not the case.
 

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
HP Probook
OS
Win 7 Pro 32-bit
Back
Top