Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dnsdist: Fix a crash on a invalid protocol in DoH forwarded-for header #11621


Copy link

@rgacogne rgacogne commented May 12, 2022

Short description

Passing an IPv6 address in the X-Forwarded-For header of an DoH frontend listening on a IPv4 address, with a proxy-protocol-enabled backend, results in dnsdist trying to mix IPv4 and IPv6 in the same proxy protocol payload which is not possible. The resulting exception was not properly handled and left a dangling UDP state, whose DOHUnit pointer was no longer valid, causing a use-after-free when dnsdist processed the dangling UDP state while checking for timeouts.

This PR is based on #11604 as it reused the same mechanism for the regression test, so it will have to be rebased after the base PR has been merged.


I have:

  • read the document
  • compiled this code
  • tested this code
  • included documentation (including possible behaviour changes)
  • documented the code
  • added or modified regression test(s)
  • added or modified unit test(s)

@rgacogne rgacogne force-pushed the ddist-fix-proxyprotocol-tc-doh+ddist-fix-proxyprotocol-tc-doh branch from f01ba9c to dc3ee9a Compare May 16, 2022 09:55
@rgacogne rgacogne requested a review from omoerbeek May 16, 2022 14:38
@rgacogne rgacogne merged commit 675b289 into PowerDNS:master May 17, 2022
@rgacogne rgacogne deleted the ddist-fix-proxyprotocol-tc-doh+ddist-fix-proxyprotocol-tc-doh branch May 17, 2022 07:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

Successfully merging this pull request may close these issues.

None yet

2 participants