Gert Doering has submitted this change. ( 
https://gerrit.openvpn.net/c/openvpn/+/2076?usp=email )

Change subject: auth_token: Wipe the server secret key after loading it
......................................................................

auth_token: Wipe the server secret key after loading it

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
Message-Id: <[email protected]>
URL: 
https://www.mail-archive.com/[email protected]/msg40478.html
Signed-off-by: Gert Doering <[email protected]>
---
M src/openvpn/auth_token.c
1 file changed, 3 insertions(+), 0 deletions(-)




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);
 }


--
To view, visit https://gerrit.openvpn.net/c/openvpn/+/2076?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib5eb24b156acb5a99c614050fb1bd64fe46d8b52
Gerrit-Change-Number: 2076
Gerrit-PatchSet: 3
Gerrit-Owner: Hansaem Wi <[email protected]>
Gerrit-Reviewer: Arne Schwabe <[email protected]>
Gerrit-Reviewer: Gert Doering <[email protected]>
Gerrit-Reviewer: Steffan Karger <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to