From: Razvan Cojocaru <[email protected]> generate_auth_token() freed the previous token and its intermediate copies without wiping them, unlike wipe_auth_token(). crypto_pem_decode() in the mbed TLS backend freed its copy of the PEM key text the same way.
Change-Id: I9d9b658a00f95ffdcd0db9abd0d8907618925746 Signed-off-by: Razvan Cojocaru <[email protected]> Acked-by: Frank Lichtenheld <[email protected]> Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2206 --- 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/+/2206 This mail reflects revision 2 of this Change. Acked-by according to Gerrit (reflected above): Frank Lichtenheld <[email protected]> diff --git a/src/openvpn/auth_token.c b/src/openvpn/auth_token.c index 261c7c2..d8e599b 100644 --- a/src/openvpn/auth_token.c +++ b/src/openvpn/auth_token.c @@ -271,10 +271,15 @@ ASSERT(buf_write(&session_token, b64output, strlen(b64output))); ASSERT(buf_write_u8(&session_token, 0)); + secure_memzero(b64output, strlen(b64output)); free(b64output); /* free the auth-token if defined, we will replace it with a new one */ - free(multi->auth_token); + if (multi->auth_token) + { + secure_memzero(multi->auth_token, strlen(multi->auth_token)); + free(multi->auth_token); + } multi->auth_token = string_alloc((char *)BPTR(&session_token), NULL); dmsg(D_SHOW_KEYS, "Generated token for client: %s (%s)", multi->auth_token, up->username); @@ -288,6 +293,8 @@ multi->auth_token_initial = string_alloc(multi->auth_token, NULL); } + buf_clear(&token); + buf_clear(&session_token); gc_free(&gc); } diff --git a/src/openvpn/crypto_mbedtls.c b/src/openvpn/crypto_mbedtls.c index ceaaad4..58c1fd2 100644 --- a/src/openvpn/crypto_mbedtls.c +++ b/src/openvpn/crypto_mbedtls.c @@ -1150,6 +1150,7 @@ } mbedtls_pem_free(&ctx); + buf_clear(&input); gc_free(&gc); return ret; } _______________________________________________ Openvpn-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openvpn-devel
