From patchwork Thu Oct 30 19:43:56 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 4553 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7001:2f13:b0:72f:f16c:e055 with SMTP id sa19csp1159188mab; Thu, 30 Oct 2025 12:44:17 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU3CfbaVw3FyPVAWKUb1HAj/lXMq5UQl7Dk0uR0Z8X4uBzOs923OXyBEc32MRUmLunVZBY2G4+UIcw=@openvpn.net X-Google-Smtp-Source: AGHT+IFgVT7mplMKAmn8XMr6/SNdReKLGg7XdVCWhreGNhyne7fRH/hR2zTKW85ya6449L9SlT2J X-Received: by 2002:a05:6602:1650:b0:945:ab4c:4eb7 with SMTP id ca18e2360f4ac-948229bdb50mr192044239f.19.1761853457521; Thu, 30 Oct 2025 12:44:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1761853457; cv=none; d=google.com; s=arc-20240605; b=atSWwyQqRs1ACUisvOJEDqg9TCRffqxpo/nzWrLsyTwO9ywup48q3Rp/s50iXyoxzD AHA6QmGS0GQ/KBzC383uGB+sNk+Q71sakp7q9NJuywaz/ch5C8QQSWeidnTTG9+fhT34 3WGWJIJB5JVsyOGwbJSqPBezgVAjqd9W7htvVnEBXw7yuA8LDfXZaRFRfZKRok1IHlAA GS2wFiHFXXA1a+cb337N8Qldbhkc/I3OzEH4MeHQ2/s+CdUemSKcld3wONBteQfoEPeN 2o2JKvRTnBg2bB8sgABUx3Fvyk7ndBZc7CyZGKDd3gDfBf9QTK2rtPVZ5KhX8lSNoUFh Cl5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=n90+T70BQwe0sI1Zlv5HX1fVDN4FAS1WI0oPcZ+Jb4k=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=HEZ6u6yAi/UjfoNRdZkVkXIiJdAtmodWrS4To1MAUKcX7izow+f9F21XDukPhjrBFN Wmx1q1kCmbboIQSJvy+5RsIs5AsuRHAqv8AS2FZ0WAJ97+AUL+Haqdh0C8SyS9xXvxdd vc3j+QAU0kBLpQFdTgBTFFTmYhrSqfBZUbDT6vCuzvhvM/4Hd7idSEVp0qo1mv+FtznE a9+rrgu7ZY+hTxEzIuoA3LHkxjvK3ZVdMm+kblzUWhQVzWZoPrl+RjTFeTLFcIZYWGNE F0soE21OcWy6PsleIYwnOUOziA9ttd5GLV6sHsUq/KRHFuNMngLm/LNLfkWgJ0sUGIuv NbKg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=hePFwbTK; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b="EVBlZV/J"; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=cs74rNNz; 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 8926c6da1cb9f-5aec88f3a9asi12217530173.158.2025.10.30.12.44.17 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Oct 2025 12:44:17 -0700 (PDT) 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=hePFwbTK; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b="EVBlZV/J"; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=cs74rNNz; 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-Owner; bh=n90+T70BQwe0sI1Zlv5HX1fVDN4FAS1WI0oPcZ+Jb4k=; b=hePFwbTKK9tafD+IXu25Nu1/8X /nsben4ThxekBda6ttXD4/Gt0Vwa0e6P/yZUxaNWgZuEJlQ75kFx8fqV9qL5npKJ5d1XrqUXFaCjc 0/HH0PMao1+cT3rK4MXBNKNv4N9QYsv7UZ1O+Vo8l8i2kiiuq+7cDSpRglyLDTe+q6fc=; Received: from [127.0.0.1] (helo=sfs-ml-3.v29.lw.sourceforge.com) by sfs-ml-3.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1vEYZD-0001aq-Jw; Thu, 30 Oct 2025 19:44:15 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-3.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1vEYZC-0001ah-R0 for openvpn-devel@lists.sourceforge.net; Thu, 30 Oct 2025 19:44:14 +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-Subscribe:List-Post:List-Owner:List-Archive; bh=6SUlcRk6zucvW15AP52sHvlJV/XsJdi8Rccex9fOhJs=; b=EVBlZV/J5npH2bwkj2EFruGXzo tb7njb5l+QQApAYR3a2zqMV15o+t/4t0ieUl3YPGH5AA6pvvm1KR+7OoLhbIW1CzCzPa5ENy3lrh6 wCzf3MJPdBKmMQlMbhuYRQtn/WClSb/QRj8Zm2QvyKF4vHys1vfMxf+z9vDwSU/hIVCs=; 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-Subscribe: List-Post:List-Owner:List-Archive; bh=6SUlcRk6zucvW15AP52sHvlJV/XsJdi8Rccex9fOhJs=; b=cs74rNNzU5VuEaNIHbKmyOb0Nv Ot+V3BJ3K2PhIxBzYcuaWujYFkL9j2Ct6drgdccLxJ2VxXFKgylUR3jhWiC3T5g8p4H2fnFeGRA/y IIEDYT7dIiBtr0fO8M5wNINV6OHpx6Ph1I4mvodmcmmTRD/eM9I8JTP9aW4NxLpOKm7Y=; Received: from [193.149.48.134] (helo=blue.greenie.muc.de) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1vEYZB-0001RU-Tj for openvpn-devel@lists.sourceforge.net; Thu, 30 Oct 2025 19:44:14 +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 59UJi2cg001746 for ; Thu, 30 Oct 2025 20:44:02 +0100 Received: (from gert@localhost) by blue.greenie.muc.de (8.18.1/8.18.1/Submit) id 59UJi2G9001745 for openvpn-devel@lists.sourceforge.net; Thu, 30 Oct 2025 20:44:02 +0100 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Thu, 30 Oct 2025 20:43:56 +0100 Message-ID: <20251030194402.1729-1-gert@greenie.muc.de> X-Mailer: git-send-email 2.49.1 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-1.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: Arne Schwabe The username environment variable is already set by the set_verify_user_pass_env function before the verify_user_pass_script function is called, so this call is not doing anything but might erroneousl [...] 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: 1vEYZB-0001RU-Tj Subject: [Openvpn-devel] [PATCH v1] clean up environment variable handling in verify_user_pass_script 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: =?utf-8?q?1847437251083061650?= X-GMAIL-MSGID: =?utf-8?q?1847437251083061650?= From: Arne Schwabe The username environment variable is already set by the set_verify_user_pass_env function before the verify_user_pass_script function is called, so this call is not doing anything but might erroneously made people think that this needs to be cleaned up. Also ensure that the password is clean from the env even in an error case. Reported-by: Joshua Rogers Found-by: ZeroPath (https://zeropath.com/) Change-Id: I6c502508026c6b85bb092ada4d16d985b20dd41f Signed-off-by: Arne Schwabe Acked-by: Gert Doering Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1326 --- 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/+/1326 This mail reflects revision 1 of this Change. Signed-off-by line for the author was added as per our policy. Acked-by according to Gerrit (reflected above): Gert Doering diff --git a/src/openvpn/ssl_verify.c b/src/openvpn/ssl_verify.c index 04ef27e..993d22c 100644 --- a/src/openvpn/ssl_verify.c +++ b/src/openvpn/ssl_verify.c @@ -1329,7 +1329,7 @@ } else { - setenv_str(session->opt->es, "username", up->username); + /* username env is already set by set_verify_user_pass_env */ setenv_str(session->opt->es, "password", up->password); } @@ -1377,10 +1377,6 @@ /* purge auth control filename (and file itself) for non-deferred returns */ key_state_rm_auth_control_files(&ks->script_auth); } - if (!session->opt->auth_user_pass_verify_script_via_file) - { - setenv_del(session->opt->es, "password"); - } done: if (tmp_file && strlen(tmp_file) > 0) @@ -1389,6 +1385,11 @@ } error: + if (!session->opt->auth_user_pass_verify_script_via_file) + { + setenv_del(session->opt->es, "password"); + } + argv_free(&argv); gc_free(&gc); return retval;