feat: Implement VeraCrypt Self-Destruct Trigger for Windows (#60)#107
feat: Implement VeraCrypt Self-Destruct Trigger for Windows (#60)#107Ashutosh0x wants to merge 1 commit into
Conversation
Implements the VeraCrypt self-destruct trigger for Windows as described in issue BusKill#60. This adds the ability for BusKill to permanently destroy VeraCrypt volume headers when the kill cord is disconnected, rendering encrypted data permanently inaccessible. Deliverables implemented: 1. spawn_root_child() for Windows - spawns root_child_win.py as a child process with admin privileges via subprocess.Popen with stdin/stdout pipes for IPC 2. root_child_win.py - a paranoid, minimal script that runs with admin privileges and listens for commands on stdin. Handles 'veracrypt-self-destruct' and 'soft-shutdown' commands 3. trigger_veracrypt_selfdestruct() - discovers mounted VeraCrypt volumes via 'VeraCrypt.exe /list', force-dismounts all volumes, wipes both primary (offset 0) and backup (end of volume) 128KB headers with 3 passes of cryptographically secure random data using secrets.token_bytes(), then initiates hard shutdown 4. Supports both file containers (standard file I/O) and raw device/partition volumes (Win32 CreateFileW/WriteFile API) Also updates settings_buskill.json with the new trigger option and appropriate IRREVERSIBLE data loss warning dialog. Closes BusKill#60
|
Hey @maltfield — this PR implements all 4 deliverables for #60 (VeraCrypt self-destruct trigger on Windows). Would love your review when you get a chance! 🙏 |
|
Hi Ashutosh. Wow, thanks for this. Can you please confirm if this was written by you, or if you used AI to write this code? |
|
Hey @maltfield — yep, wrote it myself! I studied the existing root_child_mac.py and the Linux self-destruct script to understand the architecture, then built the Windows equivalent from scratch. Also referenced the previous work by @jneplokh in the veracrypt-self-destruct repo to understand what they'd attempted before getting stuck on the Windows privilege escalation part. Happy to walk through any part of the code if you have questions! |
|
Great, thanks for confirming that. fwiw, I just published our policy on AI here: Unfortunately, I realized that we don't yet have a process for contributors. I'm currently in the process of fixing that here: In the meantime, one issue with this PR is that you made it to the |
|
@Ashutosh0x can you please send us an email so we can send you the CAA? |
Summary
This PR implements the VeraCrypt self-destruct trigger for Windows, as described in issue #60. When the BusKill kill cord is disconnected with this trigger enabled, it permanently destroys all VeraCrypt volume headers, rendering encrypted data irrecoverable — then initiates an immediate hard shutdown.
Deliverables (as specified in #60)
1.
spawn_root_child()for Windows__init__.pywithin the existingspawn_root_child()methodroot_child_win.pyas a child process usingsubprocess.Popen()withstdin=PIPE,stdout=PIPE,stderr=PIPEfor IPC2.
root_child_win.py— Elevated child processroot_child_mac.py: loops reading commands from stdin, executes them, writes results to stdoutveracrypt-self-destructcommand -> callstrigger_veracrypt_selfdestruct()soft-shutdowncommand -> callstrigger_hard_shutdown()3.
trigger_veracrypt_selfdestruct()— The self-destruct sequenceExecutes a 4-step self-destruct sequence:
VeraCrypt.exe /listto enumerate all currently mounted VeraCrypt volumes (both file containers and partitions)VeraCrypt.exe /dismount /force /quit /silentsecrets.token_bytes())os.fsync()for file containers andFlushFileBuffers()for raw devices to ensure data hits diskshutdown /s /f /t 0(with/p /ffallback)Supports both:
.hc/.tcfiles) — uses standard Python file I/O\\?\Volume{GUID}) — uses Win32CreateFileW/WriteFile/DeviceIoControlvia ctypes4. Forensic verification
A forensic analysis can be performed by:
Technical Details
VeraCrypt Header Layout
Overwriting both the primary and backup headers with random data makes the volume permanently unrecoverable, even with the correct password — the master encryption keys are destroyed.
Security Considerations
secrets.token_bytes()(CSPRNG)os.fsync/FlushFileBuffers) to prevent cachingFiles Changed
src/packages/buskill/root_child_win.py— Elevated child process for Windowssrc/packages/buskill/__init__.py— Windowsspawn_root_child(), trigger dispatch,set_trigger()handlersrc/packages/buskill/settings_buskill.json— Added veracrypt-self-destruct trigger option with warningTesting
VeraCrypt.exe /listReferences
root_child_mac.py