celzero / rethink-app

DNS over HTTPS / DNS over Tor / DNSCrypt client, WireGuard proxifier, firewall, and connection tracker for Android.
https://rethinkfirewall.com/
Apache License 2.0
2.58k stars 129 forks source link

v054c: Configuring SOCKS5 proxy authentication breaks proxy functionality #919

Open FLAGEL opened 1 year ago

FLAGEL commented 1 year ago

Starting with v054c, configuring Rethink to use a SOCKS5 proxy with authentication will result in infinite connection resets. Configuring Rethink to use a SOCKS5 proxy without authentication works as intended. v054a worked as intended with and without SOCKS5 authentication. Results are from a Pixel-device running up-to-date Android 13 and Every Proxy.

SOCKS5 proxy without authentication bypassing Rethink: Works.

~ $ curl -v -x socks5://10.111.222.1:1080 test100.goosehollow.design
*   Trying 10.111.222.1:1080...
* Connected to 10.111.222.1 (10.111.222.1) port 1080 (#0)
* SOCKS5 connect to IPv4 44.227.65.245:80 (locally resolved)
* SOCKS5 request granted.
* Connected to 10.111.222.1 (10.111.222.1) port 1080 (#0)
> GET / HTTP/1.1
> Host: test100.goosehollow.design
> User-Agent: curl/8.0.1
> Accept: */*
>
< HTTP/1.1 307 Temporary Redirect
< Server: openresty
< Date: Tue, 30 May 2023 11:59:43 GMT
< Content-Type: text/html; charset=utf-8
< Content-Length: 168
< Connection: keep-alive
< Location: http://www.goosehollow.design
< X-Frame-Options: sameorigin
<
<html>
<head><title>307 Temporary Redirect</title></head>
<body>
<center><h1>307 Temporary Redirect</h1></center>
<hr><center>openresty</center>
</body>
</html>
* Connection #0 to host 10.111.222.1 left intact

SOCKS5 proxy without authentication via Rethink: Works.

~ $ curl -v test101.goosehollow.design
*   Trying 44.227.65.245:80...
* Connected to test101.goosehollow.design (44.227.65.245) port 80 (#0)
> GET / HTTP/1.1
> Host: test101.goosehollow.design
> User-Agent: curl/8.0.1
> Accept: */*
>
< HTTP/1.1 307 Temporary Redirect
< Server: openresty
< Date: Tue, 30 May 2023 12:00:00 GMT
< Content-Type: text/html; charset=utf-8
< Content-Length: 168
< Connection: keep-alive
< Location: http://www.goosehollow.design
< X-Frame-Options: sameorigin
<
<html>
<head><title>307 Temporary Redirect</title></head>
<body>
<center><h1>307 Temporary Redirect</h1></center>
<hr><center>openresty</center>
</body>
</html>
* Connection #0 to host test101.goosehollow.design left intact

SOCKS5 proxy with authentication bypassing Rethink: Works.

~ $ curl -v -x socks5://12345:12345@10.111.222.1:1080 test102.goosehollow.design
*   Trying 10.111.222.1:1080...
* Connected to 10.111.222.1 (10.111.222.1) port 1080 (#0)
* SOCKS5 connect to IPv4 44.227.76.166:80 (locally resolved)
* SOCKS5 request granted.
* Connected to 10.111.222.1 (10.111.222.1) port 1080 (#0)
> GET / HTTP/1.1
> Host: test102.goosehollow.design
> User-Agent: curl/8.0.1
> Accept: */*
>
< HTTP/1.1 307 Temporary Redirect
< Server: openresty
< Date: Tue, 30 May 2023 12:00:52 GMT
< Content-Type: text/html; charset=utf-8
< Content-Length: 168
< Connection: keep-alive
< Location: http://www.goosehollow.design
< X-Frame-Options: sameorigin
<
<html>
<head><title>307 Temporary Redirect</title></head>
<body>
<center><h1>307 Temporary Redirect</h1></center>
<hr><center>openresty</center>
</body>
</html>
* Connection #0 to host 10.111.222.1 left intact

SOCKS5 proxy with authentication via Rethink: Fails.

~ $ curl -v test103.goosehollow.design
*   Trying 44.227.76.166:80...
* Connected to test103.goosehollow.design (44.227.76.166) port 80 (#0)
> GET / HTTP/1.1
> Host: test103.goosehollow.design
> User-Agent: curl/8.0.1
> Accept: */*
>
* Recv failure: Connection reset by peer
* Closing connection 0
curl: (56) Recv failure: Connection reset by peer
~ $
ignoramous commented 1 year ago

Thanks for the bug report.

If you're comfortable doing so, will you please share output from adb logcat | grep GoLog from immediately as you attempt these connections?

FLAGEL commented 1 year ago

I can probably do that, but it will take some time as I won't have my regular setup available the coming weeks.

ignoramous commented 1 month ago

Can you confirm if this issue persists in the latest versions like v055j?