Skip to content

NS record pointing to alias (CNAME) can cause infinite recursion #1421

Description

@marc-vanderwal

The following command line on a zone where one of its name server names points to an alias (CNAME) causes infinite looping:

$ zonemaster-cli --test basic02 --level info chi-eureseine.fr

Seconds Level    Message
======= ======== =======
   0.00 INFO     Using version v7.0.0 of the Zonemaster engine.
Deep recursion on subroutine "Zonemaster::Engine::Recursor::_recurse" at /home/vanderwal/.perl5/lib/perl5/Zonemaster/Engine/Recursor.pm line 442.
Deep recursion on subroutine "Zonemaster::Engine::Recursor::_do_query" at /home/vanderwal/.perl5/lib/perl5/Zonemaster/Engine/Recursor.pm line 297.
Deep recursion on subroutine "Zonemaster::Engine::Recursor::_do_query" at /home/vanderwal/.perl5/lib/perl5/Zonemaster/Engine/Recursor.pm line 297.
Deep recursion on subroutine "Zonemaster::Engine::Recursor::_do_query" at /home/vanderwal/.perl5/lib/perl5/Zonemaster/Engine/Recursor.pm line 297.
Deep recursion on subroutine "Zonemaster::Engine::Recursor::_do_query" at /home/vanderwal/.perl5/lib/perl5/Zonemaster/Engine/Recursor.pm line 297.
Deep recursion on subroutine "Zonemaster::Engine::Recursor::_do_query" at /home/vanderwal/.perl5/lib/perl5/Zonemaster/Engine/Recursor.pm line 297.
Deep recursion on subroutine "Zonemaster::Engine::Recursor::_do_query" at /home/vanderwal/.perl5/lib/perl5/Zonemaster/Engine/Recursor.pm line 297.
Deep recursion on subroutine "Zonemaster::Engine::Recursor::_do_query" at /home/vanderwal/.perl5/lib/perl5/Zonemaster/Engine/Recursor.pm line 297.
Deep recursion on subroutine "Zonemaster::Engine::Recursor::_do_query" at /home/vanderwal/.perl5/lib/perl5/Zonemaster/Engine/Recursor.pm line 297.
Deep recursion on subroutine "Zonemaster::Engine::Recursor::_do_query" at /home/vanderwal/.perl5/lib/perl5/Zonemaster/Engine/Recursor.pm line 297.
Deep recursion on subroutine "Zonemaster::Engine::Recursor::_do_query" at /home/vanderwal/.perl5/lib/perl5/Zonemaster/Engine/Recursor.pm line 297.
Deep recursion on subroutine "Zonemaster::Engine::Recursor::_do_query" at /home/vanderwal/.perl5/lib/perl5/Zonemaster/Engine/Recursor.pm line 297.
Deep recursion on subroutine "Zonemaster::Engine::Recursor::_do_query" at /home/vanderwal/.perl5/lib/perl5/Zonemaster/Engine/Recursor.pm line 297.
Deep recursion on subroutine "Zonemaster::Engine::Recursor::_do_query" at /home/vanderwal/.perl5/lib/perl5/Zonemaster/Engine/Recursor.pm line 297.
Deep recursion on subroutine "Zonemaster::Engine::Recursor::_do_query" at /home/vanderwal/.perl5/lib/perl5/Zonemaster/Engine/Recursor.pm line 297.
Deep recursion on subroutine "Zonemaster::Engine::Recursor::_do_query" at /home/vanderwal/.perl5/lib/perl5/Zonemaster/Engine/Recursor.pm line 297.
Deep recursion on subroutine "Zonemaster::Engine::Recursor::_do_query" at /home/vanderwal/.perl5/lib/perl5/Zonemaster/Engine/Recursor.pm line 297.
Deep recursion on subroutine "Zonemaster::Engine::Recursor::_do_query" at /home/vanderwal/.perl5/lib/perl5/Zonemaster/Engine/Recursor.pm line 297.
Deep recursion on subroutine "Zonemaster::Engine::Recursor::get_addresses_for" at /home/vanderwal/.perl5/lib/perl5/Zonemaster/Engine/Recursor.pm line 385.
Deep recursion on subroutine "Zonemaster::Engine::Recursor::_resolve_cname" at /home/vanderwal/.perl5/lib/perl5/Zonemaster/Engine/Recursor.pm line 317.
Deep recursion on subroutine "Zonemaster::Engine::Recursor::_resolve_cname" at /home/vanderwal/.perl5/lib/perl5/Zonemaster/Engine/Recursor.pm line 317.

Explanation

Why does it happen on chi-eureseine.fr? And why does it happen with Basic02?

In the process of executing the test case, a SOA query for chi-eureseine.fr is done. Zonemaster eventually gets a referral to ns.crihan.fr and ns.ch-eureseine.fr, with glue only for ns.crihan.fr; both are out-of-bailiwick (yes, the second one as well; there is no typo).

Zonemaster then attempts to get A records for ns.ch-eureseine.fr. The ch-eureseine.fr zone is delegated to ns.crihan.fr (with glue) and ns.chi-eureseine.fr.

It eventually gets a response from ns.crihan.fr: ns.ch-eureseine.fr is an alias for lxnsext.ch-eureseine.fr. There is an A record in the response, so Zonemaster stops there.

But then, Zonemaster attempts to get AAAA records for ns.ch-eureseine.fr. This time, it gets the same CNAME resource record from ns.crihan.fr without any AAAA records in the same response, because there are none.

Because of that, Zonemaster restarts a recursive query for lxnsext.ch-eureseine.fr/AAAA. In the process, it forgets that it was actually trying to resolve AAAA records for ns.ch-eureseine.fr to get the SOA record for chi-eureseine.fr. Zonemaster sees that it needs to resolve AAAA records for ns.ch-eureseine.fr in the process of resolving lxnsext.ch-eureseine.fr/AAAA, gets the lone CNAME again, and retries the recursive query for lxnsext.ch-eureseine.fr/AAAA once again, forgetting all context again. This goes on infinitely, until zonemaster-engine is killed.

Metadata

Metadata

Labels

P-HighPriority: Issue to be solved before otherS-PRforIssueStatus: There is a PR that is meant to resolve the issueT-BugType: Bug in software or error in test case description

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions