>_ IzzyLab

Hands-on task

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

Hidden capabilities in /opt

medium~5 min

After a break-in you need to find out whether the attacker left themselves a backdoor. The SUID bits are clean, but privileges can also be attached through capabilities — ls -l doesn't show them. Find all files with capabilities in the /opt tree (recursively) and write their paths, one per line, to /root/caps-opt.txt — only the paths, without the capabilities themselves.

What you'll practise:
  • capabilities
  • getcap
  • security audit
  • awk
  • investigation

Topic breakdown

Linux capabilities split root's powers into separate privileges: cap_net_raw — raw sockets, cap_dac_read_search — read any file bypassing permissions, cap_setuid — change UID. Attached to a binary (setcap), they work like a targeted SUID and are just as usable for escalation — but ls -l doesn't show them, so during incident analysis they are searched for separately. getcap reads a file's capabilities, and with the recursive flag it walks the whole tree and prints only files that have them; the output is then filtered down to the paths.

What's checked

  1. both files with capabilities found
  2. no extra files
  3. the file contains only paths

What it looks like