Tugux CMS 1.2 (pid) Remote Arbitrary File Deletion Vulnerability

Title: Tugux CMS 1.2 (pid) Remote Arbitrary File Deletion Vulnerability
Advisory ID: ZSL-2011-5024
Type: Local/Remote
Impact: Manipulation of Data
Risk: (3/5)
Release Date: 10.07.2011
Summary
Tugux CMS is a free, open-source content Management system (CMS) and application that powers the entire web.
Description
Input passed to the 'pid' parameter in administrator/delete_page_parse.php is not properly sanitised before being used to delete files. This can be exploited to delete files with the permissions of the web server via directory traversal sequences passed within the 'pid' parameter.

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

/administrator/delete_page_parse.php
----------------
1: <?php
2: ///post form data
3: $id=$_POST['pid'];
4:
5: $pic1 = ("slides/$id/image_01.jpg");
6: if (file_exists($pic1)) {
7: unlink($pic1);
8: }
9: $dir = "slides/$id";
10: rmdir($dir);
11:
12: include_once "../scripts/connect_to_mysql.php";
13: $query = mysqli_query($myConnection, "DELETE FROM pages WHERE id='$id' ") or die (mysqli_error($myConnection));
14: echo '<table align="center"><tr> <td><div style=" width:300px; margin:auto; border:1px solid #BBB; font-family:Arial, Helvetica, sans-serif; color:#666; text-align:center">
15: <img src="images/check.png" width="90" height="87"><br />
16: Operation completed.Your page has been DELETED.<br />
17: <a href="index.php">Click Here to go back</a></div></td></tr></table>';
18: exit();
19: ?>

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

Vendor
Tugux Studios - http://www.tugux.com
Affected Version
1.2
Tested On
Microsoft Windows XP Professional SP3 (EN)
Apache 2.2.14 (Win32)
PHP 5.3.1
MySQL 5.1.41
Vendor Status
N/A
PoC
tugux_delete.txt
Credits
Vulnerability discovered by Gjoko Krstic - <gjoko@zeroscience.mk>
References
[1] http://www.exploit-db.com/exploits/17518/
[2] http://securityreason.com/exploitalert/10604
[3] http://packetstormsecurity.org/files/102946
[4] http://www.securityfocus.com/bid/48631
[5] http://xforce.iss.net/xforce/xfdb/68495
[6] http://secunia.com/advisories/44663
Changelog
[10.07.2011] - Initial release
[11.07.2011] - Added reference [2], [3] and [4]
[12.07.2011] - Added reference [5]
[20.07.2011] - Added reference [6]
Contact
Zero Science Lab

Web: http://www.zeroscience.mk
e-mail: lab@zeroscience.mk