Repository navigation
access: match hosts allow/deny hostname tokens against IPv6 peers - #1140
Open
scarabeusiv wants to merge 1 commit into
Open
scarabeusiv wants to merge 1 commit into
scarabeusiv wants to merge 1 commit into
Conversation
match_hostname() resolved hostname tokens with gethostbyname(), which only returns IPv4 addresses, so a hostname token never matched an IPv6 peer: allow entries locked such clients out and deny entries silently failed open. Resolve with getaddrinfo(PF_UNSPEC) instead, mirroring match_address() in the same file. Fixes RsyncProject#563.
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.
match_hostname()forward-resolveshosts allow/hosts denyhostname tokens withgethostbyname(), which only returns IPv4 addresses, and string-compares them against the peer's numeric address. For an IPv6 peer the comparison can never succeed, so a hostname token is dead in both lists: inhosts allow, a client whose address is the name's AAAA record is denied anyway (#563); inhosts deny, the same client is admitted — the deny rule silently fails open for IPv6, the failure class CVE-2026-70452 closed for unresolvable tokens.Resolve the token with
getaddrinfo()(PF_UNSPEC) instead and compare each result viainet_ntop, mirroringmatch_address()in the same file. IPv4 behaviour is unchanged; the only semantics change is that AAAA results now take part in the match. Failure to resolve keeps the existing behaviour (deny tokens fail closed, allow tokens fail as a non-match).Verified with a loopback daemon (
hosts allow/hosts deny=localhost, clients over 127.0.0.1 and ::1): before, IPv6 was denied by the allow rule and admitted past the deny rule; after, both rules apply to both families.daemon-access,daemon-access-ipanddaemon-deny-dns-failopenpass.Spotted by rpmcrab's
binary-or-shlib-calls-gethostbynamecheck (the Rust successor to rpmlint) while auditing the openSUSE rsync package.Fixes #563.