Attacks and Exploits

A standard user on a Linux host finds a root-owned cron job that runs /opt/backup.sh every minute. The script file is world-writable. What is the best way to gain root?

Show the answer

Correct answerD. Append a command to the writable script so root's next scheduled run executes it

AWhy not this: /etc/shadow is readable only by root, so a standard user cannot get the hashes this way.

BWhy not this: LD_PRELOAD applies only to programs launched from that shell; the running root cron daemon is unaffected.

CWhy not this: A standard user cannot attach to or hollow a root-owned process; the operating system blocks it.

DWhy this is right: The root job executes the writable script, so tester-added commands run as root at the next scheduled run.

Cron runs the script as root, so any command added to a file the tester can write runs with root privileges on the next run. LD_PRELOAD only affects processes started from the tester's own environment, so it never reaches the already running cron daemon.