phpBMS

Show
Ignore:
Timestamp:
01/01/10 23:10:02 (2 years ago)
Author:
brieb
Message:
  • Fixed several SQL injection vulnerabilities
  • Fixed several XSS vulnerabilities due to PHP_SELF and REQUREST_URI
  • Fixed severa path disclosure errors
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/phpbms/modules/bms/clients_email.php

    r702 r704  
    1 <?php  
     1<?php 
    22/* 
    33 $Rev$ | $LastChangedBy$ 
     
    4141 
    4242        include("./include/clients_email_include.php"); 
    43          
    44          
     43 
     44 
    4545        $thecommand="showoptions"; 
    4646        if(isset($_POST["command"])) $thecommand=$_POST["command"]; 
    47          
     47 
    4848        switch($thecommand){ 
    4949                case "send email": 
     
    5454                                        foreach($_SESSION["emailids"] as $id) 
    5555                                                $whereclause.="clients.id=".$id." or "; 
    56                                         $whereclause=substr($whereclause,0,strlen($whereclause)-3);                                      
     56                                        $whereclause=substr($whereclause,0,strlen($whereclause)-3); 
    5757                                break; 
    5858                                case "savedsearch": 
     
    6464                                case "all": 
    6565                                        $whereclause=""; 
    66                                 break;                                           
     66                                break; 
    6767                        }//end switch 
    6868                        //next the from: 
    69                         $_SESSION["massemail"]["from"]=str_replace("]",">",str_replace("[","<",$_POST["ds-email"]));                     
     69                        $_SESSION["massemail"]["from"]=str_replace("]",">",str_replace("[","<",$_POST["ds-email"])); 
    7070                        $_SESSION["massemail"]["whereclause"]=$whereclause; 
    7171                        $_SESSION["massemail"]["subject"]=$_POST["subject"]; 
    7272                        $_SESSION["massemail"]["body"]=$_POST["body"]; 
    7373                        $_SESSION["massemail"]["savedproject"]=$_POST["pid"]; 
    74                          
     74 
    7575                        $querystatement="SELECT id,email, if(clients.lastname!=\"\",concat(clients.lastname,\", \",clients.firstname,if(clients.company!=\"\",concat(\" (\",clients.company,\")\"),\"\")),clients.company) AS name FROM clients ".$whereclause; 
    7676                        $sendqueryresult=$db->query($querystatement); 
    7777                        if(!$sendqueryresult) $error = new appError(300,"Error with: ".$querystatement); 
    78                          
     78 
    7979                break; 
    8080                case "delete project": 
     
    100100                        $thecommand="showoptions"; 
    101101                break; 
    102                  
     102 
    103103                case "done": 
    104104                case "cancel": 
    105105                        goURL(APP_PATH."search.php?id=2"); 
    106                          
     106 
    107107                break; 
    108108        } 
    109          
    110          
     109 
     110 
    111111        $pageTitle="Client/Prospect E-Mail"; 
    112   
     112 
    113113        $phpbms->cssIncludes[] = "pages/clientemail.css"; 
    114114        $phpbms->jsIncludes[] = "modules/bms/javascript/clientemail.js"; 
     
    117117                //============================================================== 
    118118                $theform = new phpbmsForm(); 
    119                  
     119 
    120120                if(is_numeric($therecord["emailfrom"])) 
    121121                        $theid=$therecord["emailfrom"]; 
    122122                else 
    123123                        $theid=0; 
    124                  
     124 
    125125                $theinput = new inputSmartSearch($db, "email", "Pick Active User Email", $theid, "from"); 
    126126                $theform->addField($theinput); 
    127                  
     127 
    128128                $theform->jsMerge(); 
    129129                //============================================================== 
    130130                //End Form Elements 
    131                  
     131 
    132132                if($therecord["emailto"]!="selected" AND $therecord["emailto"]!="all") 
    133133                        $phpbms->bottomJS[] ='thediv=getObjectFromID("showsavedsearches");thediv.style.display="block"'; 
     
    135135                if(!is_numeric($therecord["emailfrom"])) 
    136136                        $phpbms->bottomJS[] ='thefield=getObjectFromID("ds-email");thefield.value="'.$therecord["emailfrom"].'"'; 
    137                  
     137 
    138138                if($thecommand=="send email"){ 
    139                  
    140                         $phpbms->topJS[]='               
    141                         ids=new Array();                         
     139 
     140                        $phpbms->topJS[]=' 
     141                        ids=new Array(); 
    142142                        emails=new Array(); 
    143143                        names= new Array();'; 
    144                          
     144 
    145145                        while($therecord = $db->fetchArray($sendqueryresult)){ 
    146146                                $phpbms->topJS[]="ids[ids.length]=".$therecord["id"].";"; 
    147147                                $phpbms->topJS[]="names[names.length]=\"".$therecord["name"]."\";"; 
    148148                                $phpbms->topJS[]="emails[emails.length]=\"".$therecord["email"]."\";"; 
    149                         }                        
     149                        } 
    150150                }//end if 
    151   
     151 
    152152        include("header.php") 
    153153 
     
    156156        <div class="bodyline" id="mainBG"> 
    157157                <h1 id="topTitle"><span><?php echo $pageTitle?></span></h1> 
    158                  
    159                 <form action="<?php echo $_SERVER["PHP_SELF"] ?>" method="post" name="theform" id="theform"> 
     158 
     159                <form action="<?php echo htmlentities($_SERVER["PHP_SELF"]) ?>" method="post" name="theform" id="theform"> 
    160160        <?php if($thecommand=="showoptions") { ?> 
    161          
     161 
    162162                <input type="hidden" name="pid" id="pid" value="<?php echo $therecord["id"]?>" /> 
    163163                <div class="box"> 
    164                          
     164 
    165165                        <p id="toP"> 
    166                                 <label for="therecords">to</label><br />                         
     166                                <label for="therecords">to</label><br /> 
    167167                                <select id="therecords" name="therecords" onchange="showSavedSearches(this);"> 
    168168                                        <option value="selected" <?php if ($therecord["emailto"]=="selected") echo "selected=\"selected\""?>>e-mail addresses from selected records (<?php echo count($_SESSION["emailids"]) ?> record<?php if(count($_SESSION["emailids"])>1) echo "s"?>)</option> 
    169169                                        <option value="savedsearch" <?php if ($therecord["emailto"]!="selected" AND $therecord["emailto"]!="all") echo "selected=\"selected\""?>>e-mail addresses from saved search...</option> 
    170                                 </select>                                
     170                                </select> 
    171171                        </p> 
    172172                        <p id="showsavedsearches" > 
    173173                                <label for="savedsearches">load e-mail addresses from saved search...</label><br /> 
    174                                 <?php showSavedSearches($db,$therecord["emailto"]); ?>                   
    175                         </p> 
    176                          
     174                                <?php showSavedSearches($db,$therecord["emailto"]); ?> 
     175                        </p> 
     176 
    177177                        <div class="fauxP" id="fromDiv"><?php  $theform->showField("email")?></div> 
    178                          
     178 
    179179                        <p> 
    180180                                <label for="subject">subject</label><br /> 
    181                                 <input type="text" name="subject" id="subject" maxlength="128" value="<?php echo htmlQuotes($therecord["subject"])?>"/>                  
    182                         </p> 
    183                 </div> 
    184                  
     181                                <input type="text" name="subject" id="subject" maxlength="128" value="<?php echo htmlQuotes($therecord["subject"])?>"/> 
     182                        </p> 
     183                </div> 
     184 
    185185                <div class="box"> 
    186186                        <p> 
     
    194194                        </p> 
    195195                </div> 
    196                  
     196 
    197197                <div class="box"> 
    198198                        <div id="projectButtons"> 
     
    205205                                <input type="submit" name="command"     id="sendemail" value="send email" class="Buttons" /> 
    206206                                <input type="submit" name="command"     id="cancel" value="cancel" class="Buttons" /> 
    207                                 <input type="submit" name="command"     id="othercommand" value="" class="Buttons" />                            
    208                         </div> 
    209                 </div> 
    210                  
     207                                <input type="submit" name="command"     id="othercommand" value="" class="Buttons" /> 
     208                        </div> 
     209                </div> 
     210 
    211211                <div id="loadedprojects"> 
    212212                        <p><?php showSavedProjects($db)?></p> 
     
    218218                </div> 
    219219<?php } elseif($thecommand=="send email"){?> 
    220                  
     220 
    221221                <div id="processingWrap"> 
    222222                        <div class="box"> 
phpBMS vulnerability assesment provided by Orvant Inc. Copyright © 2010 Kreotek, LLC. All Rights reserved.