[{"@context":"http:\/\/schema.org\/","@type":"BlogPosting","@id":"https:\/\/wiki.edu.vn\/en\/wiki40\/shellshock-software-bug-wikipedia\/#BlogPosting","mainEntityOfPage":"https:\/\/wiki.edu.vn\/en\/wiki40\/shellshock-software-bug-wikipedia\/","headline":"Shellshock (software bug) – Wikipedia","name":"Shellshock (software bug) – Wikipedia","description":"before-content-x4 Security bug in the Unix Bash shell discovered in 2014 after-content-x4 Shellshock, also known as Bashdoor,[1] is a family","datePublished":"2020-11-25","dateModified":"2020-11-25","author":{"@type":"Person","@id":"https:\/\/wiki.edu.vn\/en\/wiki40\/author\/lordneo\/#Person","name":"lordneo","url":"https:\/\/wiki.edu.vn\/en\/wiki40\/author\/lordneo\/","image":{"@type":"ImageObject","@id":"https:\/\/secure.gravatar.com\/avatar\/c9645c498c9701c88b89b8537773dd7c?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/c9645c498c9701c88b89b8537773dd7c?s=96&d=mm&r=g","height":96,"width":96}},"publisher":{"@type":"Organization","name":"Enzyklop\u00e4die","logo":{"@type":"ImageObject","@id":"https:\/\/wiki.edu.vn\/wiki4\/wp-content\/uploads\/2023\/08\/download.jpg","url":"https:\/\/wiki.edu.vn\/wiki4\/wp-content\/uploads\/2023\/08\/download.jpg","width":600,"height":60}},"image":{"@type":"ImageObject","@id":"https:\/\/wiki.edu.vn\/wiki4\/wp-content\/uploads\/2023\/08\/download.jpg","url":"https:\/\/wiki.edu.vn\/wiki4\/wp-content\/uploads\/2023\/08\/download.jpg","width":100,"height":100},"url":"https:\/\/wiki.edu.vn\/en\/wiki40\/shellshock-software-bug-wikipedia\/","wordCount":11532,"articleBody":" (adsbygoogle = window.adsbygoogle || []).push({});before-content-x4Security bug in the Unix Bash shell discovered in 2014 (adsbygoogle = window.adsbygoogle || []).push({});after-content-x4Shellshock, also known as Bashdoor,[1] is a family of security bugs[2] 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[3] to many Internet-facing services, such as web servers, that use Bash to process requests.On 12 September 2014, St\u00e9phane Chazelas informed Bash’s maintainer Chet Ramey[1] of his discovery of the original bug, which he called “Bashdoor”. Working with security experts, Mr. Chazelas developed a patch[1] (fix) for the issue, which by then had been assigned the vulnerability identifier CVE-2014-6271.[4] The existence of the bug was announced to the public on 2014-09-24, when Bash updates with the fix were ready for distribution.[5]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.[1][6] 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.[7][8] (adsbygoogle = window.adsbygoogle || []).push({});after-content-x4Attackers exploited Shellshock within hours of the initial disclosure by creating botnets of compromised computers to perform distributed denial-of-service attacks and vulnerability scanning.[9][10] Security companies recorded millions of attacks and probes related to the bug in the days following the disclosure.[11][12]Because of the potential to compromise millions of unpatched systems, Shellshock was compared to the Heartbleed bug in its severity.[3][13]Table of Contents (adsbygoogle = window.adsbygoogle || []).push({});after-content-x4Background[edit]Reports of attacks[edit]Specific exploitation vectors[edit]Reported vulnerabilities[edit]Overview[edit]Initial report (CVE-2014-6271)[edit]CVE-2014-6277[edit]CVE-2014-6278[edit]CVE-2014-7169[edit]CVE-2014-7186[edit]CVE-2014-7187[edit]Patches[edit]References[edit]External links[edit]Background[edit]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.[14][15][16]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.[17] 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.[18] 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,[5] though it took some time for computers to be updated to close the potential security issue.Reports of attacks[edit]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.[9][10][19]Kaspersky Labs reported that machines compromised in an attack, dubbed “Thanks-Rob”, were conducting DDoS attacks against three targets, which they did not identify.[9] 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.[10]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.[11] 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.[12]On 6 October, it was widely reported that Yahoo! servers had been compromised in an attack related to the Shellshock issue.[20][21]Yet the next day, it was denied that it had been Shellshock that specifically had allowed these attacks.[22]Specific exploitation vectors[edit]CGI-based web serverWhen 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.[6]Security documentation for the widely used Apache web server states: “CGI scripts can … be extremely dangerous if they are not carefully checked,”[23] 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.[citation needed]OpenSSH serverOpenSSH 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.[24]DHCP clientsSome 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.[13]Qmail serverWhen 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.[25][7]IBM HMC restricted shellThe bug can be exploited to gain access to Bash from the restricted shell of the IBM Hardware Management Console,[26] a tiny Linux variant for system administrators. IBM released a patch to resolve this.[27]Reported vulnerabilities[edit]Overview[edit]The maintainer of Bash was warned about the first discovery of the bug on 2014-09-12; a fix followed soon.[1] A few companies and distributors were informed before the matter was publicly disclosed on 2014-09-24 with CVE identifier CVE-2014-6271.[4][5] However, after the release of the patch there were subsequent reports of different, yet related vulnerabilities.[28]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”.[29]On 27 September 2014, Micha\u0142 Zalewski from Google Inc. announced his discovery of other Bash vulnerabilities,[7] one based upon the fact that Bash is typically compiled without address space layout randomization.[30] 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.[31]Initial report (CVE-2014-6271)[edit]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.[32] The vulnerability can be tested with the following command:env x='() {\u00a0:;}; 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\u00a0vulnerable”, which was embedded into the specially crafted environment variable named “x”.[8][33]CVE-2014-6277[edit]Discovered by Micha\u0142 Zalewski,[7][30][34] the vulnerability CVE-2014-6277, which relates to the parsing of function definitions in environment variables by Bash, can cause a segfault.[35]CVE-2014-6278[edit]Also discovered by Micha\u0142 Zalewski,[35][36] this bug (CVE-2014-6278) relates to the parsing of function definitions in environment variables by Bash.CVE-2014-7169[edit]On the same day the original vulnerability was published, Tavis Ormandy discovered this related bug (CVE-2014-7169),[24] which isdemonstrated in the following code:env X='() { (a)=>' bash -c \"echo date\"; cat echoOn a vulnerable system, this would execute the command “date” unintentionally.[24]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 echoFri Sep 26 01:37:16 UTC 2014The 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 echocat: echo: No such file or directoryCVE-2014-7186[edit]Florian Weimer and Todd Sabin found this bug (CVE-2014-7186),[8][31] which relates to an out-of-bounds memory access error in the Bash parser code.[37]An example of the vulnerability, which leverages the use of multiple “"},{"@context":"http:\/\/schema.org\/","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"item":{"@id":"https:\/\/wiki.edu.vn\/en\/wiki40\/#breadcrumbitem","name":"Enzyklop\u00e4die"}},{"@type":"ListItem","position":2,"item":{"@id":"https:\/\/wiki.edu.vn\/en\/wiki40\/shellshock-software-bug-wikipedia\/#breadcrumbitem","name":"Shellshock (software bug) – Wikipedia"}}]}]