Skip to content

Baiting

Baiting leaves something tempting, usually a USB drive labelled "Payroll" or "Confidential", where a victim will find it. Plugging it in runs malware, or the device pretends to be a keyboard and types attack commands.

DraftLast reviewed Oct 11, 20261 scriptEdit this page on GitHub

This page is a draft: its scripts were tested in a lab, but its references still need an independent review.

On this page

After this lesson you can

  • Explain what Baiting is in your own words.
  • Describe how the attack or technique works.
  • Walk through a real-world example from start to finish.
  • Recognise it using the detection techniques in this lesson.
  • Apply the prevention methods described here.
  • Read and run the Python script in a lab you control.
  • Relate the topic to T1091, T1200 in the standards.

Last reviewed: 2026-10-11 | Status: Draft (new topic; scripts tested against local lab targets, references not yet independently re-verified)

Standards mapping

FrameworkReference
OWASP Top 10:2025not applicable
MITRE ATT&CK (v19)Initial Access / T1091 Replication Through Removable Media; T1200 Hardware Additions
CWEnot applicable
CAPECnot applicable
Example CVEnot applicable

What it is

Baiting leaves something tempting, usually a USB drive labelled "Payroll" or "Confidential", where a victim will find it. Plugging it in runs malware, or the device pretends to be a keyboard and types attack commands.

How it works

Two mechanisms are common. Storage media carry files that look like documents but are programs (double extensions such as invoice.pdf.exe, autorun files, shortcuts, macros). Programmable USB devices present themselves as a keyboard and send keystrokes faster than a person, opening a shell and downloading malware in seconds.

Real-world example

In 2008 the US Department of Defense suffered a widely reported compromise by the agent.btz worm, spread through removable media, which led to a ban on USB drives across military networks. Add a primary source when expanding this section.

Detection

  • Inspect the drive without opening anything: autorun files, executables in the root, double extensions, macro documents (usb_bait_scanner.py)
  • A "storage" device that also presents a keyboard interface (keystroke-injection signature)
  • Endpoint alerts for new USB device classes; logs of newly attached devices

Prevention

In order of strength. The first items fix the cause; the rest reduce risk.

  1. Disable autorun and autoplay; block unknown removable storage with device control (allow-list approved devices)
  2. Block USB HID devices from unmanaged storage-class devices where possible
  3. Teach staff: never plug in found media; hand it to IT
  4. Give IT a sacrificial or kiosk machine that mounts media read-only (mount -o ro,noexec,nosuid,nodev)
  5. Keep endpoint protection current and restrict macros in Office documents

Scripts in this topic

Common mistakes

  • Believing a drive is safe because it looks new or sealed
  • Scanning with antivirus after opening the files
  • Treating only storage devices as a risk: charging cables and keyboards can also be implants

Test it safely

Use an empty folder or a throwaway virtual machine. Never test with real malware.

Practical Python labs

Open a script to read its source and copy the run commands. Run security tools only on systems you own or have written permission to test.

Check what you have covered

These questions are generated from this lesson's category, standards mapping and scripts. They test where things live in the guide, not how well you understand the concepts. Nothing is saved or tracked.

1.Which category is "Baiting" part of?
2.Which MITRE ATT&CK identifier is listed in the standards mapping for "Baiting"?
3.Which of these scripts belongs to the "Baiting" lesson?
4.Is usb_bait_scanner.py a detection script or a prevention script?