Tasks with Wildcard
One of the mistakes that users may make is the addition of wildcard to a scheduled task command. Say for example when the user wants to zip the entire contents of a folder periodically, the user may add a * to the end of the command to include all the files that are dropped into that folder. The task scheduler command may look like this,
Now this can be problematic since when this command is executed the file names within the directory are substituted within the command and if a filename is structure like a command, then it gets executed along with this tar command.
Let us add files to the directory that appear like a command that modifies the SUID of the bash,
This will create 3 files within the directory of which 2 filenames are basically commands that transform the tar command. So when the tar command executes finally, the command appears like this,
After the scheduled task gets executed, the SUID of bash gets modified allowing the user to gain root shell.
Last updated