Skip to content

Push and pull into a destination below another user's symlink: oc prints its own error instead of change_dir#2/#3 and creates the new directory in that user's tree before refusing #8870

Done

Description

@oferchen

On push and pull, when the destination path passes through a symlink owned by another user, the oc receiver refuses with exit 3 as rsync 3.5.2 does, but:

  • it prints its own failed to access destination directory ... line instead of 3.5.2's change_dir#2 / change_dir#3 line;
  • when the run has to create the destination directory, it first creates that directory inside the other user's tree (3.5.2 does the same), then refuses.

The local-copy case is fixed in #8858. The push-side line text and order for an existing destination are #8863.

Measured

Fixture: B/dest/sub is a symlink to B/outside, owned by uid 65534 (chown -h). oc is the #8858 fix build on both ends of a local remote-shell shim; 3.5.2 is the release build.

Pull, single file (host:B/src/f B/dest/sub/g), exit 3 in both, nothing written outside:

lines after the refusal line
3.5.2 rsync: [Receiver] change_dir#3 "B/dest/sub" failed: Too many levels of symbolic links (40); code-3 trailer [Receiver=3.5.2]; rsync error: received SIGUSR1 (code 19) ... [sender=3.5.2]
oc failed to access destination directory 'B/dest/sub': Too many levels of symbolic links (os error 40); code-3 trailer; no change_dir#3 line, no sender SIGUSR1 line

Pull, created directory (-r host:B/src/d/ B/dest/sub/new/), exit 3 in both:

lines outside/new created
3.5.2 refusal; change_dir#2 "B/dest/sub/new" failed: ... (40); code-3 trailer; sender SIGUSR1 line yes
oc refusal; failed to access destination directory 'B/dest/sub/new/': ... (os error 40); code-3 trailer yes

Push, created directory (-r B/src/d/ host:B/dest/sub/new/), exit 3 in both:

lines outside/new created
3.5.2 refusal; change_dir#2 "B/dest/sub/new" failed: ... (40); code-3 trailer [Receiver=3.5.2] yes
oc server error: failed to access destination directory 'B/dest/sub/new/': ... (code 3) ... [server=...] first, then the refusal yes

Upstream

get_local_name (main.c): do_mkdir is a plain mkdir(dest_path) that follows symlinks (syscall.c), then change_dir(dest_path, CD_NORMAL) refuses at change_dir#2; for a single file, change_dir#3 on the parent. The network receiver reaches the same code.

Target

  • Print 3.5.2's change_dir#2 / change_dir#3 lines, role tag and trailer, including the sender's SIGUSR1 line on a pull.
  • Do not create the directory before refusing. This is the same deliberate deviation already chosen for the local copy in Local copy to a single-file destination writes through another user's symlink (CVE-2026-53796 residual) #8858: oc walks the parent first and refuses, so nothing is created in another user's tree. Lines and exit 3 otherwise equal 3.5.2.
  • Privileged binary tests for push and pull that fail, rather than skip, when the privilege to plant a foreign-owned symlink is missing.

Related: #8858 (local copy), #8863 (push line text and order for an existing destination).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions