Home Private Messages Search
CPG Dragonfly™ CMS stopsoftwarepatents.eu petition banner
Toggle Content
 
Forums ⇒ CMS (All) ⇒ Security :: Archives ⇒ Coppermine 1.2x security exploits :: Archived


Coppermine 1.2x security exploits :: Archived
Post any security related questions in here.
Please send discovered reports to security @ cpgnuke.com
Do Not post links to exploits or hacker sites - your post will be edited/deleted.
If you think you've been hacked, FIRST go through your server logs.

Go to page 1, 2, 3, 4  Next
Post new topic    Revive this topic    Printer Friendly Page     Forum Index ⇒  Security

Topic Archived View previous topic :: View next topic  
Author Message
DJ Maze
Developer
Developer

Offline Offline
Joined: Apr 19, 2004
Posts: 5683
Location: http://tinyurl.com/5z8dmv
PostPosted: Sat May 01, 2004 2:22 pm
Post subject: Coppermine 1.2x security exploits

Most of this is accesible thru a hacked admin account.
Since CPG-Nuke has secure admin it is hard to break in, but when they get in you could loose everything, so read.

Thanks to Maku for notifying Exclamation

Quote::
{================================================================================}
{ [waraxe-2004-SA#026] }
{================================================================================}
{ }
{ [ Multiple vulnerabilities in Coppermine Photo Gallery for PhpNuke ] }
{ }
{================================================================================}

Author: Janek Vind "waraxe"
Date: 29. April 2004
Location: Estonia, Tartu
Web: www.waraxe.us/index.ph...&id=26


Affected software description:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Affected software description:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Coppermine Photo Gallery 1.2.2b for CMS
Copyright (C) 2002,2003 Grégory DEMAR <gdemar@wanadoo.fr>
www.chezgreg.net/coppermine/
Updated by the Coppermine Dev Team coppermine.sf.net/team/
New Port by GoldenTroll
coppermine.findhere.org/
Based on coppermine 1.1d by Surf www.surf4all.net/
coppermine.findhere.org

I have tested two versions of the Coppermine: 1.2.2b and 1.2.0 RC4, which i will name
further as "new version" and "old version".


Vulnerabilities:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

A. Full path disclosure:

Many scripts in Coppermine software package are not protected against direct access,
therefore standard php error messages can be provoked, which leads to exposure the full
path to the scripts. Such piece of information has great value for potential attacker, who
will use this in next steps of hacking.

Version scope: both new and old versions are affected.

FIXES Add a die() line (seems they got lost along the way after a merge of standalone and cms version:

phpinfo.php
PHP:
if (!defined('IN_COPPERMINE')) DIE();
function
cpgGetPhpinfoConf($search)

addpic.php
PHP:
if (eregi("modules/", $_SERVER['PHP_SELF'])) {
die (
"You can't access this file directly...");
}
define('ADDPIC_PHP', true);
define('NO_HEADER', true);
require(
"modules/" . $name . "/include/load.inc.php");

config.php
PHP:
if (eregi("modules/", $_SERVER['PHP_SELF'])) {
die (
"You can't access this file directly...");
}
define('CONFIG_PHP', true);
require(
"modules/" . $name . "/include/load.inc.php");

db_input.php
PHP:
if (eregi("modules/", $_SERVER['PHP_SELF'])) {
die (
"You can't access this file directly...");
}
define('DB_INPUT_PHP', true);
require(
"modules/" . $name . "/include/load.inc.php");

displayecard.php
PHP:
if (eregi("modules/", $_SERVER['PHP_SELF'])) {
die (
"You can't access this file directly...");
}
define('DISPLAYECARD_PHP', true);
require(
"modules/" . $name . "/include/load.inc.php");

ecard.php
PHP:
if (eregi("modules/", $_SERVER['PHP_SELF'])) {
die (
"You can't access this file directly...");
}
define('ECARDS_PHP', true);
require(
"modules/" . $name . "/include/load.inc.php");

include/crop.inc.php
PHP:
if (!defined('IN_COPPERMINE')) die('Not in Coppermine...');
// ////////////////// Variables //////////////////////////////
// used texts
$txt['bigger'] = ">";

Quote::
B. Cross-site scripting aka XSS:

Can be used by potential attacker for stealing cookies and doing other operations, which in
normal conditions are not permitted by browser's cross-domain security restrictions.

Version scope: only new version is affected.

REMOVE docs/menu.inc.php

Quote::
C. Arbitrary directory browsing (needs nuke admin rights!):

PhpNuke is known by the many security bugs, leading to admin account overtaking by attacker.
So needing of the admin rights to use this exploit is not such big restriction ...

Version scope: both new and old versions are affected.
searchnew.php
PHP:
function getallpicindb(&$pic_array, $startdir)
{
global
$CONFIG;
if (
ereg('\.\.', $startdir)) die('Access denied'); // thanks to waraxe for finding this admin vulnerability
$sql = "SELECT filepath, filename " . "FROM {$CONFIG['TABLE_PICTURES']} " . "WHERE filepath LIKE '$startdir%'";
$result = db_query($sql);

Quote::
D. Execution of the arbitrary shell commands in server (needs nuke admin rights!):

Yes, again we need PhpNuke admin privileges to accomplish this exploit, but as said before,
there are many ways to compromise nuke's admin account.

Version scope: both new and old versions are affected.

include/picmgmt.inc.php AND include/picmgmtbatch.inc.php
PHP:
    // try to get more memory for executing large pictures -> DJMaze
ini_set("memory_limit", "32M");
// Method for thumbnails creation
$CONFIG['jpeg_qual'] = intval($CONFIG['jpeg_qual']);
$CONFIG['im_options'] = escapeshellarg($CONFIG['im_options']);
switch (
$method) {

Quote::
E. Remote file inclusion:

Version scope: both new and old versions are affected (different bugs in different scripts).

There exists remote file inclusion vulnerabilities in Coppermine Photo Gallery, which
can lead to arbitrary php code parsing, shell commands injection, etc. And as discussed before,
finally this can lead to total compromise of the victim server.

Of course, attacker's server, where those scripts are, must NOT PARSE PHP!!

See ya!

open your theme.php
PHP:
/* (at your option) any later version.                                      */
/****************************************************************************/
/* $Id: theme.php,v 1.6 2004/04/08 08:23:42 gtroll Exp $ */
/****************************************************************************/
if (!defined('IN_COPPERMINE')) die('Not in Coppermine...');

_________________
There are two paths, the short one and the long one.
When you choose the short path you will notice it takes longer then the long path.
So READ the FAQ and Wiki first Razz

DJ Maze's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Fedora 15 / 2.2.22 / 5.5.20 / 5.3.10 / CVS


Last edited by DJ Maze on Wed May 05, 2004 6:27 am; edited 4 times in total
Back to top
View user's profile Visit poster's website Yahoo Messenger Photo Gallery
Dogman
Newbie
Newbie

Offline Offline
Joined: May 01, 2004
Posts: 2

PostPosted: Sat May 01, 2004 7:45 pm
Post subject: Re: Coppermine 1.2x security exploits

Hi,...

this Code:
Code::
if (ereg('..', $startdir)) die('Access denied');

in "searchnew.php" will not work for me...

"$startdir" is filled with: "userpics/Menschen/" but I get an "Access denied"...

Dogman Cool


Dogman's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Win/1.3/4.0.18/4.3.4
Back to top
View user's profile Visit poster's website
sigi
Newbie
Newbie

Offline Offline
Joined: May 01, 2004
Posts: 5

PostPosted: Sat May 01, 2004 8:03 pm
Post subject: Re: Coppermine 1.2x security exploits

same for me - access denied ...


sigi's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
SuSe 8.2 / 1.7x / 3.23.52 / 4.34
Back to top
View user's profile Visit poster's website
lost1
Newbie
Newbie

Offline Offline
Joined: Apr 25, 2004
Posts: 28

PostPosted: Sat May 01, 2004 8:16 pm
Post subject: Re: Coppermine 1.2x security exploits

Thank you. 1 question
Quote::
REMOVE menu.inc.php

does this line refer to postnuke only?


lost1's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
linux host/ apache 1.3.29/ mysql4/php4
Back to top
View user's profile Visit poster's website
DJ Maze
Developer
Developer

Offline Offline
Joined: Apr 19, 2004
Posts: 5683
Location: http://tinyurl.com/5z8dmv
PostPosted: Sat May 01, 2004 8:58 pm
Post subject: Re: Coppermine 1.2x security exploits

Oops the code should be searchnew.php
PHP:
function getallpicindb(&$pic_array, $startdir)
{
global
$CONFIG;
if (
ereg('\.\.', $startdir)) die('Access denied'); // thanks to waraxe for finding this admin vulnerability
$sql = "SELECT filepath, filename " . "FROM {$CONFIG['TABLE_PICTURES']} " . "WHERE filepath LIKE '$startdir%'";
$result = db_query($sql);

_________________
There are two paths, the short one and the long one.
When you choose the short path you will notice it takes longer then the long path.
So READ the FAQ and Wiki first Razz

DJ Maze's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Fedora 15 / 2.2.22 / 5.5.20 / 5.3.10 / CVS
Back to top
View user's profile Visit poster's website Yahoo Messenger Photo Gallery
Dogman
Newbie
Newbie

Offline Offline
Joined: May 01, 2004
Posts: 2

PostPosted: Sat May 01, 2004 9:06 pm
Post subject: Re: Coppermine 1.2x security exploits

This did it... Very Happy

Thank you...

Dogman Cool


Dogman's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Win/1.3/4.0.18/4.3.4
Back to top
View user's profile Visit poster's website
darkgrue
Developer
Developer

Offline Offline
Joined: Apr 20, 2004
Posts: 542
Location: Lancaster, CA
PostPosted: Sun May 02, 2004 2:52 am
Post subject: Re: Coppermine 1.2x security exploits

PHP:
$CONFIG['jpeg_qual'] = escapeshellarg($CONFIG['jpeg_qual']);
Since the parameter is always supposed to be an integer, can I suggest:
PHP:
$CONFIG['jpeg_qual'] = intval($CONFIG['jpeg_qual']);
This is causing problems on my installation (does it with the jpeg_qual value too, which is why I used intval()):
PHP:
$CONFIG['im_options'] = escapeshellarg($CONFIG['im_options']);
It ends up changing the string (I've verified the database):
Quote::
-antialias
to:
Quote::
''\''-antialias'\'''
Ugh. Not good.
I fixed the problem by changing the line to read:
PHP:
$im_options = escapeshellarg($CONFIG['im_options']);
and changing {$CONFIG['im_options']} to {$im_options} in Line 145.

_________________
It is pitch black. You are likely to be eaten by a grue.

darkgrue's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Ubuntu 11.04, Atom D525/Apache 2.2.17/MySQL 5.1.54/PHP 5.3.5/Dragonfly 10.0.04 CVS
Back to top
View user's profile Visit poster's website
DJ Maze
Developer
Developer

Offline Offline
Joined: Apr 19, 2004
Posts: 5683
Location: http://tinyurl.com/5z8dmv
PostPosted: Sun May 02, 2004 4:25 am
Post subject: Re: Coppermine 1.2x security exploits

thanks darkgrue

_________________
There are two paths, the short one and the long one.
When you choose the short path you will notice it takes longer then the long path.
So READ the FAQ and Wiki first Razz

DJ Maze's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Fedora 15 / 2.2.22 / 5.5.20 / 5.3.10 / CVS
Back to top
View user's profile Visit poster's website Yahoo Messenger Photo Gallery
Head-e
Silver Supporter
Silver Supporter

Offline Offline
Joined: Apr 20, 2004
Posts: 937

PostPosted: Mon May 03, 2004 1:22 am
Post subject: Re: Coppermine 1.2x security exploits

is there anyway to make a patch, or post updated files for the less knowledgable php users? Rolling Eyes i'm tryin!


Head-e please enter your server specs in your user profile! Crying or Very sad
Back to top
View user's profile Photo Gallery
Trevor
Developer
Developer

Offline Offline
Joined: Apr 19, 2004
Posts: 2170
Location: New York
PostPosted: Mon May 03, 2004 1:23 am
Post subject: Re: Coppermine 1.2x security exploits

cvs.sourceforge.net/vi...ortby=date


Trevor's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Linux / 1.3.34 / 4.1.18 / 4.4.2 / CVS
Back to top
View user's profile Photo Gallery
Phoenix
• Many Posts •
• Many Posts •

Offline Offline
Joined: Apr 19, 2004
Posts: 8799
Location: Netizen
PostPosted: Mon May 03, 2004 1:31 am
Post subject: Re: Coppermine 1.2x security exploits

The Topic was 1.2x - CPG-Nuke releases are 1.3.0 - use CVS at your own risk, otherwise use 8.1.1 and refer issues to Modules Forum. Smile

_________________
DonationsPro for DragonflyCMS, SMF, MyBB, vBulletin

Phoenix's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Back to top
View user's profile Visit poster's website Photo Gallery
Trevor
Developer
Developer

Offline Offline
Joined: Apr 19, 2004
Posts: 2170
Location: New York
PostPosted: Mon May 03, 2004 1:31 am
Post subject: Re: Coppermine 1.2x security exploits

Oops, sorry Embarassed


Trevor's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Linux / 1.3.34 / 4.1.18 / 4.4.2 / CVS
Back to top
View user's profile Photo Gallery
Jeruvy
Security Team
Security Team

Offline Offline
Joined: Apr 23, 2004
Posts: 1432
Location: Canada
PostPosted: Tue May 04, 2004 2:07 am
Post subject: Re: Coppermine 1.2x security exploits

Full-Disclosure Today.

Watch the kiddies come out.

_________________
J.
j e r u v y a t y a h o o d o t c o m

Need help? Look here: www.dragonflycms.org/W...d=112.html
Need to chat? Look for me on irc.freenode.net

Jeruvy's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Ubuntu7.10/Debian3.1 - 2.2.3/1.3.37 - 5.0.38/4.0.27 - 5.2.1/4.4.7 - CVS/9.1.2}
Back to top
View user's profile ICQ Number Yahoo Messenger Photo Gallery
DJ Maze
Developer
Developer

Offline Offline
Joined: Apr 19, 2004
Posts: 5683
Location: http://tinyurl.com/5z8dmv
PostPosted: Tue May 04, 2004 2:18 am
Post subject: Re: Coppermine 1.2x security exploits

Check my new topic
cpgnuke.com/index.php?...&t=422 to see more hack prevention especialy to prevent above attacks and trap them instantly Very Happy

_________________
There are two paths, the short one and the long one.
When you choose the short path you will notice it takes longer then the long path.
So READ the FAQ and Wiki first Razz

DJ Maze's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
Fedora 15 / 2.2.22 / 5.5.20 / 5.3.10 / CVS
Back to top
View user's profile Visit poster's website Yahoo Messenger Photo Gallery
sigi
Newbie
Newbie

Offline Offline
Joined: May 01, 2004
Posts: 5

PostPosted: Tue May 04, 2004 9:47 pm
Post subject: Re: Coppermine 1.2x security exploits

just one more question.-.-.

after installing the above fixes the thumbnail and normal pics have a rather nasty look - see it at www.allygally.de , the pics added today -.-.-.

any idea what this could be ?


sigi's server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS)
SuSe 8.2 / 1.7x / 3.23.52 / 4.34


Last edited by sigi on Tue May 04, 2004 9:52 pm; edited 1 time in total
Back to top
View user's profile Visit poster's website
Display posts from previous:   
Post new topic    Revive this topic    Printer Friendly Page    Forum Index ⇒  Security
Page 1 of 4
All times are GMT
Go to page 1, 2, 3, 4  Next

Archive Revive
Username:
This is an archived topic - your reply will not be appended here.
Instead, a new topic will be generated in the active forum.
The new topic will provide a reference link to this archived topic.
 
   Toggle Content User Info

Welcome Anonymous

Nickname
Password
(Register)

   Toggle Content Last CVS commits
· Fixed .ico Expires header.
· Removed domain name from cookies so subdomains wont access them anymore.
· CSS and JS, case insensitives.
· CSS and JS, send correct HTTP 1.1 headers and fixed issues where themes and...
· Further security class improvements.
· 301 redirects on LEO changes
· Option to force 3xx http status codes
· Validate googlebot.com and google.com crawlers.
· CCBot
· Rss with etag and atom.

read more...

   Toggle Content Community

Support for DragonflyCMS in a other languages:

Deutsch
Español

   Toggle Content X-links
UltraEdit Browse Happy logo Firefox MySQL PostgreSQL Valid CSS! Valid XHTML 1.0! Unicode Encoded Badge NukeBiz Resources Raven DragonflyCMS Dedicated Now InsideSupport Lampe Berger

You are seeing squares or questionmarks on this page?

All content of this website is copyrighted by the Creative Commons NC-SA
The logos and trademarks used on this site are the property of their respective owners
We are not responsible for comments posted by our users, as they are the property of the poster.
Our server runs on a P3 1.2GHz with 512MB RAM with no accelerators
Support GoPHP5.org
Interactive software released under GNU GPL, Code Credits, Privacy Policy