From patchwork Mon Apr 13 05:56:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lev Stipakov X-Patchwork-Id: 1077 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director9.mail.ord1d.rsapps.net ([172.31.255.6]) by backend30.mail.ord1d.rsapps.net with LMTP id 4OLhFCGMlF6uAQAAIUCqbw for ; Mon, 13 Apr 2020 11:58:25 -0400 Received: from proxy19.mail.iad3b.rsapps.net ([172.31.255.6]) by director9.mail.ord1d.rsapps.net with LMTP id 4OlaEiGMlF7iFgAAalYnBA ; Mon, 13 Apr 2020 11:58:25 -0400 Received: from smtp1.gate.iad3b ([172.31.255.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy19.mail.iad3b.rsapps.net with LMTP id 4ImODCGMlF6UJQAAIG4riQ ; Mon, 13 Apr 2020 11:58:25 -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: smtp1.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; dkim=fail (signature verification failed) header.d=gmail.com; dmarc=fail (p=none; dis=none) header.from=gmail.com X-Suspicious-Flag: YES X-Classification-ID: 9ae1efd0-7d9f-11ea-bed7-5254008fd675-1-1 Received: from [216.105.38.7] ([216.105.38.7:33376] helo=lists.sourceforge.net) by smtp1.gate.iad3b.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 41/CF-14159-02C849E5; Mon, 13 Apr 2020 11:58:24 -0400 Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.90_1) (envelope-from ) id 1jO1SZ-0002JC-76; Mon, 13 Apr 2020 15:57:19 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jO1SX-0002J4-Ds for openvpn-devel@lists.sourceforge.net; Mon, 13 Apr 2020 15:57:17 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: MIME-Version:Content-Type:Content-Transfer-Encoding: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=WLHSpFqIAMOf2EWZAmC1/sdHoqBpTrdxbZ/8t9I8pcg=; b=gmH+WUixeBkCctOisrUpHjqq1H iE70kgOSfk7eLr/sirul0gJIETtxMJihcN3B9CdnQylgAyRA0t2iQIRI+UGl/gGNnu4kDvJpqcv94 xBf9BdQ8RnsAvLIbvNDOc5uIn59IhFyhHbkhAmDA6FHixrKehLdTc8YYbOaIgo1LqgGU=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version: Content-Type:Content-Transfer-Encoding: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=WLHSpFqIAMOf2EWZAmC1/sdHoqBpTrdxbZ/8t9I8pcg=; b=dk4ggGnKjywH86FdBWm5Zg5bfm 3iTznZNLeVMuvQheXn8it5pNyhJ4rdyHDYHOl2FtJtIH9uVa24wLD5R3j2tHzWiEIRlRH1JBmB/7y vPCCrol5biclcJ0U88GYT/dm5AKNTYqFpiVzrgvHheJw+k2K4plUMDfzXqLC5XZ+eerk=; Received: from mail-lf1-f47.google.com ([209.85.167.47]) by sfi-mx-4.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.92.2) id 1jO1SS-00HPX3-Od for openvpn-devel@lists.sourceforge.net; Mon, 13 Apr 2020 15:57:17 +0000 Received: by mail-lf1-f47.google.com with SMTP id 131so6884027lfh.11 for ; Mon, 13 Apr 2020 08:57:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=WLHSpFqIAMOf2EWZAmC1/sdHoqBpTrdxbZ/8t9I8pcg=; b=BII9QYHf27LWQyKMfcpT4HNaMyMvz9dy+uIfYVHvA8X8VCypUwxU/YCovM1z1tHOn7 6ZeVpA0BfARKx8KDsNTbcfb1y8AGqbbJR9tLg5CxI2lYUpfLK/aMqXsAkmnbp+1p0VBH Az8amzmKzdhWdwjDq7NwKy1JzRjNUt1GH3WD/XonXR6P+HnR9lBc55khdt1MwMJyMXAZ GEkYnAu7U4RgIng06hzss5qzc/7HMzzbZkjaVfZXY9zXsMaoVZxTYGUTT5GeId2wt72f dmei2H6qyGmutsX4k7YgO1+Q1Se14VPb0vvwm+mIs1LnGNg0mkxX6Aj8VWits3Ut312F YTLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=WLHSpFqIAMOf2EWZAmC1/sdHoqBpTrdxbZ/8t9I8pcg=; b=aMcCT1y66jKi0A//6Zwg4o+dgDcaGA0K6wEVdFbAdBIp7Xn9qyD+OSuoOh22sL1x/c ZEpiXZqBw2WoCnMLNQlgfwdQx6SQ5QC6JmgVAWkyut38uZpNPGGbkmg7yasnYXkIofRX Usy4NfOsAhmEyvR5n00atrZ7YxJ1boYQHFCkyS+oAyHZ4gA9qwKBZ2VcrHRng+bly1SZ KBImdmNKOcmca+JAqOPJD5YFJ6X0G8BfR6/wadnEBECCXlU70GGgGlDmls4KVrXvbCGG oa3UVRtdR0OE5DjNRSH8wpTMKDMChh8nd1LR7bjmRxjVhex31/LYJU5yI5EUEraRtho0 hWhg== X-Gm-Message-State: AGi0Puas+QzgpocCOoy5tD7Xki8vLAenwjohpUbM49An7ch0+0UO9Qud nZ9bUZIX5oSojNM3+9O6QyilMiwbiMU= X-Google-Smtp-Source: APiQypIiz+SmxeVjSIZHx9OATm021n8pAESH5hMPBE6+eH6/1zlOwUUiBjXMemmCg6l3HzfPxog73A== X-Received: by 2002:ac2:4466:: with SMTP id y6mr10942105lfl.125.1586793425458; Mon, 13 Apr 2020 08:57:05 -0700 (PDT) Received: from LAPTOP-4L3N7KFS.localdomain (81-175-130-136.bb.dnainternet.fi. [81.175.130.136]) by smtp.gmail.com with ESMTPSA id p23sm8266727lfc.95.2020.04.13.08.57.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Apr 2020 08:57:04 -0700 (PDT) From: Lev Stipakov To: openvpn-devel@lists.sourceforge.net Date: Mon, 13 Apr 2020 18:56:50 +0300 Message-Id: <20200413155650.114-1-lstipakov@gmail.com> X-Mailer: git-send-email 2.17.1 X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (lstipakov[at]gmail.com) -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.167.47 listed in list.dnswl.org] -0.8 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.167.47 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-Headers-End: 1jO1SS-00HPX3-Od Subject: [Openvpn-devel] [PATCH] Fix illegal client float 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: , Cc: Lev Stipakov MIME-Version: 1.0 Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox From: Lev Stipakov There is a time frame between allocating peer-id and initializing data channel key, which is performed on receiving push request. If a "rogue" data channel packet arrives during that time frame from another address and with same peer-id, this would cause client to float to that new address. This is because: - tls_pre_decrypt() sets buffer length to zero if data channel key has not been initialized, which leads to - openvpn_decrypt() returns true if buffer length is zero, which leads to - process_incoming_link_part1() returns true, which calls multi_process_float(), which commits float Note that problem doesn't happen when data channel key is initialized, since in this case openvpn_decrypt() returns false. Fix illegal float by adding buffer length check before calling multi_process_float(). This should fix Trac #1272. Signed-off-by: Lev Stipakov --- src/openvpn/multi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/openvpn/multi.c b/src/openvpn/multi.c index da0aeeba..58892a87 100644 --- a/src/openvpn/multi.c +++ b/src/openvpn/multi.c @@ -2555,7 +2555,7 @@ multi_process_incoming_link(struct multi_context *m, struct multi_instance *inst orig_buf = c->c2.buf.data; if (process_incoming_link_part1(c, lsi, floated)) { - if (floated) + if (floated && c->c2.buf.len > 0) { multi_process_float(m, m->pending); }