Changeset 15035 for branches/rel/html


Ignore:
Timestamp:
2007/07/10 22:12:44 (17 years ago)
Author:
adati
Message:

任意のドライブおよび、フォルダの画像ファイル等にアクセスが可能な脆弱性を修正

Location:
branches/rel/html
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/rel/html/install/user_data/include/bloc/best5.tpl

    r12157 r15035  
    1515        <td> 
    1616         
    17         <!--{if $arrBestProducts[cnt].main_list_image != ""}--><!--{assign var=image_path value="`$smarty.const.IMAGE_SAVE_DIR`/`$arrBestProducts[cnt].main_list_image`"}--><!--{else}--><!--{assign var=image_path value="`$smarty.const.NO_IMAGE_DIR`"}--><!--{/if}--> 
     17        <!--{if $arrBestProducts[cnt].main_list_image != ""}--><!--{assign var=image_path value="`$arrBestProducts[cnt].main_list_image`"}--><!--{else}--><!--{assign var=image_path value="`$smarty.const.NO_IMAGE_DIR`"}--><!--{/if}--> 
    1818         
    1919        <table width="190" border="0" cellspacing="0" cellpadding="0" summary=" "> 
     
    4848        <!--{assign var=cnt2 value=`$smarty.section.cnt.iteration*$smarty.section.cnt.step-1` }--> 
    4949        <!--{if $arrBestProducts[$cnt2]|count > 0}--> 
    50             <!--{if $arrBestProducts[$cnt2].main_list_image != ""}--><!--{assign var=image_path value="`$smarty.const.IMAGE_SAVE_DIR`/`$arrBestProducts[$cnt2].main_list_image`"}--><!--{else}--><!--{assign var=image_path value="`$smarty.const.NO_IMAGE_DIR`"}--><!--{/if}--> 
     50            <!--{if $arrBestProducts[$cnt2].main_list_image != ""}--><!--{assign var=image_path value="`$arrBestProducts[$cnt2].main_list_image`"}--><!--{else}--><!--{assign var=image_path value="`$smarty.const.NO_IMAGE_DIR`"}--><!--{/if}--> 
    5151            <table width="190" border="0" cellspacing="0" cellpadding="0" summary=" "> 
    5252                <tr valign="top"> 
  • branches/rel/html/install/user_data/templates/default1/include/bloc/best5.tpl

    r12157 r15035  
    1515        <td> 
    1616         
    17         <!--{if $arrBestProducts[cnt].main_list_image != ""}--><!--{assign var=image_path value="`$smarty.const.IMAGE_SAVE_DIR`/`$arrBestProducts[cnt].main_list_image`"}--><!--{else}--><!--{assign var=image_path value="`$smarty.const.NO_IMAGE_DIR`"}--><!--{/if}--> 
     17        <!--{if $arrBestProducts[cnt].main_list_image != ""}--><!--{assign var=image_path value="`$arrBestProducts[cnt].main_list_image`"}--><!--{else}--><!--{assign var=image_path value="`$smarty.const.NO_IMAGE_DIR`"}--><!--{/if}--> 
    1818         
    1919        <table width="190" border="0" cellspacing="0" cellpadding="0" summary=" "> 
     
    4848        <!--{assign var=cnt2 value=`$smarty.section.cnt.iteration*$smarty.section.cnt.step-1` }--> 
    4949        <!--{if $arrBestProducts[$cnt2]|count > 0}--> 
    50             <!--{if $arrBestProducts[$cnt2].main_list_image != ""}--><!--{assign var=image_path value="`$smarty.const.IMAGE_SAVE_DIR`/`$arrBestProducts[$cnt2].main_list_image`"}--><!--{else}--><!--{assign var=image_path value="`$smarty.const.NO_IMAGE_DIR`"}--><!--{/if}--> 
     50            <!--{if $arrBestProducts[$cnt2].main_list_image != ""}--><!--{assign var=image_path value="`$arrBestProducts[$cnt2].main_list_image`"}--><!--{else}--><!--{assign var=image_path value="`$smarty.const.NO_IMAGE_DIR`"}--><!--{/if}--> 
    5151            <table width="190" border="0" cellspacing="0" cellpadding="0" summary=" "> 
    5252                <tr valign="top"> 
  • branches/rel/html/install/user_data/templates/default1/templates/detail.tpl

    r13457 r15035  
    341341                                    <td align="center" valign="middle"><a href="<!--{$smarty.const.DETAIL_P_HTML}--><!--{$arrRecommend[cnt].product_id}-->"> 
    342342                                    <!--{if $arrRecommend[cnt].main_list_image != ""}--> 
    343                                         <!--{assign var=image_path value="`$smarty.const.IMAGE_SAVE_DIR`/`$arrRecommend[cnt].main_list_image`"}--> 
     343                                        <!--{assign var=image_path value="`$arrRecommend[cnt].main_list_image`"}--> 
    344344                                    <!--{else}--> 
    345345                                        <!--{assign var=image_path value="`$smarty.const.NO_IMAGE_DIR`"}--> 
     
    382382                                    <td align="center" valign="middle"><a href="<!--{$smarty.const.DETAIL_P_HTML}--><!--{$arrRecommend[$nextCnt].product_id}-->"> 
    383383                                    <!--{if $arrRecommend[$nextCnt].main_list_image != ""}--> 
    384                                         <!--{assign var=image_path value="`$smarty.const.IMAGE_SAVE_DIR`/`$arrRecommend[$nextCnt].main_list_image`"}--> 
     384                                        <!--{assign var=image_path value="`$arrRecommend[$nextCnt].main_list_image`"}--> 
    385385                                    <!--{else}--> 
    386386                                        <!--{assign var=image_path value="`$smarty.const.NO_IMAGE_DIR`"}--> 
  • branches/rel/html/install/user_data/templates/detail.tpl

    r13457 r15035  
    378378                                    <td align="center" valign="middle"><a href="<!--{$smarty.const.DETAIL_P_HTML}--><!--{$arrRecommend[cnt].product_id}-->"> 
    379379                                    <!--{if $arrRecommend[cnt].main_list_image != ""}--> 
    380                                         <!--{assign var=image_path value="`$smarty.const.IMAGE_SAVE_DIR`/`$arrRecommend[cnt].main_list_image`"}--> 
     380                                        <!--{assign var=image_path value="`$arrRecommend[cnt].main_list_image`"}--> 
    381381                                    <!--{else}--> 
    382382                                        <!--{assign var=image_path value="`$smarty.const.NO_IMAGE_DIR`"}--> 
    383383                                    <!--{/if}--> 
    384                                     <img src="<!--{$smarty.const.SITE_URL}-->resize_image.php?image=<!--{$image_path|sfRmDupSlash}-->&width=65&height=65" alt="<!--{$arrRecommend[cnt].name|escape}-->"></a></td> 
     384                                    <img src="<!--{$smarty.const.SITE_URL}-->resize_image.php?image=<!--{$image_path|sfRmDupSlash}-->&width=65&height=65" alt="<!--{$arrRecommend[cnt].name|escape}-->"></a> 
     385                                    </td> 
    385386                                    <td align="right"> 
    386387                                    <table width="145" border="0" cellspacing="0" cellpadding="0" summary=" "> 
     
    419420                                    <td align="center" valign="middle"><a href="<!--{$smarty.const.DETAIL_P_HTML}--><!--{$arrRecommend[$nextCnt].product_id}-->"> 
    420421                                    <!--{if $arrRecommend[$nextCnt].main_list_image != ""}--> 
    421                                         <!--{assign var=image_path value="`$smarty.const.IMAGE_SAVE_DIR`/`$arrRecommend[$nextCnt].main_list_image`"}--> 
     422                                        <!--{assign var=image_path value="`$arrRecommend[$nextCnt].main_list_image`"}--> 
    422423                                    <!--{else}--> 
    423424                                        <!--{assign var=image_path value="`$smarty.const.NO_IMAGE_DIR`"}--> 
  • branches/rel/html/resize_image.php

    r13448 r15035  
    55 
    66require_once($include_dir . HTML2DATA_DIR. "lib/gdthumb.php"); 
    7 require_once($include_dir . HTML2DATA_DIR. "conf/conf.php");     
     7require_once($include_dir . HTML2DATA_DIR. "conf/conf.php"); 
    88 
    99$objThumb = new gdthumb(); 
    1010 
    11 $file = $_GET["image"]; 
     11$file = NO_IMAGE_DIR; 
     12 
     13// NO_IMAGE_DIR°Ê³°¤Î¥Õ¥¡¥¤¥ë̾¤¬ÅϤµ¤ì¤¿¾ì¹ç¡¢¥Õ¥¡¥¤¥ë̾¤Î¥Á¥§¥Ã¥¯¤ò¹Ô¤¦ 
     14if ( isset($_GET['image']) && $_GET['image'] !== NO_IMAGE_DIR) { 
     15     
     16    //ÉÔÀµ¤Ê¥Õ¥¡¥¤¥ë̾¤¬ÅϤµ¤ì¤¿¾ì¹ç¤Ï½ªÎ»¤µ¤»¤ë 
     17    if ( lfCheckFileName() !== true ) { 
     18        exit(); 
     19    } 
     20     
     21    $file = IMAGE_SAVE_DIR . $_GET['image']; 
     22} 
     23 
    1224if(file_exists($file)){ 
    13     $objThumb->Main($file, $_GET["width"], $_GET["height"], "", true); 
     25    $objThumb->Main($file, $_GET["width"], $_GET["height"], "", true); 
    1426}else{ 
    15     $objThumb->Main(NO_IMAGE_DIR, $_GET["width"], $_GET["height"], "", true); 
     27    $objThumb->Main(NO_IMAGE_DIR, $_GET["width"], $_GET["height"], "", true); 
     28} 
     29 
     30// ¥Õ¥¡¥¤¥ë̾¤Î·Á¼°¤ò¥Á¥§¥Ã¥¯ 
     31function lfCheckFileName() { 
     32    //$pattern = '|^[0-9]+_[0-9a-z]+\.[a-z]{3}$|'; 
     33    $pattern = '|\.\./|'; 
     34    $file    = trim($_GET["image"]); 
     35    if ( preg_match_all($pattern, $file, $matches) ) { 
     36        return false; 
     37    } else { 
     38        return true; 
     39    } 
    1640} 
    1741 
Note: See TracChangeset for help on using the changeset viewer.