Shellshock (Software Bug): History
Please note this is an old version of this entry, which may differ significantly from the current revision.
Contributor:

Shellshock, also known as Bashdoor, is a family of security bugs in the Unix Bash shell, the first of which was disclosed on 24 September 2014. Shellshock could enable an attacker to cause Bash to execute arbitrary commands and gain unauthorized access to many Internet-facing services, such as web servers, that use Bash to process requests. On 12 September 2014, Stéphane Chazelas informed Bash's maintainer Chet Ramey of his discovery of the original bug, which he called "Bashdoor". Working with security experts, Mr. Chazelas developed a patch (fix) for the issue, which by then had been assigned the vulnerability identifier CVE-2014-6271. The existence of the bug was announced to the public on 2014-09-24, when Bash updates with the fix were ready for distribution. The bug Chazelas discovered caused Bash to unintentionally execute commands when the commands are concatenated to the end of function definitions stored in the values of environment variables. Within days of its publication, a variety of related vulnerabilities were discovered (CVE-2014-6277, CVE-2014-6278, CVE-2014-7169, CVE-2014-7186 and CVE-2014-7187). Ramey addressed these with a series of further patches. Attackers exploited Shellshock within hours of the initial disclosure by creating botnets of compromised computers to perform distributed denial-of-service attacks and vulnerability scanning. Security companies recorded millions of attacks and probes related to the bug in the days following the disclosure. Because of the potential to compromise millions of unpatched systems, Shellshock was compared to the Heartbleed bug in its severity.

  • denial-of-service
  • vulnerabilities
  • bashdoor

1. Background

The Shellshock bug affects Bash, a program that various Unix-based systems use to execute command lines and command scripts. It is often installed as the system's default command-line interface. Analysis of the source code history of Bash shows the bug was introduced on 5 August 1989, and released in Bash version 1.03 on 1 September 1989.[1][2][3]

Shellshock is an arbitrary code execution vulnerability that offers a way for users of a system to execute commands that should be unavailable to them. This happens through Bash's "function export" feature, whereby one Bash process can share command scripts with other Bash processes that it executes.[4] This feature is implemented by encoding the scripts in a table that is shared between the processes, known as the environment variable list. Each new Bash process scans this table for encoded scripts, assembles each one into a command that defines that script in the new process, and executes that command.[5] The new process assumes that the scripts found in the list come from another Bash process, but it cannot verify this, nor can it verify that the command that it has built is a properly formed script definition. Therefore, an attacker can execute arbitrary commands on the system or exploit other bugs that may exist in Bash's command interpreter, if the attacker has a way to manipulate the environment variable list and then cause Bash to run. At the time the bug was discovered, Bash was installed on macOS and many Linux operating systems as the main command interpreter, so that any program that used the system function to run any other program would use Bash to do so.

The presence of the bug was announced to the public on 2014-09-24, when Bash updates with the fix were ready for distribution,[6] though it took some time for computers to be updated to close the potential security issue.

2. Reports of Attacks

Within an hour of the announcement of the Bash vulnerability, there were reports of machines being compromised by the bug. By 25 September 2014, botnets based on computers compromised with exploits based on the bug were being used by attackers for distributed denial-of-service (DDoS) attacks and vulnerability scanning.[7][8][9] Kaspersky Labs reported that machines compromised in an attack, dubbed "Thanks-Rob", were conducting DDoS attacks against three targets, which they did not identify.[7] On 26 September 2014, a Shellshock-related botnet dubbed "wopbot" was reported, which was being used for a DDoS attack against Akamai Technologies and to scan the United States Department of Defense.[8]

On 26 September, the security firm Incapsula noted 17,400 attacks on more than 1,800 web domains, originating from 400 unique IP addresses, in the previous 24 hours; 55% of the attacks were coming from China and the United States.[10] By 30 September, the website performance firm CloudFlare said it was tracking approximately 1.5 million attacks and probes per day related to the bug.[11]

On 6 October, it was widely reported that Yahoo! servers had been compromised in an attack related to the Shellshock issue.[12][13] Yet the next day, it was denied that it had been Shellshock that specifically had allowed these attacks.[14]

3. Specific Exploitation Vectors

CGI-based web server

When a web server uses the Common Gateway Interface (CGI) to handle a document request, it copies certain information from the request into the environment variable list and then delegates the request to a handler program. If the handler is a Bash script, or if it executes Bash, then Bash will receive the environment variables passed by the server and will process them as described above. This provides a means for an attacker to trigger the Shellshock vulnerability with a specially crafted document request.[15]

Security documentation for the widely used Apache web server states: "CGI scripts can ... be extremely dangerous if they are not carefully checked,"[16] and other methods of handling web server requests are typically used instead. There are a number of online services which attempt to test the vulnerability against web servers exposed to the Internet.

OpenSSH server

OpenSSH has a "ForceCommand" feature, where a fixed command is executed when the user logs in, instead of just running an unrestricted command shell. The fixed command is executed even if the user specified that another command should be run; in that case the original command is put into the environment variable "SSH_ORIGINAL_COMMAND". When the forced command is run in a Bash shell (if the user's shell is set to Bash), the Bash shell will parse the SSH_ORIGINAL_COMMAND environment variable on start-up, and run the commands embedded in it. The user has used their restricted shell access to gain unrestricted shell access, using the Shellshock bug.[17]

DHCP clients

Some DHCP clients can also pass commands to Bash; a vulnerable system could be attacked when connecting to an open Wi-Fi network. A DHCP client typically requests and gets an IP address from a DHCP server, but it can also be provided a series of additional options. A malicious DHCP server could provide, in one of these options, a string crafted to execute code on a vulnerable workstation or laptop.[18]

Qmail server

When using Bash to process email messages (e.g. through .forward or qmail-alias piping), the qmail mail server passes external input through in a way that can exploit a vulnerable version of Bash.[19][20]

IBM HMC restricted shell

The bug can be exploited to gain access to Bash from the restricted shell of the IBM Hardware Management Console,[21] a tiny Linux variant for system administrators. IBM released a patch to resolve this.[22]

4. Reported Vulnerabilities

4.1. Overview

The maintainer of Bash was warned about the first discovery of the bug on 2014-09-12; a fix followed soon.[23] A few companies and distributors were informed before the matter was publicly disclosed on 2014-09-24 with CVE identifier CVE-2014-6271.[6][24] However, after the release of the patch there were subsequent reports of different, yet related vulnerabilities.[25]

On 26 September 2014, two open-source contributors, David A. Wheeler and Norihiro Tanaka, noted that there were additional issues, even after patching systems using the most recently available patches. In an email addressed to the oss-sec and bash-bug mailing lists, Wheeler wrote: "This patch just continues the 'whack-a-mole' job of fixing parsing errors that began with the first patch. Bash's parser is certain [to] have many many many other vulnerabilities".[26]

On 27 September 2014, Michał Zalewski from Google Inc. announced his discovery of other Bash vulnerabilities,[20] one based upon the fact that Bash is typically compiled without address space layout randomization.[27] On 1 October, Zalewski released details of the final bugs and confirmed that a patch by Florian Weimer from Red Hat posted on 25 September does indeed prevent them. He has done that using a fuzzing technique with the aid of software utility known as american fuzzy lop.[28]

4.2. Initial Report (CVE-2014-6271)

This original form of the vulnerability (CVE-2014-6271) involves a specially crafted environment variable containing an exported function definition, followed by arbitrary commands. Bash incorrectly executes the trailing commands when it imports the function.[29] The vulnerability can be tested with the following command:

env x='() { :;}; echo vulnerable' bash -c "echo this is a test"

In systems affected by the vulnerability, the above commands will display the word "vulnerable" as a result of Bash executing the command "echo vulnerable", which was embedded into the specially crafted environment variable named "x".[30][31]

4.3. CVE-2014-6277

Discovered by Michał Zalewski,[20][27][32] the vulnerability CVE-2014-6277, which relates to the parsing of function definitions in environment variables by Bash, can cause a segfault.[33]

4.4. CVE-2014-6278

Also discovered by Michał Zalewski,[33][34] this bug (CVE-2014-6278) relates to the parsing of function definitions in environment variables by Bash.

4.5. CVE-2014-7169

On the same day the original vulnerability was published, Tavis Ormandy discovered this related bug (CVE-2014-7169),[17] which is demonstrated in the following code:

env X='() { (a)=>\' bash -c "echo date"; cat echo

On a vulnerable system, this would execute the command "date" unintentionally.[17]

Here is an example of a system that has a patch for CVE-2014-6271 but not CVE-2014-7169:

$ X='() { (a)=>\' bash -c "echo date" bash: X: line 1: syntax error near unexpected token `=' bash: X: line 1: `' bash: error importing function definition for `X' $ cat echo Fri Sep 26 01:37:16 UTC 2014

The system displays syntax errors, notifying the user that CVE-2014-6271 has been prevented, but still writes a file named 'echo', into the working directory, containing the result of the 'date' call.

A system patched for both CVE-2014-6271 and CVE-2014-7169 will simply echo the word "date" and the file "echo" will not be created, as shown below:

$ X='() { (a)=>\' bash -c "echo date" date $ cat echo cat: echo: No such file or directory

4.6. CVE-2014-7186

Florian Weimer and Todd Sabin found this bug (CVE-2014-7186),[28][30] which relates to an out-of-bounds memory access error in the Bash parser code.[35]

An example of the vulnerability, which leverages the use of multiple "<<EOF" declarations (nested "here documents"):

bash -c 'true <<EOF <<EOF <<EOF <<EOF <<EOF <<EOF <<EOF <<EOF <<EOF <<EOF <<EOF <<EOF <<EOF <<EOF' || echo "CVE-2014-7186 vulnerable, redir_stack"

A vulnerable system will echo the text "CVE-2014-7186 vulnerable, redir_stack".

4.7. CVE-2014-7187

Also found by Florian Weimer,[30] CVE-2014-7187 is an off-by-one error in the Bash parser code, allowing out-of-bounds memory access.[36]

An example of the vulnerability, which leverages the use of multiple "done" declarations:

(for x in {1..200} ; do echo "for x$x in ; do :"; done; for x in {1..200} ; do echo done ; done) | bash || echo "CVE-2014-7187 vulnerable, word_lineno"

A vulnerable system will echo the text "CVE-2014-7187 vulnerable, word_lineno". This test requires a shell that supports brace expansion.[37]

5. Patches

Until 24 September 2014, Bash maintainer Chet Ramey provided a patch version bash43-025 of Bash 4.3 addressing CVE-2014-6271,[38] which was already packaged by distribution maintainers. On 24 September, bash43-026 followed, addressing CVE-2014-7169.[39] Then CVE-2014-7186 was discovered. Florian Weimer from Red Hat posted some patch code for this "unofficially" on 25 September,[40] which Ramey incorporated into Bash as bash43-027.[41][42]—These patches provided code only, helpful only for those who know how to compile ("rebuild") a new Bash binary executable file from the patch file and remaining source code files. The patches added a variable name prefix when functions are exported; this prevented arbitrary variables from triggering the vulnerability and enabled other programs to remove Bash functions from the environment.

The next day, Red Hat officially presented according updates for Red Hat Enterprise Linux,[43][44] after another day for Fedora 21.[45] Canonical Ltd. presented updates for its Ubuntu Long Term Support versions on Saturday, 27 September;[46] on Sunday, there were updates for SUSE Linux Enterprise.[47] The following Monday and Tuesday at the end of the month, Mac OS X updates appeared.[48][49]

On 1 October 2014, Michał Zalewski from Google Inc. finally stated that Weimer's code and bash43-027 had fixed not only the first three bugs but even the remaining three that were published after bash43-027, including his own two discoveries.[28] This means that after the earlier distribution updates, no other updates have been required to cover all the six issues.[44]

All of them have also been covered for the IBM Hardware Management Console.[22]

The content is sourced from: https://handwiki.org/wiki/Software:Shellshock_(software_bug)

References

  1. Fox, Brian (21 March 1990). "Bash 1.05 ChangeLog". http://www.oldlinux.org/Linux.old/bin/old/bash-1.05/ChangeLog. 
  2. Chazelas, Stéphane (10 October 2014). "when was shellshock introduced". Stéphane Chazelas and Chet Ramey confirm the vulnerability introduction date on Bash official communication channel. http://thread.gmane.org/gmane.comp.shells.bash.bugs/22418. 
  3. Chazelas, Stéphane (25 September 2014). "When was the shellshock (CVE-2014-6271/7169) bug introduced, and what is the patch that fully fixes it?". https://unix.stackexchange.com/questions/157381/when-was-the-shellshock-cve-2014-6271-7169-bug-introduced-and-what-is-the-pat/157495#157495. 
  4. "Bash Reference Manual: Shell Functions". https://www.gnu.org/software/bash/manual/bash.html#Shell-Functions. 
  5. "Bash 4.3 source code, file variables.c, lines 315-388". http://git.savannah.gnu.org/cgit/bash.git/tree/variables.c?id=ac50fbac377e32b98d2de396f016ea81e8ee9961#n315. 
  6. Florian Weimer (24 September 2014). "Re: CVE-2014-6271: remote code execution through bash". oss-sec (Mailing list). Retrieved 1 November 2014. http://seclists.org/oss-sec/2014/q3/666
  7. Greenberg, Andy (25 September 2014). "Hackers Are Already Using the Shellshock Bug to Launch Botnet Attacks". Wired. https://www.wired.com/2014/09/hackers-already-using-shellshock-bug-create-botnets-ddos-attacks/. Retrieved 28 September 2014. 
  8. Saarinen, Juha (26 September 2014). "First Shellshock botnet attacks Akamai, US DoD networks". iTnews. http://www.itnews.com.au/News/396197,first-shellshock-botnet-attacks-akamai-us-dod-networks.aspx. 
  9. Various (26 September 2014). "Web attacks build on Shellshock bug". BBC. http://m.bbc.com/news/technology-29375636. 
  10. Perlroth, Nicole (26 September 2014). "Companies Rush to Fix Shellshock Software Bug as Hackers Launch Thousands of Attacks". New York Times. http://bits.blogs.nytimes.com/2014/09/26/companies-rush-to-fix-shellshock-software-bug-as-hackers-launch-thousands-of-attacks/. 
  11. Strohm, Chris; Robertson, Jordan (30 September 2014). "Shellshock Draws Hacker Attacks, Sparks Race to Patch Bug". Businessweek. http://www.businessweek.com/news/2014-09-30/shellshock-draws-hacker-attacks-sparks-race-to-patch-bug. 
  12. Boren, Zachary (6 October 2014). "Shellshock: Romanian hackers are accessing Yahoo servers, claims security expert". Independent. https://www.independent.co.uk/life-style/gadgets-and-tech/news/shellshock-romanian-hackers-are-accessing-yahoo-servers-claims-security-expert-9777753.html. 
  13. "Yahoo! Shellshocked Like Ninja Turtles!". http://www.futuresouth.us/wordpress/?p=5. 
  14. Hanno Böck (7 October 2014). "Yahoo durch Shellshock angegriffen" (in de). Golem - IT-News für Profis. http://www.golem.de/news/bash-luecke-yahoo-durch-shellshock-angegriffen-1410-109656.html. 
  15. Leyden, John (24 September 2014). "Patch Bash NOW: 'Shell Shock' bug blasts OS X, Linux systems wide open". The Register. https://www.theregister.co.uk/2014/09/24/bash_shell_vuln/. 
  16. "Apache HTTP Server 2.2 Documentation: Security Tips". http://httpd.apache.org/docs/2.2/misc/security_tips.html. 
  17. Wolfgang Kandek (24 September 2014). "The Laws of Vulnerabilities". Qualys.com. https://blog.qualys.com/laws-of-vulnerabilities/2014/09/24/bash-shellshock-vulnerability. 
  18. Cerrudo, Cesar (30 September 2014). "Why the Shellshock Bug Is Worse than Heartbleed". http://www.technologyreview.com/view/531286/why-the-shellshock-bug-is-worse-than-heartbleed/. 
  19. Kyle George (27 September 2014). "qmail is a vector for CVE-2014-6271 (bash shellshock)". qmail (Mailing list). https://lists.archive.carbon60.com/qmail/users/138578
  20. Saarinen, Juha (29 September 2014). "Further flaws render Shellshock patch ineffective". iTnews. http://www.itnews.com.au/News/396256,further-flaws-render-shellshock-patch-ineffective.aspx. 
  21. "IBM HMC is a vector for CVE-2014-6271 (bash "shellshock")". https://www.ibm.com/developerworks/community/blogs/brian/resource/BLOGS_UPLOADED_IMAGES/shellshock.png. 
  22. "Security Bulletin: Vulnerabilities in Bash affect DS8000 HMC (CVE-2014-6271, CVE-2014-7169, CVE-2014-7186, CVE-2014-7187, CVE-2014-6277, CVE-2014-6278)". IBM. 3 October 2014. https://www-304.ibm.com/support/docview.wss?uid=ssg1S1004879. 
  23. Perlroth, Nicole (25 September 2014). "Security Experts Expect 'Shellshock' Software Bug in Bash to Be Significant". New York Times. https://www.nytimes.com/2014/09/26/technology/security-experts-expect-shellshock-software-bug-to-be-significant.html. 
  24. Florian Weimer (24 September 2014). "Re: CVE-2014-6271: remote code execution through bash". oss-sec (Mailing list). Retrieved 1 November 2014. http://seclists.org/oss-sec/2014/q3/650
  25. "Shellshock". 13 February 2015. http://www.dwheeler.com/essays/shellshock.html. 
  26. Gallagher, Sean (26 September 2014). "Still more vulnerabilities in bash? Shellshock becomes whack-a-mole". Arstechnica. https://arstechnica.com/security/2014/09/still-more-vulnerabilities-in-bash-shellshock-becomes-whack-a-mole/. 
  27. Staff (28 September 2014). "Shellshock, Part 3: Three more security problems in Bash (in german)". Heise Online. http://www.heise.de/security/meldung/ShellShock-Teil-3-Noch-drei-Sicherheitsprobleme-bei-der-Bash-2404788.html. 
  28. "Bash bug: the other two RCEs, or how we chipped away at the original fix (CVE-2014-6277 and '78)". lcamtuf blog. 1 October 2014. http://lcamtuf.blogspot.com/2014/10/bash-bug-how-we-finally-cracked.html. 
  29. "Vulnerability Summary for CVE-2014-6271". NIST. 4 October 2014. http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2014-6271. 
  30. Vaughan-Nichols, Steven (27 September 2014). "Shellshock: Better 'bash' patches now available". ZDNet. http://www.zdnet.com/shellshock-better-bash-patches-now-available-7000034115/. 
  31. "Bash specially-crafted environment variables code injection attack". Red Hat Security. https://securityblog.redhat.com/2014/09/24/bash-specially-crafted-environment-variables-code-injection-attack/. 
  32. Staff (27 September 2014). "National Cyber Awareness System Vulnerability Summary for CVE-2014-6277". National Institute of Standards and Technology. https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2014-6277. 
  33. Constatin, Lucian (29 September 2014). "Improved patch tackles new Shellshock Bash bug attack vectors". http://www.pcworld.com/article/2688932/improved-patch-tackles-new-shellshock-attack-vectors.html. 
  34. Staff (30 September 2014). "National Cyber Awareness System Vulnerability Summary for CVE-2014-6278". National Institute of Standards and Technology. https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2014-6278. 
  35. Staff (29 September 2014). "National Cyber Awareness System Vulnerability Summary for CVE-2014-7186". National Institute of Standards and Technology. https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2014-7186. 
  36. Staff (29 September 2014). "National Cyber Awareness System Vulnerability Summary for CVE-2014-7187". National Institute of Standards and Technology. https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2014-7187. 
  37. Ramey, Chet. "Re: CVE-2014-7187". http://lists.gnu.org/archive/html/bug-bash/2014-10/msg00139.html. 
  38. "BASH PATCH REPORT". 12 September 2014. http://ftp.gnu.org/gnu/bash/bash-4.3-patches/bash43-025. 
  39. "BASH PATCH REPORT". 25 September 2014. http://ftp.gnu.org/gnu/bash/bash-4.3-patches/bash43-026. 
  40. Weimer, Florian (25 September 2014). "Re: CVE-2014-6271: remote code execution through bash". http://www.openwall.com/lists/oss-security/2014/09/25/13. 
  41. "BASH PATCH REPORT". 25 September 2014. http://ftp.gnu.org/gnu/bash/bash-4.3-patches/bash43-027. 
  42. Gallagher, Sean (26 September 2014). "New "Shellshock" patch rushed out to resolve gaps in first fix [Updated"]. https://arstechnica.com/security/2014/09/new-shellshock-patch-rushed-out-to-resolve-gaps-in-first-fix/. 
  43. "Important: bash security update". Red Hat. 30 September 2014. https://rhn.redhat.com/errata/RHSA-2014-1306.html. 
  44. "Bash Code Injection Vulnerability via Specially Crafted Environment Variables (CVE-2014-6271, CVE-2014-7169)". Red Hat. 2 October 2014. https://access.redhat.com/articles/1200223. 
  45. "[SECURITY Fedora 21 Update: bash-4.3.25-2.fc21"]. 27 September 2014. https://lists.fedoraproject.org/pipermail/package-announce/2014-September/139129.html. 
  46. "USN-2364-1: Bash vulnerabilities". Canonical Ltd.. 27 September 2014. http://www.ubuntu.com/usn/usn-2364-1/. 
  47. "SUSE Security Update: Security update for bash". OpenSUSE. 28 September 2014. http://lists.opensuse.org/opensuse-security-announce/2014-09/msg00042.html. 
  48. Clover, Juli (29 September 2014). "Apple Releases OS X Bash Update to Fix 'Shellshock' Security Flaw in Mavericks, Mountain Lion, and Lion". MacRumors.com. http://www.macrumors.com/2014/09/29/apple-os-x-mavericks-bash-update/. 
  49. Slivka, Eric (30 September 2014). "Apple Releases OS X Yosemite Golden Master Candidate to Developers [Update: Also Public Beta"]. MacRumors.com. http://www.macrumors.com/2014/09/30/os-x-yosemite-developer-preview-9/. 
More
This entry is offline, you can click here to edit this entry!