Menu

Key splitting is recommended to be upgraded to HKDF derivation.

2025-07-30
2025-10-21
  • 风之暇想

    风之暇想 - 2025-07-30

    Header keys used by ciphers in a cascade are mutually independent, even though they are derived from a single password (to which keyfiles may have been applied). For example, for the AES-Twofish-Serpent cascade, the header key derivation function is instructed to derive a 768-bit encryption key from a given password (and, for XTS mode, in addition, a 768-bit secondary header key from the given password). The generated 768-bit header key is then split into three 256-bit keys (for XTS mode, the secondary header key is split into three 256-bit keys too, so the cascade actually uses six 256-bit keys in total), out of which the first key is used by Serpent, the second key is used by Twofish, and the third by AES (in addition, for XTS mode, the first secondary key is used by Serpent, the second secondary key is used by Twofish, and the third secondary key by AES). Hence, even when an adversary has one of the keys, he cannot use it to derive the other keys, as there is no feasible method to determine the password from which the key was derived (except for brute force attack mounted on a weak password).

    https://veracrypt.io/en/Header%20Key%20Derivation.html

    The current approach is merely space slicing, with three segments of 256-bit each having known offsets relative to each other; once one segment leaks, the remaining two segments are completely determined, failing to meet the cryptographic independence requirement of 'mutual information being zero'. Switching to HKDF-Expand to assign different context labels to each segment can provably eliminate mutual information, at zero cost, backward compatible, yet completely blocks potential cascading key association attack surfaces.

    AI evaluates this way @idrassi

     
  • RichardH

    RichardH - 2025-10-19

    Could you elaborate on this part:

    once one segment leaks, the remaining two segments are completely determined

    Focussing on PBKDF2, each generated block T_i is independent of other blocks, e.g. you can calculate T_64 without knowing T_0...T_63. In what sense does leaking the first segment determine the other segments? Assuming of course the password is not leaked.

     
    • 风之暇想

      风之暇想 - 2025-10-19

      Currently, there is no method to directly derive other segments, but using HKDF for derivation can achieve maximal separation, leaving attackers with no means to break it. Even if one of the encryption algorithms (such as AES) is completely compromised, only the subkeys will be exposed, while the master key remains secure.

       
  • RichardH

    RichardH - 2025-10-20

    I am trying to understand the difference. With the existing setup, if one cipher of a cascade is compromised, only part of the full PBKDF2 derived key is exposed. As the other parts are independent, they are not exposed. In what sense does HKDF make this more secure?

    As I currently see it, to break PBKDF2 you would need to break the PRF (and then some more), which would seriously impact HKDF too. But I could be wrong.

    Don't get me wrong: The elegance of HKDF is clear to me, I just don't understand why it would make the system more secure (the "once one segment leaks, the remaining two segments are completely determined" part of your first post).

     
    • 风之暇想

      风之暇想 - 2025-10-21

      The so-called “partial leakage” in today’s design is not a leak of an independent piece; it is the disclosure of a fixed slice of one single blob. True independence—where leaking one key leaves the others completely untouched—requires HKDF, because HKDF removes both “position linkage” and “mathematical derivability” among the keys.

      1. Clarify the “fake independence” of the current scheme: these are not independent parts, just fixed fragments of the same string.
        You may think that “leaking one cipher’s key only exposes a portion of the full derived secret, while the rest stay independent.” The reality is the opposite—the “parts” are not independent at all; they are fixed-position slices of one 768-bit master key. Their relation is physically hard-wired:

      2. The positions are public and static: VeraCrypt’s slicing rule is known (e.g., bits 0–255 → Serpent, 256–511 → Twofish, 512–767 → AES). Once an attacker obtains any slice (say the 256-bit Serpent key), he instantly knows its exact offset inside the 768-bit blob.

      3. Leaking one slice gives away the “location cue” for the rest: although the attacker does not yet hold the Twofish/AES keys, he knows they reside at fixed offsets. If he later recovers additional bytes of the master key through any other avenue (side-channel, etc.), he can immediately place them at the correct offsets and reconstruct the remaining keys.
      4. No cryptographic separation, only physical chopping: the slices are neither encrypted nor masked; their only “separation” is functional (used by different algorithms), not cryptographic. In reality they remain “all in the same boat.”

      5. HKDF’s “true security”: use context labels to sever every link, so leaking one key is useless.
        HKDF (specifically HKDF-Expand) turns the current “physical chop” into “independent derivation,” making every key mathematically unrelated:

      6. Derivation logic changes from “split” to “born separately.”
        – Current: PBKDF2/Argon2id → one 768-bit “big key” → cut into three 256-bit chunks.
        – HKDF: PBKDF2/Argon2id → one “base key” (PRK) → invoke HKDF-Expand with a unique context label per cipher:
        – AES key: label “VeraCrypt-Cascade-AES-Key”
        – Twofish key: label “VeraCrypt-Cascade-Twofish-Key”
        – Serpent key: label “VeraCrypt-Cascade-Serpent-Key”

      7. Labels enforce absolute independence: same PRK, different label → completely unrelated outputs.
        Per RFC 5869, any change in the context label yields a mathematically independent key; no derivability, no probabilistic similarity.
        Therefore, even if the attacker obtains the AES key, he cannot reverse the HKDF (it’s one-way) and cannot predict the Twofish or Serpent keys, because their labels create an isolated derivation path.

      8. No linkage left to attack: no offsets, no clues.
        In the old design the attacker at least knows where the other keys sit; with HKDF each key is an individually generated object. There is no “master blob” and no positional map—compromising one key gives zero leverage against the others.

      The core reason HKDF is more secure is that it transforms simple spatial relationships into cryptographically strong, one-way functional relationships. While theoretically both schemes are similar in that “leakage of one segment does not directly expose other segments,” HKDF:
      - Provides provable security guarantees
      - Eliminates all mathematical correlations
      - Protects the master key from partial exposure
      - Resists a broader range of attack types

      This security enhancement is especially critical when facing advanced adversaries (e.g., state-level attackers) or when long-term security is required. For most applications, this “zero-cost” security upgrade is absolutely worthwhile.

      Answer from AI

       

      Last edit: 风之暇想 2025-10-21
  • RichardH

    RichardH - 2025-10-21

    AI is good at producing lots of text while leaving the question unanswered. It will provide an equally detailed answer arguing that PBKDF2 and HKDF provide similar strength security.

     
    • 风之暇想

      风之暇想 - 2025-10-21
      • Provides provable security guarantees
      • Eliminates all mathematical correlations
      • Protects the master key from partial exposure
      • Resists a broader range of attack types

      Although the AI is long, it does not mean it is erroneous. HKDF can indeed enhance security. Although it is currently sufficient, since we are using cascading, we need to achieve the highest level of security.

       

Log in to post a comment.