Restrict access to the service pipe to SYSTEM and owner
Some checks failed
Build / Check code style with Uncrustify (push) Has been cancelled
Build / gcc-mingw - x64 - OSSL (push) Has been cancelled
Build / gcc-mingw - x86 - OSSL (push) Has been cancelled
Build / gcc - ubuntu-24.04 - OpenSSL 3.0.13 --enable-pkcs11 (push) Has been cancelled
Build / gcc - ubuntu-22.04 - OpenSSL 3.0.2 --enable-pkcs11 (push) Has been cancelled
Build / gcc - ubuntu-22.04 - mbed TLS 2.28.0 (push) Has been cancelled
Build / clang-asan - ubuntu-22.04 - mbedtls (push) Has been cancelled
Build / clang-asan - ubuntu-22.04 - openssl (push) Has been cancelled
Build / clang-asan - ubuntu-24.04 - mbedtls (push) Has been cancelled
Build / clang-asan - ubuntu-24.04 - openssl (push) Has been cancelled
Build / macos-13 - libressl - asan (push) Has been cancelled
Build / macos-13 - openssl@1.1 - asan (push) Has been cancelled
Build / macos-13 - openssl@3 - asan (push) Has been cancelled
Build / macos-14 - libressl - asan (push) Has been cancelled
Build / macos-14 - openssl@1.1 - asan (push) Has been cancelled
Build / macos-14 - openssl@3 - asan (push) Has been cancelled
Build / macos-15 - libressl - asan (push) Has been cancelled
Build / macos-15 - openssl@1.1 - asan (push) Has been cancelled
Build / macos-15 - openssl@3 - asan (push) Has been cancelled
Build / macos-13 - libressl - normal (push) Has been cancelled
Build / macos-13 - openssl@1.1 - normal (push) Has been cancelled
Build / macos-13 - openssl@3 - normal (push) Has been cancelled
Build / macos-14 - libressl - normal (push) Has been cancelled
Build / macos-14 - openssl@1.1 - normal (push) Has been cancelled
Build / macos-14 - openssl@3 - normal (push) Has been cancelled
Build / macos-15 - libressl - normal (push) Has been cancelled
Build / macos-15 - openssl@1.1 - normal (push) Has been cancelled
Build / macos-15 - openssl@3 - normal (push) Has been cancelled
Build / msbuild - amd64 - openssl (push) Has been cancelled
Build / msbuild - arm64 - openssl (push) Has been cancelled
Build / msbuild - x86 - openssl (push) Has been cancelled
Build / clang asan - ubuntu-22.04 - libressl (push) Has been cancelled
Build / gcc normal - ubuntu-22.04 - libressl (push) Has been cancelled
Build / mingw unittest argv - x64 - OSSL (push) Has been cancelled
Build / mingw unittest auth_token - x64 - OSSL (push) Has been cancelled
Build / mingw unittest buffer - x64 - OSSL (push) Has been cancelled
Build / mingw unittest crypto - x64 - OSSL (push) Has been cancelled
Build / mingw unittest cryptoapi - x64 - OSSL (push) Has been cancelled
Build / mingw unittest misc - x64 - OSSL (push) Has been cancelled
Build / mingw unittest ncp - x64 - OSSL (push) Has been cancelled
Build / mingw unittest packet_id - x64 - OSSL (push) Has been cancelled
Build / mingw unittest pkt - x64 - OSSL (push) Has been cancelled
Build / mingw unittest provider - x64 - OSSL (push) Has been cancelled
Build / mingw unittest tls_crypt - x64 - OSSL (push) Has been cancelled
Build / mingw unittest argv - x86 - OSSL (push) Has been cancelled
Build / mingw unittest auth_token - x86 - OSSL (push) Has been cancelled
Build / mingw unittest buffer - x86 - OSSL (push) Has been cancelled
Build / mingw unittest crypto - x86 - OSSL (push) Has been cancelled
Build / mingw unittest cryptoapi - x86 - OSSL (push) Has been cancelled
Build / mingw unittest misc - x86 - OSSL (push) Has been cancelled
Build / mingw unittest ncp - x86 - OSSL (push) Has been cancelled
Build / mingw unittest packet_id - x86 - OSSL (push) Has been cancelled
Build / mingw unittest pkt - x86 - OSSL (push) Has been cancelled
Build / mingw unittest provider - x86 - OSSL (push) Has been cancelled
Build / mingw unittest tls_crypt - x86 - OSSL (push) Has been cancelled

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 <selva.nair@gmail.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1402
Message-Id: <20251124183911.24851-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34656.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
This commit is contained in:
Selva Nair 2025-11-24 19:39:06 +01:00 committed by Gert Doering
parent a8fb9f6443
commit f410584205

View file

@ -1975,10 +1975,26 @@ RunOpenvpn(LPVOID p)
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 = NULL;
LPCWSTR szSDDL = L"D:(A;;GA;;;SY)(A;;GA;;;OW)";
if (!ConvertStringSecurityDescriptorToSecurityDescriptorW(
szSDDL, SDDL_REVISION_1, &pSD, NULL))
{
ReturnLastError(pipe, L"ConvertSDDL");
goto out;
}
sa.nLength = sizeof(sa);
sa.lpSecurityDescriptor = pSD;
sa.bInheritHandle = FALSE;
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 | PIPE_REJECT_REMOTE_CLIENTS,
1, 128, 128, 0, NULL);
1, 128, 128, 0, &sa);
if (ovpn_pipe == INVALID_HANDLE_VALUE)
{
ReturnLastError(pipe, L"CreateNamedPipe");