Skip to content

This package contains a serious security hole. #1

@skx

Description

@skx

Consider the following code:

var dnsSync = require('dns-sync');
console.log(dnsSync.resolve('$(id > /tmp/foo)'));

The library is loaded. The function resolve is called, which contains this code:

  // ..
  cmd = util.format('"%s" "%s" %s', nodeBinary, scriptPath, hostname);
  // ...
  response = shell.exec(cmd, {silent: true});

So the end result is a call to a command like:

       "/opt/node/bin/node" "/path/to/dns-lookup-script" "$(id > /tmp/foo)'"

The shell expands that, by executing "/usr/bin/id > /tmp/foo" - et voila arbitrary command execution, triggered by a DNS lookup.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions