Protect Your Logs from Tampering
Use file attributes to prevent intruders from removing traces of their break-in.
In the course of an intrusion, an attacker will more than likely leave telltale signs of his actions in various system logs. This is a valuable audit trail that should be well protected. Without reliable logs, it can be very difficult to figure out how the attacker got in, or where the attack came from. This information is crucial in analyzing the incident and then responding to it by contacting the appropriate parties involved [Hack #100] . However, if the break-in attempt is successful and the intruder gains root privileges, what’s to stop him from removing the traces of his misbehavior?
This is where file attributes come in to save the day (or at least
make it a little better). Both Linux and the BSDs have the ability to
assign extra attributes to files and directories. This is different
from the standard Unix permissions scheme in that the attributes set
on a file apply universally to all users of the system, and they
affect file accesses at a much deeper level than file permissions or
ACLs
[Hack #4]
.
In Linux you can see and modify the attributes that are set for a
given file by using the lsattr and
chattr commands, respectively. Under the BSDs,
ls -lo can be used to view the attributes, and
chflags can be used to modify them. At the time of this writing, file attributes in Linux are available only when using the ext2 and ext3 filesystems. There are also kernel ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access