Change in openvpn[master]: Harden interactive service pipe
A message that is not in the archive (sent off-list or not yet received): gerrit.1763922943000.Ie66a142751354e421d48b273784fc79bcb9f7208@...2715...
Attention is currently required from: plaisthos.
Hello plaisthos,
I'd like you to do a code review.
Please visit
http://gerrit.openvpn.net/c/openvpn/+/1396?usp=email
to review the following change.
Change subject: Harden interactive service pipe
......................................................................
Harden interactive service pipe
- Append a version 4 uuid to ovpn_pipe_name to make it less predictable
- Do not allow remote access to the pipe
This greatly reduces the possibility of a rogue process racing to open the pipe before CreateFile() is called in the worker thread.
Addresses OpenVPN/openvpn-private-issues#83
---
M src/openvpnserv/interactive.c
1 file changed, 20 insertions(+), 3 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/96/1396/1
src/openvpnserv/interactive.c +20 -3
@@ -3398,12 +3398,29 @@ goto out; } +UUID pipe_uuid; +RPC_STATUS rpc_stat =UuidCreate (&pipe_uuid); +if (rpc_stat !=RPC_S_OK ) + { +ReturnError (pipe, rpc_stat,L"UuidCreate" ,1 , &exit_event); + goto out; + } + +RPC_WSTR pipe_uuid_str =NULL ; + rpc_stat =UuidToStringW (&pipe_uuid, &pipe_uuid_str); +if (rpc_stat !=RPC_S_OK ) + { +ReturnError (pipe, rpc_stat,L"UuidToString" ,1 , &exit_event); + goto out; + }swprintf (ovpn_pipe_name,_countof (ovpn_pipe_name), - L"\\\\.\\pipe\\" _L(PACKAGE) L"%ls\\service_%lu", service_instance, -GetCurrentThreadId ()); + L"\\\\.\\pipe\\" _L(PACKAGE) L"%ls\\service_%lu_%ls", service_instance, +GetCurrentThreadId (), pipe_uuid_str); +RpcStringFree (&pipe_uuid_str); + ovpn_pipe =CreateNamedPipe ( ovpn_pipe_name,PIPE_ACCESS_DUPLEX |FILE_FLAG_FIRST_PIPE_INSTANCE |FILE_FLAG_OVERLAPPED , -PIPE_TYPE_MESSAGE |PIPE_READMODE_MESSAGE |PIPE_WAIT ,1 ,128 ,128 ,0 ,NULL ); +PIPE_TYPE_MESSAGE |PIPE_READMODE_MESSAGE |PIPE_WAIT |PIPE_REJECT_REMOTE_CLIENTS ,1 ,128 ,128 ,0 ,NULL );if (ovpn_pipe ==INVALID_HANDLE_VALUE ) {ReturnLastError (pipe,L"CreateNamedPipe" );
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1396?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: Ie66a142751354e421d48b273784fc79bcb9f7208
Gerrit-Change-Number: 1396
Gerrit-PatchSet: 1
Gerrit-Owner: selvanair <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Attention is currently required from: plaisthos, selvanair.
stipa has posted comments on this change by selvanair. ( http://gerrit.openvpn.net/c/openvpn/+/1396?usp=email )
Change subject: Harden interactive service pipe
......................................................................
Patch Set 1: Code-Review+2
(1 comment)
Patchset:
PS1:
Code looks good and it works:
PS C:\Users\lev\Projects\openvpn-build\src\openvpn> Get-ChildItem \\.\pipe\ | Where-Object Name -like '*openvpn*'
Directorio: \\.\pipe\openvpn
Mode LastWriteTime Length Name ---- ------------- ------ ---- ------ 01/01/1601 2:00 2 openvpn\service ------ 01/01/1601 2:00 1 openvpn\service_31012_97a67dbf-1f64-44d5-8bec-332bbdc1a277
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1396?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: Ie66a142751354e421d48b273784fc79bcb9f7208
Gerrit-Change-Number: 1396
Gerrit-PatchSet: 1
Gerrit-Owner: selvanair <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: selvanair <[email protected]...>
Gerrit-Comment-Date: Mon, 24 Nov 2025 08:02:41 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Attention is currently required from: plaisthos, selvanair.
d12fk has posted comments on this change by selvanair. ( http://gerrit.openvpn.net/c/openvpn/+/1396?usp=email )
Change subject: Harden interactive service pipe
......................................................................
Patch Set 1:
(1 comment)
Commit Message:
http://gerrit.openvpn.net/c/openvpn/+/1396/comment/d0f34bf7_ca8fba25?usp=email :
PS1, Line 16: Addresses OpenVPN/openvpn-private-issues#83
Does it make sense to mention issues which cannot the viewed by the public?
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1396?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: Ie66a142751354e421d48b273784fc79bcb9f7208
Gerrit-Change-Number: 1396
Gerrit-PatchSet: 1
Gerrit-Owner: selvanair <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: d12fk <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: selvanair <[email protected]...>
Gerrit-Comment-Date: Mon, 24 Nov 2025 11:47:29 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Attention is currently required from: plaisthos, selvanair, stipa.
Hello plaisthos, stipa,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/1396?usp=email
to look at the new patch set (#2).
The following approvals got outdated and were removed:
Code-Review+2 by stipa
The change is no longer submittable: Code-Review and checks~ChecksSubmitRule are unsatisfied now.
Change subject: Harden interactive service pipe
......................................................................
Harden interactive service pipe
- Append a version 4 uuid to ovpn_pipe_name to make it less predictable
- Do not allow remote access to the pipe
This greatly reduces the possibility of a rogue process racing to open the pipe before CreateFile() is called in the worker thread.
---
M src/openvpnserv/interactive.c
1 file changed, 20 insertions(+), 3 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/96/1396/2
src/openvpnserv/interactive.c +20 -3
@@ -3398,12 +3398,29 @@ goto out; } +UUID pipe_uuid; +RPC_STATUS rpc_stat =UuidCreate (&pipe_uuid); +if (rpc_stat !=RPC_S_OK ) + { +ReturnError (pipe, rpc_stat,L"UuidCreate" ,1 , &exit_event); + goto out; + } + +RPC_WSTR pipe_uuid_str =NULL ; + rpc_stat =UuidToStringW (&pipe_uuid, &pipe_uuid_str); +if (rpc_stat !=RPC_S_OK ) + { +ReturnError (pipe, rpc_stat,L"UuidToString" ,1 , &exit_event); + goto out; + }swprintf (ovpn_pipe_name,_countof (ovpn_pipe_name), - L"\\\\.\\pipe\\" _L(PACKAGE) L"%ls\\service_%lu", service_instance, -GetCurrentThreadId ()); + L"\\\\.\\pipe\\" _L(PACKAGE) L"%ls\\service_%lu_%ls", service_instance, +GetCurrentThreadId (), pipe_uuid_str); +RpcStringFree (&pipe_uuid_str); + ovpn_pipe =CreateNamedPipe ( ovpn_pipe_name,PIPE_ACCESS_DUPLEX |FILE_FLAG_FIRST_PIPE_INSTANCE |FILE_FLAG_OVERLAPPED , -PIPE_TYPE_MESSAGE |PIPE_READMODE_MESSAGE |PIPE_WAIT ,1 ,128 ,128 ,0 ,NULL ); +PIPE_TYPE_MESSAGE |PIPE_READMODE_MESSAGE |PIPE_WAIT |PIPE_REJECT_REMOTE_CLIENTS ,1 ,128 ,128 ,0 ,NULL );if (ovpn_pipe ==INVALID_HANDLE_VALUE ) {ReturnLastError (pipe,L"CreateNamedPipe" );
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1396?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: Ie66a142751354e421d48b273784fc79bcb9f7208
Gerrit-Change-Number: 1396
Gerrit-PatchSet: 2
Gerrit-Owner: selvanair <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: d12fk <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: selvanair <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Attention is currently required from: d12fk, plaisthos, stipa.
selvanair has posted comments on this change by selvanair. ( http://gerrit.openvpn.net/c/openvpn/+/1396?usp=email )
Change subject: Harden interactive service pipe
......................................................................
Patch Set 2:
(1 comment)
Commit Message:
http://gerrit.openvpn.net/c/openvpn/+/1396/comment/486f78d8_24255d0b?usp=email :
PS1, Line 16: Addresses OpenVPN/openvpn-private-issues#83
Quoted 1 line
Does it make sense to mention issues which cannot the viewed by the public?
Removed
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1396?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: Ie66a142751354e421d48b273784fc79bcb9f7208
Gerrit-Change-Number: 1396
Gerrit-PatchSet: 2
Gerrit-Owner: selvanair <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: d12fk <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: d12fk <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-Comment-Date: Mon, 24 Nov 2025 15:40:43 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: d12fk <[email protected]...>
PATCH v2 1/1 Harden interactive service pipe
In reply to a message not in the archiveFrom: Selva Nair <[email protected]...>
- Append a version 4 uuid to ovpn_pipe_name to make it less predictable
- Do not allow remote access to the pipe
This greatly reduces the possibility of a rogue process racing to open the pipe before CreateFile() is called in the worker thread.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1396
---
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/+/1396
This mail reflects revision 2 of this Change.
Acked-by according to Gerrit (reflected above):
src/openvpnserv/interactive.c +20 -3
@@ -3398,12 +3398,29 @@ goto out; } +UUID pipe_uuid; +RPC_STATUS rpc_stat =UuidCreate (&pipe_uuid); +if (rpc_stat !=RPC_S_OK ) + { +ReturnError (pipe, rpc_stat,L"UuidCreate" ,1 , &exit_event); + goto out; + } + +RPC_WSTR pipe_uuid_str =NULL ; + rpc_stat =UuidToStringW (&pipe_uuid, &pipe_uuid_str); +if (rpc_stat !=RPC_S_OK ) + { +ReturnError (pipe, rpc_stat,L"UuidToString" ,1 , &exit_event); + goto out; + }swprintf (ovpn_pipe_name,_countof (ovpn_pipe_name), - L"\\\\.\\pipe\\" _L(PACKAGE) L"%ls\\service_%lu", service_instance, -GetCurrentThreadId ()); + L"\\\\.\\pipe\\" _L(PACKAGE) L"%ls\\service_%lu_%ls", service_instance, +GetCurrentThreadId (), pipe_uuid_str); +RpcStringFree (&pipe_uuid_str); + ovpn_pipe =CreateNamedPipe ( ovpn_pipe_name,PIPE_ACCESS_DUPLEX |FILE_FLAG_FIRST_PIPE_INSTANCE |FILE_FLAG_OVERLAPPED , -PIPE_TYPE_MESSAGE |PIPE_READMODE_MESSAGE |PIPE_WAIT ,1 ,128 ,128 ,0 ,NULL ); +PIPE_TYPE_MESSAGE |PIPE_READMODE_MESSAGE |PIPE_WAIT |PIPE_REJECT_REMOTE_CLIENTS ,1 ,128 ,128 ,0 ,NULL );if (ovpn_pipe ==INVALID_HANDLE_VALUE ) {ReturnLastError (pipe,L"CreateNamedPipe" );
[Openvpn-devel] [PATCH applied] Re: Harden interactive service pipe
Thanks for taking this on.
I've stared lightly at the code and it looks good. Lev has tested it and it does what it says on the lid - make the pipe name nearly impossible to guess. Path name length is also not a problem (max 256, plenty of room to grow).
Your patch has been applied to the master branch.
I think the release/2.6 branch would also benefit from this one (at least) but it does not want to get in - TEXT() vs. L() changes, at least.
commit 05d0808ee65d68691b0133f5fc3c09bfdba5259d (master)
Author: Selva Nair Date: Mon Nov 24 17:53:06 2025 +0100
Harden interactive service pipe
Signed-off-by: Selva Nair <[email protected]...>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1396
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg34638.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
cron2 has uploaded a new patch set (#3) to the change originally created by selvanair. ( http://gerrit.openvpn.net/c/openvpn/+/1396?usp=email )
Change subject: Harden interactive service pipe
......................................................................
Harden interactive service pipe
- Append a version 4 uuid to ovpn_pipe_name to make it less predictable
- Do not allow remote access to the pipe
This greatly reduces the possibility of a rogue process racing to open the pipe before CreateFile() is called in the worker thread.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1396
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg34638.html
---
M src/openvpnserv/interactive.c
1 file changed, 20 insertions(+), 3 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/96/1396/3
src/openvpnserv/interactive.c +20 -3
@@ -3397,12 +3397,29 @@ goto out; } +UUID pipe_uuid; +RPC_STATUS rpc_stat =UuidCreate (&pipe_uuid); +if (rpc_stat !=RPC_S_OK ) + { +ReturnError (pipe, rpc_stat,L"UuidCreate" ,1 , &exit_event); + goto out; + } + +RPC_WSTR pipe_uuid_str =NULL ; + rpc_stat =UuidToStringW (&pipe_uuid, &pipe_uuid_str); +if (rpc_stat !=RPC_S_OK ) + { +ReturnError (pipe, rpc_stat,L"UuidToString" ,1 , &exit_event); + goto out; + }swprintf (ovpn_pipe_name,_countof (ovpn_pipe_name), - L"\\\\.\\pipe\\" _L(PACKAGE) L"%ls\\service_%lu", service_instance, -GetCurrentThreadId ()); + L"\\\\.\\pipe\\" _L(PACKAGE) L"%ls\\service_%lu_%ls", service_instance, +GetCurrentThreadId (), pipe_uuid_str); +RpcStringFree (&pipe_uuid_str); + ovpn_pipe =CreateNamedPipe ( ovpn_pipe_name,PIPE_ACCESS_DUPLEX |FILE_FLAG_FIRST_PIPE_INSTANCE |FILE_FLAG_OVERLAPPED , -PIPE_TYPE_MESSAGE |PIPE_READMODE_MESSAGE |PIPE_WAIT ,1 ,128 ,128 ,0 ,NULL ); +PIPE_TYPE_MESSAGE |PIPE_READMODE_MESSAGE |PIPE_WAIT |PIPE_REJECT_REMOTE_CLIENTS ,1 ,128 ,128 ,0 ,NULL );if (ovpn_pipe ==INVALID_HANDLE_VALUE ) {ReturnLastError (pipe,L"CreateNamedPipe" );
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1396?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: Ie66a142751354e421d48b273784fc79bcb9f7208
Gerrit-Change-Number: 1396
Gerrit-PatchSet: 3
Gerrit-Owner: selvanair <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: d12fk <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1396?usp=email )
Change subject: Harden interactive service pipe
......................................................................
Harden interactive service pipe
- Append a version 4 uuid to ovpn_pipe_name to make it less predictable
- Do not allow remote access to the pipe
This greatly reduces the possibility of a rogue process racing to open the pipe before CreateFile() is called in the worker thread.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1396
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg34638.html
---
M src/openvpnserv/interactive.c
1 file changed, 20 insertions(+), 3 deletions(-)
src/openvpnserv/interactive.c +20 -3
@@ -3397,12 +3397,29 @@ goto out; } +UUID pipe_uuid; +RPC_STATUS rpc_stat =UuidCreate (&pipe_uuid); +if (rpc_stat !=RPC_S_OK ) + { +ReturnError (pipe, rpc_stat,L"UuidCreate" ,1 , &exit_event); + goto out; + } + +RPC_WSTR pipe_uuid_str =NULL ; + rpc_stat =UuidToStringW (&pipe_uuid, &pipe_uuid_str); +if (rpc_stat !=RPC_S_OK ) + { +ReturnError (pipe, rpc_stat,L"UuidToString" ,1 , &exit_event); + goto out; + }swprintf (ovpn_pipe_name,_countof (ovpn_pipe_name), - L"\\\\.\\pipe\\" _L(PACKAGE) L"%ls\\service_%lu", service_instance, -GetCurrentThreadId ()); + L"\\\\.\\pipe\\" _L(PACKAGE) L"%ls\\service_%lu_%ls", service_instance, +GetCurrentThreadId (), pipe_uuid_str); +RpcStringFree (&pipe_uuid_str); + ovpn_pipe =CreateNamedPipe ( ovpn_pipe_name,PIPE_ACCESS_DUPLEX |FILE_FLAG_FIRST_PIPE_INSTANCE |FILE_FLAG_OVERLAPPED , -PIPE_TYPE_MESSAGE |PIPE_READMODE_MESSAGE |PIPE_WAIT ,1 ,128 ,128 ,0 ,NULL ); +PIPE_TYPE_MESSAGE |PIPE_READMODE_MESSAGE |PIPE_WAIT |PIPE_REJECT_REMOTE_CLIENTS ,1 ,128 ,128 ,0 ,NULL );if (ovpn_pipe ==INVALID_HANDLE_VALUE ) {ReturnLastError (pipe,L"CreateNamedPipe" );
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1396?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie66a142751354e421d48b273784fc79bcb9f7208
Gerrit-Change-Number: 1396
Gerrit-PatchSet: 3
Gerrit-Owner: selvanair <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: d12fk <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>