T1070.002: Clear Linux or Mac System Logs

Adversaries may clear system logs to hide evidence of an intrusion. macOS and Linux both keep track of system or user-initiated actions via system logs. The majority of native system logging is stored under the /var/log/ directory. Subfolders in this directory categorize logs by their related functions, such as:

  • /var/log/messages:: General and system-related messages
  • /var/log/secure or /var/log/auth.log: Authentication logs
  • /var/log/utmp or /var/log/wtmp: Login records
  • /var/log/kern.log: Kernel logs
  • /var/log/cron.log: Crond logs
  • /var/log/maillog: Mail server logs
  • /var/log/httpd/: Web server access and error logs

Positive Technologies products that cover the technique

MaxPatrol SIEM knowledge base

unix_mitre_attck_defense_evasion: PT-CR-440: Unix_Log_Config_Modify: Audit daemon configuration file change

Detection

IDDS0022Data source and componentFile: File DeletionDescription

Monitor for unexpected deletion of a system log file, typically stored in /var/logs or /Library/Logs.

IDDS0022Data source and componentFile: File ModificationDescription

Monitor for changes made to system log files, typically stored in /var/log or /Library/Logs, for unexpected modifications to access permissions and attributes

IDDS0017Data source and componentCommand: Command ExecutionDescription

Monitor executed commands and arguments for actions that could be taken to remove or overwrite system logs.

Mitigation

IDM1029NameRemote Data StorageDescription

Automatically forward events to a log server or data repository to prevent conditions in which the adversary can locate and manipulate data on the local system. When possible, minimize time delay on event reporting to avoid prolonged storage on the local system.

IDM1022NameRestrict File and Directory PermissionsDescription

Protect generated event files that are stored locally with proper permissions and authentication and limit opportunities for adversaries to increase privileges by preventing Privilege Escalation opportunities.

IDM1041NameEncrypt Sensitive InformationDescription

Obfuscate/encrypt event files locally and in transit to avoid giving feedback to an adversary.