{"id":177,"date":"2011-07-01T05:45:13","date_gmt":"2011-07-01T05:45:13","guid":{"rendered":"http:\/\/blog.flirc.tv\/?p=177"},"modified":"2022-10-07T18:09:19","modified_gmt":"2022-10-07T18:09:19","slug":"doh-blog-was-hacked","status":"publish","type":"post","link":"https:\/\/blog.flirc.tv\/index.php\/2011\/07\/01\/doh-blog-was-hacked\/","title":{"rendered":"Doh! &#8211; Blog Was Hacked"},"content":{"rendered":"<p>I went to visit the blog to share some awesome news, flirc is now patent pending.<\/p>\n<p>However, when I went to visit the blog, I get a glorious message saying, &#8220;fuck you&#8221; with a site redirection to some stupid hackors website that was obviously designed in 1994.<\/p>\n<p>How did this happen&#8230;going to share&#8230;<\/p>\n<p>Okay, let&#8217;s try getting into the wordpress backend, logged in, everything looked fine. WordPress is still intact. I notice there is wordpress upgrade available, so I hit that, maybe there was some security flaw. WordPress updated, went back to the main page, still hacked.<\/p>\n<p>Okay, let&#8217;s go one step further. I ssh into and start looking at the log files. Crazy, no one got into SSH.<\/p>\n<p>Okay, how about FTP? Looked through those log files, nothing&#8230;.<\/p>\n<p>Scratching my head at this point, I go into the directory with wordpress and do an<\/p>\n<blockquote><p>ls -lah<\/p>\n<p>-rw-r&#8211;r&#8211; \u00a0 \u00a01 _www \u00a0 \u00a0 _www \u00a0 6.1K Jun 30 20:23 index.html<\/p><\/blockquote>\n<p>Okay, here we go, there isn&#8217;t supposed to be an index.html file in this directory, wordpress uses index.php. Opening this up, yup, it&#8217;s some crap html with redirects and pop-ups. Okay, let&#8217;s save it:<\/p>\n<blockquote><p>mv index.html index.asshat<\/p><\/blockquote>\n<p>Let&#8217;s keep looking<\/p>\n<blockquote><p>ls -lah<\/p><\/blockquote>\n<p>Two more files owned by www and not me:<\/p>\n<blockquote><p>-rw-r&#8211;r&#8211; \u00a0 \u00a01 _www \u00a0 \u00a0 _www \u00a0 124B Jun 22 20:55 jundab.txt<\/p>\n<p>-rw-r&#8211;r&#8211; \u00a0 \u00a01 _www \u00a0 \u00a0 _www \u00a0 \u00a028K Jun 29 22:44 file.htm<\/p><\/blockquote>\n<p>Let&#8217;s peek inside the file<\/p>\n<blockquote><p>cat\u00a0jundab.txt<\/p>\n<p>MagelangCyber Was Here-Hacked by Jundab-thx Hmei7, kaMtiEz, k4l0ng666, boebefa, s13doeL, Dr. Cruzz , \u00a0ibl13Z and you~<\/p><\/blockquote>\n<p>Okay, great, file.htm is still there, feel free to check it out. What a waste of time that must have been to do.<\/p>\n<p>So how did this happen. Let&#8217;s go into \/var\/log and check.<\/p>\n<blockquote><p>cd \/var\/log<\/p>\n<p>grep jundab -ir *<\/p><\/blockquote>\n<p>Ahah, found it in\u00a0apache2\/access_log<\/p>\n<p>Here is the line: \u00a0&#8220;GET \/favicon.ico HTTP\/1.1&#8221; 404 1075 118.96.148.7 &#8211; &#8211; [22\/Jun\/2011:20:55:39-0700] &#8220;PUT \/jundab.txt HTTP\/1.0&#8221; 201 308<\/p>\n<p>Mother Fucker&#8230;. so for someone to be able to do this, they used the standard HTTP PUT method. How? Simple:<\/p>\n<blockquote><p>curl blog.flirc.tv\/ &#8211;upload-file jundab.txt<\/p><\/blockquote>\n<p>Did that from another machine, bam, transferred. So you can just transfer files to webservers? Yes and no. I made a huge error. For this to be possible, my root directory of the blog was writeable by www. I believe the set permissions were:<\/p>\n<blockquote><p>drwxrwxr-x \u00a040 &#8216;user&#8217; \u00a0_www \u00a0 \u00a01.3K Jun 30 22:34 blog<\/p><\/blockquote>\n<p>Yeah, that&#8217;s bad. How do you fix this? Change it so it&#8217;s not writeable by apache.<\/p>\n<blockquote><p>chmod 755 blog<\/p>\n<p>ls -lah<\/p>\n<p>drwxr-xr-x \u00a040 &#8216;user&#8217; \u00a0_www \u00a0 \u00a01.3K Jun 30 22:34 blog<\/p><\/blockquote>\n<p>So this small error could have been a lot of trouble. I found it pretty close after it happened, but that doesn&#8217;t matter. Drop a php script on there that has an exploit, call the php script from a browser, and I&#8217;m done. There were no php scripts, so thankfully, it was probably a BOT that runs around and try&#8217;s putting files on servers. But in any case, the server was hacked and the only way to recover is to assume the system has been compromised, and restore.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I went to visit the blog to share some awesome news, flirc is now patent pending. However, when I went to visit the blog, I get a glorious message saying, &#8220;fuck you&#8221; with a site redirection to some stupid hackors website that was obviously designed in 1994. How did this happen&#8230;going to share&#8230; Okay, let&#8217;s [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true},"categories":[6],"tags":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/ppp9g-2R","_links":{"self":[{"href":"https:\/\/blog.flirc.tv\/index.php\/wp-json\/wp\/v2\/posts\/177"}],"collection":[{"href":"https:\/\/blog.flirc.tv\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.flirc.tv\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.flirc.tv\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.flirc.tv\/index.php\/wp-json\/wp\/v2\/comments?post=177"}],"version-history":[{"count":1,"href":"https:\/\/blog.flirc.tv\/index.php\/wp-json\/wp\/v2\/posts\/177\/revisions"}],"predecessor-version":[{"id":1058,"href":"https:\/\/blog.flirc.tv\/index.php\/wp-json\/wp\/v2\/posts\/177\/revisions\/1058"}],"wp:attachment":[{"href":"https:\/\/blog.flirc.tv\/index.php\/wp-json\/wp\/v2\/media?parent=177"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.flirc.tv\/index.php\/wp-json\/wp\/v2\/categories?post=177"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.flirc.tv\/index.php\/wp-json\/wp\/v2\/tags?post=177"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}