Explore our new Cybersecurity Terms Glossary, explained by our experts.

View the Glossary View the Glossary
PRIVIA

Cybersecurity Terms Glossary

What Is the USB Rubber Ducky?

The USB Rubber Ducky looks like a memory stick but announces itself as a keyboard, typing a prepared script into an unlocked computer faster than any person could.

Illustration for the cybersecurity term USB Rubber Ducky
Home / Blog / Cybersecurity Terms / What Is the USB Rubber Ducky?
17 November 2026

What Is the USB Rubber Ducky?

What Is the USB Rubber Ducky?

The USB Rubber Ducky exploits a trust decision that every operating system made decades ago: keyboards do not need approval. Plug one in and it works immediately, because asking a user to authorise their keyboard with the keyboard would be absurd. The Rubber Ducky, sold by Hak5, is a device shaped like a memory stick that tells the computer it is a keyboard and then types.

What it types is a script loaded onto a microSD card, and it types it at machine speed. Several hundred characters go in before a user watching the screen has worked out what is happening, which is enough to open a terminal, run a command, and close the window again.

How the Attack Works

The device enumerates as a USB human interface device. The operating system loads a standard keyboard driver, the device begins sending key codes from its payload, and the computer obeys, because from its point of view somebody is typing. No vulnerability is exploited and no software is installed, which is why antivirus products historically saw nothing at all.

Payloads are written in DuckyScript, a deliberately simple language of delays, key names, and strings. Later versions added variables, conditional logic, and the ability to read back the state of the keyboard lock indicators, which gives the device a primitive return channel: the host can be made to toggle those lights in a pattern that encodes data, so the device can exfiltrate small amounts of information without any network access at all. The same versions can fingerprint the operating system before choosing which payload to run.

The Wider Device Family

DeviceDistinguishing feature
USB Rubber DuckyDedicated keystroke injection, memory stick form factor
Bash BunnyMultiple payload modes, can also present as storage or a network adapter
O.MG CableInjection hardware hidden inside an ordinary charging cable, with wireless control
Flipper ZeroMulti-tool that includes keystroke injection alongside radio and NFC features
Programmable microcontrollersInexpensive boards flashed with HID firmware, functionally equivalent

The last row is the one that matters for policy. The capability costs a few pounds, so controls based on identifying one specific product are pointless. The underlying issue is covered more broadly under BadUSB.

Where It Fits in an Engagement

Physical entry and keystroke injection pair naturally. A tester who has reached a desk during a physical penetration test needs seconds at an unlocked machine, and the device provides them. The second scenario is the drop: devices left in a car park, a reception area, or an internal post tray, relying on somebody plugging one in to see what is on it. That behaviour is measured in awareness exercises precisely because it remains common.

What a payload is permitted to do belongs in the rules of engagement. In a controlled test it typically proves execution and stops, rather than establishing a persistent channel on a production endpoint.

Defending Against It

Three layers work together.

Physical measures still have a place. Port blockers on machines in public areas, charge-only adapters for staff who need to power devices from unfamiliar sockets, and a clear instruction never to plug in a found drive all reduce exposure. The instruction works better when people have been told why.

Our Social Engineering Services include device drop scenarios and on-site injection attempts, which test the lock-screen habit and the device policy at the same time.

FAQ – Frequently Asked Questions

Does Antivirus Stop a Rubber Ducky?

Not by itself. The device delivers keystrokes rather than files, so nothing malicious is written to disk for a scanner to inspect. Modern endpoint products do detect what the keystrokes cause: an unexpected script interpreter launching, an encoded command line, or an outbound connection. Device control and screen locking remain the primary preventive controls.

Can It Work on a Locked Computer?

No, not for keystroke injection. A locked screen accepts nothing but the password, so the payload goes nowhere. This is why the automatic lock timeout is the single most valuable control against the technique. Devices that also present as network adapters can attempt other attacks against a locked machine, which is a separate concern.

How Do We Block USB Keystroke Injection?

Use device control policy. Windows Group Policy can restrict device installation to approved hardware identifiers, so an unrecognised keyboard is never initialised. Endpoint protection suites add auditing and alerting, and USBGuard provides equivalent control on Linux. Combine this with short screen lock timeouts and logging of new HID devices for investigation.

Is Buying One Legal in the UK?

Yes. It is sold openly as security testing equipment and is used by testers, researchers, and automation engineers. Using it against a computer you have no authority over is unauthorised access under the Computer Misuse Act 1990, and carrying it with that intent can engage other offences. Authorised testing requires written permission naming the systems and sites involved.

Related Terms

You May Be Interested In These

What Happened in the LastPass Breach?

Cybersecurity Terms

17 November 2026

What Happened in the LastPass Breach?

Read More
What Is a Dictionary Attack?

Cybersecurity Terms

17 November 2026

What Is a Dictionary Attack?

Read More
What Is Autopsy?

Cybersecurity Terms

17 November 2026

What Is Autopsy?

Read More