Skip to contentSkip to conversation

Change in openvpn[master]: openvpnserv: validate opevnvpn-gui process path

Openvpn-devel stipa (Code Review) 4 participants 8 messages Oct 30, 2025 – Nov 8, 2025 2 messages not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos.

Hello plaisthos, flichtenheld,

I'd like you to do a code review.
Please visit

    http://gerrit.openvpn.net/c/openvpn/+/1333?usp=email

to review the following change.

Change subject: openvpnserv: validate opevnvpn-gui process path
......................................................................

openvpnserv: validate opevnvpn-gui process path

Ensure that the service pipe client process (which is openvpn-gui) is from openvpn binary directory, defined in registry. This limits unauthorized connections to the service pipe.

Change-Id Ie990f4dd10094810d6632f8dedfa261727ebfbcb

---
M src/openvpnserv/interactive.c
M src/openvpnserv/validate.c
M src/openvpnserv/validate.h

3 files changed, 55 insertions(+), 0 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/33/1333/1

src/openvpnserv/interactive.c +6 -0
index ce0d4dd..f4b3311 100644
@@ -3275,6 +3275,12 @@
     ZeroMemory(&undo_lists, sizeof(undo_lists));
     ZeroMemory(&proc_info, sizeof(proc_info));
 
+    if (!ValidateServicePipeClient(pipe, &settings))
+    {
+        ReturnError(pipe, ERROR_ACCESS_DENIED, L"ValidateServicePipeClient", 1, &exit_event);
+        goto out;
+    }
+
     if (!GetStartupData(pipe, &sud))
     {
         goto out;
src/openvpnserv/validate.c +45 -0

48 lines not on this page · raw message

src/openvpnserv/validate.h +4 -0
index 6f3bf09..495902d 100644
@@ -49,4 +49,8 @@
     return (wcsncmp(o, L"--", 2) == 0);
 }
 
+/* Ensures that the service pipe client (openvpn-gui process)
+ * is from OpenVPN binary directory */
+BOOL ValidateServicePipeClient(HANDLE pipe, const settings_t *s);
+
 #endif /* ifndef VALIDATE_H */

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1333?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie990f4dd10094810d6632f8dedfa261727ebfbcb
Gerrit-Change-Number: 1333
Gerrit-PatchSet: 1
Gerrit-Owner: stipa <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>

#2 lore raw

[Openvpn-devel] [M] Change in openvpn[master]: openvpnserv: validate openvpn-gui process path

In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos.

Hello flichtenheld, plaisthos,

I'd like you to reexamine a change. Please visit

    http://gerrit.openvpn.net/c/openvpn/+/1333?usp=email

to look at the new patch set (#2).

Change subject: openvpnserv: validate openvpn-gui process path
......................................................................

openvpnserv: validate openvpn-gui process path

Ensure that the service pipe client process (which is openvpn-gui) is from openvpn binary directory, defined in registry. This limits unauthorized connections to the service pipe.

Change-Id Ie990f4dd10094810d6632f8dedfa261727ebfbcb

---
M src/openvpnserv/interactive.c
M src/openvpnserv/validate.c
M src/openvpnserv/validate.h

3 files changed, 55 insertions(+), 0 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/33/1333/2

src/openvpnserv/interactive.c +6 -0
index ce0d4dd..f4b3311 100644
@@ -3275,6 +3275,12 @@
     ZeroMemory(&undo_lists, sizeof(undo_lists));
     ZeroMemory(&proc_info, sizeof(proc_info));
 
+    if (!ValidateServicePipeClient(pipe, &settings))
+    {
+        ReturnError(pipe, ERROR_ACCESS_DENIED, L"ValidateServicePipeClient", 1, &exit_event);
+        goto out;
+    }
+
     if (!GetStartupData(pipe, &sud))
     {
         goto out;
src/openvpnserv/validate.c +45 -0

48 lines not on this page · raw message

src/openvpnserv/validate.h +4 -0
index 6f3bf09..495902d 100644
@@ -49,4 +49,8 @@
     return (wcsncmp(o, L"--", 2) == 0);
 }
 
+/* Ensures that the service pipe client (openvpn-gui process)
+ * is from OpenVPN binary directory */
+BOOL ValidateServicePipeClient(HANDLE pipe, const settings_t *s);
+
 #endif /* ifndef VALIDATE_H */

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1333?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie990f4dd10094810d6632f8dedfa261727ebfbcb
Gerrit-Change-Number: 1333
Gerrit-PatchSet: 2
Gerrit-Owner: stipa <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>

#3 lore raw

Re: [Openvpn-devel] [M] Change in openvpn[master]: openvpnserv: validate openvpn-gui process path

Quoted 6 lines · stipa (Code Review)

Attention is currently required from: flichtenheld, plaisthos.

stipa *uploaded patch set #2* to this change.

View Change <http://gerrit.openvpn.net/c/openvpn/+/1333?usp=email>

Quoted 9 lines

openvpnserv: validate openvpn-gui process path

Ensure that the service pipe client process (which is openvpn-gui) is from openvpn binary directory, defined in registry. This limits unauthorized connections to the service pipe.

Do we really want to do this? I thought allowing any user process to use the interactive service was deliberate: the only restriction being user whitelisted as "OpenVPNAdministrators" or else we allow only a limited set of config directives.

Currently, starting openvpn.exe through the service using a script or a custom application works. Without having to install it in the "OpenVPN/bin" directory. Do we want to take away that functionality? The threat being addressed here is unclear to me.

Selva

#8 lore raw

[Openvpn-devel] [M] Change in openvpn[master]: openvpnserv: validate openvpn-gui process path

In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos, stipa.

selvanair has posted comments on this change by stipa. ( http://gerrit.openvpn.net/c/openvpn/+/1333?usp=email )

Change subject: openvpnserv: validate openvpn-gui process path
......................................................................

Patch Set 2:

(1 comment)

Patchset:

PS2:
Unsure why we want to do this. Currently we can use the service to start openvpn.exe as user by a script or any user application. Subject restrictions like only whitelisted config directives unless user is in a specific group.

Why take away that functionality?

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1333?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie990f4dd10094810d6632f8dedfa261727ebfbcb
Gerrit-Change-Number: 1333
Gerrit-PatchSet: 2
Gerrit-Owner: stipa <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-CC: selvanair <[email protected]...>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-Comment-Date: Thu, 30 Oct 2025 17:05:57 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No

#4 lore raw

Re: [Openvpn-devel] [M] Change in openvpn[master]: openvpnserv: validate openvpn-gui process path

In reply to Selva Nair

Hi,

Quoted 9 lines · Selva Nair

Do we really want to do this? I thought allowing any user process to use the interactive service was deliberate: the only restriction being user whitelisted as "OpenVPNAdministrators" or else we allow only a limited set of config directives.

Currently, starting openvpn.exe through the service using a script or a custom application works. Without having to install it in the "OpenVPN/bin" directory. Do we want to take away that functionality? The threat being addressed here is unclear to me.

I'm also sceptic on this.

The report was, if I understand this correctly, about "non logged in users" to be able to access the pipe (by means of whatever means windows has for this). "Only allow programs from openvpn\bin\ to access the pipe" fixes something else.

gert

Signature · 6 lines
"If was one thing all people took for granted, was conviction that if you 
 feed honest figures into a computer, honest figures come out. Never doubted 
 it myself till I met a computer with a sense of humor."
                             Robert A. Heinlein, The Moon is a Harsh Mistress

Gert Doering - Munich, Germany                             [email protected]...
#5 lore raw

Re: [Openvpn-devel] [M] Change in openvpn[master]: openvpnserv: validate openvpn-gui process path

Indeed, this is to allow only programs under openvpn/bin talk to interactive service.

Are there any valid use cases where any other processes are supposed to talk to the service?

Note that this is not related to the original MSFT report - a malicious process running as a pipe server received a connection from openvpn-gui and impersonated as a user of openvpn-gui.

Quoted 30 lines · Gert Doering

Hi,

Quoted 9 lines · Selva Nair

Do we really want to do this? I thought allowing any user process to use the interactive service was deliberate: the only restriction being user whitelisted as "OpenVPNAdministrators" or else we allow only a limited set of config directives.

Currently, starting openvpn.exe through the service using a script or a custom application works. Without having to install it in the "OpenVPN/bin" directory. Do we want to take away that functionality? The threat being addressed here is unclear to me.

I'm also sceptic on this.

The report was, if I understand this correctly, about "non logged in users" to be able to access the pipe (by means of whatever means windows has for this). "Only allow programs from openvpn\bin\ to access the pipe" fixes something else.

gert

--
"If was one thing all people took for granted, was conviction that if you
feed honest figures into a computer, honest figures come out. Never doubted it myself till I met a computer with a sense of humor."
Robert A. Heinlein, The Moon is a Harsh Mistress

Gert Doering - Munich, Germany [email protected]...

Signature · 1 line
-Lev
#7 lore raw

[Openvpn-devel] Fwd: [M] Change in openvpn[master]: openvpnserv: validate openvpn-gui process path

In reply to a message not in the archive
Cc the list

---------- Forwarded message ---------
From: Selva Nair <[email protected]...>
Date: Thu, Oct 30, 2025 at 6:06 PM
Subject: Re: [Openvpn-devel] [M] Change in openvpn[master]: openvpnserv:
validate openvpn-gui process path
To: Lev Stipakov <[email protected]...>

Quoted 5 lines · On Thu, Oct 30, 2025, 17:16 Lev Stipakov <[email protected]...> wrote:

Indeed, this is to allow only programs under openvpn/bin talk to interactive service.

Are there any valid use cases where any other processes are supposed to talk to the service?

I can think of a few:
- use a powershell script to start openvpn for testing or otherwise
- run openvpn from task scheduler
- use a third party GUI with the service (like eduVPN)

In fact we already use it to start openvpn through the automatic service:
though that will continue to work with this patch.

Anyway, iircc, it was a deliberate decision to leave interactive service as a generic way for running openvpn without admin access, not just as a helper for OpenVPN-GUI. With this change, anyone wanting to write a new UI leveraging the service will have to fork it, or install their program under OpenVPN\bin.

In any case what exactly is achieved by locking down the service this way?

It's necessary for the service to start a valid openvpn.exe and we do check that. It's also necessary for the GUI to be sure that it's talking to a legitimate openvpn.exe -- we did enforce that the other day. But I fail to see a strong reason to restrict service clients in this manner.

What am I missing?

Selva

#9 lore raw

[Openvpn-devel] [M] Change in openvpn[master]: openvpnserv: validate openvpn-gui process path

In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos, stipa.

d12fk has posted comments on this change by stipa. ( http://gerrit.openvpn.net/c/openvpn/+/1333?usp=email )

Change subject: openvpnserv: validate openvpn-gui process path
......................................................................

Patch Set 2:

(3 comments)

File src/openvpnserv/validate.c:

http://gerrit.openvpn.net/c/openvpn/+/1333/comment/8a56b40a_84d5cd59?usp=email :
PS2, Line 350: if (!GetNamedPipeClientProcessId(pipe, &clientPID))
I remember we looked at this back when the reports from Microsoft came in. Not sure if I recall correctly, but wasn't it this API which always reported the same PID no matter which process connected to the pipe second?

http://gerrit.openvpn.net/c/openvpn/+/1333/comment/6c18fe77_e5aadcaa?usp=email :
PS2, Line 371: HRESULT hr = PathCchCanonicalizeEx(bin_dir, _countof(bin_dir), s->bin_dir,
dirs will always have a trailing slash with #1336

http://gerrit.openvpn.net/c/openvpn/+/1333/comment/a4c3a93c_555a1a40?usp=email :
PS2, Line 373: if ((hr == S_OK) && wcsncmp(bin_dir, path, wcslen(bin_dir)) == 0)
Compare case-insesitive here, to get no false positives

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1333?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie990f4dd10094810d6632f8dedfa261727ebfbcb
Gerrit-Change-Number: 1333
Gerrit-PatchSet: 2
Gerrit-Owner: stipa <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: d12fk <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-CC: selvanair <[email protected]...>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-Comment-Date: Sat, 08 Nov 2025 00:07:29 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No