Force Proxy to any Windows/MacOS/Linux Application TCP and UDP traffic
C ccybersecurityhttp3httpproxylinuxlinux-proxymacosmacos-appmacos-proxyproxifierproxifier-alternativeproxyclienttcpthick-clientudpwindivertwindows
fix(windows): HTTP CONNECT could send stack memory to the proxy when the request did not fit its buffer
AnoF-Cybere16cd3ac79ce
diff --git a/Windows/src/pb_http.c b/Windows/src/pb_http.cindex a42be16..d4b901e 100644--- a/Windows/src/pb_http.c+++ b/Windows/src/pb_http.c@@ -44,6 +44,9 @@ int http_connect_v6(SOCKET s, const UINT8 dest_ip6[16], UINT16 dest_port, consthost_part, dest_port, host_part, dest_port);}+ // snprintf returns the length it WOULD have written: a request that did not fit (very long credentials or+ // host name) must be refused, never sent with that length, or send() would read past the buffer.+ if (len < 0 || len >= (int)sizeof(request)) return -1;if (send(s, request, len, 0) != len) return -1;len = recv(s, response, sizeof(response) - 1, 0);@@ -103,6 +106,13 @@ int http_connect(SOCKET s, UINT32 dest_ip, UINT16 dest_port, const PROXY_CONFIGhost_part, dest_port, host_part, dest_port);}+ // snprintf returns the length it WOULD have written: refuse a request that did not fit instead of letting+ // send() read past the buffer (very long credentials + a long cached host name).+ if (len < 0 || len >= (int)sizeof(request))+ {+ log_message("HTTP: CONNECT request too long for the buffer (credentials or host name too long)");+ return -1;+ }if (send(s, request, len, 0) != len){log_message("HTTP: Failed to send CONNECT request");