>_ IzzyLab

Hands-on task

This task is step 21 of the course “Users, groups and permissions”

What the installer left behind: SUID in /opt

medium~5 min

A third-party installer deployed software into /opt/vendor, and there's a suspicion it left programs with the SUID bit. Find all such files in /opt/vendor (at any depth) and write their full paths, one per line, to /root/vendor_suid.txt.

What you'll practise:
  • suid bit
  • find -perm
  • security audit
  • special bits
  • third-party software

Topic breakdown

The SUID bit makes a program run with the privileges of the file's owner, not of whoever launched it. If the owner is root, a stray SUID on the wrong binary becomes a ladder to full access, so after installing someone else's software such files are checked first. find looks them up by a permission mask: SUID corresponds to 4000, and the -perm form with the - prefix selects files where this bit is set whatever the other permissions are. Next to it you may find SGID (2000) — that's a different bit, and the report doesn't mix them up.

What's checked

  1. /root/vendor_suid.txt is not empty
  2. the list has exactly all SUID files from /opt/vendor

What it looks like