]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
socks: In establish_socks_proxy_udpassoc check result of recv_socks_reply
authorFrank Lichtenheld <frank@lichtenheld.com>
Wed, 14 Jan 2026 13:58:02 +0000 (14:58 +0100)
committerGert Doering <gert@greenie.muc.de>
Wed, 14 Jan 2026 18:38:28 +0000 (19:38 +0100)
Not just check the return value but also that relay_addr
is valid. recv_socks_reply doesn't care whether the answer
is what we expected. This is probably a very unlikely edge
case but it doesn't hurt to check for it here.

Reported-By: Joshua Rogers <contact@joshua.hu>
Found-By: ZeroPath (https://zeropath.com)
Github: openvpn-private-issues#13
Change-Id: Ic1c8f24de423541bdc85e70b5a688213800d86de
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1469
Message-Id: <20260114135807.20637-1-gert@greenie.muc.de>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35249.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
src/openvpn/socks.c

index 078b4e191c36d66246b9a160afe5bc3b65db9831..5cb5912ffdbc873e24a82c326f4246697986f5ef 100644 (file)
@@ -412,8 +412,7 @@ establish_socks_proxy_udpassoc(struct socks_proxy_info *p,
             send(ctrl_sd, "\x05\x03\x00\x01\x00\x00\x00\x00\x00\x00", 10, MSG_NOSIGNAL);
         if (size != 10)
         {
-            msg(D_LINK_ERRORS | M_ERRNO,
-                "establish_socks_proxy_passthru: TCP port write failed on send()");
+            msg(D_LINK_ERRORS | M_ERRNO, "%s: TCP port write failed on send()", __func__);
             goto error;
         }
     }
@@ -424,6 +423,11 @@ establish_socks_proxy_udpassoc(struct socks_proxy_info *p,
     {
         goto error;
     }
+    if (!relay_addr->addr.in4.sin_addr.s_addr)
+    {
+        msg(D_LINK_ERRORS, "%s: Socks proxy did not answer with IPv4 address", __func__);
+        goto error;
+    }
 
     return;