Repository navigation
fix: address GHSA-rjfm-3w2m-jf4f hostname ACL bypass during chroot - #5524
Merged
Merged
Conversation
Hostname-based `hosts deny` rules silently fail-OPEN when the daemon runs under `daemon chroot` and the chroot lacks NSS configuration (/etc/resolv.conf, /etc/nsswitch.conf, /etc/hosts, NSS shared objects). Per-connection reverse DNS runs inside the chroot, returns nothing, and the matcher cannot prove the peer's name matches the deny pattern, so the connection is admitted. An attacker who controls their PTR record (or simply blackholes reverse DNS) can bypass a hostname-pattern deny rule. Upstream rsync 3.4.3 (commit c38f20c5) closes the bug by moving the reverse DNS lookup to before chroot/setuid in the per-connection `start_daemon()`, relying on `client_name()`'s internal cache so the post-chroot ACL evaluation uses the cached value. oc-rsync uses a thread-per-connection model where the `daemon chroot` directive is applied process-wide at startup, before any peer connects, so the upstream "resolve before the chroot in this connection" sequence is not available - by the time a worker thread sees a new peer, the process is already chrooted. Fix: tighten `ModuleDefinition::permits` to fail closed when reverse DNS returns `None` and any `hosts deny` rule is hostname-based. Hostname-pattern deny rules already presume the resolver works; if it does not, the safe-by-default posture is to refuse the connection rather than admit it. IP-only deny rules and pure allow rules are unaffected. Regression tests: - `module_hostname_deny_fails_closed_when_dns_unresolved` mirrors Scenario A of upstream's testsuite/daemon-chroot-acl.test. - `module_ip_deny_unaffected_by_dns_failure` pins down that the fail-closed guard activates only for hostname-pattern deny rules. SECURITY.md updated to mark CVE-2026-43617 / GHSA-rjfm-3w2m-jf4f as Fixed and describe the daemon-chroot path that the previous "Not vulnerable" assessment missed.
This was referenced Jun 10, 2026
4 tasks done
oferchen
added a commit
that referenced
this pull request
Jun 11, 2026
…fication docs(audits): verify UTS-22.b GHSA-rjfm-3w2m-jf4f closure by PR #5524
5 tasks
oferchen
added a commit
that referenced
this pull request
Aug 24, 2026
…5524) Hostname-based `hosts deny` rules silently fail-OPEN when the daemon runs under `daemon chroot` and the chroot lacks NSS configuration (/etc/resolv.conf, /etc/nsswitch.conf, /etc/hosts, NSS shared objects). Per-connection reverse DNS runs inside the chroot, returns nothing, and the matcher cannot prove the peer's name matches the deny pattern, so the connection is admitted. An attacker who controls their PTR record (or simply blackholes reverse DNS) can bypass a hostname-pattern deny rule. Upstream rsync 3.4.3 (commit c38f20c5) closes the bug by moving the reverse DNS lookup to before chroot/setuid in the per-connection `start_daemon()`, relying on `client_name()`'s internal cache so the post-chroot ACL evaluation uses the cached value. oc-rsync uses a thread-per-connection model where the `daemon chroot` directive is applied process-wide at startup, before any peer connects, so the upstream "resolve before the chroot in this connection" sequence is not available - by the time a worker thread sees a new peer, the process is already chrooted. Fix: tighten `ModuleDefinition::permits` to fail closed when reverse DNS returns `None` and any `hosts deny` rule is hostname-based. Hostname-pattern deny rules already presume the resolver works; if it does not, the safe-by-default posture is to refuse the connection rather than admit it. IP-only deny rules and pure allow rules are unaffected. Regression tests: - `module_hostname_deny_fails_closed_when_dns_unresolved` mirrors Scenario A of upstream's testsuite/daemon-chroot-acl.test. - `module_ip_deny_unaffected_by_dns_failure` pins down that the fail-closed guard activates only for hostname-pattern deny rules. SECURITY.md updated to mark CVE-2026-43617 / GHSA-rjfm-3w2m-jf4f as Fixed and describe the daemon-chroot path that the previous "Not vulnerable" assessment missed.
oferchen
added a commit
that referenced
this pull request
Aug 24, 2026
…fication docs(audits): verify UTS-22.b GHSA-rjfm-3w2m-jf4f closure by PR #5524
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
Closes the hostname-based ACL bypass tracked as GHSA-rjfm-3w2m-jf4f / CVE-2026-43617. A peer connecting to a daemon configured with
daemon chrootand a hostname-basedhosts denyrule was silently admitted whenever post-chroot reverse DNS failed - the chroot typically lacks/etc/resolv.conf,/etc/nsswitch.conf,/etc/hosts, and the NSS shared objects, solookup_addr()returnedNone, theHostname(_)matcher could not prove the peer matched the pattern, and the deny check fell through. An attacker who controls their PTR record (or simply blackholes reverse DNS) could connect from a hostname the operator explicitly intended to block.Upstream patch
Upstream rsync 3.4.3 (commit
c38f20c5) moves the reverse DNS lookup to before chroot/setuid in the per-connectionstart_daemon(), relying onclient_name()'s internal cache so the post-chroot ACL evaluation uses the cached value.oc-rsync parity fix
oc-rsync uses a thread-per-connection model where
daemon chrootis applied process-wide at startup (accept_loop.rs::serve_connections), before any peer connects. Worker threads inherit the chroot, so there is no per-connection moment "before this connection's chroot" in which to resolve a specific peer.Rather than re-architect the accept loop, this PR tightens the ACL matcher itself:
When reverse DNS returns
Noneand anyhosts denyrule is hostname-based,permits()fails closed. The hostname-pattern presumes a working resolver; if it is missing, the safe-by-default posture is to refuse the connection rather than admit it. The change has zero effect on:hosts allowrules - already fail-closed when no allow pattern matches.The session- and module-level reverse DNS calls in
session_runtime.rs/module_access::request.rs/module_access::listing.rsstill run before per-moduleuse chroot, mirroring upstream's "resolve before chroot" intent for the per-module path; the new guard catches the residualdaemon chrootglobal-directive path where pre-resolution is architecturally impossible.Regression tests
module_hostname_deny_fails_closed_when_dns_unresolvedmirrors Scenario A of upstream'stestsuite/daemon-chroot-acl.test: configurehosts deny = *.bad.example, simulate the post-chroot DNS failure via the test override, and assertpermits()rejects the peer.module_ip_deny_unaffected_by_dns_failurepins the scope of the fail-closed guard: a module with an IP-only deny rule (192.0.2.0/24) must continue to admit peers outside the denied range even when their reverse DNS fails, and must continue to deny peers inside the range.SECURITY.md
Updated the CVE-2026-43617 row from "Not vulnerable" to Fixed, documents the
daemon chrootglobal-directive path that the previous assessment missed, and cross-references the new regression tests.Test plan
cargo nextest run -p daemon --all-features -E 'test(module_hostname_deny_fails_closed_when_dns_unresolved) | test(module_ip_deny_unaffected_by_dns_failure) | test(module_peer_hostname_resolution_before_chroot_denies_unknown) | test(module_definition_hostname_deny_takes_precedence) | test(module_definition_mixed_ip_and_hostname_acl)'- CI verifies.Constraints respected
crates/branding/.#![deny(unsafe_code)].#[allow(clippy::...)]waivers.