From: Hansaem Wi <[email protected]> auth_token_init_secret() reads the auth-token server key into a 2048 byte buffer, copies it into a struct key on the stack, converts that into a struct key_parameters on the stack and frees the buffer with free_buf(), so all three copies of the key stay in memory. tls_crypt_v2_init_server_key() already wipes its struct key after init_key_ctx(); do the same here for the struct key and the struct key_parameters, and clear the buffer before freeing it.
Found by scanning freed heap blocks for the key from test_auth_token. Assisted-by: Claude Code:claude-opus-5-5 Change-Id: Ib5eb24b156acb5a99c614050fb1bd64fe46d8b52 Signed-off-by: Hansaem Wi <[email protected]> Acked-by: Steffan Karger <[email protected]> Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2076 --- This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master. Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2076 This mail reflects revision 2 of this Change. Acked-by according to Gerrit (reflected above): Steffan Karger <[email protected]> diff --git a/src/openvpn/auth_token.c b/src/openvpn/auth_token.c index 969f37f..84558af 100644 --- a/src/openvpn/auth_token.c +++ b/src/openvpn/auth_token.c @@ -172,6 +172,9 @@ key_parameters_from_key(&key_params, &key); init_key_ctx(key_ctx, &key_params, &kt, false, "auth-token secret"); + secure_memzero(&key, sizeof(key)); + secure_memzero(&key_params, sizeof(key_params)); + buf_clear(&server_secret_key); free_buf(&server_secret_key); } _______________________________________________ Openvpn-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openvpn-devel
