From patchwork Fri Sep 9 09:59:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arne Schwabe X-Patchwork-Id: 2746 X-Patchwork-Delegate: heiko@ist.eigentlich.net Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director12.mail.ord1d.rsapps.net ([172.31.255.6]) by backend30.mail.ord1d.rsapps.net with LMTP id AKi4MD2bG2PSSQAAIUCqbw (envelope-from ) for ; Fri, 09 Sep 2022 15:59:57 -0400 Received: from proxy17.mail.iad3b.rsapps.net ([172.31.255.6]) by director12.mail.ord1d.rsapps.net with LMTP id IO5mMD2bG2OhNAAAIasKDg (envelope-from ) for ; Fri, 09 Sep 2022 15:59:57 -0400 Received: from smtp23.gate.iad3b ([172.31.255.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy17.mail.iad3b.rsapps.net with LMTPS id 8HccKz2bG2MWfgAA5ccGVQ (envelope-from ) for ; Fri, 09 Sep 2022 15:59:57 -0400 X-Spam-Threshold: 95 X-Spam-Score: 0 X-Spam-Flag: NO X-Virus-Scanned: OK X-Orig-To: openvpnslackdevel@openvpn.net X-Originating-Ip: [216.105.38.7] Authentication-Results: smtp23.gate.iad3b.rsapps.net; iprev=pass policy.iprev="216.105.38.7"; spf=pass smtp.mailfrom="openvpn-devel-bounces@lists.sourceforge.net" smtp.helo="lists.sourceforge.net"; dkim=fail (signature verification failed) header.d=sourceforge.net; dkim=fail (signature verification failed) header.d=sf.net; dmarc=none (p=nil; dis=none) header.from=rfc2549.org X-Suspicious-Flag: YES X-Classification-ID: f9d4f32c-3079-11ed-90b5-525400aa5716-1-1 Received: from [216.105.38.7] ([216.105.38.7:44062] helo=lists.sourceforge.net) by smtp23.gate.iad3b.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id DB/10-22300-C3B9B136; Fri, 09 Sep 2022 15:59:57 -0400 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.95) (envelope-from ) id 1oWk9p-00024d-Tp; Fri, 09 Sep 2022 19:59:21 +0000 Received: from [172.30.20.202] (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.95) (envelope-from ) id 1oWk9o-00024W-BN for openvpn-devel@lists.sourceforge.net; Fri, 09 Sep 2022 19:59:20 +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: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:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=meMer5upGID1TKsLb+NZGB9Nn83PEG8P/K6ZbOJfNxc=; b=YexNRcTTcWIDxv1kdpYx1XMZr0 gNfxVZgvjLeF0Bd2U8aRi6Lc05feWBIq3ENfLXl53NUnptEY29x7RNCn155XPO4+qpR38Ri7vHaDv Mt91lcxO7OXlBmgNYwmBXIXIyJ7VaPTMNi6JAHM7xVurfc94fUw1ot2dgt4LRzq+mcRQ=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version: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:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=meMer5upGID1TKsLb+NZGB9Nn83PEG8P/K6ZbOJfNxc=; b=Z D2UwlrkcwkPDvDntLmnWZNi29zDzFF+Oy2fM636GoQHYi2y3HGg+iMenSDkJLILo2fEz25xtoQ2sC BDZFXGU+51mWm0uEGXw07jyMIRtylR5rFZ7JlFg1K7AlAH41bkpPqLVMaW+3yBHNArNpi3VUDY5ZN JIdnQcDyUjaYwdjY=; Received: from mail.blinkt.de ([192.26.174.232]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1oWk9n-0002pB-PK for openvpn-devel@lists.sourceforge.net; Fri, 09 Sep 2022 19:59:20 +0000 Received: from kamera.blinkt.de ([2001:638:502:390:20c:29ff:fec8:535c]) by mail.blinkt.de with smtp (Exim 4.95 (FreeBSD)) (envelope-from ) id 1oWk9W-000IjN-QC for openvpn-devel@lists.sourceforge.net; Fri, 09 Sep 2022 21:59:02 +0200 Received: (nullmailer pid 2011844 invoked by uid 10006); Fri, 09 Sep 2022 19:59:02 -0000 From: Arne Schwabe To: openvpn-devel@lists.sourceforge.net Date: Fri, 9 Sep 2022 21:59:00 +0200 Message-Id: <20220909195902.2011798-1-arne@rfc2549.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Spam-Report: Spam detection software, running on the system "util-spamd-1.v13.lw.sourceforge.com", 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: This change makes the state machine more strict in terms of transation that are allowed. The benefit of this change are two: - allows any option that might be pushed to affect renegotiation consistently This is a prerequisite for the upcoming secure renegotiation patch set - avoids corner cases of a peer (or an attacker) t [...] Content analysis details: (0.3 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 SPF_NONE SPF: sender does not publish an SPF Record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record X-Headers-End: 1oWk9n-0002pB-PK Subject: [Openvpn-devel] [PATCH 1/3] Allows renegotiation only to start if session is fully established 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 This change makes the state machine more strict in terms of transation that are allowed. The benefit of this change are two: - allows any option that might be pushed to affect renegotiation consistently This is a prerequisite for the upcoming secure renegotiation patch set - avoids corner cases of a peer (or an attacker) trying to renegotiate the session while the original session is not fully setup. Currently there there are no problems known with this but it is better to avoid the corner case in the first time. Signed-off-by: Arne Schwabe Acked-by: Heiko Hund --- src/openvpn/ssl.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/openvpn/ssl.c b/src/openvpn/ssl.c index 002871288..36a236fe3 100644 --- a/src/openvpn/ssl.c +++ b/src/openvpn/ssl.c @@ -3011,7 +3011,7 @@ tls_process(struct tls_multi *multi, ASSERT(session_id_defined(&session->session_id)); /* Should we trigger a soft reset? -- new key, keeps old key for a while */ - if (ks->state >= S_ACTIVE + if (ks->state >= S_GENERATED_KEYS && ((session->opt->renegotiate_seconds && now >= ks->established + session->opt->renegotiate_seconds) || (session->opt->renegotiate_bytes > 0 @@ -3733,9 +3733,11 @@ tls_pre_decrypt(struct tls_multi *multi, } /* - * Remote is requesting a key renegotiation + * Remote is requesting a key renegotiation. We only allow renegotiation + * when the previous session is fully established to avoid weird corner + * cases. */ - if (op == P_CONTROL_SOFT_RESET_V1 && TLS_AUTHENTICATED(multi, ks)) + if (op == P_CONTROL_SOFT_RESET_V1 && ks->state >= S_GENERATED_KEYS) { if (!read_control_auth(buf, &session->tls_wrap, from, session->opt))