Repository navigation
fix(daemon): route the log-file open onto the ownership walk - #7441
Merged
Merged
Conversation
The daemon opened its log file with a plain path-based
`OpenOptions::new().create(true).append(true)`, while upstream opens
every log file through `open_no_attacker_symlinks()`:
logfile_fp = fdopen(open_no_attacker_symlinks(logfile_name,
O_WRONLY|O_APPEND|O_CREAT, 0644), "a");
(log.c:169-170). The reason is stated at log.c:165 - `--log-file` and
`log file =` are operator-supplied paths that may transit
attacker-writable directories, and a symlink planted at any component
redirects a root daemon's log into a file of the attacker's choosing.
The walk refuses symlink components not owned by uid 0 or our euid.
The client `--log-file` was already routed, but requested mode `0666`
where upstream passes `0644`. Upstream additionally wraps its open in
`umask(022 | orig_umask)` (log.c:163) so a permissive umask can never
yield a group- or world-writable log; `0644` reaches the same fixed
point without the dance, because it holds no group or other write bit
for a umask to have to clear. Both sinks now pass `0644`.
Tests pin both sinks with the child's umask pinned to 0, which is what
makes the assertion discriminating: umask can only clear bits, so under
the usual 022 a `0666` request also lands as `0644` and the two
spellings are indistinguishable. A third test validates that instrument
directly, so the pair cannot pass vacuously if the umask pin ever stops
applying.
oferchen
added a commit
that referenced
this pull request
Aug 24, 2026
…7477) The docs were last refreshed at #7423; 55 PRs have merged since, and the testsuite figures they quote had drifted far enough to understate the current state by roughly half. CHANGELOG: fill in Unreleased for everything merged since #7423. The dominant theme is routing every operator-named auxiliary file open onto the ownership walk - upstream's open_no_attacker_symlinks() applied at the call sites upstream applies it - plus a daemon hardening batch and an alt-dest correctness batch. README and SECURITY: the per-leg outcome tables were re-derived from the committed expect manifests rather than carried forward. Failures fell and the corpus grew, so every figure moved: non-root pipe 43 -> 21 fail (345 -> 349 corpus) root pipe 62 -> 29 fail (345 -> 349 corpus) non-root tcp 42 -> 29 fail (155 -> 158 corpus) root tcp 55 -> 38 fail (155 -> 158 corpus) Distinct divergences: 64 -> 31 across the two full-corpus legs, 89 -> 55 across all four. SECURITY, two CVE rows that had gone stale: - CVE-2026-53790 said "under audit". The refusal has since been applied at the live sink - oc-rsync's own single-character config expander, which upstream does not have, so an upstream-shaped port alone would have been inert (#7465, #7430, #7445). - CVE-2026-53795 listed only the staging family. The auxiliary-file family followed it onto the walk (#7421-#7426, #7439, #7441-#7443, #7459, #7463); what remains is the per-option-family confinement.
oferchen
added a commit
that referenced
this pull request
Aug 24, 2026
oferchen
added a commit
that referenced
this pull request
Aug 24, 2026
…7477) The docs were last refreshed at #7423; 55 PRs have merged since, and the testsuite figures they quote had drifted far enough to understate the current state by roughly half. CHANGELOG: fill in Unreleased for everything merged since #7423. The dominant theme is routing every operator-named auxiliary file open onto the ownership walk - upstream's open_no_attacker_symlinks() applied at the call sites upstream applies it - plus a daemon hardening batch and an alt-dest correctness batch. README and SECURITY: the per-leg outcome tables were re-derived from the committed expect manifests rather than carried forward. Failures fell and the corpus grew, so every figure moved: non-root pipe 43 -> 21 fail (345 -> 349 corpus) root pipe 62 -> 29 fail (345 -> 349 corpus) non-root tcp 42 -> 29 fail (155 -> 158 corpus) root tcp 55 -> 38 fail (155 -> 158 corpus) Distinct divergences: 64 -> 31 across the two full-corpus legs, 89 -> 55 across all four. SECURITY, two CVE rows that had gone stale: - CVE-2026-53790 said "under audit". The refusal has since been applied at the live sink - oc-rsync's own single-character config expander, which upstream does not have, so an upstream-shaped port alone would have been inert (#7465, #7430, #7445). - CVE-2026-53795 listed only the staging family. The auxiliary-file family followed it onto the walk (#7421-#7426, #7439, #7441-#7443, #7459, #7463); what remains is the per-option-family confinement.
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.
What
The daemon opened its log file with a plain path-based
OpenOptions::new().create(true).append(true). Upstream opens every log filethrough the ownership walk:
log.c:169-170, reached bylog_init()for both the client--log-fileand thedaemon's log sink. The reason is stated at
log.c:165: these areoperator-supplied paths that may transit attacker-writable directories, and a
symlink planted at any component redirects a root daemon's log into a file of the
attacker's choosing. The walk refuses symlink components not owned by uid 0 or
our euid.
The client
--log-filewas already routed through the walk, but requested mode0666where upstream passes0644. Both sinks now pass0644.Why 0644 and not 0666
Upstream wraps its open in
umask(022 | orig_umask)(log.c:163) so a permissiveumask can never produce a group- or world-writable log. Requesting
0644reachesthe same fixed point without the dance -
0644holds no group or other write bitfor a umask to have to clear.
Tests
tests/log_file_created_with_upstream_mode.rspins both sinks, each with thespawned child's umask pinned to
0viapre_exec.The umask pin is what makes the assertion mean anything:
umask(2)can onlyclear bits, so under the usual
022a0666request also lands as0644andthe two spellings become indistinguishable. Under umask
0,0666stays0666and only a genuine
0644request reads back as0644- so the same assertionalso discriminates routing, since an open that passes no mode at all cannot
produce
0644.A third test (
pinning_the_child_umask_takes_effect) validates that instrumentdirectly, so the pair cannot pass vacuously if the pin ever stops applying.
Proven RED three ways, each with the others staying green:
0o666OpenOptionsVerification
cargo fmt --all -- --check, workspace clippy-D warnings: clean-D warnings,--all-targets) ondaemon+cli: cleancargo nextest run -p daemon --all-features: 1814 passed, 0 failedcli+ root integration tests: 27 passed, 0 failed