From: "cron2 (Code Review)" Date: Wed, 14 Jan 2026 18:40:46 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="STaSneUbd1I="; charset=UTF-8 Subject: [Openvpn-devel] [XS] Change in openvpn[master]: socks: In establish_socks_proxy_udpassoc check result of recv_socks_r... List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: flichtenheld Cc: plaisthos , openvpn-devel --STaSneUbd1I= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/14= 69?usp=3Demail ) Change subject: socks: In establish_socks_proxy_udpassoc check result of re= cv_socks_reply ...................................................................... socks: In establish_socks_proxy_udpassoc check result of recv_socks_reply 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 Found-By: ZeroPath (https://zeropath.com) Github: openvpn-private-issues#13 Change-Id: Ic1c8f24de423541bdc85e70b5a688213800d86de Signed-off-by: Frank Lichtenheld Acked-by: Gert Doering Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1469 Message-Id: <20260114135807.20637-1-gert@...1296...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg35= 249.html Signed-off-by: Gert Doering --- M src/openvpn/socks.c 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/openvpn/socks.c b/src/openvpn/socks.c index 078b4e1..5cb5912 100644 --- a/src/openvpn/socks.c +++ b/src/openvpn/socks.c @@ -412,8 +412,7 @@ send(ctrl_sd, "\x05\x03\x00\x01\x00\x00\x00\x00\x00\x00", 10, = MSG_NOSIGNAL); if (size !=3D 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 sen= d()", __func__); goto error; } } @@ -424,6 +423,11 @@ { goto error; } + if (!relay_addr->addr.in4.sin_addr.s_addr) + { + msg(D_LINK_ERRORS, "%s: Socks proxy did not answer with IPv4 addre= ss", __func__); + goto error; + } return; -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1469?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings?usp=3Demail Gerrit-MessageType: merged Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: Ic1c8f24de423541bdc85e70b5a688213800d86de Gerrit-Change-Number: 1469 Gerrit-PatchSet: 2 Gerrit-Owner: flichtenheld Gerrit-Reviewer: cron2 Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel --STaSneUbd1I= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 sub= mitted this change.

View Change

socks: In establish_socks_proxy_udpassoc check r=
esult of recv_socks_reply

Not just check the return value but also t= hat relay_addr
is valid. recv_socks_reply doesn't care whether the a= nswer
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 R= ogers <contact@...2949...>
Found-By: ZeroPath (https://zeropath.co= m)
Github: openvpn-private-issues#13
Change-Id: Ic1c8f24de423541bdc85= e70b5a688213800d86de
Signed-off-by: Frank Lichtenheld <frank@...2724...= ..>
Acked-by: Gert Doering <gert@...1296...>
Gerrit URL: htt= ps://gerrit.openvpn.net/c/openvpn/+/1469
Message-Id: <20260114135807.= 20637-1-gert@...1296...>
URL: https://www.mail-archive.com/openvpn-de= vel@lists.sourceforge.net/msg35249.html
Signed-off-by: Gert Doering <= gert@...1296...>
---
M src/openvpn/socks.c
1 file changed, 6 in= sertions(+), 2 deletions(-)

diff --git a/src/openvpn/socks.c b/src/openvpn/socks.c
i= ndex 078b4e1..5cb5912 100644
--- a/src/openvpn/socks.c
+++ b/src/openvpn/socks.c
@@ -412,8 +412,7 @@
send(ctrl_sd, "\x05\x03\x00\x01\x00\x00\x0= 0\x00\x00\x00", 10, MSG_NOSIGNAL);
if (size != =3D 10)
{
- msg(D_LINK_ERRORS | M_ERRNO,
- "establish_socks_proxy= _passthru: TCP port write failed on send()");
+ msg(D_LINK_ERRORS | M_ERRNO, &qu= ot;%s: TCP port write failed on send()", __func__);
= goto error;
}
}
@@ -424,6 +423,11 @@
{
= 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__);
<= span style=3D"color: hsl(120, 100%, 40%);">+ goto error;

<= span style=3D"color: hsl(120, 100%, 40%);">+ }

<= br> return;


To view, visit change 1469. To unsubscribe, or for help writing mail filters= , visit settings= .

Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ic1c8f24de423541bdc85e70b5a6= 88213800d86de
Gerrit-Change-Number: 1469
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <frank@...2723...= .>
Gerrit-Reviewer: cron2 <gert@...1296...>=
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
= --STaSneUbd1I=--