Skip to content

fix(dns): MX, NS and SOA answers use the queried domain's hosts - #1502

Merged
Mzack9999 merged 1 commit into
projectdiscovery:devfrom
antcybersec:fix/dns-mx-ns-soa-zone-apex
Oct 30, 2026
Merged

Mzack9999 merged 1 commit into
projectdiscovery:devfrom
antcybersec:fix/dns-mx-ns-soa-zone-apex

Conversation

@antcybersec

Copy link
Copy Markdown

Fixes #1501

  • When running with multiple -domain entries, handleMX, handleNS, and handleSOA performed an exact match on the queried name against mxDomains/nsDomains, falling back to Domains[0] if not matched. As a result:
    • Queries for names under a second domain (e.g. x.example.org MX) returned the first domain's hosts (mail.example.com).
    • Mixed-case queries (e.g. EXAMPLE.ORG NS) missed the map lookup due to case sensitivity and returned the first domain's nameservers.
  • Updated handleMX, handleNS, and handleSOA to use zoneApex, matching the behavior of resultFunction from fix(dns): answer A/AAAA by question type, NODATA with SOA, NS at zone apex #1485. This ensures the correct, case-insensitive zone apex is selected for each domain (including nested domains like sub.example.com).
  • Added unit test TestDNSServerMXNSSOAPointToQueriedDomain covering exact MX, NS, and SOA records across multiple domains, mixed-case queries, and nested domains.

Tested with:

  • go test -race ./pkg/...
  • go vet ./pkg/server/
  • golangci-lint run ./pkg/server/...

@coderabbitai

coderabbitai Bot commented Oct 30, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8dc829f5-2265-47fe-bf83-af1846f6be2c

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@Mzack9999
Mzack9999 merged commit a7c1b71 into projectdiscovery:dev Oct 30, 2026
9 checks passed
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.

MX, NS and SOA answers for names under a second -domain point to the first domain's servers

2 participants