Executive brief
The dns-sync Node.js library is used to perform DNS lookups. A vulnerability in the resolve function allows attackers to inject shell commands through specially crafted hostnames, leading to arbitrary command execution on systems using the library.
Technical details
The dns-sync Node.js library versions before 0.1.1 contain a command injection vulnerability (CWE-77) in the resolve() API function. The vulnerability exists because user-supplied hostnames are passed directly into a shell command without proper sanitization. The vulnerable code constructs a shell command by concatenating the hostname argument with a node script path, then executes it via shell.exec(). An attacker can inject shell metacharacters (such as command substitution syntax like $(command)) into the hostname argument to execute arbitrary commands with the privileges of the Node.js process. No authentication or special privileges are required; any code calling the resolve() function with untrusted input is vulnerable. The vulnerability was fixed in version 0.1.1.
Affected products
- npm dns-sync before 0.1.1
Timeline
- 2014-11-10: disclosed
- 2014-11-10: patched: Fixed in version 0.1.1