{"id":62,"date":"2014-02-13T16:28:49","date_gmt":"2014-02-13T16:28:49","guid":{"rendered":"https:\/\/qbytes.cloud\/?p=47"},"modified":"2014-02-13T16:28:49","modified_gmt":"2014-02-13T16:28:49","slug":"apache-compromise","status":"publish","type":"post","link":"https:\/\/www.qbytes.cloud\/index.php\/2014\/02\/13\/apache-compromise\/","title":{"rendered":"Apache Compromise"},"content":{"rendered":"<p>Your server is running very slow.<\/p>\n<p>    Top looks Okay. Loads are not insane. Ram is high, but not out of bounds. sar shows high i\/o wait times. Swap usage is not an issue. MySql process show hundreds of sleeping processes. Restarting MySql or Apache clears them, but then they start right back up.<\/p>\n<p>WHAT?  This make no sense!<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\ntail \/var\/www\/vhost\/domain.com\/statistics\/log\/access_log\n<\/pre>\n<p>\u2026<\/p>\n<p>[07\/Dec\/2013:17:08:17 -0700] \u201cGET \/local\/image_product480000_1\/mlomeupenvtb2012tb201212tb201212044071d032736e44d9b3e5b914d378f9e2jpg.jpg HTTP\/1.0\u2033 200 16322 \u201c-\u201d \u201c-\u201d<br \/>\n[07\/Dec\/2013:17:08:17 -0700] \u201cGET \/local\/image_product480000_1\/pics2dsstaticcomprodimg165178300jpg.jpg HTTP\/1.0\u2033 200 12690 \u201c-\u201d \u201c-\u201d<br \/>\n[07\/Dec\/2013:17:08:17 -0700] \u201cGET \/local\/image_product480000_1\/slimagesmacyscomisimageMCYproducts4optimized515264fpxtif.jpg HTTP\/1.0\u2033 200 10497 \u201c-\u201d \u201c-\u201d<br \/>\n[07\/Dec\/2013:17:08:17 -0700] \u201cGET \/local\/image_product480000_1\/plefuxcom6120111219A0361000WNipadiphonebatteriesexternal5000mah3751965bigjpg.jpg HTTP\/1.0\u2033 200 9638 \u201c-\u201d \u201c-\u201d<br \/>\n[07\/Dec\/2013:17:08:17 -0700] \u201cGET \/local\/image_product480000_1\/taylorgiftscomimagesp43126500jpg.jpg HTTP\/1.0\u2033 200 59977 \u201c-\u201d \u201c-\u201d<\/p>\n<p>Notice how these connections are coming from the server itself instead of from an external IP.<\/p>\n<p>Now look at who is connecting to the server:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nnetstat -nat | grep :80 | gawk &#039;{ print $5; }&#039; | gawk -F: &#039;{ print $1 }&#039; | sort | uniq -c | sort -n\n<\/pre>\n<p>2 66.249.73.222<br \/>\n3 157.55.32.143<br \/>\n3 199.30.20.68<br \/>\n3 199.30.20.76<br \/>\n4 131.253.24.85<br \/>\n4 199.30.20.106<br \/>\n4 23.67.252.11<br \/>\n4 65.55.55.229<br \/>\n5 174.125.28.4<br \/>\n12 23.67.252.59<br \/>\n325 64.150.184.165<\/p>\n<p>Again, all coming from the server. The solution to the problem was discovered in \/tmp<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nls -la \/tmp\n<\/pre>\n<p>total 44532<br \/>\ndrwxrwxrwx  4 root   root    3522560 Dec  7 17:12 .<br \/>\ndrwxr-xr-x 24 root   root       4096 Dec  6 13:03 ..<br \/>\ndrwx\u2013x\u2013x  2 apache apache     4096 Feb 29  2012 .bash<br \/>\n-rw-r\u2013r\u2013  1 apache apache    37281 Oct 13 10:21 .dsf<br \/>\n-rw-r\u2013r\u2013  1 apache apache    37287 Oct 13 17:46 .dsf.1<br \/>\n-rw-r\u2013r\u2013  1 apache apache    37287 Oct 13 17:46 .dsf.2<br \/>\n-rw-r\u2013r\u2013  1 apache apache    37287 Oct 13 17:46 .dsf.3<br \/>\n-rw-r\u2013r\u2013  1 apache apache    37287 Oct 13 17:46 .dsf.4<br \/>\n-rw-r\u2013r\u2013  1 apache apache    37287 Oct 13 17:46 .dsf.5<br \/>\n-rw-r\u2013r\u2013  1 apache apache    37287 Oct 13 17:46 .dsf.6<br \/>\n-rw-r\u2013r\u2013  1 apache apache    37281 Oct 13 18:18 .dsf.7<br \/>\n-rw-r\u2013r\u2013  1 apache apache    37281 Oct 13 18:18 .dsf.8<\/p>\n<p>now,<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nls -la \/tmp\/.bash\n<\/pre>\n<p>total 27392<br \/>\ndrwx\u2013x\u2013x 2 apache apache     4096 Feb 29  2012 .<br \/>\ndrwxrwxrwx 4 root   root    3522560 Dec  7 17:14 ..<br \/>\n-rwx\u2013x\u2013x 1 apache apache      146 Nov 12  2012 1<br \/>\n-rwxr-xr-x 1 apache apache      323 Jan 13  2011 autorun<br \/>\n-rwx\u2013x\u2013x 1 apache apache     8922 Jan 23  2006 b<br \/>\n-rwx\u2013x\u2013x 1 apache apache    19557 May  9  2005 b2<br \/>\n-rwxr-xr-x 1 apache apache    11445 Jan  5  2011 bang<br \/>\n-rwxr-xr-x 1 apache apache 12321980 Feb 29  2012 bangnew<br \/>\n-rwxr-xr-x 1 apache apache 11824732 Jan 23  2011 bangold<br \/>\n-rw-r\u2013r\u2013 1 apache apache       44 Aug  3 03:28 cron.d<br \/>\n-rwx\u2013x\u2013x 1 apache apache    14679 Nov  2  2005 f4<br \/>\n-rwxr-xr-x 1 apache apache    15988 Sep  7  2002 juno<br \/>\n-rw-r\u2013r\u2013 1 apache apache       11 Aug  3 03:28 mech.dir<br \/>\n-rwx\u2013x\u2013x 1 apache apache      566 Jan 20  2013 mech.set<br \/>\n-rwxr-xr-x 1 apache apache       27 Jan 11  2011 run<br \/>\n-rwx\u2013x\u2013x 1 apache apache   152108 Jan 11  2011 sshd:<br \/>\n-rwxr-xr-x 1 apache apache       17 Nov  5  2008 start<br \/>\n-rwxr-xr-x 1 apache apache     8231 Feb 29  2012 std<br \/>\n-rwxr-xr-x 1 apache apache    13399 Aug  6  2000 stealth<br \/>\n-rwx\u2013x\u2013x 1 apache apache     8790 Jan 23  2006 stream<br \/>\n-rwxr-xr-x 1 apache apache    17690 Feb  6  1996 synk<br \/>\n-rwxr-xr-x 1 apache apache     6442 Jun 23  2011 talk<br \/>\n-rwxr\u2013r\u2013 1 apache apache      166 Aug  3 03:28 update<br \/>\n-rwx\u2013x\u2013x 1 apache apache    14841 Jul 22  2005 v<br \/>\n-rwxr-xr-x 1 apache apache    14911 Mar  6  2002 v2<\/p>\n<p>End Result<\/p>\n<p>End result: This server ahs been root compromised.  The only solution is to reinstall and slave drive the existing compromised drive.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Your server is running very slow. Top looks Okay. Loads are not insane. Ram is high, but not out of bounds. sar shows high i\/o wait times. Swap usage is not an issue. MySql process show hundreds of sleeping processes. Restarting MySql or Apache clears them, but then they start right back up. WHAT? This &#8230; <a title=\"Apache Compromise\" class=\"read-more\" href=\"https:\/\/www.qbytes.cloud\/index.php\/2014\/02\/13\/apache-compromise\/\" aria-label=\"Read more about Apache Compromise\">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":[4],"tags":[135,136],"class_list":["post-62","post","type-post","status-publish","format-standard","hentry","category-apache","tag-apache-access_log-server-connecting-to-itself","tag-connecting-with-its-own-ip"],"_links":{"self":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/62","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=62"}],"version-history":[{"count":0,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/62\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/media?parent=62"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/categories?post=62"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/tags?post=62"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}