Sudo Misconfigurations
Last updated
Was this helpful?
Last updated
Was this helpful?
On this page, we speak about specific SUDO misconfigurations that can be leveraged to subvert sudo's intended functionality and elevate our privileges.
The following sudo
configuration allow an user to execute some command with another user's privileges without knowing the password.
LD_PRELOAD
is an optional environmental variable containing one or more paths to shared libraries, or shared objects, that the loader will load before any other shared library including the C runtime library (libc.so) This is called preloading a library.
If env_keep+=LD_PRELOAD
is explicitly defined in the sudo -l
output and you can call some command with sudo, you can escalate your privileges.
the LD_LIBRARY_PATH
env variable controls the path where libraries are going to be searched.
If env_keep+=LD_LIBRARY_PATH
is explicitly defined in the sudo -l
output and you can call some command with sudo, you can escalate your privileges.
This SETENV
directive allows the user to set an environment variable while executing something:
If we can execute some command as root but env_reset
and secure_path
are set, we cannot override the PATH environment variable.
Instead we need to check if we have permission to write each path if a the sudo binary is specified without the full command path.
If we can execute some command as root and it contains a wildcard. We may use symlinks, path traversal or multiple arguments to exploit it.