Gallery: Arbitrary command execution

Security Team  Contact Address

Updated September 02, 2004

1.  Gentoo Linux Security Advisory

Version Information

Advisory Reference GLSA 200409-05 / Gallery
Release Date September 02, 2004
Latest Revision May 22, 2006: 02
Impact normal
Exploitable remote
Package Vulnerable versions Unaffected versions Architecture(s)
www-apps/gallery < 1.4.4_p2 >= 1.4.4_p2 All supported architectures

Related bugreports: #60742

Synopsis

The Gallery image upload code contains a temporary file handling vulnerability which could lead to execution of arbitrary commands.

2.  Impact Information

Background

Gallery is a PHP script for maintaining online photo albums.

Description

The upload handling code in Gallery places uploaded files in a temporary directory. After 30 seconds, these files are deleted if they are not valid images. However, since the file exists for 30 seconds, a carefully crafted script could be initiated by the remote attacker during this 30 second timeout. Note that the temporary directory has to be located inside the webroot and an attacker needs to have upload rights either as an authenticated user or via "EVERYBODY".

Impact

An attacker could run arbitrary code as the user running PHP.

3.  Resolution Information

Workaround

There are several workarounds to this vulnerability:

Resolution

All Gallery users should upgrade to the latest version:

Code Listing 3.1: Resolution

# emerge sync

# emerge -pv ">=www-apps/gallery-1.4.4_p2"
# emerge ">=www-apps/gallery-1.4.4_p2"

4.  References