Skip to content

fix: pin the destination and ACL apply, admit getgroups in the daemon filter - #8201

Merged
oferchen merged 15 commits into
masterfrom
fix/security-bundle-cves
Oct 14, 2026
Merged

oferchen merged 15 commits into
masterfrom
fix/security-bundle-cves

Conversation

@oferchen

@oferchen oferchen commented Oct 14, 2026 •

Copy link
Copy Markdown
Owner

Summary

This bundles three security fixes.

CVE-2026-53796: pin the operator-named destination (Partially fixed)

A receiver that is not a daemon (local copy, the pull client, --server over rsh) now walks the destination path checking symlink owners, mirroring upstream change_dir()'s open_no_attacker_symlinks_dirfd() in util1.c. A symlink owned by another uid is refused with exit 3. The fd the walk returns becomes the pinned destination root, so later opens of the destination reuse it instead of resolving the path again; a swap of the path after the walk is refused with ELOOP. The daemon path is unchanged. On Windows this code is not compiled.

It stays Partially fixed, because upstream fchdir()s into the pinned directory and oc has not reached that end state:

  • After a swap, the network receiver still makes about 60 path-based metadata calls (stat, chmod, utime). They fail closed with exit 23, so file data stays inside the destination, but the metadata calls are not pinned (task 546).
  • A local destination that names a single file is not pinned.
  • On push, the client gets only exit 3 and its own error line, checked over an rsh shim whose server stderr is kept separate. Two things are missing: the server never prints the walk's "refusing to follow a symlink owned by an untrusted user" line, not even to its own stderr; and the server's fatal "failed to access destination directory" text does not cross the protocol (GAP 1434, the IOBUF family). fix: mirror upstream server diagnostic routing and max verbosity #8198 forwards info and debug lines only, so it does not cover either.

CVE-2026-53799, ACL half: apply ACLs through a pinned leaf (Fixed, upstream parity on supported platforms)

On Linux, ACLs are now written through a leaf pinned beneath the destination root, using the kernel's system.posix_acl_* xattr format. The encoding is byte-identical to upstream lib/acl.c:120-153, and a golden test checks it.

  • Only regular files, directories and FIFOs are opened, with O_NONBLOCK|O_NOFOLLOW|O_NOCTTY, as in rsync.c:563-571. Before this change oc also opened device nodes.
  • Devices and sockets get their ACL through the pinned parent directory and /proc/self/fd, falling back to the path when /proc is unavailable (acls.c:1315-1321).
  • The local copy path is now pinned as well; before this it applied ACLs by path at every call site.
  • macOS and the BSDs still apply ACLs by path, as upstream 3.5.1 does (acls.c:1316-1322, 1352). Upstream pins by fd only on Linux (configure.ac:1510-1514, acls.c:1266-1322). Its Solaris facl arm (acls.c:1325-1344) doesn't apply, because oc doesn't support Solaris or illumos. So 53799 is now Fixed (upstream parity on supported platforms).

--version now reports ACL-at on Linux ACL builds and lists the none entries. Its JSON and footer are laid out like upstream 3.5.1 (usage.c:189-238, 336-339).

ACLs on special files (receiver)

The receiver's special-file pass (create_specials_in_range) set mode, owner and times on FIFOs, sockets and devices, but never their ACL. Upstream applies ACLs to them through set_file_attrs -> set_acl (rsync.c:800). The pass now applies the ACL after the other metadata, in all five receiver drivers, and reports failures as FERROR_XFER.

  • On master the gap was invisible: the UTS acl-symlink-race cell exits early unless --version reports ACL-at, so it passed without testing anything. With ACL-at now reported, the cell's positive control runs, and it passes only with this fix (nonroot pipe, root pipe and nonroot TCP legs).
  • New test receiver_applies_the_acl_to_a_fifo_entry. Removing the new apply block makes it fail.
  • Not done: upstream also sets xattrs on special files, and oc still doesn't.

Daemon seccomp: admit getgroups

The daemon worker's seccomp allowlist did not include getgroups. As a result, process_in_group() returned false and a chown to a supplementary group was silently skipped.

Validation

All runs are on Linux aarch64, on the merged tree:

  • fmt is clean. clippy -D warnings is clean for cli, core, daemon, engine, fast_io, metadata, transfer and bin, with default features and with --all-features.
Suite Result
CVE-2026-53796 e2e + pin tests 11/11
seccomp / getgroups 10/10
ACL (metadata) 130/130
version:: (core) 258/258
transfer/core sandbox, destination, untrusted and ACL 147/147
Re-run after the special-file fix (metadata, confinement, receiver, ACL, version, seccomp) 1886/1886
  • The getgroups test runs for real both as root (via sudo) and as nonroot. Removing getgroups from the allowlist fails it in both runs.
  • 53796 tests that fail on the pre-fix base: the untrusted-symlink push exits 0 and writes outside the destination; local --insecure-links exits 23; the local swap race writes outside the destination. All three pass on the fix. Three mutations each turn tests red: bypassing the owner check, re-opening the destination by path, and dropping the receiver sandbox.
  • ACL mutations that each turn tests red: path-based apply, dropping the destination root, opening sockets, an unpinned local copy, and ACL-at forced to false.
  • cargo xtask no-placeholders and the citation ratchet both pass.
  • One pre-existing engine failure, no_implied_dirs_follows_an_existing_dest_symlink_path_element (ELOOP), fails the same way on untouched master on the same machine. Master CI passes it, so the failure looks specific to that machine.

Docs

SECURITY.md, docs/audits/cve-uts351-matrix.md (including the Totals table), README and CHANGELOG are updated. The counts are now 27 fixed, 1 partially fixed (53796) and 5 not applicable.

The version golden test helpers now have the same cfg gate as the tests that use them; on Windows they were dead code.

A non-root daemon worker decides whether it may set a file group from
metadata::group_is_settable, which mirrors upstream is_in_group()
(uidlist.c:195-239) and lists the process groups with getgroups(2).
The worker allowlist omitted getgroups, so under the daemon-seccomp
feature the call failed with EPERM, every supplementary group read as
foreign, and each such chown was skipped while the transfer exited 0.
UTS daemon-groupmap-wild over TCP failed this way with --all-features.

Admit SYS_getgroups (the only number on x86_64 and aarch64). A failing
getgroups still falls back to the effective gid as upstream does, but
is now reported once on stderr instead of passing silently.
Mirror upstream 3.5.1 usage.c:110-125: a Linux build with ACL support
prints ACL-at or no ACL-at after ACLs. The value comes from
metadata::ACL_APPLY_IS_FD_PINNED, which records that the receiver
applies ACLs by path, so oc reports no ACL-at.

End the checksum and compress lists with none, as upstream
get_default_nno_list() does with a dup markup (compat.c:477-478), in
both the text and JSON reports. This replaces two tests that asserted
the lists exclude none, which the 3.5.1 binary contradicts.

Add a golden test of the Capabilities and Optimizations text, derived
from upstream print_info_flags() wrap loop.
…on root

The network receiver and the local copy now write ACLs the way the
xattr half already does: through an O_NOFOLLOW fd pinned beneath the
destination root, serialised into the kernel system.posix_acl_* format
(lib/acl.c acl_to_xattr). A refused pin on a slashed path skips the ACL
(rsync.c:597 xattr_refuse). Like upstream (rsync.c:563-571) only regular
files, directories and FIFOs are opened; devices and sockets are written
through the confined parent dirfd via /proc/self/fd (lib/acl.c xacl_set_at).
--version reports ACL-at on Linux ACL builds.
Pack the -VV capability and optimization objects with the same 75-byte
line buffer as the text report (usage.c:189-238): one loop now serves
both, entries are filled to the line width, and each object closes with
"  }" on its own line.

Wrap the warranty footer to upstream's three lines (usage.c:336-339),
with two spaces after each full stop and the "Licence" spelling, while
keeping this binary's program name.

Extend the golden tests with the JSON objects and the footer, derived
from the same reproduction of upstream's wrap loop.
…x/security-bundle-cves

# Conflicts:
#	README.md
@github-actions github-actions Bot added the bug Something isn't working label Oct 14, 2026
The receiver's special-file pass set the mode, owner and times on a
FIFO, socket or device node but never applied its ACL. Upstream's
set_file_attrs() calls set_acl() for every non-symlink entry
(rsync.c:800), holding a FIFO open O_NONBLOCK and addressing a device
or socket through its parent (rsync.c:563-571, acls.c:1315-1321). Thread
the ACL cache and id map into create_specials and apply the ACL beneath
the destination root, so the acl-symlink-race positive control holds.

The dir and leaf fields of DestPin::Parent are read only by the Linux
fd-pinned ACL apply, so they are now compiled only there; other targets
and builds without the acl feature failed with dead_code under
-D warnings.

Also reformat backups.rs, which cargo fmt cannot reach.
@oferchen
oferchen merged commit 499b5cc into master Oct 14, 2026
87 of 88 checks passed
@oferchen
oferchen deleted the fix/security-bundle-cves branch October 14, 2026 21:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant