Visit our newest sister site!
Hundreds of free aircraft flight manuals
Civilian • Historical • Military • Declassified • FREE!

TUCoPS :: Web :: Apps :: b06-3741.htm

Remote command execution in planetGallery
Advisory: Remote command execution in planetGallery
Advisory: Remote command execution in planetGallery

Content-Type: text/plain;
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Advisory: Remote command execution in planetGallery

An admin of planetGallery is allowed to create new galleries and upload
images. Because of a vulnerable regular expression, he may also upload
PHP scripts and thereby execute arbitrary commands with the privileges
of PHP.

Product: planetGallery
Affected Versions: <= 22.05.2006
=46ixed Versions: 14.07.2006
Vulnerability Type: Remote command execution
Security-Risk: low
Vendor-Status: informed, fixed version released
Advisory-Status: public
CVE: CVE-2006-3676

PlanetGallery is a commercial PHP script which is used to publish image
galleries, show image descriptions and send picture postcards generated
from the galleries.

More Details
The faulty regular expression is in admin/gallery_admin.php:

193   $allow_file_types = 'gif|jpg|jpeg|png|bmp';
197   if (preg_match('#\.'.$allow_file_types.'?#i',
          $_FILES['grafik']['name'][$i])) {

Each variable $_FILES['grafik']['name'][$i] contains the filename of an
uploaded file. Only images with filename extensions supplied in
$allow_file_types are allowed, but the regular expression also matches
files like 'example.png.php'. Webservers interprete this as a PHP script.

Proof of Concept
Create a gallery and upload a PHP script named 'evil.png.php'
containing ''.

Now, access 

You should see the phpinfo page.

Change line 193 of admin/admin_gallery.php to:

   $allow_file_types = '(gif|jpg|jpeg|png|bmp)';

And line 197 to:

   if (preg_match('#\.'.$allow_file_types.'$#i',
          $_FILES['grafik']['name'][$i])) {

Update to the newest version 14.07.2006.

Security Risk
The attacker has to be admin of planetGallery to exploit this
vulnerability. If your admin directory is protected by a .htaccess file
(as the author strictly recommends), the risk is considered low,
otherwise everybody can impersonate the admin and exploit this
vulnerability.  PlanetGallery is not a multiuser gallery CMS, so the
admin of planetGallery is probably the maintainer of the website who
will have access to the system anyway. RedTeam therefore rates the risk
of this vulnerability as low.

2006-07-13 Discovery of vulnerability
2006-07-13 Vendor is informed
2006-07-14 Vendor releases fixed version
2006-07-20 Advisory is released


RedTeam Pentesting is offering individual penetration tests, short
pentests, performed by a team of specialised IT-security experts.
Hereby, security weaknesses in company networks are uncovered and can be
fixed immediately.

As there are only few experts in this field, RedTeam wants to share its
knowledge and enhance the public knowledge with research in security
related areas. The results are made available as public security

More information about RedTeam can be found at 

RedTeam Pentesting               Tel.: +49-241-963 1300
Dennewartstr. 25-27              Fax : +49-241-963 1304
52068 Aachen 

Content-Type: application/pgp-signature

Version: GnuPG v1.4.4 (GNU/Linux)



TUCoPS is optimized to look best in Firefox® on a widescreen monitor (1440x900 or better).
Site design & layout copyright © 1986-2015 AOH