Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[ GLSA 200404-01 ] Insecure sandbox temporary lockfile vulnerabilities in Portage
View unanswered posts
View posts from last 24 hours

Reply to topic    Gentoo Forums Forum Index News & Announcements
View previous topic :: View next topic  
Author Message

Joined: 13 Jun 2003
Posts: 4087
Location: Dresden, Germany

PostPosted: Tue Apr 06, 2004 5:46 pm    Post subject: [ GLSA 200404-01 ] Insecure sandbox temporary lockfile vulne Reply with quote

Gentoo Linux Security Advisory

Title: Insecure sandbox temporary lockfile vulnerabilities in Portage (GLSA 200404-01)
Severity: normal
Exploitable: local
Date: April 04, 2004
Bug(s): #21923
ID: 200404-01


A flaw has been found in the temporary file handling algorithms for the sandboxing code used within Portage. Lockfiles created during normal Portage operation of portage could be manipulated by local users resulting in the truncation of hard linked files; causing a Denial of Service attack on the system.


Portage is Gentoo's package management system which is responsible for installing, compiling and updating any ebuilds on the system through the Gentoo rsync tree. Under default configurations, most ebuilds run under a sandbox which prevent the build process writing to the "real" system outside the build directory - packages are installed into a temporary location and then copied over safely by Portage instead. During the process the sandbox wrapper creates lockfiles in the /tmp directory which are vulnerable to a hard-link attack.

Affected Packages

Package: sys-apps/portage
Vulnerable: < 2.0.50-r3
Unaffected: >= 2.0.50-r3
Architectures: All supported architectures


A flaw in Portage's sandbox wrapper has been found where the temporary lockfiles are subject to a hard-link attack which allows linkable files to be overwritten to an empty file. This can be used to damage critical files on a system causing a Denial of Service, or alternatively this attack may be used to cause other security risks; for example firewall configuration data could be overwritten without notice. The vulnerable sandbox functions have been patched to test for these new conditions: namely; for the existance of a hard-link which would be removed before the sandbox process would continue, for the existance of a world-writable lockfile in which case the sandbox would also remove it, and also for any mismatches in the UID ( anything but root ) and the GID ( anything but the group of the sandbox process ). If the vulnerable files cannot be removed by the sandbox, then the sandbox would exit with a fatal error warning the adminstrator of the issue. The patched functions also fix any other sandbox I/O operations which do not explicitly include the mentioned lockfile.


Any user with write access to the /tmp directory can hard-link a file to /tmp/sandboxpids.tmp - this file would eventually be replaced with an empty one; effectively wiping out the file it was linked to as well with no prior warning. This could be used to potentially disable a vital component of the system and cause a path for other possible exploits. This vulnerability only affects systems that have /tmp on the root partition: since symbolic link attacks are filtered, /tmp has to be on the same partition for an attack to take place.


A workaround is not currently known for this issue. All users are advised to upgrade to the latest version of the affected package.


Users should upgrade to Portage 2.0.50-r3 or later:
# emerge sync
# emerge -pv ">=sys-apps/portage-2.0.50-r3"
# emerge ">=sys-apps/portage-2.0.50-r3"

Last edited by GLSA on Sun May 07, 2006 4:50 pm; edited 1 time in total
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index News & Announcements All times are GMT
Page 1 of 1

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum