{"id":679,"date":"2014-09-25T23:06:44","date_gmt":"2014-09-25T23:06:44","guid":{"rendered":"https:\/\/qbytes.cloud\/?p=679"},"modified":"2014-09-25T23:06:44","modified_gmt":"2014-09-25T23:06:44","slug":"bash-security","status":"publish","type":"post","link":"https:\/\/www.qbytes.cloud\/index.php\/2014\/09\/25\/bash-security\/","title":{"rendered":"Bash Code Injection Vulnerability (Shellshock)"},"content":{"rendered":"<h3>Products Affected:<\/h3>\n<table border=\"1\">\n<tbody>\n<tr>\n<th>Product\/Channel<\/th>\n<th>Fixed in package<\/th>\n<th>Remediation details<\/th>\n<\/tr>\n<tr>\n<td rowspan=\"1\">Red Hat Enterprise Linux 7<\/td>\n<td>bash-4.2.45-5.el7_0.2<\/td>\n<td rowspan=\"1\"><a href=\"https:\/\/access.redhat.com\/site\/solutions\/1207723\">Red Hat Enterprise Linux<\/a><\/td>\n<\/tr>\n<tr>\n<td rowspan=\"4\">Red Hat Enterprise Linux 6<\/td>\n<td>bash-4.1.2-15.el6_5.1<\/td>\n<td rowspan=\"1\"><a href=\"https:\/\/access.redhat.com\/site\/solutions\/1207723\">Red Hat Enterprise Linux<\/a><\/td>\n<\/tr>\n<tr>\n<td>bash-4.1.2-15.el6_5.1.sjis.1<\/td>\n<td><a href=\"https:\/\/access.redhat.com\/site\/solutions\/1207723\">Red Hat Enterprise Linux<\/a><\/td>\n<\/tr>\n<tr>\n<td>bash-4.1.2-9.el6_2.1<\/td>\n<td><a href=\"https:\/\/access.redhat.com\/site\/solutions\/1207723\">Red Hat Enterprise Linux 6.2 AUS<\/a><\/td>\n<\/tr>\n<tr>\n<td>bash-4.1.2-15.el6_4.1<\/td>\n<td><a href=\"https:\/\/access.redhat.com\/site\/solutions\/1207723\">Red Hat Enterprise Linux 6.4 EUS<\/a><\/td>\n<\/tr>\n<tr>\n<td rowspan=\"4\">Red Hat Enterprise Linux 5<\/td>\n<td>bash-3.2-33.el5.1<\/td>\n<td><a href=\"https:\/\/access.redhat.com\/site\/solutions\/1207723\">Red Hat Enterprise Linux<\/a><\/td>\n<\/tr>\n<tr>\n<td>bash-3.2-33.el5_11.1.sjis.1<\/td>\n<td><a href=\"https:\/\/access.redhat.com\/site\/solutions\/1207723\">Red Hat Enterprise Linux<\/a><\/td>\n<\/tr>\n<tr>\n<td>bash-3.2-24.el5_6.1<\/td>\n<td><a href=\"https:\/\/access.redhat.com\/site\/solutions\/1207723\">Red Hat Enterprise Linux 5.6 LL<\/a><\/td>\n<\/tr>\n<tr>\n<td>bash-3.2-32.el5_9.2<\/td>\n<td><a href=\"https:\/\/access.redhat.com\/site\/solutions\/1207723\">Red Hat Enterprise Linux 5.9 EUS<\/a><\/td>\n<\/tr>\n<tr>\n<td rowspan=\"1\">Red Hat Enterprise Linux 4<\/td>\n<td>bash-3.0-27.el4.2<\/td>\n<td rowspan=\"1\"><a href=\"https:\/\/access.redhat.com\/site\/solutions\/1207723\">Red Hat Enterprise Linux 4 ELS<\/a><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p>Check the version:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">&#x5B;root@server]# rpm -qa | grep bash\nbash-completion-1.3-7.el6.noarch\nbash-4.1.2-15.el6_4.x86_64\n\n<\/pre>\n<p>Diagnostic Steps:<\/p>\n<h4>Exploit 1 (<a href=\"http:\/\/web.nvd.nist.gov\/view\/vuln\/detail?vulnId=CVE-2014-6271\" target=\"_blank\" rel=\"noopener\">CVE-2014-6271<\/a>)<\/h4>\n<p>There are a few different ways to test if your system is vulnerable to shellshock. Try running the following command in a shell.<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">env x=&#039;() { :;}; echo vulnerable&#039; bash -c &quot;echo this is a test&quot;<\/pre>\n<p>If you see &#8220;vulnerable&#8221; you need to <a href=\"https:\/\/shellshocker.net\/#fix\">update bash<\/a>. Otherwise, you should be good to go.<\/p>\n<h4>Exploit 2 (<a href=\"http:\/\/web.nvd.nist.gov\/view\/vuln\/detail?vulnId=CVE-2014-7169\" target=\"_blank\" rel=\"noopener\">CVE-2014-7169<\/a>)<\/h4>\n<p>Even after upgrading bash you may still be vulnerable to this exploit. Try running the following code.<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">env X=&#039;() { (shellshocker.net)=&amp;gt;&#039; bash -c &quot;echo date&quot;; cat echo ; rm -f echo<\/pre>\n<p>If the above command outputs the current date (it may also show errors), you are still vulnerable.<\/p>\n<h4>Exploit 3 (???)<\/h4>\n<p>Here is another variation of the exploit. <i>Please leave a comment below if you know the CVE of this exploit.<\/i><\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">env -i X=&#039; () { }; echo hello&#039; bash -c &#039;date&#039;<\/pre>\n<p>If the above command outputs &#8220;hello&#8221;, you are vulnerable.<\/p>\n<h4>Exploit 4 (<a href=\"https:\/\/access.redhat.com\/security\/cve\/CVE-2014-7186\" target=\"_blank\" rel=\"noopener\">CVE-2014-7186<\/a>)<\/h4>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">bash -c &#039;true &amp;lt;&amp;lt;EOF &amp;lt;&amp;lt;EOF &amp;lt;&amp;lt;EOF &amp;lt;&amp;lt;EOF &amp;lt;&amp;lt;EOF &amp;lt;&amp;lt;EOF &amp;lt;&amp;lt;EOF &amp;lt;&amp;lt;EOF &amp;lt;&amp;lt;EOF &amp;lt;&amp;lt;EOF &amp;lt;&amp;lt;EOF &amp;lt;&amp;lt;EOF &amp;lt;&amp;lt;EOF &amp;lt;&amp;lt;EOF&#039; ||\necho &quot;CVE-2014-7186 vulnerable, redir_stack&quot;<\/pre>\n<p>A vulnerable system will echo the text &#8220;CVE-2014-7186 vulnerable, redir_stack&#8221;.<\/p>\n<h4>Exploit 5 (<a href=\"https:\/\/access.redhat.com\/security\/cve\/CVE-2014-7187\" target=\"_blank\" rel=\"noopener\">CVE-2014-7187<\/a>)<\/h4>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">(for x in {1..200} ; do echo &quot;for x$x in ; do :&quot;; done; for x in {1..200} ; do echo done ; done) | bash ||\necho &quot;CVE-2014-7187 vulnerable, word_lineno&quot;<\/pre>\n<p>A vulnerable system will echo the text &#8220;CVE-2014-7187 vulnerable, word_lineno&#8221;.<\/p>\n<p>Run update:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">&#x5B;root@server ~]# yum update bash\nLoaded plugins: downloadonly, fastestmirror, priorities\nLoading mirror speeds from cached hostfile\nepel\/metalink                                            |  16 kB     00:00\n * base: mirror.hmc.edu\n * epel: mirrors.solfo.com\n * extras: centos.sonn.com\n * updates: linux.mirrors.es.net\nbase                                                     | 3.7 kB     00:00\nextras                                                   | 3.3 kB     00:00\nupdates                                                  | 3.4 kB     00:00\nupdates\/primary_db                                       | 5.3 MB     00:00\n81 packages excluded due to repository priority protections\nSetting up Update Process\nResolving Dependencies\n--&amp;gt; Running transaction check\n---&amp;gt; Package bash.x86_64 0:4.1.2-15.el6_4 will be updated\n---&amp;gt; Package bash.x86_64 0:4.1.2-15.el6_5.1 will be an update\n--&amp;gt; Finished Dependency Resolution\n\nDependencies Resolved\n\n================================================================================\n Package       Arch            Version                   Repository        Size\n================================================================================\nUpdating:\n bash          x86_64          4.1.2-15.el6_5.1          updates          905 k\n\nTransaction Summary\n================================================================================\nUpgrade       1 Package(s)\n\nTotal download size: 905 k\nIs this ok &#x5B;y\/N]: y\nDownloading Packages:\nbash-4.1.2-15.el6_5.1.x86_64.rpm                         | 905 kB     00:00\nRunning rpm_check_debug\nRunning Transaction Test\nTransaction Test Succeeded\nRunning Transaction\n  Updating   : bash-4.1.2-15.el6_5.1.x86_64                                 1\/2\n  Cleanup    : bash-4.1.2-15.el6_4.x86_64                                                                                                                                                        2\/2\n  Verifying  : bash-4.1.2-15.el6_5.1.x86_64                                                                                                                                                      1\/2\n  Verifying  : bash-4.1.2-15.el6_4.x86_64                                                                                                                                                        2\/2\n\nUpdated:\n  bash.x86_64 0:4.1.2-15.el6_5.1\n\nComplete!\n\n<\/pre>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">&#x5B;root@server ~]# rpm -qa | grep bash\nbash-4.1.2-15.el6_5.1.x86_64\nbash-completion-1.3-7.el6.noarch\n\n<\/pre>\n<p>Test after update:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">&#x5B;root@server ~]# env x=&#039;() { :;}; echo vulnerable&#039;  bash -c &quot;echo this is a test&quot;\nbash: warning: x: ignoring function definition attempt\nbash: error importing function definition for `x&#039;\nthis is a test\n<\/pre>\n<p>For Ubuntu Systems:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">apt-get update; apt-get install --only-upgrade bash<\/pre>\n<p>For Arch Linux:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">pacman -Sy bash<\/pre>\n<p>A reboot is not required after the update.<\/p>\n<p>Resources:<\/p>\n<p><a href=\"https:\/\/access.redhat.com\/articles\/1200223\" target=\"_blank\" rel=\"noopener\">https:\/\/access.redhat.com\/articles\/1200223<\/a><\/p>\n<p><a href=\"http:\/\/www.reuters.com\/article\/2014\/09\/24\/us-cybersecurity-bash-idUSKCN0HJ2FQ20140924\" target=\"_blank\" rel=\"noopener\">http:\/\/www.reuters.com\/article\/2014\/09\/24\/us-cybersecurity-bash-idUSKCN0HJ2FQ20140924<\/a><\/p>\n<p><a href=\"http:\/\/seclists.org\/oss-sec\/2014\/q3\/685\" target=\"_blank\" rel=\"noopener\">http:\/\/seclists.org\/oss-sec\/2014\/q3\/685<\/a><\/p>\n<p><a href=\"http:\/\/www.vox.com\/2014\/9\/25\/6843949\/the-bash-bug-explained\" target=\"_blank\" rel=\"noopener\">http:\/\/www.vox.com\/2014\/9\/25\/6843949\/the-bash-bug-explained<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Products Affected: Product\/Channel Fixed in package Remediation details Red Hat Enterprise Linux 7 bash-4.2.45-5.el7_0.2 Red Hat Enterprise Linux Red Hat Enterprise Linux 6 bash-4.1.2-15.el6_5.1 Red Hat Enterprise Linux bash-4.1.2-15.el6_5.1.sjis.1 Red Hat Enterprise Linux bash-4.1.2-9.el6_2.1 Red Hat Enterprise Linux 6.2 AUS bash-4.1.2-15.el6_4.1 Red Hat Enterprise Linux 6.4 EUS Red Hat Enterprise Linux 5 bash-3.2-33.el5.1 Red Hat &#8230; <a title=\"Bash Code Injection Vulnerability (Shellshock)\" class=\"read-more\" href=\"https:\/\/www.qbytes.cloud\/index.php\/2014\/09\/25\/bash-security\/\" aria-label=\"Read more about Bash Code Injection Vulnerability (Shellshock)\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,102],"tags":[],"class_list":["post-679","post","type-post","status-publish","format-standard","hentry","category-administration","category-security"],"_links":{"self":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/679","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/comments?post=679"}],"version-history":[{"count":0,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/679\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/media?parent=679"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/categories?post=679"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/tags?post=679"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}