CVE-2014–6271 — Shellshock Vulnerability Explained
Bash failed to stop parsing environment variables after a function definition, so commands appended after the definition were executed. An attacker could inject such a value through CGI headers and run arbitrary commands on the server.
medium.com
Published on medium.com
Bash is the default command-line shell used by most Linux distributions and by macOS systems. Because it is deeply integrated into many services and scripts, vulnerabilities in Bash can have a massive impact.
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
Bash did not stop parsing an environment variable after the end of an exported function definition, so trailing commands were executed.
Impact
An attacker could execute arbitrary commands, access sensitive files, install malware, pivot deeper into the network and use the server to launch further attacks.
What the attacker needed
Vulnerable Bash version; Bash processes attacker-controlled environment variable; often a CGI script on a web server
How it was found
- A user sends an HTTP request to a CGI script on the web server.
- The web server sets environment variables from the request, including headers such as User-Agent.
- The attacker includes a function definition followed by a command in a header value.
- The web server launches the CGI script, which inherits the crafted environment variable.
- Bash parses the variable and executes the command after the function definition.
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 program that runs commands on Linux and macOS. It can store small reusable pieces of code, called functions, in its settings. A bug meant that if extra commands were tacked onto the end of such a stored function, Bash would run them too. An attacker who could control one of those settings, for example through a web request header, could therefore run their own commands on the server.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.