Skip to content

dns.setServers is memory unsafe and can be used to dump core #8538

Description

@deian
  • Version: 6.5.0
  • Platform:
  • Subsystem:

dns.setServers is memory unsafe and can be used to dump core.

This doesn't seem like a serious security vulnerability (hence my reporting here), but can certainly be used to cause DOS and it might be nice to have a stdlib that is memory safe.

constdns=require('dns');constservers=[];servers[0]='127.0.0.1';servers[2]='0.0.0.0';dns.setServers(servers);// causes the CHECK src/cares_wrap.cc:1241 to dump core

another variant:

constdns=require('dns');constservers=['127.0.0.1','192.168.1.1'];servers[3]='127.1.0.1';servers[4]='127.1.0.1';servers[5]='127.1.1.1';Object.defineProperty(servers,2,{enumerable: true,get: ()=>{servers.length=3;return'0.0.0.0';}});dns.setServers(servers);// causes the CHECK src/cares_wrap.cc:1241 to dump core

Related to: #8539, #8537, #7902

Metadata

Metadata

Assignees

No one assigned

    Labels

    c++Issues and PRs that require attention from people who are familiar with C++.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