Skip to content

+ VeraCrypt/TrueCrypt hidden volumes: create safely and protect from the outer mount - #811

Merged
Hawkynt merged 3 commits into
mainfrom
feat/veracrypt-hidden-volumes
Nov 10, 2026
Merged

Hawkynt merged 3 commits into
mainfrom
feat/veracrypt-hidden-volumes

Conversation

@Hawkynt

@Hawkynt Hawkynt commented Nov 10, 2026

Copy link
Copy Markdown
Owner

Hidden volumes can now be created and protected, and are found from the password alone.

Changes

  • TcHiddenVolume: places a hidden volume exactly where VeraCrypt does (data ends 4 KiB before the backup header area; header in the 64 KiB slot, backup 64 KiB before the end; outer header untouched). Written only after the outer volume proves the space free: decrypted with the outer password, its filesystem detected, its IFilesystemExtentMap walked; outer volumes without one are refused. Sparse hidden volumes are refused.
  • Descriptor: a hidden.img input plus HiddenPassword (must differ) and HiddenSize/Cipher/Prf/Pim creates outer and hidden together; mounting the outer volume with ProtectHidden(+Pim/Keyfiles) refuses any write reaching the hidden data and, like VeraCrypt, every write after that.
  • Without a Hidden parameter the password is tried on the standard header, then the hidden one (as VeraCrypt does), so hidden volumes mount from the UI with just the password.
  • Docs (docs/VERACRYPT-ON-DISK.md hidden-volume section), README row, API reference; CI VeraCrypt oracle runs the hidden-volume class too.

Verification

  • VeraCrypt's own hidden volume (outer AES, hidden AES/SHA-256) opens in ours with what it wrote through its mapping; VeraCrypt mounts our hidden volume to our plaintext and accepts it for --protect-hidden on the outer mount; cryptsetup --tcrypt-hidden maps ours.
  • Protection refuses the write and leaves the hidden volume intact; refusals for unknown outer filesystems, overlapping allocations, wrong outer/protection passwords; password-only mount finds the hidden volume. 88 VeraCrypt unit tests pass.

Closes #802

…the outer mount

Hidden volumes could be opened by their password but not created, and
writing through the outer volume could silently destroy them.

- TcHiddenVolume.Add/Write: place a hidden volume where VeraCrypt does (data
  ends 4 KiB before the backup header area; both size fields = hidden size,
  data offset absolute, outer header untouched), header in the 64 KiB slot
  and its backup 64 KiB before the end, unused hidden space random. Only
  after the outer volume proves the space free: decrypted with the outer
  password, its filesystem detected and its IFilesystemExtentMap walked;
  outer volumes without one are refused. Sparse hidden volumes are refused.
- Descriptor: a hidden.img input plus HiddenPassword (must differ),
  HiddenSize/Cipher/Prf/Pim creates outer and hidden in one go; mounting the
  outer volume with ProtectHidden(+Pim/Keyfiles) wraps it in
  HiddenProtectedBlockDevice, which refuses any write reaching the hidden
  data and, like VeraCrypt, every write after that. A protection password
  that opens no hidden header is rejected.

Placement measured from containers made by veracrypt 1.26.29's CLI (rung 1/2
as in the VeraCrypt commit; the layout facts are in docs/VERACRYPT-ON-DISK.md).

Verified: VeraCrypt's hidden volume (outer AES, hidden AES/SHA-256) opens in
ours with what it wrote through its mapping; VeraCrypt mounts our hidden
volume to our plaintext and accepts it for --protect-hidden on the outer
mount; cryptsetup --tcrypt-hidden maps ours; protection refuses the write
and leaves the hidden volume intact; refusals for unknown outer filesystems,
overlapping allocations, wrong outer/protection passwords.

Closes #802
…assword

Symptom: a hidden volume could only be mounted with an explicit Hidden=true
parameter, which the mount window has no way to pass - so from the UI the
hidden volume was unreachable.

Fix: without a Hidden parameter, the password is tried on the standard
header (and its backup), then on the hidden header positions, exactly as
VeraCrypt's own mount does. Hidden=true/false still pins one kind.
Protection is skipped when the password itself opened the hidden volume.
New public types TcHiddenVolume and HiddenProtectedBlockDevice, the nullable
TcUnlockOptions.Header and the documented Create (Svr4Bfs block kept from
main, which the local run cannot load).
@Hawkynt
Hawkynt merged commit 21e6093 into main Nov 10, 2026
9 of 10 checks passed
@Hawkynt
Hawkynt deleted the feat/veracrypt-hidden-volumes branch November 10, 2026 22:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

VeraCrypt/TrueCrypt hidden volumes: open, protect and create

1 participant