Geofencing for the Bash Bunny Mark II
Once upon a time a friend of mine robbed the wrong bank. True story. Turns out he got the directions wrong on a physical engagement.
Hotplug attacks are great, until they're not — which is why it's important to limit the scope of engagement. Thankfully the Bash Bunny Mark II can do this with a geofencing feature using bluetooth signals to prevent payloads from running unless it's certain to be in the defined area.
Imagine an engagement where you want to exfiltrate loot from the boss' home office. You know she has IoT gear all around her house — voice assistants, wireless lamps, bluetooth speakers. You also know that you definitely don't want the payload to run if by chance the Bash Bunny walks. Geofencing time!
It's easy — just prefix your payload with this:
Now the payload is paused until the Bluetooth low energy device specified is seen. Similarly the geofencing feature can be used to exclude a certain area — only running when Bluetooth devices are not visible.
So, how do we know which devices are where? I'm glad you asked. Enter the Bluetooth Geofence Profiler payload.
# Title: Bluetooth Geofence Profiler# Description: Saves bluetooth scan in loot folder for geofenced payloads# Author: Hak5Darren# Version: 1.0# Category: General## Enable serial BTLE module#LED SETUPstty -F /dev/ttyS1 speed 115200 cs8 -cstopb -parenb -echo -ixon -icanon -opoststty -F /dev/ttyS1 speed 115200 cs8 -cstopb -parenb -echo -ixon -icanon -opostsleep 1## Set BTLE module to observation mode#echo -n -e "AT+ROLE=2" > /dev/ttyS1echo -n -e "AT+RESET" > /dev/ttyS1## Copy strings from 10 second observation scan to file in loot folder#LED ATTACKtimeout 10s cat /dev/ttyS1 > /tmp/bt_observationstrings /tmp/bt_observation > /root/udisk/loot/btle-profile.txt## Sync file system and finish#LED CLEANUPsyncLED FINISH
Load this payload to your switch position of choosing and execute while in the vicinity you wish to wirelessly profile. It'll create a new btle-profile.txt file in the loot folder. In it you'll find strings from the BTLE wireless landscape. For example, at my place I find the following:
Ld+xLE-Bose SoundLink MicroLd+xMBAudio
Armed with the Bluetooth Low Energy landscape of our target, we can populate our payload with WAIT_FOR_PRESENT commands to prevent the payload from further executing until, as the Ducky Script command implies, they're present.
Double up on the devices to even further the specificity!
WAIT_FOR_PRESENT SoundLink WAIT_FOR_PRESENT MBAudio
Even if the Bash Bunny finds its way into an area where another Bose SoundLink Micro device lives, the payload will continue to halt until MBAudio is also seen. The more devices are specified, the greater the geofence.
The WAIT_FOR_PRESENT extension accepts a single parameter ($1) — in our case SoundLink or MBAudio — and continues looping over a scan of the BTLE landscape until the string specified is found via grep.