{"id":43,"date":"2007-11-04T00:43:38","date_gmt":"2007-11-03T16:43:38","guid":{"rendered":"http:\/\/www.sysadmindayph.com\/blog\/cover-your-tracks-after-hacking-a-unix-box\/"},"modified":"2012-06-16T22:13:32","modified_gmt":"2012-06-16T14:13:32","slug":"cover-your-tracks-after-hacking-a-unix-box","status":"publish","type":"post","link":"http:\/\/www.sysadmindayph.com\/blog\/cover-your-tracks-after-hacking-a-unix-box\/","title":{"rendered":"Cover Your Tracks After Hacking A UNIX Box"},"content":{"rendered":"<p>In the <a href=\"http:\/\/www.sysadmindayph.com\/blog\/monitoring-user-logins-in-unix\/\">Monitoring User Login<\/a> post, the commands and files that are related in tracking user activities are discussed.<\/p>\n<p>Here are some ways of covering your fingerprints on a server using the <a href=\"http:\/\/www.sysadmindayph.com\/blog\/monitoring-user-logins-in-unix\/\">files that monitors user logins<\/a>.<\/p>\n<p>We want to erase any trace that will show that we were inside the box. In doing so we&#8217;ll just:<\/p>\n<blockquote><p>cat \/dev\/null &gt; &lt;file&gt;<\/p><\/blockquote>\n<p><strong>Lastlog file<\/strong><\/p>\n<p>Clear out the last log file if you&#8217;re using an existing user from the box. Lastlogin file shows when and where a particular user last login from.<\/p>\n<blockquote><p><span name=\"intelliTxt\" id=\"intelliTxt\"><code>login: razile<br \/>\nPassword:<\/code><\/span><\/p>\n<p><strong>Last login: Fri Oct 21 21:50:02 2007 from 210.2.9.1<\/strong><br \/>\nSun Microsystems Inc.   SunOS 5.9       Generic May 2002<br \/>\nrazile@unix-box %<\/p><\/blockquote>\n<p>Erase that if you don&#8217;t want the admin see where you last login from (IP, hostname, time etc)<\/p>\n<blockquote><p>cat \/dev\/null &gt; \/var\/adm\/lastlogin<\/p><\/blockquote>\n<p>After clearing the lastlog file, comparing the first login and the second one:<\/p>\n<p>(first login)<\/p>\n<blockquote><p>Last login: Thu Nov\u00a0 1 21:33:41 2007 from 210.23.109.1<br \/>\nSun Microsystems Inc.\u00a0\u00a0 SunOS 5.9\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Generic May 2002<br \/>\nuser@server-&gt;<\/p><\/blockquote>\n<p>(after deletion)<\/p>\n<blockquote><p>\u00a0Sun Microsystems Inc.\u00a0\u00a0 SunOS 5.9\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Generic May 2002<br \/>\nbash: unalias: `e&#8217;: not an alias<br \/>\nuser@server-&gt;<\/p><\/blockquote>\n<p><strong>wtmpx\/tmpx files<\/strong><\/p>\n<p>If you want to check those users who logged in to a Unix box, type in &#8216;last&#8217;<\/p>\n<blockquote><p>UnixBox# last | more<br \/>\nroot\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 pts\/21\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 101.221.224.61\u00a0\u00a0\u00a0 Sat Nov\u00a0 3 11:38\u00a0\u00a0 still logged in<br \/>\nsitescp\u00a0\u00a0 pts\/20\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 19.168.128.132\u00a0 Sat Nov\u00a0 3 07:00\u00a0\u00a0 still logged in<br \/>\nroot\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 pts\/23\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 101.221.224.51\u00a0\u00a0\u00a0 Sat Nov\u00a0 3 05:05\u00a0\u00a0 still logged in<br \/>\nroot\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 pts\/22\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 101.221.224.51\u00a0\u00a0\u00a0 Sat Nov\u00a0 3 05:05\u00a0\u00a0 still logged in<br \/>\npaladel\u00a0\u00a0\u00a0 pts\/22\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 14.122.4.99\u00a0\u00a0\u00a0\u00a0 Fri Nov\u00a0 2 14:33 &#8211; 15:32\u00a0 (00:59)<br \/>\nboy1\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 pts\/26\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 14.122.4.67\u00a0\u00a0\u00a0\u00a0 Fri Nov\u00a0 2 13:22 &#8211; 14:50\u00a0 (01:28)<br \/>\nboy2\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 pts\/26\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 14.122.4.67\u00a0\u00a0\u00a0\u00a0 Fri Nov\u00a0 2 13:20 &#8211; 13:22\u00a0 (00:02)<\/p><\/blockquote>\n<p>You&#8217;ll see the user who was logged in, the terminal used, the IP where he came from the date or duration of his activity in the server.<\/p>\n<p>That is a lot of information, so in covering up your track, delete or zero out the files that stores these information<\/p>\n<blockquote><p>cat \/dev\/null &gt; \/var\/adm\/wtmpx<br \/>\ncat \/dev\/null &gt; \/var\/adm\/tmpx<\/p><\/blockquote>\n<p>After doing so, you&#8217;ll get this when doing &#8216;last&#8217;<\/p>\n<blockquote><p># cat \/dev\/null &gt; \/var\/adm\/wtmpx<br \/>\n# last | more<\/p>\n<p>wtmp begins Sun Nov\u00a0 4 00:41<br \/>\n#<\/p><\/blockquote>\n<p>You could also zero out the \/var\/adm\/messages if you&#8217;re really paranoid.<\/p>\n<p>Of course doing these is like shouting and telling the whole universe that you were there.<\/p>\n<p>These are just a few to cover you track&#8230; Do you have any additions? Or any tips in covering the intrusion without knowing that you were there?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In the Monitoring User Login post, the commands and files that are related in tracking user activities are discussed. Here are some ways of covering your fingerprints on a server using the files that monitors &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,8],"tags":[],"class_list":["post-43","post","type-post","status-publish","format-standard","hentry","category-solaris","category-tips"],"_links":{"self":[{"href":"http:\/\/www.sysadmindayph.com\/blog\/wp-json\/wp\/v2\/posts\/43","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.sysadmindayph.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.sysadmindayph.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.sysadmindayph.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.sysadmindayph.com\/blog\/wp-json\/wp\/v2\/comments?post=43"}],"version-history":[{"count":3,"href":"http:\/\/www.sysadmindayph.com\/blog\/wp-json\/wp\/v2\/posts\/43\/revisions"}],"predecessor-version":[{"id":347,"href":"http:\/\/www.sysadmindayph.com\/blog\/wp-json\/wp\/v2\/posts\/43\/revisions\/347"}],"wp:attachment":[{"href":"http:\/\/www.sysadmindayph.com\/blog\/wp-json\/wp\/v2\/media?parent=43"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.sysadmindayph.com\/blog\/wp-json\/wp\/v2\/categories?post=43"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.sysadmindayph.com\/blog\/wp-json\/wp\/v2\/tags?post=43"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}