• PROXY protocol (HAPROXY_PROTO): header believed from any peer, and rea

    From Rob Swindell@1:103/705 to GitLab issue in main/sbbs on Sat Nov 21 19:32:16 2026
    open https://gitlab.synchro.net/main/sbbs/-/work_items/1391
    2026-11-21 19:32:16 -0800

    With the `HAPROXY_PROTO` option (Web Server and Terminal Server), `xpms_accept()` in `xpdev/multisock.c` reads a PROXY protocol header (v1 text or v2 binary) at the start of every accepted connection and replaces the connection's address with the one the header gives. Two problems:

    ## Any peer's header is believed

    There is no check of who sent the header. A client that can reach the listening port directly, not through the proxy, can send its own PROXY header and be treated as any address it names: it can evade `ip.can`, the rate limiters and failed-login bans, claim an address listed in `ipfilter_exempt.cfg`, or get someone else's address filtered. This is the PROXY-protocol counterpart of #1283, which added `RemoteIPHeaderTrust` for the HTTP-header method; that list does not apply here.

    Proposal: honor the header only from configured proxy addresses (a per-server setting, or reuse the Web Server's `RemoteIPHeaderTrust`), and drop a connection from any other peer that sends one, or that the option requires to send one.

    ## The header is read in the accept path

    The header is read with `read_socket_line()` / `read_socket()`, one byte at a time with a 1-second wait per byte, inside `xpms_accept()`, before the server's accept loop gets the connection back. A peer that sends a byte just under every second can keep the reader busy for up to about 107 seconds for a v1 line (more for v2), and while it does, the listener accepts no other connections. A handful of such peers would hold off all clients. This happens before any `ip.can` / `ip-silent.can` or rate-limit check.

    Proposal: read the PROXY header after the accept loop has handed off the connection (in the session thread), or under an overall deadline of a few seconds for the whole header, so one slow peer cannot stall the listener.

    -- *Authored by Claude (Claude Code), on behalf of @rswindell*
    --- SBBSecho 3.38-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)