[waraxe-2008-SA#066] - Multiple Vulnerabilities in Coppermine 1.4.14
===============================================================================
Author: Janek Vind "waraxe"
Date: 31. January 2008
Location: Estonia, Tartu
Web: http://www.waraxe.us/advisory-66.html
Target software description:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Coppermine Photo Gallery is a multi-purpose fully-featured and integrated web
picture gallery script written in PHP using GD or ImageMagick as image library
with a MySQL backend.
Coppermine Photo Gallery has been tested working well on IIS, Apache 1.3.24
onwards to the latest Apache 2, on Linux, UNIX, OSX, and Win32 systems.
Vulnerabilities discovered
===============================================================================
1. Reflected XSS in "docs/showdoc.php"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
http://localhost/coppermine.1.4.14/docs/showdoc.php?
h=waraxe&t=<script>alert(123);</script>
http://localhost/coppermine.1.4.14/docs/showdoc.php?
h=</title><script>alert(123);</script>&t=waraxe
2. Low-impact sql injection(s) in "util.php"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Preconditions:
===============
a) Attacker must have Coppermine admin privileges.
Example fragment from source code:
--------------------------------------------------
function update_thumbs()
{
global $CONFIG, $lang_util_php;
$albumid = (isset($_POST['albumid'])) ? $_POST['albumid'] : 0;
$albstr = ($albumid) ? "WHERE aid = $albumid" : '';
$updatetype = $_POST['updatetype'];
$numpics = $_POST['numpics'];
$startpic = (isset($_POST['startpic'])) ? $_POST['startpic'] : 0;
echo "<h2>{$lang_util_php['thumbs_wait']}</h2>";
$result = cpg_db_query("SELECT * FROM {$CONFIG['TABLE_PICTURES']}
$albstr LIMIT $startpic, $numpics");
$count = mysql_num_rows($result);
--------------------------------------------------
As seen above, "$_POST['albumid']", "$_POST['startpic']" and
"$_POST['numpics']" are used in sql query without proper sanitization.
Clearly this points to possible sql injection security hole.
As this script can be used only by admins, then i'd classify it as
"low impact". By the way, there seems to be more sql injections in this
script.
3. Low-impact sql injection(s) in "reviewcom.php"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Preconditions:
===============
a) Attacker must have Coppermine admin privileges.
Example fragment from source code:
--------------------------------------------------
if (isset($_POST['cid_array'])) {
$cid_array = $_POST['cid_array'];
$cid_set = '';
foreach ($cid_array as $cid)
$cid_set .= ($cid_set == '') ? '(' . $cid : ', ' . $cid;
$cid_set .= ')';
cpg_db_query("DELETE FROM {$CONFIG['TABLE_COMMENTS']}
WHERE msg_id IN $cid_set");
$nb_com_del = mysql_affected_rows();
}
--------------------------------------------------
It's easy to spot the problem - unsanitized data from "$_POST['cid_array']"
is used in DELETE query. In case of MySql 4.1.x attacker can fetch any info
from database via using subqueries functionality in affected DELETE query.
"Low impact" - because Coppermine admin privileges needed.
4. Information leakage in "update.php"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Anyone can execute update script "update.php":
http://victim.com/cpg14x/update.php
This specific script seems to be harmless in allready installed coppermine
instances, but looking at output, produced by script, we can see some insider
information. Example - database table prefix can be seen by potential attacker.
This piece of information can be useful in further attacks.
5. Path diclosure in "include/slideshow.inc.php"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
http://localhost/coppermine.1.4.14/include/slideshow.inc.php
... and we see error message in javascript source code:
<b>Fatal error</b>: Call to undefined function get_pic_data() in <b>
C:\apache_wwwroot\coppermine.1.4.14\include\slideshow.inc.php
</b> on line <b>53</b><br />
How to fix:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Download new Coppermine version 1.4.15 as soon as possible!
Greetings:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Greets to ToXiC, LINUX, y3dips, Sm0ke, Heintz, slimjim100, koko, str0ke
and anyone else who know me!
Greetings to Raido Kerna. Tervitusi Torufoorumi rahvale!
Contact:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
come2waraxe@yahoo.com
Janek Vind "waraxe"
Homepage: http://www.janekvind.com/
Waraxe forum: http://www.waraxe.us/forums.html
---------------------------------- [ EOF ] ---------------------------------
{"id": "SECURITYVULNS:DOC:18983", "bulletinFamily": "software", "title": "[waraxe-2008-SA#066] - Multiple Vulnerabilities in Coppermine 1.4.14", "description": "\r\n[waraxe-2008-SA#066] - Multiple Vulnerabilities in Coppermine 1.4.14\r\n===============================================================================\r\n\r\nAuthor: Janek Vind "waraxe"\r\nDate: 31. January 2008\r\nLocation: Estonia, Tartu\r\nWeb: http://www.waraxe.us/advisory-66.html\r\n\r\n\r\nTarget software description:\r\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n\r\nCoppermine Photo Gallery is a multi-purpose fully-featured and integrated web\r\npicture gallery script written in PHP using GD or ImageMagick as image library\r\nwith a MySQL backend.\r\n\r\nCoppermine Photo Gallery has been tested working well on IIS, Apache 1.3.24\r\nonwards to the latest Apache 2, on Linux, UNIX, OSX, and Win32 systems.\r\n\r\nVulnerabilities discovered\r\n===============================================================================\r\n\r\n1. Reflected XSS in "docs/showdoc.php"\r\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n\r\nhttp://localhost/coppermine.1.4.14/docs/showdoc.php?\r\nh=waraxe&t=<script>alert(123);</script>\r\nhttp://localhost/coppermine.1.4.14/docs/showdoc.php?\r\nh=</title><script>alert(123);</script>&t=waraxe\r\n\r\n\r\n2. Low-impact sql injection(s) in "util.php"\r\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n\r\nPreconditions:\r\n===============\r\na) Attacker must have Coppermine admin privileges.\r\n\r\n\r\nExample fragment from source code:\r\n--------------------------------------------------\r\nfunction update_thumbs()\r\n{\r\n global $CONFIG, $lang_util_php;\r\n\r\n $albumid = (isset($_POST['albumid'])) ? $_POST['albumid'] : 0;\r\n $albstr = ($albumid) ? "WHERE aid = $albumid" : '';\r\n\r\n $updatetype = $_POST['updatetype'];\r\n $numpics = $_POST['numpics'];\r\n $startpic = (isset($_POST['startpic'])) ? $_POST['startpic'] : 0;\r\n\r\n echo "<h2>{$lang_util_php['thumbs_wait']}</h2>";\r\n\r\n $result = cpg_db_query("SELECT * FROM {$CONFIG['TABLE_PICTURES']}\r\n $albstr LIMIT $startpic, $numpics");\r\n $count = mysql_num_rows($result);\r\n--------------------------------------------------\r\n\r\nAs seen above, "$_POST['albumid']", "$_POST['startpic']" and\r\n"$_POST['numpics']" are used in sql query without proper sanitization.\r\nClearly this points to possible sql injection security hole.\r\nAs this script can be used only by admins, then i'd classify it as\r\n"low impact". By the way, there seems to be more sql injections in this\r\nscript.\r\n\r\n\r\n3. Low-impact sql injection(s) in "reviewcom.php"\r\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n\r\nPreconditions:\r\n===============\r\na) Attacker must have Coppermine admin privileges.\r\n\r\n\r\nExample fragment from source code:\r\n--------------------------------------------------\r\nif (isset($_POST['cid_array'])) {\r\n $cid_array = $_POST['cid_array'];\r\n $cid_set = '';\r\n foreach ($cid_array as $cid)\r\n $cid_set .= ($cid_set == '') ? '(' . $cid : ', ' . $cid;\r\n $cid_set .= ')';\r\n\r\n cpg_db_query("DELETE FROM {$CONFIG['TABLE_COMMENTS']}\r\n WHERE msg_id IN $cid_set");\r\n $nb_com_del = mysql_affected_rows();\r\n}\r\n--------------------------------------------------\r\n\r\nIt's easy to spot the problem - unsanitized data from "$_POST['cid_array']"\r\nis used in DELETE query. In case of MySql 4.1.x attacker can fetch any info\r\nfrom database via using subqueries functionality in affected DELETE query.\r\n"Low impact" - because Coppermine admin privileges needed.\r\n\r\n4. Information leakage in "update.php"\r\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n\r\nAnyone can execute update script "update.php":\r\n\r\nhttp://victim.com/cpg14x/update.php\r\n\r\nThis specific script seems to be harmless in allready installed coppermine\r\ninstances, but looking at output, produced by script, we can see some insider\r\ninformation. Example - database table prefix can be seen by potential attacker.\r\nThis piece of information can be useful in further attacks.\r\n\r\n5. Path diclosure in "include/slideshow.inc.php"\r\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n\r\nhttp://localhost/coppermine.1.4.14/include/slideshow.inc.php\r\n\r\n... and we see error message in javascript source code:\r\n\r\n<b>Fatal error</b>: Call to undefined function get_pic_data() in <b>\r\nC:\apache_wwwroot\coppermine.1.4.14\include\slideshow.inc.php\r\n</b> on line <b>53</b><br />\r\n\r\n\r\nHow to fix:\r\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n\r\nDownload new Coppermine version 1.4.15 as soon as possible!\r\n\r\n\r\nGreetings:\r\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n\r\nGreets to ToXiC, LINUX, y3dips, Sm0ke, Heintz, slimjim100, koko, str0ke\r\nand anyone else who know me!\r\nGreetings to Raido Kerna. Tervitusi Torufoorumi rahvale!\r\n\r\nContact:\r\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n\r\ncome2waraxe@yahoo.com\r\nJanek Vind "waraxe"\r\n\r\nHomepage: http://www.janekvind.com/\r\nWaraxe forum: http://www.waraxe.us/forums.html\r\n\r\n---------------------------------- [ EOF ] ---------------------------------", "published": "2008-01-31T00:00:00", "modified": "2008-01-31T00:00:00", "cvss": {"score": 0.0, "vector": "NONE"}, "href": "https://vulners.com/securityvulns/SECURITYVULNS:DOC:18983", "reporter": "Securityvulns", "references": [], "cvelist": [], "type": "securityvulns", "lastseen": "2018-08-31T11:10:24", "edition": 1, "viewCount": 43, "enchantments": {"score": {"value": 0.2, "vector": "NONE"}, "dependencies": {"references": []}, "backreferences": {"references": [{"type": "canvas", "idList": ["COPPERMINE"]}, {"type": "securityvulns", "idList": ["SECURITYVULNS:VULN:8623"]}]}, "exploitation": null, "vulnersScore": 0.2}, "affectedSoftware": [], "immutableFields": [], "cvss2": {}, "cvss3": {}, "_state": {"dependencies": 1647589307, "score": 1659730939}}