From: Hansaem Wi <[email protected]> ks->key_src holds the pre_master and random values that the peers exchange in key method 2. It is wiped after the data channel keys have been generated and on the error paths of key_method_2_read() and key_method_2_write(). When a key state is freed before the keys are generated, for example because an --auth-user-pass-verify script or a client-connect script rejects the client, key_state_free() frees it with plain free() and the key material stays in freed memory, on the server and on the client.
Wipe it with secure_memzero() before freeing it. Assisted-by: Claude Code:claude-opus-5-5 Change-Id: I4d35f54402460c5866aeba26216ac1b2d2f8ebdc Signed-off-by: Hansaem Wi <[email protected]> Acked-by: Steffan Karger <[email protected]> Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2075 --- 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/+/2075 This mail reflects revision 1 of this Change. Acked-by according to Gerrit (reflected above): Steffan Karger <[email protected]> diff --git a/src/openvpn/ssl.c b/src/openvpn/ssl.c index 086a6fc..eef8e7d 100644 --- a/src/openvpn/ssl.c +++ b/src/openvpn/ssl.c @@ -934,6 +934,10 @@ free(ks->rec_ack); free(ks->lru_acks); + if (ks->key_src) + { + secure_memzero(ks->key_src, sizeof(*ks->key_src)); + } free(ks->key_src); packet_id_free(&ks->crypto_options.packet_id); _______________________________________________ Openvpn-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openvpn-devel
