Shellshock Bug
Shellshock (also known as Bashdoor) is a security bug in the Bourne Again SHell (BASH)
Command Line Interpreter (CLI), also known as a shell. The BASH shell is widely distributed as the default CLI on many unix-like OS, including most types of Linux, many types of Unix, some types of BSD and Apple’s OSX.
Shellshock could allow hackers to remotely issue administrative commands to web servers. Seeing as a hacker can force a server to do anything he/she wants, there is a serious risk that private information can easily be stolen from affected servers. This could mean significant problems for companies with a web presence in the Internet whose servers are affected, according to a few information security professionals.
Since the announcement of the initial Shellshock bug (24 September 2014), related bugs in BASH were found by various researchers. The most important of these is the CVE-2014-6271 bug. It gives a good sense of the severity:
“GNU BASH through 4.3 processes trailing strings after function definitions in the values of environment variables, which allows remote attackers to execute arbitrary code via a crafted environment, as demonstrated by vectors involving the ForceCommand feature in OpenSSH sshd, the mod_cgi and mod_cgid modules in the Apache HTTP Server, scripts executed by unspecified DHCP clients, and other situations in which setting the environment occurs across a privilege boundary from BASH execution.”
Therefore, it seems to be clear that anything that can manipulate the environment variables has the potential to be a vector for this vulnerability. Some experts are calling the Shellshock bug “a far more serious threat than the Heartbleed vulnerability”, which was discovered months ago (April 2014) and is still known to be affecting thousands of devices. That is because Shellshock allows unauthenticated attackers to remotely execute commands, while Heartbleed only allows intruders to steal information from servers. If an attacker identifies a vulnerable server, he/she can perform a number of different types of requests and several forms of attack, as a consequence. However, a more serious problem is faced by network devices that use embedded Linux, such as routers, switches, and security appliances. If there is an older, no longer supported model, it may be close to impossible to patch it and will likely be vulnerable to attacks.
An analysis of attacks experienced on this vulnerability shows that most of them are targeting HTTP web servers. Servers that run the Common Gateway Interface (CGI) or FastCGI have the capability to expose BASH to a HTTP request vector. A maliciously “handmade” HTTP request can allow an attacker to inject arbitrary commands onto the server and BASH will execute them, if invoked. BASH can be called directly by the CGI, or it could be called via a subprocess or system command. If BASH is started at any point within the context of this malicious CGI request, then the vulnerability will be triggered.
Actually, this bug has existed in the BASH code for over twenty years, since BASH program was written. However, it is not possible to estimate if or not this vulnerability was exploited in the past. The high level of severity is given by a combination of three concurrent factors:
- the large number of vulnerable (web) servers on the Internet;
- an easy accessibility of various exploit tools;
- the importance of the outcome of exploitation, seeing as once a vector is found, arbitrary code execution is often easily gained.
Here is a basic explanation on what network and security administrators can do to protect their corporate’s infrastructure:
first of all, note that there’s no evidence that an exploitable Windows OS vector exists, although it’s possible;
it’s necessary obtain the latest patches from vendors and patch the affected systems to the latest version of BASH (all major Linux distributors have released patches that stop most attacks);
- where patching is not possible, or if a patch is not available for your platform, evaluate migrating to another shell program;
- check system’s exposure: for example, Red Hat has released a comprehensive guide which explains how to determine if a system is or not un-patched and vulnerable;
- keep update network and server security products;
- note that Intrusion Prevention Systems (IPS) and other types of network based detection SW or appliances are very effective for detecting and preventing Shellshock exploits, because the string sequence required to trigger the vulnerability is very distinguishable. Therefore, make sure your IPS systems are updated with the correct rule sets to detect and prevent exploitation attempts;
- keep monitoring servers and access points in your network infrastructure;
- specifically for Apache Web server, there are some Mod_Security rules that can stop attempts to exploit Shellshock. Mod_security is an Apache module that helps to protect websites from various attacks. It is used to block commonly known exploits by use of regular expressions and rule sets. These rules, created by Red Hat, are as follow:
Request Header values:
SecRule REQUEST_HEADERS “^\(\) {” “phase:1,deny,id:1000000,t:urlDecode,status:400,log,msg:’CVE-2014-6271 – Bash Attack'”
SERVER_PROTOCOL values:
SecRule REQUEST_LINE “\(\) {” “phase:1,deny,id:1000001,status:400,log,msg:’CVE-2014-6271 – Bash Attack'”
GET/POST names:
SecRule ARGS_NAMES “^\(\) {” “phase:2,deny,id:1000002,t:urlDecode,t:urlDecodeUni,status:400,log,msg:’CVE-2014-6271 – Bash Attack'”
GET/POST values:
SecRule ARGS “^\(\) {” “phase:2,deny,id:1000003,t:urlDecode,t:urlDecodeUni,status:400,log,msg:’CVE-2014-6271 – Bash Attack'”
File names for uploads:
SecRule FILES_NAMES “^\(\) {” “phase:2,deny,id:1000004,t:urlDecode,t:urlDecodeUni,status:400,log,msg:’CVE-2014-6271 – Bash Attack'”
Moreover, note that all the major Linux distributions now have patches available for the two original issues (CVE-2014-6271 and CVE-2014-7169). Several other related vulnerabilities in BASH remain un-patched, for now. However, there are no public reports yet of attacks taking advantage of these vulnerabilities and they are more difficult to exploit.
Finally, the experience relating to the major security vulnerabilities shows that reactive patching in itself is not sufficient to ensure protection against this types of attack. A proper implementation of proactive auditing policies and procedures is required in order to achieve an in-depth knowledge of the enterprise’s network infrastructure.
The less an administrator know about what software is running and where in the network, the longer it will take for him to deal with crises like Shellshock.
References
http://www.zdnet.com/shellshock-makes-heartbleed-look-insignificant-7000034143/
http://www.zdnet.com/the-shellshock-faq-heres-what-you-need-to-know-7000034219/
https://access.redhat.com/articles/1200223
http://cve.mitre.org/index.html
