| Message ID | 20260902121416.7047-1-gert@greenie.muc.de |
|---|---|
| State | New |
| Headers |
Return-Path: <openvpn-devel-bounces@lists.sourceforge.net>
Delivered-To: patchwork@openvpn.net
Received: by 2002:a05:7000:2190:b0:892:1b45:3040 with SMTP id s16csp588923mae;
Wed, 2 Sep 2026 05:14:30 -0700 (PDT)
X-Forwarded-Encrypted: i=2;
AKwUvByG5LULDL6dsafXGZ1NoJWo2i5JH+W+7wthjwKPG1Ne8WC3L+KYEG2rJpf+LGP6fUB9sJSHMX6zOVc=@openvpn.net
X-Received: by 2002:a05:6870:270:b0:46a:e87f:a7f3 with SMTP id
586e51a60fabf-46f88507af1mr3524649fac.2.1788351270623;
Wed, 02 Sep 2026 05:14:30 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1788351270; cv=none;
d=google.com; s=arc-20260327;
b=kTEPUMMJgSWTYZ5yLTBKkT/SDujjOTTu5j8TF3dSJloQDzxaz8kFL3TFJINuGBj7At
8aeLB4hk/km06t5scm80VVlA5QbpitTQInOx+a6EY3tV497FddsEC2cuqpWRc/Om7Vew
3LrJYgDZbR8H5EhjtgQCAix/0OHO7VJnqZjiXhPN30uo7NVFujKhJgoTH6ysW+h4849V
1U29dhC9H2IkIS88qM2PSaEhXfernGj5aYX44er0ybPix4gTKHwDK+XUJBJODhcTYhN1
MbkScONyIXQcIYJezTpMczrXJfSJ7Ym/aDCk8A9TNm/tG3fTt1pABOferWvcuJpInvWP
/Bbw==
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=4HIvmlRBNmS1rgdWLqAsvhytqit4bSqxkyRNc4i+Ilc=;
fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=;
b=pO0p+1VKtGVBHMC1K6jXQCEyjuoe4FW4kUr8rQM335TFLd3io6h7/6tkgbNTX/IyQK
WdU54ua1JxEHJsVE1H4JGzj3mkBhK+Fym/9BUQIU/sMWx6Opb2pPOixSoREds2Zjk+w9
7VouIcuJEfXE7vo5WgMudqZUR/XPb3snPxXo3clogodKM7nKivspuvkayG10VMNqiqG1
Yw2mX3yo2hVD8u7YuXF8uQbdSW2HixRT/u0R2cOikFT+Fc8PmYvgpQXQp/WfPcb4ab/T
I5dc/cCgoGicGPabFEnMbgsUKz0/iFivIBiALmjih1DqaGuboA4VM+BH1TP6M9d9IFNX
bssg==;
dara=google.com
ARC-Authentication-Results: i=1; mx.google.com;
dkim=pass header.i=@lists.sourceforge.net header.s=beta
header.b=W3r2uP1j;
dkim=neutral (body hash did not verify) header.i=@sourceforge.net
header.s=x header.b=W5gZlJNu;
dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x
header.b=Vh5e4MWH;
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
586e51a60fabf-46f332ab9a2si3625319fac.243.2026.09.02.05.14.30
(version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
Wed, 02 Sep 2026 05:14:30 -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=W3r2uP1j;
dkim=neutral (body hash did not verify) header.i=@sourceforge.net
header.s=x header.b=W5gZlJNu;
dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x
header.b=Vh5e4MWH;
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=4HIvmlRBNmS1rgdWLqAsvhytqit4bSqxkyRNc4i+Ilc=; b=W3r2uP1jRQLEyKS9ZKK9inQRrp
scl/gHKxpgWmVNih9G7Jq0CkPyj9haTZ+UqG9VMZToGmZj74/SayiqAezv+vBgRFyoVW8/Dxl+Hcr
rQRQwSxhtDDWRsytmkFqizMlNJGH+tC8jqQ4mBa0YzrQeeEMiS28ehk5uvHdCOp6cqaw=;
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.95)
(envelope-from <openvpn-devel-bounces@lists.sourceforge.net>)
id 1x1jrH-0001vh-Ff;
Wed, 02 Sep 2026 12:14:27 +0000
Received: from [172.30.29.66] (helo=mx.sourceforge.net)
by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLS1.2) tls
TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95)
(envelope-from <gert@blue4.greenie.muc.de>) id 1x1jrF-0001va-No
for openvpn-devel@lists.sourceforge.net;
Wed, 02 Sep 2026 12:14:25 +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=AtRgBiSWWZZZa5dW6vqtW2fyShZr4mSrFXog83NOaKM=; b=W5gZlJNuvwj8q237f5Mgw3/1qC
FnMJXu2raUmTfNn0xOqBEjblxTDnfdTGpkqFB1SxVl2xEVPj9Y3kuyqNPEk+CDobmSK0aSOi0Q0Hx
UvTsbqEKLJttY9viX7N8/AbnXs5FuSsZOk6O3CqydStc5AbU7LVwBVtLqmroiwi+CjRc=;
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=AtRgBiSWWZZZa5dW6vqtW2fyShZr4mSrFXog83NOaKM=; b=Vh5e4MWHBhi1aKZZ7w8bCXEr8m
aESzo+N7eoO35Fq6fcNYt+ebkNHVo1ygz+W1FKAg6TxcTWSoKweITLJSqt+cJpBIhW8hbwcZDw97l
TYayPP1HyK4A7OW5hmg4y3FIo1o6RhN+1fXQsWFhTysKITx10ognpIvmdU/0uFXySfSk=;
Received: from [193.149.48.129] (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 1x1jrD-0003Fm-VR for openvpn-devel@lists.sourceforge.net;
Wed, 02 Sep 2026 12:14:25 +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 682CEHGj007069
for <openvpn-devel@lists.sourceforge.net>; Wed, 2 Sep 2026 14:14:17 +0200
Received: (from gert@localhost)
by blue.greenie.muc.de (8.18.2/8.18.1/Submit) id 682CEHVB007068
for openvpn-devel@lists.sourceforge.net; Wed, 2 Sep 2026 14:14:17 +0200
From: Gert Doering <gert@greenie.muc.de>
To: openvpn-devel@lists.sourceforge.net
Date: Wed, 2 Sep 2026 14:14:09 +0200
Message-ID: <20260902121416.7047-1-gert@greenie.muc.de>
X-Mailer: git-send-email 2.53.0
In-Reply-To:
<gerrit.1788295708000.I68429deb39c0bae335d46a4170973a14c644ccf9@gerrit.openvpn.net>
References:
<gerrit.1788295708000.I68429deb39c0bae335d46a4170973a14c644ccf9@gerrit.openvpn.net>
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: Lev Stipakov <lev@openvpn.net> wide_cmd_line() only
quoted arguments containing a space, so & | < > ^ % ( ) and ! were passed
unquoted. CreateProcess() runs .bat and .cmd files through cmd.exe, which
parses the command line again, [...]
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: 1x1jrD-0003Fm-VR
Subject: [Openvpn-devel] [PATCH v1] win32: quote arguments that cmd.exe
would reinterpret
X-BeenThere: openvpn-devel@lists.sourceforge.net
X-Mailman-Version: 2.1.21
Precedence: list
List-Id: <openvpn-devel.lists.sourceforge.net>
List-Unsubscribe: <https://lists.sourceforge.net/lists/options/openvpn-devel>,
<mailto:openvpn-devel-request@lists.sourceforge.net?subject=unsubscribe>
List-Archive:
<http://sourceforge.net/mailarchive/forum.php?forum_name=openvpn-devel>
List-Post: <mailto:openvpn-devel@lists.sourceforge.net>
List-Help: <mailto:openvpn-devel-request@lists.sourceforge.net?subject=help>
List-Subscribe: <https://lists.sourceforge.net/lists/listinfo/openvpn-devel>,
<mailto:openvpn-devel-request@lists.sourceforge.net?subject=subscribe>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: openvpn-devel-bounces@lists.sourceforge.net
X-getmail-retrieved-from-mailbox: Inbox
X-GMAIL-THRID: 1875222222025539188
X-GMAIL-MSGID: 1875222222025539188
|
| Series |
[Openvpn-devel,v1] win32: quote arguments that cmd.exe would reinterpret
|
|
Commit Message
Gert Doering
Sept. 2, 2026, 12:14 p.m. UTC
From: Lev Stipakov <lev@openvpn.net> wide_cmd_line() only quoted arguments containing a space, so & | < > ^ % ( ) and ! were passed unquoted. CreateProcess() runs .bat and .cmd files through cmd.exe, which parses the command line again, so a certificate subject passed to --tls-verify could start a second command (CERT/CC VU#123335). Quote on those characters too. Double quotes are already replaced with '_', so nothing else needs escaping. The delimiters , ; and = are left out: cmd.exe uses them to separate %1..%9 but cannot run anything with them, and quoting them would change what existing scripts receive. GitHub: OpenVPN/openvpn-private-issues#159 Reported-By: Clouditera Security; Z.ai Security; NSFOCUS <security@clouditera.com> CVE: 2026-84256 Change-Id: I68429deb39c0bae335d46a4170973a14c644ccf9 Signed-off-by: Lev Stipakov <lev@openvpn.net> Acked-by: Heiko Hund <heiko@openvpn.net> Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1891 --- 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/+/1891 This mail reflects revision 1 of this Change. Acked-by according to Gerrit (reflected above): Heiko Hund <heiko@openvpn.net>
diff --git a/src/openvpn/win32.c b/src/openvpn/win32.c index 44b010d..d527160 100644 --- a/src/openvpn/win32.c +++ b/src/openvpn/win32.c @@ -936,6 +936,22 @@ } } +/* special to cmd.exe, which CreateProcess() uses to run .bat/.cmd (VU#123335) */ +#define CMD_QUOTE_TRIGGERS " &|<>^%()!" + +static bool +argv_element_needs_quotes(const char *str) +{ + for (const char *c = str; *c != '\0'; ++c) + { + if (strchr(CMD_QUOTE_TRIGGERS, *c) != NULL) + { + return true; + } + } + return false; +} + static WCHAR * wide_cmd_line(const struct argv *a, struct gc_arena *gc) { @@ -974,13 +990,13 @@ { buf_printf(&buf, " "); } - if (string_class(work, CC_ANY, CC_SPACE)) + if (argv_element_needs_quotes(work)) { - buf_printf(&buf, "%s", work); + buf_printf(&buf, "\"%s\"", work); } else { - buf_printf(&buf, "\"%s\"", work); + buf_printf(&buf, "%s", work); } }