Repository navigation
fix: confine daemon alt-basis paths to module root (URV-5.a) - #5540
Merged
Merged
Conversation
The daemon's relative alt-basis admission path (--copy-dest=REL / --link-dest=REL / --compare-dest=REL) called module_path.join(rel) without any confinement check. A client could submit --copy-dest=../../etc on a chroot-disabled module and have the receiver target inodes outside the module root. Mirror upstream rsync 3.4.4 secure_relative_open() (syscall.c:1791- 1896) by front-door rejecting any `..` component in the relative path before the join. This matches upstream's portable fallback semantics (syscall.c:1883-1896), which is the only safe behaviour without kernel-enforced RESOLVE_BENEATH on the destination tree. oc-rsync never chdir's the daemon process into a transfer subdirectory of the module, so upstream's re-anchoring branch (syscall.c:1817-1844) for --link-dest=../sibling-within-module does not apply: a relative ref-dir path is always interpreted against the module root directly. Add regression tests covering the headline exploit (../../etc), bare `..`, leading `..`, trailing `..`, embedded `..`, and the positive admission cases for clean siblings and nested paths. Classified in SECURITY.md under the SEC-1 family (TOCTOU / filesystem confinement on chroot-disabled modules).
This was referenced Jun 10, 2026
oferchen
added a commit
that referenced
this pull request
Aug 24, 2026
The daemon's relative alt-basis admission path (--copy-dest=REL / --link-dest=REL / --compare-dest=REL) called module_path.join(rel) without any confinement check. A client could submit --copy-dest=../../etc on a chroot-disabled module and have the receiver target inodes outside the module root. Mirror upstream rsync 3.4.4 secure_relative_open() (syscall.c:1791- 1896) by front-door rejecting any `..` component in the relative path before the join. This matches upstream's portable fallback semantics (syscall.c:1883-1896), which is the only safe behaviour without kernel-enforced RESOLVE_BENEATH on the destination tree. oc-rsync never chdir's the daemon process into a transfer subdirectory of the module, so upstream's re-anchoring branch (syscall.c:1817-1844) for --link-dest=../sibling-within-module does not apply: a relative ref-dir path is always interpreted against the module root directly. Add regression tests covering the headline exploit (../../etc), bare `..`, leading `..`, trailing `..`, embedded `..`, and the positive admission cases for clean siblings and nested paths. Classified in SECURITY.md under the SEC-1 family (TOCTOU / filesystem confinement on chroot-disabled modules).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
secure_relative_open()confinement (syscall.c:1791-1896) into the daemon's relative alt-basis admission path incrates/daemon/src/daemon/sections/module_access/client_args.rs.module_path.join(rel)with no..rejection and noRESOLVE_BENEATHconfinement, so a client could submit--copy-dest=../../etcon a chroot-disabled module and the receiver would target inodes outside the module root...component in--copy-dest=REL/--link-dest=REL/--compare-dest=RELrelative paths, then join the validated path onto the module root. The session is torn down with@ERROR: refusing alt-basis path that escapes module root: ...on rejection.Why upstream's portable fallback, not RESOLVE_BENEATH
Upstream's RESOLVE_BENEATH branch handles a case oc-rsync does not hit: rsync chdir's into a transfer subdirectory of the module and then needs to allow
--link-dest=../sibling-within-moduleto climb back to a peer directory still inside the module (syscall.c:1817-1844). oc-rsync never chdir's the daemon process into a subdirectory of the module path (see the existing comment atbuild_server_configabove the call site), so the relative ref-dir path is always interpreted against the module root directly. Upstream's portable fallback (syscall.c:1883-1896) is the matching semantics in that regime: reject..outright. This is also the safest behaviour on platforms without kernel-sideRESOLVE_BENEATH(NetBSD, OpenBSD, Solaris, Cygwin, pre-5.6 Linux), where per-component walking cannot adjudicate..against bind-mounts and racing symlinks.SECURITY.md classification
Bug class falls under the SEC-1 family in SECURITY.md (TOCTOU and filesystem confinement on chroot-disabled modules). The closely related CVE-2026-29518 / CVE-2026-43619 entries cover symlink races on receiver syscalls; this fix closes a narrower but related admission-time path-traversal hole on the same
use chroot = noconfigurations that the SEC-1 work targets.Test plan
confine_alt_basis_admits_clean_relative_siblingconfine_alt_basis_admits_nested_relative_pathconfine_alt_basis_rejects_bare_dotdotconfine_alt_basis_rejects_leading_dotdotconfine_alt_basis_rejects_path_traversal_to_etc(the headline../../etcexploit)confine_alt_basis_rejects_embedded_dotdotconfine_alt_basis_rejects_trailing_dotdotpath_has_dotdot_component_detects_all_forms