1
0
mirror of https://github.com/rofl0r/proxychains-ng synced 2026-05-15 01:52:34 +08:00

Compare commits

..

7 Commits

  • configure: add -Werror for implicit func decls (fix netbsd segfault)
    without -Werror=implicit-function-declaration our test for GNU-style
    getservbyname_r silently succeeds on NetBSD 10
    (because the function exists, so the testcase links successfully).
    
    however NetBSD's version has a completely different signature which
    leads to crashes at runtime:
    
        Program terminated with signal SIGSEGV, Segmentation fault.
        #0  0x0000f1707faa2b78 in free () from /usr/lib/libc.so.12
        [Current thread is 1 (process 25072)]
        (gdb) backtrace
        #0  0x0000f1707faa2b78 in free () from /usr/lib/libc.so.12
        #1  0x0000f1707fac58b0 in _servent_open () from /usr/lib/libc.so.12
        #2  0x0000f1707fac5a60 in setservent_r () from /usr/lib/libc.so.12
        #3  0x0000f1707fac4490 in getservbyname_r () from /usr/lib/libc.so.12
        #4  0x0000f17080235788 in mygetservbyname_r (name=0xf1707f847ab0 "80", proto=0x0, result_buf=0xffffffe29738, buf=0xffffffe29338 "", buflen=1024, result=0xffffffe29758) at src/core.c:917
        #5  0x0000f17080235aa8 in proxy_getaddrinfo (node=0xf1707f847ba0 "4get.nadeko.net", service=0xf1707f847ab0 "80", hints=0xffffffe29978, res=0xffffffe29968) at src/core.c:1004
        #6  0x0000f17080238a94 in getaddrinfo (node=0xf1707f847ba0 "4get.nadeko.net", service=0xf1707f847ab0 "80", hints=0xffffffe29978, res=0xffffffe29968) at src/libproxychains.c:795
    
    netbsd's signature is:
    struct servent *
    getservbyname_r(const char *name, const char *proto, struct servent *sp,
        struct servent_data *sd)
    
    and basically the first thing it does is to free existing members of the
    sd struct, which obviously crashes when the thing passed as 4th argument
    isn't actually that kind of struct.
  • fix potential buffer overflow in config file parsing
    could be triggered by using username or password exceeding 255
    bytes for http type proxies.
    
    closes #606
5 changed files with 22 additions and 9 deletions
+9
View File
@@ -263,6 +263,15 @@ Known Problems:
there are unconfirmed reports that it works as root though.
musl libc is unaffected from the bug.
Useful links
------------
the following sites may prove useful to check for leaks:
https://ipfighter.com/
https://browserleaks.com/webrtc
https://dnsleaktest.com
http://check.torproject.org - tor specific
http://ifconfig.me - can be used via curl
http://ifconfig.io/
Community:
----------
Vendored
+3 -1
View File
@@ -182,6 +182,7 @@ ishaiku() {
check_compile 'whether C compiler works' '' 'int main() {return 0;}' || fail 'error: install a C compiler and library'
check_compile 'whether libc headers are complete' '' '#include <netdb.h>\nint main() {return 0;}' || fail 'error: necessary libc headers are not installed'
check_compile 'whether C compiler understands -Wno-unknown-pragmas' '-Wno-unknown-pragmas' 'int main() {return 0;}'
check_compile 'whether C compiler understands -Werror=implicit-function-declaration' '-Werror=implicit-function-declaration' 'int main() {return 0;}'
if ! check_compile 'whether getnameinfo() servlen argument is POSIX compliant (socklen_t)' "-DGN_NODELEN_T=socklen_t -DGN_SERVLEN_T=socklen_t -DGN_FLAGS_T=int" \
'#define _GNU_SOURCE\n#include <netdb.h>\nint getnameinfo(const struct sockaddr *, socklen_t, char *, socklen_t, char *, socklen_t, int);int main() {\nreturn 0;}' ; then
@@ -220,6 +221,7 @@ check_define __APPLE__ && {
fi
}
check_define __FreeBSD__ && bsd_detected=true
check_define __NetBSD__ && bsd_detected=true
check_define __OpenBSD__ && {
bsd_detected=true
echo "CFLAGS+=-DIS_OPENBSD">>config.mak
@@ -249,7 +251,7 @@ check_link "whether we can use -Wl,--no-as-needed" "-Wl,--no-as-needed" \
LD_SONAME_FLAG=
printf "checking what's the option to use in linker to set library name ... "
for o in --soname -h -soname -install_name; do
check_link_silent "-shared -Wl,$o,libconftest.so" "void test_func(int a) {}" && LD_SONAME_FLAG=$o && break
check_link_silent "-shared -Wl,$o,libconftest.so" "void test_func(void) {}" && LD_SONAME_FLAG=$o && break
done
if [ -z "$LD_SONAME_FLAG" ]; then
printf '\ncannot find an option to set library name\n'
+1
View File
@@ -5,6 +5,7 @@
*/
#undef _GNU_SOURCE
#define _GNU_SOURCE
#include <unistd.h>
#define _POSIX_C_SOURCE 200809L
+2 -2
View File
@@ -241,7 +241,7 @@ static int proxy_from_string(const char *proxystring,
ul = p-u;
p++;
pl = at-p;
if(proxytype == RS_PT_SOCKS5 && (ul > 255 || pl > 255))
if(ul > 255 || pl > 255)
return 0;
memcpy(user_buf, u, ul);
user_buf[ul]=0;
@@ -767,7 +767,7 @@ HOOKFUNC(int, connect, int sock, const struct sockaddr *addr, unsigned int len)
}
#ifdef IS_SOLARIS
HOOKFUNC(int, __xnet_connect, int sock, const struct sockaddr *addr, unsigned int len)
HOOKFUNC(int, __xnet_connect, int sock, const struct sockaddr *addr, unsigned int len) {
return connect(sock, addr, len);
}
#endif
+7 -6
View File
@@ -79,12 +79,12 @@ proxy_dns
# we use the reserved 224.x.x.x range by default,
# if the proxified app does a DNS request, we will return an IP from that range.
# on further accesses to this ip we will send the saved DNS name to the proxy.
# in case some control-freak app checks the returned ip, and denies to
# in case some control-freak app checks the returned ip, and denies to
# connect, you can use another subnet, e.g. 10.x.x.x or 127.x.x.x.
# of course you should make sure that the proxified app does not need
# *real* access to this subnet.
# *real* access to this subnet.
# i.e. dont use the same subnet then in the localnet section
#remote_dns_subnet 127
#remote_dns_subnet 127
#remote_dns_subnet 10
remote_dns_subnet 224
@@ -109,7 +109,7 @@ tcp_connect_time_out 8000
## RFC6890 Loopback address range
## if you enable this, you have to make sure remote_dns_subnet is not 127
## you'll need to enable it if you want to use an application that
## you'll need to enable it if you want to use an application that
## connects to localhost.
# localnet 127.0.0.0/255.0.0.0
# localnet ::1/128
@@ -147,8 +147,8 @@ tcp_connect_time_out 8000
# socks5 192.168.67.78 1080 lamer secret
# http 192.168.89.3 8080 justu hidden
# socks4 192.168.1.49 1080
# http 192.168.39.93 8080
#
# http 192.168.39.93 8080
#
#
# proxy types: http, socks4, socks5, raw
# * raw: The traffic is simply forwarded to the proxy without modification.
@@ -159,3 +159,4 @@ tcp_connect_time_out 8000
# meanwile
# defaults set to "tor"
socks4 127.0.0.1 9050