Seregon 1374100ea0 Improve data transfer robustness & network PAL
Add internal API docs and tweak build/gitignore; bump release to 1.2.2. Increase default buffer/stream sizes and add data-specific I/O timeouts/linger for PS4/PS5/other platforms; disable transfer rate limiting on PS5. Introduce new PAL networking primitives (pal_socket_configure_data, cork/uncork, timeouts/drain helpers) and update pal_network.h/.c for safer, more configurable socket behavior and telemetry. Make file I/O more robust on consoles (F_NOCACHE, posix_fadvise) and harden HTTP CSRF token formatting to avoid overruns. Replace the old per-session token-bucket rate limiter with socket corking around sendfile/read loops, add fsync flushes and richer failure reporting in RETR/STOR/APPE, and implement a graceful data-socket close sequence to avoid RSTs. Minor Makefile fixes to ensure build directories exist.
2026-02-22 00:17:57 +01:00
2026-02-13 22:06:09 +01:00
2026-02-13 16:55:53 +01:00

zftpd - Zero-copy FTP Daemon compatible with all POSIX systems

C11 License Downloads
Multi-platform FTP server designed to run both as a POSIX binary (Linux/macOS) and as a console payload (PS3/PS4/PS5).

Key Features

  • Zero-copy data path where available (sendfile fast path; falls back to buffered I/O when encrypted)
  • Robust TCP I/O (partial sends, EINTR, backpressure-aware send buffers)
  • Control/data channel timeouts + session idle timeout
  • Path hardening (canonicalization, traversal blocking, optional safe-list for /dev, /proc, /sys)
  • Structured per-session logging + stats (bytes/files sent/received)
  • Transfer rate limiting (token bucket, compile-time toggle)
  • Resume uploads via REST + STOR; append uploads via APPE
  • Optional ChaCha20 stream cipher (AUTH XCRYPT) with PSK
  • On-screen notifications on PS4/PS5 (IP/port and status)
  • Optional ZHTTP web file explorer (compile-time, enabled by default on PS4/PS5)

Supported FTP Commands

  • Authentication & control: USER, PASS, QUIT, NOOP
  • Navigation: CWD, CDUP, PWD
  • Listing: LIST, NLST, MLSD, MLST (MLST minimal)
  • Transfer: RETR, STOR, APPE, REST
  • File management: DELE, RMD, MKD, RNFR, RNTO
  • Data connection: PORT, PASV
  • Information: SIZE, MDTM, STAT, SYST, FEAT, HELP
  • Transfer parameters: TYPE, MODE, STRU
  • Encryption (opt-in): AUTH XCRYPT (ChaCha20 PSK)

Build

Artifacts are placed in build/<target>/<build_type>/.

Requirements

  • C11 Toolchain (gcc/clang) + make
  • To generate .bin: objcopy (binutils or llvm-objcopy). Alternatively, use SDK wrappers:
    • PS4: OBJCOPY=orbis-objcopy
    • PS5: OBJCOPY=prospero-objcopy
  • PS4: PS4_PAYLOAD_SDK set
  • PS5: PS5_PAYLOAD_SDK set

Commands

# Linux
make TARGET=linux

# macOS
make TARGET=macos

# PS4
make TARGET=ps4

# PS5
make TARGET=ps5

# Debug build
make TARGET=linux BUILD_TYPE=debug

Output (what to use)

Artifacts are versioned and platform-tagged (examples):

  • Linux: build/linux/release/zftpd-linux-<arch>-v<version>.elf
  • macOS: build/macos/release/zftpd-macos-<arch>-v<version>
  • PS4: build/ps4/release/zftpd-ps4-v<version>.bin + zftpd-ps4-v<version>.elf
  • PS5: build/ps5/release/zftpd-ps5-v<version>.bin + zftpd-ps5-v<version>.elf

Running (Daemon) by Platform

Linux

./build/linux/release/zftpd-linux-<arch>-v<version>.elf

Useful options (POSIX only): -p <port> and -d <root>.

macOS

./build/macos/release/zftpd-macos-<arch>-v<version>

PS4

  • Requires a payload loader (e.g. WebKit/PPPwn/Netcat/GoldHEN). zftpd does not require a resident "HEN", but must be launched by a loader/exploit.
  • If the loader expects a .bin payload: send build/ps4/release/zftpd-ps4-v<version>.bin.
  • If the loader accepts ELF: you can choose between build/ps4/release/zftpd-ps4-v<version>.bin and build/ps4/release/zftpd-ps4-v<version>.elf.

On startup, it shows a notification with IP and port.

PS5

  • Requires a payload loader (etaHEN/Netcat/equivalent loader).
  • If the loader expects a .bin payload: send build/ps5/release/zftpd-ps5-v<version>.bin.
  • If the loader accepts ELF: you can choose between build/ps5/release/zftpd-ps5-v<version>.bin and build/ps5/release/zftpd-ps5-v<version>.elf.

On startup, it shows "started" notifications + FTP: <ip>:<port>.

Configuration

Compile-time configuration is in ftp_config.h. Useful macros:

  • FTP_DEFAULT_PORT (PS4/PS5 default 2122, POSIX default 2121)
  • FTP_MAX_SESSIONS
  • FTP_SESSION_TIMEOUT
  • FTP_TRANSFER_RATE_LIMIT_BPS / FTP_TRANSFER_RATE_BURST_BYTES
  • FTP_LOG_COMMANDS

Notes

  • If you see "payload already loaded" on PS4/PS5, it means an instance is already active (dedup). The new daemon will try to terminate the old instance and start a new one on port FTP_DEFAULT_PORT:2122. If that fails, it will try the next port FTP_DEFAULT_PORT+1:2123 up to a maximum of 9 subsequent ports.
  • For host testing: make TARGET=linux test or make TARGET=macos test.

ZHTTP (Web File Explorer)

  • What it is: Lightweight web UI to browse, download, and (optionally) upload files from a browser.
  • Enable/disable: On by default on PS4/PS5. Disabled by default elsewhere. Override with ENABLE_ZHTTPD=1 or disable with ENABLE_ZHTTPD=0 at build time (e.g., make TARGET=ps5 ENABLE_ZHTTPD=0).
  • Build impact: Adds HTTP modules (event_loop_kqueue, http_server, http_parser, http_response, http_api, http_csrf, http_resources).
  • Usage: After starting the daemon, open http://<ip>:<port>/ (port matches the configured FTP port). Shows a file explorer with breadcrumb, direct download, and—if built with ENABLE_WEB_UPLOAD=1 (enabled alongside ZHTTP)—an upload button.
  • Security: Intended for LAN/payload scenarios; no additional auth beyond local network context. Keep the port closed on WAN.

Support

If you find zftpd useful and would like to support its ongoing development, consider making a donation. Any contribution is greatly appreciated!

Donate PayPal Support Ko-fi Sponsor GitHub

License

MIT — see LICENSE.

S
Description
Zero-copy FTP/HTTP Daemon compatible with all POSIX systems
Readme MIT
17 MiB
0 Stars 1 Watchers 0 Forks
zftpd v1.6.0
Latest
2026-09-30 13:52:32 -05:00
Languages
C 64.5%
JavaScript 19.5%
CSS 8.2%
HTML 2.9%
Makefile 2%
Other 2.9%