<?xml version="1.0" encoding="UTF-8"?>

<rss version="2.0" xmlns:blogChannel="http://backend.userland.com/blogChannelModule">

<channel>
<title>Securing .bash_history in All Things Unix</title>
<link>http://www.dslreports.com/forum/r20317535</link>
<description></description>
<language>en</language>
<pubDate>Thu, 04 Dec 2008 17:29:53 EDT</pubDate>
<lastBuildDate>Thu, 04 Dec 2008 17:29:53 EDT</lastBuildDate>

<item>
<title>Re: Securing .bash_history</title>
<link>http://www.dslreports.com/forum/remark,20318055</link>
<description><![CDATA[<A HREF="/useremail/u/654235"><b>bky</b></A> : Yep. ext(all versions), jfs, xfs, and reiser all support extended attributes.]]></description>
<guid isPermaLink="true">http://www.dslreports.com/forum/remark,20318055</guid>
<pubDate>Fri, 11 Apr 2008 13:06:46 EDT</pubDate>
</item>

<item>
<title>Re: Securing .bash_history</title>
<link>http://www.dslreports.com/forum/remark,20318033</link>
<description><![CDATA[<A HREF="/useremail/u/902719"><b>evilghost</b></A> : <div class="bquote"><small>said by  BeesTea <A HREF="/useremail/u/782124"><IMG SRC="http://i.dslr.net/bb/profile.gif" ALT="See Profile" BORDER=0 WIDTH=16 HEIGHT=11></A> :</small><br><br>Sorry, skimmed the chattr sentence and went to the first code block.  Not enough coffee this morning I guess.<br><br>Again,  great post.<br> </div>Thanks again, glad I understood chattr to be what it is.  Obviously chattr is only going to be applicable to an ext filesystem.  I would assume ReiserFS and XFS have similar fs attribute settings...]]></description>
<guid isPermaLink="true">http://www.dslreports.com/forum/remark,20318033</guid>
<pubDate>Fri, 11 Apr 2008 13:02:44 EDT</pubDate>
</item>

<item>
<title>Re: Securing .bash_history</title>
<link>http://www.dslreports.com/forum/remark,20318023</link>
<description><![CDATA[<A HREF="/useremail/u/782124"><b>BeesTea</b></A> : Sorry, skimmed the chattr sentence and went to the first code block.  Not enough coffee this morning I guess.<br><br>Again,  great post.<br><small>--<br>Overpower, overcome.</small>]]></description>
<guid isPermaLink="true">http://www.dslreports.com/forum/remark,20318023</guid>
<pubDate>Fri, 11 Apr 2008 13:00:02 EDT</pubDate>
</item>

<item>
<title>Re: Securing .bash_history</title>
<link>http://www.dslreports.com/forum/remark,20317987</link>
<description><![CDATA[<A HREF="/useremail/u/654235"><b>bky</b></A> : <div class="bquote"><small>said by  BeesTea <A HREF="/useremail/u/782124"><IMG SRC="http://i.dslr.net/bb/profile.gif" ALT="See Profile" BORDER=0 WIDTH=16 HEIGHT=11></A> :</small><br><br>It's important to note that this only stops the intruder from remapping the history file and doesn't stop the filesystem based vectors to achieve the same goal.  Linking ~/.bash_history to /dev/null is still possible, etc.<br> </div>Actually, an append-only attribute would prevent the user from doing this.]]></description>
<guid isPermaLink="true">http://www.dslreports.com/forum/remark,20317987</guid>
<pubDate>Fri, 11 Apr 2008 12:53:21 EDT</pubDate>
</item>

<item>
<title>Re: Securing .bash_history</title>
<link>http://www.dslreports.com/forum/remark,20317982</link>
<description><![CDATA[<A HREF="/useremail/u/902719"><b>evilghost</b></A> : <div class="bquote"><small>said by  BeesTea <A HREF="/useremail/u/782124"><IMG SRC="http://i.dslr.net/bb/profile.gif" ALT="See Profile" BORDER=0 WIDTH=16 HEIGHT=11></A>  :</small><br><br>Excellent post.<br><br>It's important to note that this only stops the intruder from remapping the history file and doesn't stop the filesystem based vectors to achieve the same goal.  Linking ~/.bash_history to /dev/null is still possible, etc.<br><br>Not trying to dissuade anyone from following the profile hardening method,  just trying to encourage people to view the attack from all vantage points.<br><br>Thanks!<br> </div>Can you expand on that?  I was under the impression the chattr +a would cover that (or are you speaking with regard to the readonly export settings)?  Thanks for your input<br><br><textarea name="code" class="text" cols=50 rows=10>luser@meowbox:~$ lsattr .bash_history&#012;-----a----------- .bash_history&#012;luser@meowbox:~$ ln /dev/null .bash_history&#012;ln: creating hard link `.bash_history' to `/dev/null': Invalid cross-device link&#012;luser@meowbox:~$ ln -s /dev/null .bash_history&#012;ln: creating symbolic link `.bash_history' to `/dev/null': File exists&#012;luser@meowbox:~$ rm -rf .bash_history&#012;rm: cannot remove `.bash_history': Operation not permitted&#012;luser@meowbox:~$ echo &gt; .bash_history&#012;-bash: .bash_history: Operation not permitted&#012;luser@meowbox:~$ echo "Hello" &gt;&gt; .bash_history&#012;luser@meowbox:~$ tail -n 1 .bash_history&#012;Hello&#012;</textarea><!--end code block-->]]></description>
<guid isPermaLink="true">http://www.dslreports.com/forum/remark,20317982</guid>
<pubDate>Fri, 11 Apr 2008 12:52:18 EDT</pubDate>
</item>

<item>
<title>Re: Securing .bash_history</title>
<link>http://www.dslreports.com/forum/remark,20317871</link>
<description><![CDATA[<A HREF="/useremail/u/782124"><b>BeesTea</b></A> : Excellent post.<br><br>It's important to note that this only stops the intruder from remapping the history file and doesn't stop the filesystem based vectors to achieve the same goal.  Linking ~/.bash_history to /dev/null is still possible, etc.<br><br>Not trying to dissuade anyone from following the profile hardening method,  just trying to encourage people to view the attack from all vantage points.<br><br>Thanks!<br><small>--<br>Overpower, overcome.</small>]]></description>
<guid isPermaLink="true">http://www.dslreports.com/forum/remark,20317871</guid>
<pubDate>Fri, 11 Apr 2008 12:18:58 EDT</pubDate>
</item>

<item>
<title>Re: Securing .bash_history</title>
<link>http://www.dslreports.com/forum/remark,20317614</link>
<description><![CDATA[<A HREF="/useremail/u/654235"><b>bky</b></A> : Excellent hardening tip, thanks. Also keeps the user from exporting a different value for histfile, such as /dev/null.]]></description>
<guid isPermaLink="true">http://www.dslreports.com/forum/remark,20317614</guid>
<pubDate>Fri, 11 Apr 2008 11:30:58 EDT</pubDate>
</item>

<item>
<title>Securing .bash_history</title>
<link>http://www.dslreports.com/forum/remark,20317535</link>
<description><![CDATA[<A HREF="/useremail/u/902719"><b>evilghost</b></A> : The SSH honeypot detected an actual human user, the first command they ran was "unset HISTFILE" which will unset the environment variable for the location of the bash history file.  While this is a quite old technique evidently this is the first time I had seen it.<br><br>In an effort to educate others I'm creating this topic and providing methods to mitigate this.<br><br>To prevent this you can edit /etc/profile and set these variables as read-only.  If you're using an ext filesystem you can also chattr .bash_history so it can only be opened in append mode; preventing users from erasing/clobbering the file.<br><br><textarea name="code" class="text" cols=50 rows=10>#Prevent unset of histfile, /etc/profile&#012;export HISTSIZE=1500&#012;readonly HISTFILE&#012;readonly HISTFILESIZE&#012;readonly HISTSIZE&#012;</textarea><!--end code block--><br><textarea name="code" class="text" cols=50 rows=10>#Set .bash_history as attr +a&#012;find / -maxdepth 3|grep -i bash_history|while read line; do chattr +a "$line"; done&#012;</textarea><!--end code block-->]]></description>
<guid isPermaLink="true">http://www.dslreports.com/forum/remark,20317535</guid>
<pubDate>Fri, 11 Apr 2008 11:14:56 EDT</pubDate>
</item>

</channel>
</rss>
