From: "cron2 (Code Review)" Date: Tue, 25 Nov 2025 09:02:13 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., selva.nair@...277..., openvpn-devel@lists.sourceforge.net, lstipakov@...277... Message-ID: <128bd44c75afc0b3563f428d6e4ccc2fe64ec6f6-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="6x5AlEiV0ek="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[release/2.6]: Restrict access to the service pipe to SYSTEM and owner List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: selvanair Cc: stipa , plaisthos , openvpn-devel --6x5AlEiV0ek= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/14= 02?usp=3Demail ) Change subject: Restrict access to the service pipe to SYSTEM and owner ...................................................................... Restrict access to the service pipe to SYSTEM and owner Access is restricted to SYSTEM and pipe client user (the user starting openvpn.exe). The default is full access to Administrtors, owner, and read access to everyone. This hardens the pipe further. Change-Id: I8aa1cf1585e2320fca9329bdd0227976606fe71e Signed-off-by: Selva Nair Acked-by: Gert Doering Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1402 Message-Id: <20251124183911.24851-1-gert@...1296...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34= 656.html Signed-off-by: Gert Doering --- M src/openvpnserv/interactive.c 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/openvpnserv/interactive.c b/src/openvpnserv/interactive.c index 2dc865e..275bf42 100644 --- a/src/openvpnserv/interactive.c +++ b/src/openvpnserv/interactive.c @@ -1975,10 +1975,26 @@ GetCurrentThreadId(), pipe_uuid_str); RpcStringFree(&pipe_uuid_str); + /* make a security descriptor for the named pipe with access + * restricted to the user and SYSTEM + */ + SECURITY_ATTRIBUTES sa; + PSECURITY_DESCRIPTOR pSD =3D NULL; + LPCWSTR szSDDL =3D L"D:(A;;GA;;;SY)(A;;GA;;;OW)"; + if (!ConvertStringSecurityDescriptorToSecurityDescriptorW( + szSDDL, SDDL_REVISION_1, &pSD, NULL)) + { + ReturnLastError(pipe, L"ConvertSDDL"); + goto out; + } + sa.nLength =3D sizeof(sa); + sa.lpSecurityDescriptor =3D pSD; + sa.bInheritHandle =3D FALSE; ovpn_pipe =3D CreateNamedPipe(ovpn_pipe_name, PIPE_ACCESS_DUPLEX | FILE_FLAG_FIRST_PIPE_= INSTANCE | FILE_FLAG_OVERLAPPED, PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE = | PIPE_WAIT | PIPE_REJECT_REMOTE_CLIENTS, - 1, 128, 128, 0, NULL); + 1, 128, 128, 0, &sa); + if (ovpn_pipe =3D=3D INVALID_HANDLE_VALUE) { ReturnLastError(pipe, L"CreateNamedPipe"); -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1402?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings?usp=3Demail Gerrit-MessageType: merged Gerrit-Project: openvpn Gerrit-Branch: release/2.6 Gerrit-Change-Id: I8aa1cf1585e2320fca9329bdd0227976606fe71e Gerrit-Change-Number: 1402 Gerrit-PatchSet: 2 Gerrit-Owner: selvanair Gerrit-Reviewer: cron2 Gerrit-Reviewer: plaisthos Gerrit-Reviewer: stipa Gerrit-CC: openvpn-devel --6x5AlEiV0ek= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 sub= mitted this change.

View Change

Restrict access to the service pipe to SYSTEM an=
d owner

Access is restricted to SYSTEM and pipe client user
(the = user starting openvpn.exe). The default is
full access to Administrtors,= owner, and read access
to everyone. This hardens the pipe further.
<= br>Change-Id: I8aa1cf1585e2320fca9329bdd0227976606fe71e
Signed-off-by: S= elva Nair <selva.nair@...277...>
Acked-by: Gert Doering <gert@...220...= ..1296...>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1402Message-Id: <20251124183911.24851-1-gert@...1296...>
URL: https:/= /www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34656.html
= Signed-off-by: Gert Doering <gert@...1296...>
---
M src/openvpn= serv/interactive.c
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/src/openvpnserv/interactive.c b/src/openvpnserv/interactive=
.c
index 2dc865e..275bf42 100644
--- a/src/= openvpnserv/interactive.c
+++ b/src/openvpnserv/interactive= .c
@@ -1975,10 +1975,26 @@
= GetCurrentThreadId(), pipe_uuid_str);
RpcStringF= ree(&pipe_uuid_str);

+ /* make a security descriptor for the named pipe= with access
+ * = restricted to the user and SYSTEM
+ */
+ SECURITY_ATTRIBUTES sa;
+ PSECURITY_DESCRIPTOR pSD =3D NULL;
+ LPCWSTR szSDDL =3D L"D:(A;;GA;;;SY)(A= ;;GA;;;OW)";
+ = if (!ConvertStringSecurityDescriptorToSecurityDescriptorW(
+ szSDDL, SDDL_REVISION_= 1, &pSD, NULL))
+= {
+ Return= LastError(pipe, L"ConvertSDDL");
+ goto out;
+ }
+ sa.nLength =3D sizeof(sa);
+ sa.lpSecurityDescriptor =3D pSD;
+ sa.bInheritHandle =3D FALSE;<= br> ovpn_pipe =3D CreateNamedPipe(ovpn_pipe_name,
PIPE_ACCESS_DUPLEX | FILE_FLAG_FIRST_PIPE= _INSTANCE | FILE_FLAG_OVERLAPPED,
= PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT | PIPE_REJECT= _REMOTE_CLIENTS,
- = 1, 128, 128, 0, NULL);
+ 1, 128, 128, = 0, &sa);
+=
if (ovpn_pipe =3D=3D INVALID_HANDLE_VALUE)
= {
ReturnLastError(pipe, L"CreateNamedPipe= ");

To view, visit change 1402. To uns= ubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: release/2.6
Gerrit-Change-Id: I8aa1cf1585e2320fca9329bdd02= 27976606fe71e
Gerrit-Change-Number: 1402
Gerrit-PatchSet: 2
Gerrit-Owner: selvanair <selva.nair@...1354...= ..>
Gerrit-Reviewer: cron2 <gert@...1296...>=
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-Reviewer: stipa <lstipakov@...277...= >
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
= --6x5AlEiV0ek=--