Sudo Rights Abuse
When the sudo
command is issued, the system will check if the user issuing the command has the appropriate rights, as configured in /etc/sudoers
. Sometimes we will need to know the user's password to list their sudo
rights, but any rights entries with the NOPASSWD
option can be seen without entering a password.
tcpdump
For instance:
Output:
By specifying the -z
flag, an attacker could use tcpdump
to execute a shell script, gain a reverse shell as the root user or run other privileged commands.
For example, an attacker could create the shell script .test
containing a reverse shell:
Then, we set a listener in the attacking machine:
And then, run tcpdump
as root with the postrotate-command
.
AppArmor in more recent distributions has predefined the commands used with the postrotate-command
, effectively preventing command execution.