Back to blog
Incident response

Let's wget This Bread, File Integrity Monitoring with Auditd

Linux auditd, ausearch, breach attribution

Incident response project focused on file attribution: configuring the Linux Audit daemon (auditd) to monitor a set of protected files, running simulated attack scripts against them, and using the resulting audit logs to determine exactly which attack modified which file. This is the same attribution work analysts perform after a real breach.

Objective

Terminal listing of the 10 protected files being watched

The 10 files sitting in protected_files before any rules were applied, four of these ended up being the ones the attacks actually touched.

Findings

Files modified by the attack scripts: Cloudia.txt, oakley.txt, squeaky.txt, precipitation.csv

FileAttack
Cloudia.txtattack-a
oakley.txtattack-b
squeaky.txtattack-b
precipitation.csvattack-c

Methodology

  1. Downloaded the starter project via wget and unzipped it in the home directory to keep filepaths consistent
  2. Made the three attack scripts executable with chmod u+x attack-a attack-b attack-c
  3. Set up write-watch Audit rules (auditctl -w) on each of the 10 files in /protected_files, giving each rule a unique filter key so its triggering events could be isolated later
Finished audit.rules file with a separate write-watch rule and unique filter key per protected file

The finished rule set, one -w line per file, each with its own filter key rather than one shared key across all ten.

  1. Restarted the Audit daemon (sudo systemctl restart auditd) so the new rules took effect
  2. Ran ./attack-a, ./attack-b, and ./attack-c to trigger the, at the time unknown, file modifications
  3. Filtered the Audit event logs (ausearch) by each rule's filter key to determine exactly which file each attack touched, and cross-referenced the process and executable name in each log entry back to the responsible attack script
Terminal output of ausearch filtered by the protected_files rules, showing which files were touched

Filtering ausearch output down to just the protected files confirmed exactly which four were touched and when.

Tools used

Key takeaway

File integrity monitoring is how defenders prove what an attacker actually touched after a breach. Without an audit trail like this, you can confirm a system was compromised but not reconstruct what changed or who or what triggered it. The filter-key tagging approach used here mirrors how production security teams categorize audit rules by threat type, such as privilege escalation or data exfiltration, so findings can be triaged quickly. This kind of file level audit trail is also a hard requirement, not optional, under compliance frameworks like PCI-DSS and HIPAA.

View the repo on GitHub