BadUSB is when a USB stick or cable pretends to be a keyboard and types commands into a computer.
This guide is for anyone who uses a computer at work or home and wants to know why a "free USB stick" can be risky. It explains what defenders see and how to protect against it, not how to build or use such a device. You do not need to be technical to be a target: the attack works by someone plugging in a gadget.
In short
- A BadUSB device looks like a memory stick or cable but tells the computer it is a keyboard.
- Computers usually trust keyboards, so the device can type pre-set commands very fast as the logged-in person.
- Antivirus and "no USB storage" rules may miss it, because it is not a file or a drive.
- Hand in found or posted devices, allow only approved input devices on key computers and avoid admin rights for daily work.
What you will learn
- Explain how a USB gadget can pretend to be a keyboard.
- Spot the warning signs of a fake keyboard, such as a found stick or an unusual cable.
- Check which defences your workplace has in place.
- Ask the right questions if someone hands you a "free" device.
- Typing by a gadget (keystroke injection)
- a device sending pretend key presses to a computer, as if a person typed them.
- Input device (human interface device)
- a keyboard, mouse or similar gadget a person uses to control a computer.
- Allowed-device rules (device control)
- settings that decide which gadgets a computer will accept.
What is BadUSB?
Think of a stranger in a delivery uniform who walks straight past reception. Nobody asks questions, because uniforms usually mean "allowed in". A BadUSB device wears a keyboard's uniform.
When you plug in a USB gadget, it tells the computer what kind of device it is. A BadUSB device says "I am a keyboard". The computer treats what it types as if a person were typing [2].
In 2014, researchers at SR Labs showed a worrying thing. The chips inside many ordinary USB devices could be changed to act as another kind of device, such as a keyboard [1]. Since then, ready-made gadgets for security testers have become common.
The best known is the USB Rubber Ducky, sold by Hak5 since 2010. Hak5 describes it as looking like a flash drive to a person but acting as a keyboard to a computer [2]. The O.MG Cable hides similar electronics inside what looks like a normal charging cable [3]. Both are sold for authorised testing and training.
Where the comparison stops working: a fake delivery driver may be spotted by a guard. A fake keyboard is usually accepted by the computer straight away, and its typing can be over in seconds.
Why does it matter?
A fake keyboard can type anything the logged-in person could type. If that person has wide access, so does the device.
If you work in an office
What could happen: a "free gift" stick arrives in the post, and plugging it in lets an attacker install harmful software.
Check this: know who to hand unexpected devices to at work.
If you look after company computers
What could happen: you block USB memory sticks and think the job is done, but a fake keyboard is not a memory stick.
Check this: ask whether your rules cover new keyboards as well as storage.
If you use a powerful admin account
What could happen: a device plugged into your computer types commands with your admin rights.
Check this: use a separate, everyday account for email and web, and lock your screen when you step away.
What does it look like?
To a person, the gadget looks like a normal stick or cable. Defenders spot it in their logs. Here is a made-up log from a locked-down front desk computer.
Example only. All values are made up.
Device log: RECEPTION-PC-EXAMPLE 10:14:02 New device: "USB Keyboard" ID 0000:FAKE (1) 10:14:02 Device type: keyboard (2) 10:14:02 Rule: only approved keyboards allowed (3) 10:14:02 Action: PnPDeviceBlocked (4) 10:14:05 Alert sent to IT: new keyboard blocked (5)
- A new device appears. In a real file, this line would show the maker and product numbers.
- It says it is a keyboard, even though nobody added one.
- This computer only accepts approved input devices.
- The device is stopped. Microsoft tools log this event with the name shown [4].
- IT is told, so a person can go and look.
Why this is risky: without a rule like line 3, the computer would likely accept the "keyboard". It would then run what it types.
The safer way: on shared or key computers, allow only known keyboards and mice. Get an alert when a new one appears.
How does it work?
- Someone plugs it in. The gadget may be left in a car park, posted as a gift or swapped for a normal cable.
- It introduces itself. It tells the computer it is a keyboard, which usually needs no special approval [2].
- It types very fast. It sends a pre-set list of key presses, much faster than a person could type [2].
- The computer obeys. The commands run as the logged-in person. They might open a program, change a setting or download harmful software [1].
- Scanners may not see it. SR Labs noted that malware scanners cannot inspect the hidden software inside USB devices [1]. A keyboard also does not show up as a drive, so storage-only blocks may not apply [5].

This is not just a lab trick. In January 2022 the FBI warned that a criminal group had posted BadUSB devices to US firms, disguised as gifts or health guidance. Once plugged in, the devices acted as keyboards to install harmful software [5].
A worked example
This story is made up to show the idea.
Imani Lomax works on reception at a small insurance broker. One morning a padded envelope arrives. Inside is a branded USB stick and a note: "Thank you for being a valued partner. Please plug in to view your gift voucher."
Imani remembers the office rule: hand it in, do not plug it in. She takes it to Orla Pereira, who looks after the company's computers.
Orla does not plug it into any work computer. She logs the envelope, the postmark and the note, and keeps the stick in a labelled bag. She tells the team, so anyone else who got one also hands it in.
The envelope makes Orla check her defences. The company already blocks USB memory sticks on most computers. She realises that rule may not stop a gadget that says it is a keyboard.
So she makes three changes. The reception and finance computers now accept only approved keyboards and mice, after a short test so nobody gets locked out. A new keyboard on those computers sends her an alert. Staff who use admin rights now have a separate everyday account.
Two weeks later, a supplier's sales rep asks to plug a "charging cable" into the reception computer. The computer blocks it, and Orla gets an alert. The rep's cable turns out to be harmless, but the new rules worked as planned.
Imani learned that the safest USB device is the one you do not plug in. Orla learned that blocking storage is only half the job.
Myths and mistakes
| What people think | What is true |
|---|---|
| My antivirus will catch a bad USB stick. | Scanners cannot look inside the hidden software of a USB device[1]. Not plugging it in matters most. |
| We block USB memory sticks, so we are safe. | A fake keyboard does not show up as a drive, so storage-only rules may not stop it[5]. |
| Only memory sticks are a risk. | Cables can hide the same electronics[3]. Use cables from trusted sources. |
| Plugging it in for a second is harmless. | A fake keyboard types much faster than a person, so a short time can be enough[2]. |
| Checking it on my home computer is safer. | Your home computer can be harmed too. Hand it to your IT or security team. |
What can I do this week?
- Find out who to hand unexpected USB sticks, cables and gadgets to at work.
- Lock your screen whenever you step away from your desk.
- Use only cables and chargers you bought or your workplace gave you.
- If you have admin rights, ask for a separate everyday account.
- Ask IT whether your rules cover new keyboards, not just memory sticks.
Checklist
- I do not plug in USB devices I found or did not expect.
- I know who to hand unexpected devices to.
- I use cables from trusted sources.
- I lock my screen when I leave my computer.
- Our sensitive computers accept only approved input devices.
- We get an alert when a new keyboard appears on a locked-down computer.
- Daily work is done without admin rights.
- Posted "gifts" with USB devices are reported to security.
Common questions
Is BadUSB the same as a USB virus?
No. A USB virus is a harmful file stored on a stick. A BadUSB device works differently: it pretends to be a keyboard and types commands. Some people use "BadUSB" loosely for any keyboard-pretending gadget, including testing tools such as the USB Rubber Ducky.
Are Rubber Duckies and O.MG Cables illegal?
They are sold openly as tools for security testers, IT teams and training[2][3]. The seller of the O.MG Cable says it is for authorised testing only. Our advice: never use one on a computer you do not own or have written permission to test.
Can a phone charging cable really be dangerous?
It can, if it has hidden electronics inside. Products such as the O.MG Cable look like normal cables but can type commands[3]. Use cables you bought from a trusted shop or got from your workplace, and do not borrow unknown ones for work computers.
How can I tell if a USB stick is a fake keyboard?
Usually you cannot tell by looking. That is why the safe rule is not to plug in unknown devices at all. Security teams can check suspicious devices on a separate, isolated computer, and device logs can show a "new keyboard" appearing.
Does this affect software accounts and keys?
Yes. Typed commands run with the logged-in person's access, so they can reach any passwords, keys or tokens that person's computer holds. Keeping secrets for apps and services in a vault, not in files on a laptop, limits what a fake keyboard could reach.
Where next?
Ready for the detail? Read the practitioner guide: USB Drop Attacks Guide. It goes further into device installation rules, the event records to watch and how to run a safe handling process for found and posted devices.
Also useful:
- USB and Removable Media for Beginners
- Removable Media and USB Control Guide
- Physical Security for Beginners
- Malware for Beginners
Related NHI Mgmt Group resources: Privileged Access Management for Beginners, Hardware Hacking for Beginners and Non-Human Identities for Beginners.
Key terms
- BadUSB
- A USB device changed so it acts as something else, often a keyboard, to run commands on a computer.
- USB Rubber Ducky
- A testing gadget that looks like a memory stick but acts as a keyboard and types pre-set commands.
- Keystroke injection
- Sending pretend key presses to a computer as if a person typed them.
- Human interface device
- A type of gadget, such as a keyboard or mouse, that lets a person control a computer.
- Device control
- Rules that decide which gadgets and connections a computer will accept.
- Removable media
- Storage you can plug in and take out, such as USB sticks and memory cards.
Sources and further reading
- SR Labs, "Turning USB peripherals into BadUSB", SR Labs blog, 31 July 2014. https://srlabs.de/blog/usb-peripherals-turn (accessed 1 Dec 2026).
- Hak5, "USB Rubber Ducky", product page. https://shop.hak5.org/products/usb-rubber-ducky (accessed 1 Dec 2026).
- Hak5, "O.MG Cable", product page. https://shop.hak5.org/products/omg-cable (accessed 1 Dec 2026).
- Microsoft Learn, "Device control in Microsoft Defender for Endpoint". https://learn.microsoft.com/en-us/defender-endpoint/device-control-overview (accessed 1 Dec 2026).
- "FBI: Hackers use BadUSB to target defense firms with ransomware", BleepingComputer (news report on an FBI flash alert), January 2022. https://www.bleepingcomputer.com/news/security/fbi-hackers-use-badusb-to-target-defense-firms-with-ransomware/ (accessed 1 Dec 2026).