Lion Cipher Lab

Escalate via a tar wildcard / --checkpoint-action argument injection, then fix it

Why it matters

One of the most common footguns in hand-rolled Linux automation is a privileged job that archives a directory with a wildcard: a root cron entry or backup script that does `cd /some/spool && tar czf backup.tgz *`. It looks harmless. It is not. The shell — not tar — expands that `*` into the list of filenames in the directory, and hands them to tar as separate arguments. tar, like almost every classic Unix tool, treats any argument that begins with a dash as an OPTION, not a filename. So if an ordinary, unprivileged user can create files in that directory, they can create files whose NAMES are…

What you'll learn

Steps in this lab

  1. The one idea: the shell expands the wildcard, and tar reads dashes as options
  2. Start a throwaway container (no host root needed)
  3. Plant the misconfiguration: a low-priv user and a world-writable spool the root backup globs
  4. As the low-priv user, drop the crafted files
  5. Run the vulnerable backup as root — and prove code ran as root (the 'before')
  6. Fix 1: end the options with `--` before the wildcard
  7. Fix 2: glob with `./*` so every name is a path, not an option
  8. Fix 3 (the one a pro reaches for): don't glob at all — feed the list over a pipe
  9. The honest limits — same root cause, other tools

Open the full interactive lab →