<<< Date Index >>>     <<< Thread Index >>>

[ GLSA 200409-05 ] Gallery: Arbitrary command execution



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Gentoo Linux Security Advisory                           GLSA 200409-05
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                                            http://security.gentoo.org/
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

  Severity: Normal
     Title: Gallery: Arbitrary command execution
      Date: September 02, 2004
      Bugs: #60742
        ID: 200409-05

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Synopsis
========

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

Background
==========

Gallery is a PHP script for maintaining online photo albums.

Affected packages
=================

    -------------------------------------------------------------------
     Package           /  Vulnerable  /                     Unaffected
    -------------------------------------------------------------------
  1  www-apps/gallery     < 1.4.4_p2                       >= 1.4.4_p2

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.

Workaround
==========

There are several workarounds to this vulnerability:

* Make sure that your temporary directory is not contained in the
  webroot; by default it is located outside the webroot.

* Disable upload rights to all albums for "EVERYBODY"; upload is
  disabled by default.

* Disable debug and dev mode; these settings are disabled by default.

* Disable allow_url_fopen in php.ini.

Resolution
==========

All Gallery users should upgrade to the latest version:

    # emerge sync

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

References
==========

  [ 1 ] Full Disclosure Announcement
        http://archives.neohapsis.com/archives/fulldisclosure/2004-08/0757.html
  [ 2 ] Gallery Announcement
        
http://gallery.menalto.com/modules.php?op=modload&name=News&file=article&sid=134&mode=thread&order=0&thold=0

Availability
============

This GLSA and any updates to it are available for viewing at
the Gentoo Security Website:

  http://security.gentoo.org/glsa/glsa-200409-05.xml

Concerns?
=========

Security is a primary focus of Gentoo Linux and ensuring the
confidentiality and security of our users machines is of utmost
importance to us. Any security concerns should be addressed to
security@xxxxxxxxxx or alternatively, you may file a bug at
http://bugs.gentoo.org.

License
=======

Copyright 2004 Gentoo Foundation, Inc; referenced text
belongs to its owner(s).

The contents of this document are licensed under the
Creative Commons - Attribution / Share Alike license.

http://creativecommons.org/licenses/by-sa/1.0
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFBN4QuzKC5hMHO6rkRAvjRAJ9ew8O+G6tQ/+wifIJkqYadFCU0cgCeK75X
9F2kemN3tO5SBNb80LQkLjc=
=KCrK
-----END PGP SIGNATURE-----