Summary: |
|
||||||||||||||||||||||||
Any user that can run the glexec executable, and is in the white list of users allowed to run glexec, can obtain the contents of certain files that they do not have permission to access. |
|||||||||||||||||||||||||
| |||||||||||||||||||||||||
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: |
high |
||||||||||||||||||||||||
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. The effort is high because the attacker is required to win a race condition, which may be a rare event. |
|||||||||||||||||||||||||
Impact/Consequences: |
medium |
||||||||||||||||||||||||
This vulnerability allows the attacker to read the contents of files that the calling user would not normally have access, including files that should only be readable by root. If the server contains files of a very sensitive nature the impact of this vulnerability could be of a high consequence. |
|||||||||||||||||||||||||
Full Details: |
|
||||||||||||||||||||||||
Glexec allows the user to copy an X.509 certificate from the caller's directory to a directory owned by the account that privileges are being switched to. The name of the source and destination file are specified by the user of glexec. Precautions are taken in the code to make sure the source proxy is owned by the user executing glexec and the location where the proxy is written is owned by the user that glexec is switching to. The code contains a defect that allows a race condition to violate these precautions. The writing of the proxy file is done correctly as it performed after the privileges of glexec are set to final privileges. In version 0.5.40 and later, the user privileges are dropped, but the same problem exists with respect to group privileges is the glexec executable is setgid. The reading of the proxy file contains the defect. The certificate is read
when the effective user is the root user. When the effective user is root,
all files in the system can be accessed irregardless of actual file permissions.
An outline of the major steps taken to read the proxy in
There are two problems with this code. The first is minor. The
The second more serious problem is that the code is susceptible to a
cryogenic sleep attack. A cryogenic sleep attack can occur when the file
used in step 1 is different from the file used in step 3 (even though the dev
and inode are the same). The user of glexec can specify a file that matches
all the criteria of step 2, then stop the glexec process using a
This attack is somewhat limited in scope because the file to read must be created after step 1 occurs, the amount of data read is limited to 200,000 characters, the file to attack must be on the same device, the process must be stopped between steps 1 and 3, and the inode must be reused. These all minimize the likelihood of success, but do not decrease it to zero. |
|||||||||||||||||||||||||
Cause: |
failure to drop privileges |
||||||||||||||||||||||||
The cause of this problem is a time of check, time of use (TOCTOU) race
condition between the |
|||||||||||||||||||||||||
Proposed Fix: |
|
||||||||||||||||||||||||
A simple fix for this problem is to modify the algorithm used to read the file to the outline below:
This code does not have the same flaws since only one file system object is accessed
by the See How to Open a File and Not Get Hacked by Kupsch and Miller for an alternative method of dealing with the cryogenic sleep attack and library to open the file without being susceptible. |
|||||||||||||||||||||||||
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. |