🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: muc.lists.freebsd.bugs
2 messages
2 total messages Started by bugzilla-noreply Mon, 23 Nov 2026 18:12
[Bug 301053] fetch(1): FTP data connection does not go through SOCKS5_PROXY
#666
Author: bugzilla-noreply
Date: Mon, 23 Nov 2026 18:12
59 lines
4091 bytes
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=301053

            Bug ID: 301053
           Summary: fetch(1): FTP data connection does not go through
                    SOCKS5_PROXY
           Product: Base System
           Version: 15.1-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: laamalif@proton.me

With SOCKS5_PROXY set, fetch connects to an ftp:// server through the proxy
for the control connection, but the data connection is opened directly. The
proxy never sees it. If the server is only reachable through the proxy, the
download fails.

I wrote a small SOCKS5 server that prints each CONNECT it gets, and ran
stock /usr/bin/fetch on 15.1-RELEASE-p6 (arm64) against a throwaway FTP
server that answers PASV:

  $ SOCKS5_PROXY=127.0.0.1:1081 fetch -o out ftp://127.0.0.1:2395/f
  $ cat proxy.log
  PROXY CONNECT 127.0.0.1:2395

That is the control port. The 1000 bytes came over a second connection that
is not in the log. Everything was on loopback, so the direct connection worked
and the download succeeded. I did not test against a server that can only be
reached through the proxy.

In ftp_transfer() (lib/libfetch/ftp.c) the data socket comes from socket()
and connect(), not fetch_connect(), so the SOCKS5 handshake is never done for
it. For EPSV the address is taken from getpeername() on the control socket,
which with a proxy is the proxy's address. I only ran PASV; the EPSV part is
from reading the code.

I don't have a patch yet. One way is to do a SOCKS5 CONNECT to the address
and port from the PASV/EPSV reply. Active mode would need BIND, which libfetch
doesn't have, so it would have to fail when a SOCKS5 proxy is set. The other
way is to refuse FTP data connections when SOCKS5_PROXY is set and say why.
Which would you rather have?

The same code is in main. The proxy source is attached.

-- 
You are receiving this mail because:
You are the assignee for the bug.

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-admin@muc.de
[Bug 301053] fetch(1): FTP data connection does not go through SOCKS5_PROXY
#667
Author: bugzilla-noreply
Date: Mon, 23 Nov 2026 18:12
16 lines
2453 bytes
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=301053

--- Comment #1 from laamalif@proton.me ---
Created attachment 277606
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=277606&action=edit
SOCKS5 proxy that logs each CONNECT

-- 
You are receiving this mail because:
You are the assignee for the bug.

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-admin@muc.de
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads