Skip to content

fix: gate client merge files against daemon filters (CVE-2026-53786) - #8223

Merged
oferchen merged 3 commits into
masterfrom
fix/cve-53786-receiver-merge-gate
Oct 20, 2026
Merged

oferchen merged 3 commits into
masterfrom
fix/cve-53786-receiver-merge-gate

Conversation

@oferchen

Copy link
Copy Markdown
Owner

Summary

  • Close CVE-2026-53786 (daemon-filter-merge-bypass) on the daemon receiver. On a push, a client's per-directory merge rule (--filter=': secret', sent over the filter list) made the daemon read a file its module filter hides, so that file's rules steered --delete. The merge-file gate was installed only on the daemon sender.
  • Judge every gated merge file by its module-relative path, as upstream does. The gate previously used the transfer-relative path, so an anchored module rule such as exclude = /sub/secret missed on a push or pull rooted in a module subdirectory. This affected the sender too.
  • Correct the audit row and the SECURITY.md evidence that called the daemon "immune by absence".

Details

Upstream contract. exclude.c:1638-1659 parse_filter_file() runs every merge-file open through check_filter(&daemon_filter_list, ...), on the merge file's path with module_dirlen stripped, on both roles. A hidden merge file is treated as non-existent: no error, no rules read.

What oc did on master (22a42b0).

  • Receiver chains: compile_receiver_filter_chains built the receiver's filter_chain and deletion_filter_chain from the module rules plus the client's wire rules, including dir-merge configs, without calling set_daemon_filter_gate. The delete pass's per-directory reload therefore opened any merge file the client named.
  • Path the gate checked: FilterChain::daemon_gate_hides built the name relative to transfer_root, the push or pull target, not the module root.

Fix.

  • filters: FilterChain::set_daemon_gate_root records the module root. daemon_gate_hides now judges directory.strip_prefix(module_root)/filename, falling back to the transfer-relative form outside a daemon.
  • Receiver: install_daemon_merge_gate installs the module's rules alone as the gate on filter_chain. deletion_filter_chain inherits it through the clone, so the --delete per-directory reload and --delete-excluded are covered.
  • Sender: generator/filters.rs records the module root as well.

Oracle. Each scenario was run against an upstream 3.5.1 daemon. The secret merge file holds - decoy, and decoy exists only on the destination (push) or only on the module side (pull). Push and pull with --filter=': secret'; all runs exit 0.

Scenario Upstream 3.5.1 oc master oc this branch
push, no daemon filter (control) secret read, decoy kept read, kept read, kept
push, exclude = secret not read, decoy deleted read, kept not read, deleted
push, filter = - secret not read, deleted read, kept not read, deleted
push, nested a/secret, exclude = secret not read, deleted read, kept not read, deleted
push into mod/sub/, exclude = /sub/secret not read, deleted read, kept not read, deleted
pull from mod/sub/, exclude = /sub/secret not read, decoy sent read, withheld not read, sent
push with -M--filter=': secret' (server argv), exclude = secret gated, deleted not applied, deleted not applied, deleted

Server-argv filter options. oc's daemon does not apply filter options a client forwards into the server argv with -M/--remote-option (long_form_args.rs default arm). Upstream applies them, and refuses a daemon-excluded --exclude-from with exit 4. So no hidden file is read on either side. The ungated -M--filter case is a fidelity difference rather than a leak, and is left unchanged here.

Test plan

  • cargo nextest run --all-features -E "binary(daemon_client_filter_merge_does_not_read_hidden_file)": 7 tests. Committed first as RED on master (4 of 5 initial tests failed with "the daemon read ..."; the ungated control passed). All 7 pass on this branch.
  • Mutation checks, each turning the expected tests red:
    • dropping the receiver gate install fails 4 tests;
    • dropping the receiver module root fails only the anchored push test;
    • dropping the sender module root fails only the anchored pull test.
  • cargo nextest run -p filters -p transfer -p daemon --all-features: 6972 passed. Root filter, merge and exclude tests (including integration_daemon_filter_directives): 83 passed.
  • cargo nextest run -p filters -E "test(daemon_gate)", including the new daemon_gate_root_matches_the_module_relative_merge_path with its non-vacuity half.
  • cargo fmt --all -- --check, python3 tools/ci/check_rustfmt_all.py
  • cargo clippy -p filters -p transfer -p daemon -p bin --all-targets --all-features --no-deps -- -D warnings
  • cargo check --target x86_64-pc-windows-gnu -p filters -p transfer -p daemon
  • python3 tools/ci/unsafe_owner_deps.py, cargo run -p xtask -- no-placeholders, cargo run -p xtask -- citations
  • CI: fmt + clippy, nextest (stable), Windows, macOS, Linux musl, upstream testsuite (daemon-filter-merge-bypass), interop.

Coordination

  • Related PRs / issues: none open on the filter chain.
  • Depends on: master 22a42b0.
  • Blocked by: nothing.

Conventional commit prefix

  • fix: - security bug fix (the history is a failing-first test: commit followed by the fix:).

Security considerations

  • Threat surface affected: a daemon module with exclude/filter/exclude from parameters, reached by a client that sends a dir-merge rule. On a push with --delete, the hidden file's rules decided which destination files survived. A crafted file could also inject rules from a path the module meant to hide, and with module-anchored rules this applied to pulls rooted in a subdirectory too. The file's content was never sent back verbatim by this path.
  • Mitigations / tests added: the module-rules-only gate on all receiver chains, plus module-relative judgement on both roles. tests/daemon_client_filter_merge_does_not_read_hidden_file.rs covers push, nested, anchored push and pull, and the argv vectors, all matched against upstream 3.5.1. A unit test in filters/src/chain/tests.rs pins the module-relative path.
  • Cross-references:
    • SECURITY.md CVE-2026-53786 row;
    • docs/audits/cve-uts351-matrix.md row and finding 7, both corrected;
    • upstream exclude.c:1638-1659.

Pre-merge checklist

  • Conventional commit prefix on PR title matches the change category.
  • cargo fmt --all run locally.
  • CHANGELOG.md updated if user-visible.
  • SECURITY.md updated if security-relevant.
  • No references to internal tooling or non-human authoring aids; hyphens, not em-dashes.

Pushes with --delete and a client `: secret` rule into a module whose
filter hides `secret`. Upstream 3.5.1 treats the hidden merge file as
absent (exclude.c:1638-1659); on master oc reads it, so four scenarios
fail while the ungated control passes.
A pushing client could name a module-hidden file as a per-directory
merge file over the filter list, and the daemon receiver read it, so its
rules steered --delete (CVE-2026-53786). The merge-file gate was only
installed on the sender, and it judged the path relative to the transfer
root, so an anchored module rule missed when the transfer was rooted in a
module subdirectory.

Install the module rules as the gate on the receiver chains too, and
record the module root so every merge file is judged module-relative,
mirroring exclude.c:1638-1659 parse_filter_file(). Adds pull and argv
coverage plus a filters unit test, and corrects the audit and SECURITY
rows that called the daemon immune by absence.
@oferchen
oferchen merged commit 0fe3a72 into master Oct 20, 2026
86 checks passed
@oferchen
oferchen deleted the fix/cve-53786-receiver-merge-gate branch October 20, 2026 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant