[Openvpn-devel,v1] openvpnserv: don't allow '/' in config paths

Message ID 20260831184657.3332-1-gert@greenie.muc.de
State New
Headers
Series [Openvpn-devel,v1] openvpnserv: don't allow '/' in config paths |

Commit Message

Gert Doering Aug. 31, 2026, 6:46 p.m. UTC
  From: Heiko Hund <heiko@ist.eigentlich.net>

Do not allow forward slashes in user provided config paths. The PathCch*
functions do not treat them as path separators, leading to "/../" not
being canonicalized. That, and the fact that Windows file APIs accept
forward slashes leads to possible directory traversal.

Discovered and reported by BreachX Zero Day Labs, using Typhon AI Mil v2.
Contributing Researcher: Vivek Parikh.

Reported-by: Vivek Parikh <vivek.parikh@breachx.ai>
CVE: 2026-78043
Github: OpenVPN/openvpn-private-issues#162
Change-Id: I371aafba18d336bcfd3912e92c18301e39bf6087
Signed-off-by: Heiko Hund <heiko@ist.eigentlich.net>
Acked-by: Razvan Cojocaru <razvanc@mailbox.org>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1885
---

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/+/1885
This mail reflects revision 1 of this Change.

Acked-by according to Gerrit (reflected above):
Razvan Cojocaru <razvanc@mailbox.org>
  

Comments

Gert Doering Sept. 1, 2026, 12:22 p.m. UTC | #1
Windows is weird... thanks for taking this on and fixing it.

I have not tested beyond "does it compile and pass BB tests" - I had
some initial reservations about "can this break user configs" (because
we allow "key c:/some/where/key.pem") - but this is in the iservice,
at a well-controlled point that should never see user-defined paths.

If it does, we'll hear about it...

Your patch has been applied to the master and release/2.7 branch.

release/2.6 has very different code, which was not affected by this
particular combination of inconsistent Windows APIs.

commit eecebd88a38ffe1571d1a259da87f611b7b08e9c (master)
commit fde489249fc8507c2785c50a8ed46ea35877c973 (release/2.7)
Author: Heiko Hund
Date:   Mon Aug 31 20:46:50 2026 +0200

     openvpnserv: don't allow '/' in config paths

     Signed-off-by: Heiko Hund <heiko@ist.eigentlich.net>
     Acked-by: Razvan Cojocaru <razvanc@mailbox.org>
     Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1885
     Message-Id: <20260831184657.3332-1-gert@greenie.muc.de>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg38855.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering
  

Patch

diff --git a/src/openvpnserv/validate.c b/src/openvpnserv/validate.c
index 7c0a87b..e3ef8b6 100644
--- a/src/openvpnserv/validate.c
+++ b/src/openvpnserv/validate.c
@@ -68,6 +68,11 @@ 
     {
         return FALSE;
     }
+    /* do not accept forward slashes in paths, as PathCch* functions do not handle these */
+    if (wcschr(workdir, L'/') || wcschr(fname, L'/'))
+    {
+        return FALSE;
+    }
     /* convert fname to full canonical path */
     if (PathIsRelativeW(fname))
     {