Summary: |
|
||||||||||||||||||||||||
Any user that can run the glexec executable, and is in the white list of users allowed to run glexec, can elevate their privilege to the root user. |
|||||||||||||||||||||||||
| |||||||||||||||||||||||||
Access Required: |
local user in the glexec white list |
||||||||||||||||||||||||
This vulnerability requires local access to the machine with the ability to execute glexec. In addition the user must be in the white list of accounts permitted to use glexec. |
|||||||||||||||||||||||||
Effort Required: |
medium |
||||||||||||||||||||||||
To exploit this vulnerability requires the ability to write some simple code, and to call glexec with a certain set of inputs. The attacker also needs to be in the white list of users authorized to use glexec. |
|||||||||||||||||||||||||
Impact/Consequences: |
high |
||||||||||||||||||||||||
The impact of this vulnerability is that the attacker gains root access on the host. |
|||||||||||||||||||||||||
Full Details: |
|
||||||||||||||||||||||||
Two libraries, LCAS and LCMAPS, are used by glexec to determine if a user running glexec is allowed to switch privileges to another user, determine what user to switch to, and depending upon the configuration perform the actual switch. The actions of these libraries are controlled by a configuration file. The location of the configuration file is specified by an environment variable, as are many of the inputs to these libraries. The environment variables used to configure these libraries are controlled by
the variables The environment variables for these libraries are set in the function
This logic implies that actual value that the environment variable receives is the first value defined in the following list:
Both of these libraries are designed to use plug-ins to do their actual work.
These plug-ins are implements as shared libraries that contain a set of named
functions. These libraries are loaded using The location of the shared library plug-ins are specified in the configuration file. The location of the file can be anywhere in the file system and can have any ownership and permissions. The code in these plug-ins is executed in the context and privilege of the glexec process, which is a setuid process, so it has an effective user id of root. The calling user of the glexec process can set the environment variable containing the location of the libraries configuration file. The library configuration files contain the location of the share libraries to load. Both the library configuration file, and the shared library can be in a location controlled by the user, so the user can inject code into the glexec process and run code with root privileges. An example attack is shown in the bash script below. This script creates
an LCAS configuration file and shared library, and causes glexec to execute the
code in the shared library. In this example, |
|||||||||||||||||||||||||
Cause: |
improper trust |
||||||||||||||||||||||||
This vulnerability is caused by improperly allowing a user to specify the location of shared libraries that are run with root privileges. Since these libraries are run with root privileges they should controlled only by the root user. |
|||||||||||||||||||||||||
Proposed Fix: |
|
||||||||||||||||||||||||
The environment variables that control LCAS and LCMAPS should never be taken
from the calling user. The function Also the |
|||||||||||||||||||||||||
Actual Fix: |
|
||||||||||||||||||||||||
In versions of glexec 0.5.36 and later, the The strings to allow these variable to be supplied by the user are still in the code, but are commented out. They should be removed and a strongly worded comment should be added to the code not to add then back to the list of environment variable allowed to set by the user. |
|||||||||||||||||||||||||
Acknowledgment: |
|
||||||||||||||||||||||||
This research funded in part by National Science Foundation grant OCI-0844219, NATO grant CLG 983049, and National Science Foundation grants CNS-0627501 and CNS-0716460. |