From patchwork Thu Nov 5 09:37:12 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 5603 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:6022:30a9:b0:118:2077:975e with SMTP id f41csp1561449laa; Thu, 5 Nov 2026 01:37:35 -0800 (PST) X-Forwarded-Encrypted: i=2; AKwUvBwrTwIzQq2NdktWKfBLMHdczLJvaDhEZqlP1Hap0v7M+IjSgwpxE4ISCRXgZq90vTolwfJIW70FCzk=@openvpn.net X-Received: by 2002:a05:7022:1104:b0:19d:6484:869f with SMTP id a92af1059eb24-1ac5c369c59mr23801123c88.7.1793871455077; Thu, 05 Nov 2026 01:37:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1793871455; cv=none; d=google.com; s=arc-20260327; b=OfozqLcSx83kb16Cr0sEU1N4YjLeC6MmTdu1f8Z/RhF3JkFV2FNgqbEqCyPWHsxBqV hc7T1fkIUhbJ1+GfPrauy0Hoa/ZNujA7mrClU/fbfzogTXO7WIWrMdEsjNLEz4N4yIg3 Niy3ZBkgP+WL1HjL//47qkevVZozP1VtJNPQvT0vi22f9JtX/j98KSdopqmuAvsBArAM SiSN5p8uVXsbjg7C50nQSoywiHqyvLdsxwDxXIWIyQSbCH0VI4hQx1CHhqIUHRmw4vwD DNyZ2VRxMaZQ+x6GExxLqW9aTFlW+I6eU4xKpUDWPqeT3V5qw3E4IFR0nAfax3E8dXdr RMIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=errors-to:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:date:to:from :dkim-signature:dkim-signature:dkim-signature; bh=8msGQedw9chdpQkDLwEuQpxAx89iYrFDKNwldb4rbLs=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=rcCE18bYrfwWmEOZlqDTASxYgFqw+VwBo5ed3YdxAiy+Z2AkyMbhrtBrWBfAGI9BVb Ly/fL8s07tC9VT0t0B2/vK6Sfq8PQfe0p26LTAzaeT9nn1Y1TMafbCs1/UM694Y2PzAn VBAtAA9b+mkLDISgWVbEfQy5b5QTdRNSi3sJE35LvAfhH8bjWlOpSLAExPfymZxEpU0l 9gMJRQ+QvZk2vdggZdgIbEhaE+Rax1Ly59BLMtB+fmXXMXLTaCtelpHuu/bdcB8CsAK9 Jvy7OOaJ8s1DKaWWi7kRa265vnug2MR4bUYKbS3zGerOFpxNo/nFUXsTDTPJ8DNjNCCx x9yw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=Lb79qD77; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=CJmRAZeI; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=Scx6iQi7; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=muc.de Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id a92af1059eb24-1b245c27b41si12705067c88.30.2026.11.05.01.37.34 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Nov 2026 01:37:35 -0800 (PST) Received-SPF: pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) client-ip=216.105.38.7; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=Lb79qD77; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=CJmRAZeI; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=Scx6iQi7; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=muc.de DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.sourceforge.net; s=beta; h=Content-Transfer-Encoding:Content-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: Subject:MIME-Version:References:In-Reply-To:Message-ID:Date:To:From:Sender: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Unsubscribe-Post: List-Owner; bh=8msGQedw9chdpQkDLwEuQpxAx89iYrFDKNwldb4rbLs=; b=Lb79qD77cVuqq7 a9P68PGwk8HKBjSFAtH+bjND2ZRQnc0Ek/uwmqejWa+RegbOfYDEBu6QN2LEh85RsGXLfiClYoYKx zG7D6wKsbdo1yuTjQD+uhFvyLh5OB7IfU1+7ZK8ww79+a3nAuJSdsQaFD8PN66L9bSdkLGOuxvymK jxs=; Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.100.1) (envelope-from ) id 1xOtuV-000000001qB-2Y5S; Thu, 05 Nov 2026 09:37:31 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.100.1) (envelope-from ) id 1xOtuT-000000001q3-2lD1 for openvpn-devel@lists.sourceforge.net; Thu, 05 Nov 2026 09:37:29 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Unsubscribe-Post:List-Subscribe:List-Post:List-Owner:List-Archive; bh=rohbIsfYla/sJeVVJbSzgwdur/vRW/0q1c6vWfuzzfQ=; b=CJmRAZeI98h79zUDTNkRoN/Oo7 LHro78qjYG2C1C+NcWm/lqWL+S4PmKFKCqJHliwT6wNiC7hE2HnkFYC31LKm6VWyFe7RCrK8HLnOH l/20+E81bZOsq57Wr8aKgXyrpryzhWHLQU7uz5xjOyvrSa82XXO4foov2ju6jpSXPEJI=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID: Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Unsubscribe-Post: List-Subscribe:List-Post:List-Owner:List-Archive; bh=rohbIsfYla/sJeVVJbSzgwdur/vRW/0q1c6vWfuzzfQ=; b=Scx6iQi7P9FydbN4X52YEmcUYu 0fc7wpNY90G2P/xMXxyyrKCfgWDbIFGP3waTjXbmXOwE0J0fw//CnsN9kNd/DWwih9xrBoRA/XU/b 5S3COabLpcq1qKEgNWwzlN2U1eWfbRL4d4JMFDjtlpmBgjY/+RQlMlJSGHzw+egIvR58=; Received: from [193.149.48.129] (helo=blue.greenie.muc.de) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.100.1) id 1xOtuR-000000003k9-2fks for openvpn-devel@lists.sourceforge.net; Thu, 05 Nov 2026 09:37:29 +0000 Received: from blue.greenie.muc.de (localhost [127.0.0.1]) by blue.greenie.muc.de (8.18.1/8.18.1) with ESMTP id 6A59bK5t011797 for ; Thu, 5 Nov 2026 10:37:20 +0100 Received: (from gert@localhost) by blue.greenie.muc.de (8.18.2/8.18.1/Submit) id 6A59bKXY011796 for openvpn-devel@lists.sourceforge.net; Thu, 5 Nov 2026 10:37:20 +0100 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Thu, 5 Nov 2026 10:37:12 +0100 Message-ID: <20261105093720.11781-1-gert@greenie.muc.de> X-Mailer: git-send-email 2.55.0 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Score: 1.3 (+) X-Spam-Report: Spam detection software, running on the system "sfi-spamd-2.hosts.colo.sdot.me", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: Hansaem Wi 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() an [...] Content analysis details: (1.3 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 1.3 RDNS_NONE Delivered to internal network by a host with no rDNS X-Headers-End: 1xOtuR-000000003k9-2fks Subject: [Openvpn-devel] [PATCH v1] ssl: Wipe the key source material in key_state_free() X-BeenThere: openvpn-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox X-GMAIL-THRID: 1881010554874410785 X-GMAIL-MSGID: 1881010554874410785 From: Hansaem Wi 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 Acked-by: Steffan Karger 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 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);