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: |
low |
||||||||||||||||||||||||
To exploit this vulnerability requires the ability 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. LCAS and LCMAPS both write to a log file that is determined by the
environment 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:
When writing to the log file both libraries will create the file if it does not exist. Once a file exists individual log records will be appended to the log file. The initial create or open of the log file is done with the effective user of root so no permission checks apply. This is necessary as the log file may located in a directory and have permissions that do not allow ordinary users access to disallow ordinary users access. The calling user of the glexec process can set the environment variable containing the location of the log file. It is then possible to inject data onto the end of these files that is partially controlled by the user. There are many files in the file system that if an attacker and append a small amount of carefully crafted data, they can gain access to other accounts include root. These files include configurations files, script files and data files. An example attack is shown in the bash script below. This script attacks the
password file which is used to control what accounts are available on the
host and their authentication information. If a line can be added to this
file, a new account can be added without a password that is equivalent to the
root account (has a user and group id of 0). The attack works be setting the
|
|||||||||||||||||||||||||
Cause: |
improper trust |
||||||||||||||||||||||||
This vulnerability is caused by improperly allowing a user to specify the location of log files that are opened with root privileges. Since these libraries are run with root privileges the location of log files should only be specified 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. |