Repository navigation
+ VeraCrypt/TrueCrypt hidden volumes: create safely and protect from the outer mount - #811
Merged
Merged
Conversation
…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).
This was referenced Nov 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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, itsIFilesystemExtentMapwalked; outer volumes without one are refused. Sparse hidden volumes are refused.hidden.imginput plusHiddenPassword(must differ) andHiddenSize/Cipher/Prf/Pimcreates outer and hidden together; mounting the outer volume withProtectHidden(+Pim/Keyfiles) refuses any write reaching the hidden data and, like VeraCrypt, every write after that.Hiddenparameter 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/VERACRYPT-ON-DISK.mdhidden-volume section), README row, API reference; CI VeraCrypt oracle runs the hidden-volume class too.Verification
--protect-hiddenon the outer mount;cryptsetup --tcrypt-hiddenmaps ours.Closes #802