>_ IzzyLab

Hands-on task

This task is step 14 of the course “Investigating a server”

Whose account filled up the exchange share

medium~7 min

The shared exchange directory /data/exchange ballooned overnight. Three service accounts write to it — reporter, builder and ftp-guest — and one of them seems to be compromised and dumping exfiltrated data there. Find out whose files take up the most bytes in total across the whole tree, including nested directories and hidden files, and write that account's name to /root/space-owner.txt.

What you'll practise:
  • find -printf
  • file owner
  • awk: summing
  • hidden files
  • investigation

Topic breakdown

du counts space per directory, but when files of different owners are mixed in one tree, the question "who took the space" is answered differently: you list files with their attributes and sum the size per owner. find prints the fields you need with -printf (%u — owner, %s — size in bytes), and awk accumulates the sums in an associative array and prints them at the end. There are two traps: whoever has the largest file or the most files isn't necessarily the one with the most bytes, and exfiltrated data is often hidden in hidden directories that shell globs skip.

What's checked

  1. the account using the most space found

What it looks like