A critical security vulnerability, tracked under CVE-2023-4680, has been identified in HashiCorp Vault and Vault Enterprise transit secrets engine. This vulnerability affects the encrypt endpoint, potentially allowing authorized users to decrypt arbitrary ciphertext and derive the authentication subkey when using transit secrets engine without convergent encryption. This post will provide an in-depth overview of the CVE-2023-4680 vulnerability, including code snippets, links to original references, and exploit details.

Vulnerability Details

HashiCorp Vault and Vault Enterprise are popular tools for securely managing secrets, keys, and tokens. The transit secrets engine is a widely used component for handling cryptographic operations on in-transit data. This vulnerability was introduced in version 1.6. and fixed in versions 1.14.3, 1.13.7, and 1.12.11.

The key issue here is that the transit secrets engine allows authorized users to specify arbitrary nonces when encrypting data, even with convergent encryption disabled. This behaviour, combined with an offline attack, can lead to the decryption of arbitrary ciphertext and potentially derive the authentication subkey.

Here's a code snippet that demonstrates the use of the vulnerable encrypt endpoint

import hvac
v_client = hvac.Client(url="https://vault.example.com";, token="your_token_here")
data = {"plaintext": "dGhpcyBpcyBhIHNlY3JldCBtZXNzYWdl"}
nonce = "0123456789abcdef01234567"
ctxt = v_client.secrets.transit.encrypt_data(
    name="example_key",
    plaintext=data["plaintext"],
    nonce=nonce
)
print(ctxt)

Exploit details

An attacker with knowledge of the nonce can potentially decrypt arbitrary ciphertext and derive the authentication subkey. This can lead to unauthorized access to sensitive information and significant disruption to system security.

Mitigation

Users are advised to upgrade their HashiCorp Vault and Vault Enterprise installations to the latest patched versions (1.14.3, 1.13.7, or 1.12.11) as soon as possible. This will fix the vulnerability and prevent unauthorized decryption and derivation of authentication subkeys.

Original references

1. HashiCorp Security Bulletin - HCSEC-2023-21
2. GitHub Advisory - CVE-2023-4680
3. NVD - CVE-2023-4680

Conclusion

CVE-2023-4680 is a critical vulnerability that affects the HashiCorp Vault and Vault Enterprise transit secrets engine. Authorized users can exploit this vulnerability to decrypt arbitrary ciphertext and potentially derive the authentication subkey, leading to significant security risks. As mitigation, users should urgently upgrade their Vault installations to the latest patched versions and monitor for any potential compromise.

Timeline

Published on: 09/15/2023 00:15:00 UTC
Last modified on: 09/20/2023 14:55:00 UTC