While Drive Badger's main functionality is data exfiltration, it is also able to make changes to the copied filesystem: create files or directories, write data into them, rename, delete etc. This feature is called filesystem injection and is done by "injectors". See injectors-playground repository for example scripts.
Injectors are simple scripts (working in similar way to hooks), located inside /opt/drivebadger/injectors
directory, that are executed:
Injector is a directory containing injector.sh
script, and possibly other files (eg. photos to copy to particular drive). The script receives the path to mounted partition as $1
argument and can do anything within this path. However there are some limitations:
C:\Windows
and C:\WINDOWS
are not the same)No. Injectors are run on "best effort" basis - so write may succeed, but if not, it is not considered as hard error.
Injectors may not be run at all, or may fail, in many circumstances:
mount
operation in rw
mode fails for any other reason - eg. NTFS partitions after unclean shutdown can be mounted in read-only mode without errors, but fail to mount in read-write mode.Drive Badger processes all partitions in particular order:
Exception: VeraCrypt system partitions are opened in read-write mode from the beginning, and then exfiltrated and injected in a single run.
Injectors are selected by get-injector-script.sh
script. It implements the following logic:
And only the first (best matched) injector is executed.
This means that:
UUID-based injectors are the best choice, since they're executed against only one specific partition.
Injectors specific to drive serial number are executed against all partitions on given drive. For example, typical Linux box contains at least 2 ext4
partitions: /
and /boot
, and optionally more: /home
, /var
, /tmp
and so on. So, such injectors need to implement checking for additional conditions, before attempting to make any changes.
Injectors specific only to filesystem/encryption/share type should be used only in special circumstances and with caution, since they can easily cause irreparable damage. In general, such injectors are meant to run in environment, that is seen for the first time (without any previous exfiltration or other research).
Injectors works with encrypted drives with some limitations:
bitlocker
, veracrypt
and luks
encryption types overwrite filesystem types:ext4
partitions encrypted by LUKS can only be matched by luks
type, not ext4
bitlocker
, veracrypt
instead of ntfs
injectors-playground
repository contains several examples of simple injectors, that check for existence of particular directory to make sure, that they process correct partition, and then create a simple text file.
Amongst them, there are a bit more interesting examples:
/root/.ssh/authorized_keys
file on all LUKS encrypted partitions