From patchwork Thu Dec 15 19:01:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arne Schwabe X-Patchwork-Id: 2917 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7300:c95:b0:82:e4b3:40a0 with SMTP id p21csp631580dyk; Thu, 15 Dec 2022 11:02:16 -0800 (PST) X-Google-Smtp-Source: AA0mqf6ZCmN/ZCyG81o3I8pabAcFvgbT7o+7H4sv8yJeUjWh1mJT8nYvuWsQdOtT9NTUQqq/zC5f X-Received: by 2002:a67:b34a:0:b0:3b1:4d2f:b89a with SMTP id b10-20020a67b34a000000b003b14d2fb89amr13272589vsm.28.1671130935895; Thu, 15 Dec 2022 11:02:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671130935; cv=none; d=google.com; s=arc-20160816; b=a6YzAF4NOdLaYquIbH1WKpxf9epMcBBzcwjf3xn1PamF8Cr3NrYuvWyVPp+XoB4UoZ oJgx3Fkp+ilLX6AkDDn28hjZutXbCVEWsy9QSU4erZcEOxJNxLVe4PmjIXOyOHUxpoJp +WxB5d5iE6Amly9r86O5bLDi9FrHIxdNHPec791t5sUzrnV5qZMlvpkW5yTh9S8QZy9x GQ/Rm1Ty0sMqUOe4pugD6d8MoBDFLha6VtYKIjGRe0Dps12y49P6iLw/SWFN9LGcMTO0 3aoZySvLx9vkrJYjAJ9gVAuVkGn1fvqsCfkvvPm1qoLDfv+Wcod12TVD3m35veybwVg4 5ZvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:content-transfer-encoding:cc: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; bh=5n1MiM0YxTXxuHBPL1Kep/L7FPwftpA0n2Z+xJiaM1s=; b=LZPavVDoRxJu08luolc+q9TygVjpwkqarrl66I6+EzPH0peOgoCKMA7MlYh/zzCTr6 XRUP2IgyGBnLi2cV9ePscu2XO7a1iPLiJLF3/HSxqByYDTKB3v8LLX+Z0va4EfPHaoSt 4eSHw0KaStwWesRcGb4UmD13nINfAx3IHLGi0Ad9WzNuoIN64pnaTdK2R8NzSdDasesb uJ6nUkza6x/C+muyIHsGbrlt6MLzvRAxwijsc1R6yPzjmzgS2ax2/P/9ceazF5qZIxlc QUqDD/EmGG3OIeNctWEpFUEKR0xdp7SxzPGDh/w+7VfcSxF9i5QPGqlJPK+vWT5j4jyr 0pYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=a4GcN+gs; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=BJMS4CEW; 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 Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id h30-20020a67c19e000000b003aa20a29c59si2115411vsj.471.2022.12.15.11.02.15 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Dec 2022 11:02:15 -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=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=a4GcN+gs; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=BJMS4CEW; 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 Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1p5tUX-00011D-D3; Thu, 15 Dec 2022 19:02:01 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1p5tUS-00010t-EJ for openvpn-devel@lists.sourceforge.net; Thu, 15 Dec 2022 19:01:56 +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:Cc:To:From:Sender:Reply-To: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-Subscribe:List-Post:List-Owner:List-Archive; bh=SmEXbIhKlZCGnKFo9oqFHaxkU026cJ/6XWdHVGqLdtk=; b=a4GcN+gskgZOY3uyArX6Fjal4D cRfwjjOD3IDOOSfMj9UJ+iqxgErc78J5oJW9zo6Kfr/+i3hI93PNoLzMnirUCoQ2hZ9GTvpjsbypU H0aN3oorca46Ml8LCv/ZqtV/sd0K6w8mTgjJnysGYlJCooBHnKynsCpVGKSRDGss38PQ=; 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:Cc:To:From:Sender:Reply-To: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-Subscribe: List-Post:List-Owner:List-Archive; bh=SmEXbIhKlZCGnKFo9oqFHaxkU026cJ/6XWdHVGqLdtk=; b=BJMS4CEWM3aOa9NLHm5PrAe872 kEvX+8usRn129aj4ExQzPFQcS9RYX0AxeuLBM6+kmEV4Xqxk0BdthM8N0jRlFVRop2lD9KXihhL9v 27B7ytEz9u9IrI89aWwWhPqWhxRyWro7Nmb0txA7E0qfvqd95EXmLqB5JEGiqchSdghc=; Received: from mail.blinkt.de ([192.26.174.232]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1p5tUR-000hyo-Ts for openvpn-devel@lists.sourceforge.net; Thu, 15 Dec 2022 19:01:56 +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 1p5tUF-000Kvw-8x; Thu, 15 Dec 2022 20:01:43 +0100 Received: (nullmailer pid 2107945 invoked by uid 10006); Thu, 15 Dec 2022 19:01:43 -0000 From: Arne Schwabe To: openvpn-devel@lists.sourceforge.net Date: Thu, 15 Dec 2022 20:01:36 +0100 Message-Id: <20221215190143.2107896-2-arne@rfc2549.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221215190143.2107896-1-arne@rfc2549.org> References: <20221215190143.2107896-1-arne@rfc2549.org> MIME-Version: 1.0 X-Spam-Score: 0.3 (/) 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 changes the password check on the management interface to be constant time. Normally the management port should not be exposed in a way that allows an attacker to even interact with it but making [...] Content analysis details: (0.3 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 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 X-Headers-End: 1p5tUR-000hyo-Ts Subject: [Openvpn-devel] [PATCH 1/8] Make management password check constant time 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: Connor Edwards Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox X-GMAIL-THRID: =?utf-8?q?1752307792184075091?= X-GMAIL-MSGID: =?utf-8?q?1752307792184075091?= This changes the password check on the management interface to be constant time. Normally the management port should not be exposed in a way that allows an attacker to even interact with it but making the check constant time as an additional layer of security is always good. Reported-by: Connor Edwards Signed-off-by: Arne Schwabe --- src/openvpn/manage.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/openvpn/manage.c b/src/openvpn/manage.c index 9349b62ad..d952618e7 100644 --- a/src/openvpn/manage.c +++ b/src/openvpn/manage.c @@ -198,7 +198,11 @@ man_check_password(struct management *man, const char *line) { if (man_password_needed(man)) { - if (streq(line, man->settings.up.password)) + /* This comparison is not fixed time but since strlen(time) is based on + * the attacker choice, it should not give any indication of the real + * password length */ + if (memcmp_constant_time(line, man->settings.up.password, + min_uint(strlen(line), sizeof(man->settings.up.password))) == 0) { man->connection.password_verified = true; msg(M_CLIENT, "SUCCESS: password is correct");