Skip to content

Labs cannot practise -axfr; let a scenario serve a zone transfer #434

Closed

Description

@TMHSDigital

Summary

-axfr is the one discovery feature that cannot be practised in a lab: -simulate-zone refuses it. The lab DNS server can already answer zone transfers, though. Let a scenario allow a transfer, point -axfr at the lab server, and add a lab for it.

Where

  • internal/cli/cli.go:359: {"axfr", f.axfr}, // transfers from the zone's real name servers in the -simulate-zone refusal list
  • internal/dnsserver/server.go:57 (Transfer) and :575 (dnsmessage.TypeAXFR: addTransfer): the server already serves AXFR
  • docs/labs.md:241-244: documents that -simulate-zone cannot be combined with -axfr
  • examples/labs/: six scenarios (first scan, wildcard, rate limit, recursive, failures, IPv6), none for zone transfers

Details

The refusal exists because -axfr dials the target's real name servers, which would send traffic off the machine. In a lab run, the NS lookup already goes to the lab server, so the transfer could be sent to that same server instead. The scenario format ($DELAY, $REFUSE-ABOVE, ...) would need one more directive, for example $TRANSFER allow, to turn Transfer on.

Impact

Learners and contributors cannot see what a successful (or refused) zone transfer looks like, or how its names appear with source axfr, without finding a misconfigured real server. That is the wrong thing to send beginners looking for.

Suggested fix

  • Add a $TRANSFER allow|refuse scenario directive in internal/labzone, mapped to dnsserver's Transfer.
  • In lab mode, send -axfr transfers to the lab server's address and port instead of the NS addresses, and drop axfr from the refusal list.
  • Add examples/labs/lab7-zone-transfer.zone and a "Lab 7" section: one transfer that is allowed, then the same zone refused, with questions about where the extra names came from (sources).

Acceptance criteria

  • subenum -simulate-zone lab7 -axfr lab.example reports transferred names with source axfr and sends no packet off loopback.
  • A scenario without $TRANSFER allow reports the transfer as refused.
  • docs/labs.md has the new lab and no longer lists -axfr as incompatible.

Getting started

  • Relevant files: internal/cli/cli.go, internal/cli/axfr.go, internal/labzone/labzone.go, internal/dnsserver/server.go, docs/labs.md
  • How to run tests: go test ./...
  • Related docs: docs/labs.md ("Writing your own scenario")

Filed by repo-audit/feature-ideas at 090df0a. Severity: low. Effort: M. audit-key: enhancement|internal/cli/cli.go|simulate-zone-axfr

Activity

  1. added
    enhancement
    help wanted
    area: cli
    severity: low
    on Nov 18, 2026
  2. TMHSDigital commented on Nov 19, 2026

    @TMHSDigital
    OwnerAuthor

    Fixed in e821702.

    • axfr.Options gains a Server field. When it's set, every transfer and the DNSSEC denial probe go to that host:port instead of the name servers' addresses, which are still looked up.
    • In lab mode the CLI sets Server to the lab server, so -simulate-zone no longer refuses -axfr.
    • $TRANSFER allow|refuse is a new scenario directive. With allow, the lab server answers a transfer of the scanned domain with every name the file defines (not the apex, wildcards or failing names). The default, refuse, and a transfer of a name below the apex get REFUSED.
    • examples/labs/lab7-zone-transfer.zone and a Lab 7 section in docs/labs.md cover one allowed transfer and the refused case. docs/labs.md no longer lists -axfr as incompatible, and the scenario format documents $TRANSFER.

    Acceptance:

    • subenum -simulate-zone lab7 -axfr lab.example reports billing-legacy and k8s-ingress-eu2 with sources: ["axfr"]. Lab 7's name server address is in TEST-NET (192.0.2.53), so a transfer that went off loopback could not succeed. The tests pass only because it goes to the lab server.
    • A scenario without $TRANSFER allow gets no names, and -stats has no axfr_allowed.

    Verified with go test ./... and golangci-lint v2.15.0. The new and updated tests are TestTransferDirective (labzone) and TestE2ELabAXFR, which replaces TestE2ELabRefusesAXFR. lab_scan's zone_transfer (#405) could now be offered too, but it isn't part of this change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: clienhancementhelp wantedseverity: low

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions