Skip to content

access: match hosts allow/deny hostname tokens against IPv6 peers - #1140

Open
scarabeusiv wants to merge 1 commit into
RsyncProject:masterfrom
scarabeusiv:access-getaddrinfo
Open

scarabeusiv wants to merge 1 commit into
RsyncProject:masterfrom
scarabeusiv:access-getaddrinfo

Conversation

@scarabeusiv

Copy link
Copy Markdown

match_hostname() forward-resolves hosts allow/hosts deny hostname tokens with gethostbyname(), 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: in hosts allow, a client whose address is the name's AAAA record is denied anyway (#563); in hosts 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 via inet_ntop, mirroring match_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-ip and daemon-deny-dns-failopen pass.

Spotted by rpmcrab's binary-or-shlib-calls-gethostbyname check (the Rust successor to rpmlint) while auditing the openSUSE rsync package.

Fixes #563.

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.
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.

rsyncd.conf 'host allow' entries don't work properly for DNS entries with IPV6 addresses

1 participant