util: CVE-2012-2737: validate SetIconFile caller over bus
authorRay Strode <rstrode@redhat.com>
Tue, 19 Jun 2012 16:02:24 +0000 (12:02 -0400)
committerRay Strode <rstrode@redhat.com>
Thu, 28 Jun 2012 15:27:05 +0000 (11:27 -0400)
commit26213aa0e0d8dca5f36cc23f6942525224cbe9f5
tree85683230a95efc53f9bf3b76fc95c928fb21c702
parent5e2f077e97a752092a31756eb6b3df03bc119c3d
util: CVE-2012-2737: validate SetIconFile caller over bus

The AccountsService SetIconFile call associates an icon
with a user.

SetIconFile allows users to have icons visible at the login
screen that don't necessarily originate in globally
readable or always available locations. This is accomplished
by copying the originating icon to the local disk in /var.

Since AccountsService runs with with root privileges, the
implemention of the SetIconFile method queries the uid of
the method caller, forks, switches to that uid and performs
the image copy as if it were the user.

Unfortunately, the uid lookup peformed is done "just in time"
instead of looking at peer credentials from the time the call
was initiated. There is a race condition that means a caller
could invoke the method call, quickly exec a setuid binary, and
then cause the copy to be performed as the uid of the setuid
process.

This commit changes the uid lookup logic to query the system
bus daemon for the peer credentials that were cached from the
caller at the time of the initial connection.
src/util.c