CVE-2014-3671: DNS Reverse Lookup as a Vector for the Bash Vulnerability
A DNS reverse lookup can return a PTR record containing a Shellshock payload, which is passed unsanitised into an environment variable and then to bash, allowing command execution. An attacker can plant the record and wait for a legitimate user to trigger the lookup, keeping the attack footprint small.
seclists.org
Published on seclists.org
DNS Reverse Lookup as a vector for the Bash vulnerability (CVE-2014-6271 et.al.)
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the resolver returns the PTR record without sanitising it, and the application passes it directly into an environment variable before invoking bash, which parses the function definition and executes the trailing command.
Impact
On unpatched OS X systems, an attacker could execute commands through this vector; most other operating systems appear unaffected because their resolver escaping differs, and Apple stated that after the bash update the remaining issue is not a security issue in itself.
What the attacker needed
Attacker controls a reverse DNS zone; victim performs a reverse lookup; lookup result is passed to an environment variable; bash is invoked with that environment
The fix
The bash vulnerability was fixed by Apple update DL1769, but that update does not address the resolver vector; applications should sanitise reverse lookup results before placing them in environment variables.
How it was found
- Create a reverse DNS zone whose PTR record contains a bash function definition followed by a command.
- Run a program that performs a reverse lookup of an IP address in that zone.
- The program stores the lookup result in an environment variable and starts bash.
- Bash parses the environment variable and executes the embedded command.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
Bash is a common command-line shell. Older versions had a bug where text inside environment variables (settings passed to programs) could be run as commands. This report shows that a DNS reverse lookup (finding a name from an IP address) can return such malicious text, and if a program puts that text into an environment variable and starts bash, the commands run.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.