Skip to content

Local copy to a single-file destination writes through another user's symlink (CVE-2026-53796 residual) #8858

Done

Description

@oferchen

A local copy whose destination is a single file does not put the destination's parent through the ownership walk and does not pin it. A symlink owned by another user inside the destination path is followed, and the file is written outside the destination. rsync 3.5.2 refuses. This is a residual of CVE-2026-53796.

Reproduce

dest/sub is a symlink to outside, owned by another user (uid 65534). Run as an ordinary user:

oc-rsync -t src/f dest/sub/deeper/g
exit result
rsync 3.5.2 3 prints the untrusted-symlink refusal and rsync: [Receiver] change_dir#3 "<base>/dest/sub/deeper" failed: Too many levels of symbolic links (40); outside is untouched
oc-rsync (master, and 0.6.4) 0 writes outside/deeper/g

Related rows on the same path:

fixture rsync 3.5.2 oc-rsync
untrusted symlink is the immediate parent (dest/sub/g) exit 3, same two lines exit 23, cannot replace non-directory destination with directory, nothing written (fails closed, with the wrong message)
the user's own symlink is the immediate parent follows it, exit 0 exit 23 with the same message (a plain bug)
real parent directory copies copies

A push or a pull into the same layouts is not affected: the network receivers walk and pin the parent before the transfer, and exit 3 with nothing written.

Cause

resolve_destination_like_change_dir in crates/core/src/client/run/mod.rs returns early when the destination is not a directory, so the parent is never walked or pinned. rsync 3.5.2 enters the parent with change_dir(parent, CD_NORMAL) (main.c:843-868), which goes through open_no_attacker_symlinks_dirfd and fchdir (util1.c:1448-1467).

Expected

  • The parent of a single-file local destination is walked and pinned as rsync 3.5.2 does, with its change_dir#3 line and exit 3 on refusal.
  • A symlinked parent the user owns is followed.
  • Tests against rsync 3.5.2 for the three fixtures above on local, push and pull, plus a parent swapped after entry, each failing without the fix.
  • The SECURITY.md row for CVE-2026-53796 updated.

Activity

  1. added this to the v0.6.5 milestone on Nov 26, 2026
  2. added
    bug
    on Nov 26, 2026
  3. oferchen commented on Nov 26, 2026

    @oferchen
    OwnerAuthor

    A second layout escapes the same way: a local copy into a directory that does not exist yet, below another user's symlink.

    dest/link is a symlink owned by another user, pointing at a directory outside the tree. oc-rsync -t src/f dest/link/new/:

    exit result
    rsync 3.5.2 3 refusing to follow a symlink owned by an untrusted user; ... then change_dir#2 "<base>/dest/link/new" failed: Too many levels of symbolic links (40); nothing written
    oc-rsync (master) 0 creates new/ through the link and writes the file there

    Both come from the same early return: the destination is not an existing directory, so its parent is never walked or pinned. rsync 3.5.2 re-enters a destination it has just created through the same checked change_dir (main.c:817-839). The fix must cover the created-directory case as well as the single-file case.

    For comparison, a local copy into an existing directory through the same link is refused with exit 3 on both; there only the order and wording of the lines differ.

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

    bugsecurity

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions