Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: security hole in CPG  (Read 3201 times)

0 Members and 1 Guest are viewing this topic.

anpaza

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
security hole in CPG
« on: September 21, 2008, 08:29:35 pm »

Hello!

I've been using CPG 1.4.10 for long time, and was once hacked by some moron. I've analyzed the logs and found the bug which was used by that little prick to get in. Unfortunately, I haven't bothered to report it.

Now I decided to upgrade to latest 1.4.19, and guess what... the bug is still there.

So I took the time to report it.

I won't describe how the hack works in a naive attempt to prevent other sites hacked within a short time. The bug is in the function cpg_get_custom_include().

Here's just the fix (the CPG developers may find a better way to do it, I'm not a php programmer ever):

Code: [Select]
diff -urw cpg1410/include/functions.inc.php /var/www/html/photo/include/functions.inc.php
--- cpg1410/include/functions.inc.php   2006-10-29 22:56:50.000000000 +0300
+++ /var/www/html/photo/include/functions.inc.php   2008-04-11 00:59:47.000000000 +0400
@@ -2842,6 +2842,12 @@
     {
         return $return;
     }
+
+    // Check that the file is not user-writeable
+    // If we don't do this we're asking for troubles
+    if (posix_access ($path, POSIX_W_OK))
+        return $return;
+
     ob_start();
     include($path);
     $return = ob_get_contents();

Also another simple hint to avoid being hacked: change in include/init.inc.php define('COPPERMINE_VERSION'...) to some bogus version. This way, you'll avoid your site being found with a simple google search for vulnerable versions.
Logged

Nibbler

  • Guest
Re: security hole in CPG
« Reply #1 on: September 21, 2008, 08:54:03 pm »

You can't search HTML comments using google AFAIK, and changing the version number will stop the version checker working properly.

If you have details of an actual security issue in the current 1.4.19 then PM me.
Logged

anpaza

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
Re: security hole in CPG
« Reply #2 on: September 21, 2008, 11:01:38 pm »

Yes, but you can search for "Powered by Coppermine Gallery" first, and then look in html to find out which version is installed to choose an appropiate attack vector.

In 1.4.19 one would also have to remove the "<!-- SVN Version info" comments from every template.html file, since it also contains the version number.

The rest will go in a PM.
Logged
Pages: [1]   Go Up
 

Page created in 0.016 seconds with 19 queries.