Ethical Hacking

Learn to find vulnerabilities before the bad guys do! Gain real world hands on hacking experience in our state of the art hacking lab. Course designed and taught by expert instructors with years of penetration testing experience. 12 student maximum in every class. Certification attempt included in every package.
Computer Forensics Training at InfoSec Institute

Gain the in-demand skills of a certified computer examiner, learn to recover trace data left behind by fraud, theft, and cybercrime perpetrators. Discover the source of computer crime and abuse at your organization so that it never happens again. All of our class sizes are guaranteed to be 12 students or less to facilitate one-on-one interaction with one of our expert instructors.




Network Security Vuln-Dev
[Top] [All Lists]

Re: Instant Photo Gallery <= Multiple XSS

Subject: Re: Instant Photo Gallery <= Multiple XSS
Date: Thu, 27 Apr 2006 18:00:59 -0400 (EDT)

security curmudgeon mentioned:

 /portfolio.php?cat_id=[XSS]

Based on source inspection of 1.0.2, this parameter is cleansed.

line 31 of portfolio.php says:

  $catId = $dbFilter->db_clean_input($_GET['cat_id'], 'integer');

which looks like it's going to do input validation as an integer.

BUT... did it do this properly?

Let's go to the definition for db_clean_input...

includes/classes/class_db_input_filter.php:

class db_input_filter{

...

   function db_clean_input($input, $inputType, $quoteValue=1){

       $this->input = $input;
       $this->inputType = $inputType;

...

       switch($this->inputType) {
           case 'integer':
               if(ereg("^[0-9]+$", $this->input)) {
                   $this->input = (int)$this->input;
               } else {
                   $this->errorMsg = "Input does not match specified type 
(integer).";
                   return false;
               } 


Notice the ereg() call.  It cleanses the input ONLY if it consists of
all digits.  Otherwise, the function returns 'false'.  The program
doesn't check if a bad value was provided, but still, this would have
the effect of setting the $catId variable to a blank value.

In February 2006, the developer also offered a "IPG Security Patch
1.0.1" which includes the portfolio.php file that is now in 1.0.2, so
maybe the portfolio.php/cat_id vector only applies to versions of
Instant Photo Gallery BEFORE 1.0.2.


portfolio_photo_popup.php / id is more clear:

$image_id = isset($_POST['id'])?$_POST['id']:$_GET['id'];

count_click($image_id);

and in includes/functions/fns_std.php:

function count_click($image_id){
db_connect();
      $sql = "SELECT * FROM " . PDB_PREFIX . "image_ratings WHERE id = " . 
$image_id;

So, we have direct SQL injection using the "id" parameter, which
produces resultant XSS if the SQL query is malformed in an
XSS-friendly fashion.

- Steve

<Prev in Thread] Current Thread [Next in Thread>