PAS - How are Vault Session IDs Generated?
93
Created On 11/10/26 11:01 AM - Last Modified 11/10/26 13:04 PM
Question
How are the Vault Session / Session Ids generated and what security measures are in place to prevent a user taking over another users session?
Environment
N/A;1.5;1.6;v2.0;v2.6;v3.0;v3.3;v3.5;v3.6;3.7;v3.8;v3.9;v4.0;v4.1;v4.5;v4.6;v5.0;v5.1;v5.3;v5.5;v5.6;v5.7;v6.0;v6.1;v6.2;v6.3;v6.4;v7.0;v7.1;v7.2;v7.5;v7.6;v8.0;v8.0 Beta;8.1;v8.2;v8.5;v8.6;v9.0;v9.1;v9.2;9.3;9.5;9.6;9.7;9.8;9.9;9.9.5;9.10;10.0;10.1;10.2;10.3;10.4;10.5;10.6;10.7;10.8;10.9;10.10
Answer
We have keys per session, generated at identification, based on the client & server.
See this detailed explanation:
The Vault protocol uses an Encrypt-then-MAC encryption scheme. The encrypted records of the protocol have the following structure:
Encrypted-Payload || HMAC-SHA2-512(Encrypted-Payload)
In more details:
IV || AES_256_CBC(SessionKey, IV, PrevSeq || CurrSeq || Msg) || HMAC-SHA2-512(HmacKey, IV || AES_256_CBC(SessionKey, IV, PrevSeq || CurrSeq || Msg))
IV = Explicit IV used in the CBC encryption mode.
SessionKey = mutual symmetric AES-256 key established after the client successfully logged in to the Vault
PrevSeq = the previous sequence number that the client sent. Used for replay protection
CurrSeq = the sequence number of the current records. Used for replay protection
Msg = the payload itself (the record)
HmacKey = unidirectional HMAC key established after the client successfully logged in to the Vault
|| = Concatenation symbol
Note that the two sections (IV || AES_256_CBC) are identical, to show that the HMAC tag is on the entire payload that precedes it.
The reason that both the current sequence number and the previous one is sent is that the client may be working with the same session key in several threads, so there's no possibility to enforce a strictly increasing sequence number. Instead, both sides maintain a sliding window with the additional constraint that each record is only accepted and committed to the sliding window, if the previous message was also already accepted and committed. This mechanism ensures that no records were replayed, reordered or dropped by a MiTM.