Skip to content

Unable to resolve A when record points to CNAME containing asteriskΒ #42171

@arronwoods

Description

@arronwoods

Version

16.14.0

Platform

20.5.0 Darwin Kernel Version 20.5.0: Sat May 8 05:10:33 PDT 2021; root:xnu-7195.121.3~9/RELEASE_X86_64 x86_64

Subsystem

No response

What steps will reproduce the bug?

Perform a dns.lookup() against a domain that resolves to a CNAME containing a wildcard asterisk (*).

Domains pointing to CloudFlare seem to use this approach in particular.

Sample code (will try to find a domain that breaks that I can share publicly):

const dns = require('dns');
dns.setServers([ "8.8.8.8", "8.8.4.4" ]);

domain="test.tld";

dns.resolve(domain, function (error, addresses) {
    console.log("Error: ", error);  // null
    console.log("DNS servers: ", dns.getServers());  // [ '8.8.8.8', '8.8.4.4' ]
    console.log(domain + " resolves to: ", addresses);  // [ '192.168.0.10' ]
});

Using nslookup or dig does return an A record. Using a version of node <16.6.2 also works.

Probably related to this similar issue:
#39780

How often does it reproduce? Is there a required condition?

Can be reproduced every time.

What is the expected behavior?

dns.resolve() returns a successful result (A record addresses).

What do you see instead?

Error:  Error: queryA EBADRESP test.tld
    at QueryReqWrap.onresolve [as oncomplete] (node:dns:213:19) {
  errno: undefined,
  code: 'EBADRESP',
  syscall: 'queryA',
  hostname: 'test.tld'
}

Additional information

Seems related to:

Metadata

Metadata

Assignees

No one assigned

    Labels

    dnsIssues and PRs related to the dns subsystem.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions