Skip to content

dns.lookupService triggers a SIGABRT when passed a Buffer #64877

Description

@davidebombelli

Version

v26.5.1

Platform

Linux bombe-mint 6.8.0-136-generic #136-Ubuntu SMP PREEMPT_DYNAMIC Wed Jul  1 21:53:05 UTC 2026 x86_64 x86_64 x86_64 GNU/Linux

Subsystem

No response

What steps will reproduce the bug?

Run the following code with node test.js:

const dns = require('dns');

const invalidAddress = Buffer.from('127.0.0.1');
dns.lookupService(invalidAddress, 80, (err) => console.log(err))

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

It reproduces reliably every time that the above code is run.

What is the expected behavior? Why is that the expected behavior?

When an invalid address is passed, a TypeError should be thrown like:

TypeError [ERR_INVALID_ARG_VALUE]: The argument 'address' is invalid.

What do you see instead?

  #  /usr/local/n/versions/node/26.5.1/bin/node[144772]: void node::cares_wrap::(anonymous namespace)::GetNameInfo(const FunctionCallbackInfo<Value> &) at ../src/cares_wrap.cc:2048
  #  Assertion failed: args[1]->IsString()

----- Native stack trace -----

 1: 0x81d228 node::Assert(node::AssertionInfo const&) [/usr/local/n/versions/node/26.5.1/bin/node]
 2: 0x8b268a  [/usr/local/n/versions/node/26.5.1/bin/node]
 3: 0x70aca7dcfae9 

----- JavaScript stack trace -----

1: lookupService (node:dns:288:21)
2: /home/username/test.js:4:5
3: node:internal/modules/cjs/loader:1934:14
4: node:internal/modules/cjs/loader:2074:10
5: node:internal/modules/cjs/loader:1656:32
6: node:internal/modules/cjs/loader:1448:12
7: wrapModuleLoad (node:internal/modules/cjs/loader:261:19)
8: executeUserEntryPoint (node:internal/modules/run_main:154:5)
9: node:internal/main/run_main_module:33:47


Aborted (core dumped)

Additional information

It looks like there is some missing input validation on the JavaScript side. The issue is however caught by the underlying cpp code, preventing security issues.

Metadata

Metadata

Assignees

No one assigned

    Labels

    dnsIssues and PRs related to the dns subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions