Skip to content

Commit

Permalink
pht 파일 업로드 취약점 수정 adm1nkyj(김용진, http://adm1nkyj.kr) 님 제보
Browse files Browse the repository at this point in the history
  • Loading branch information
thisgun committed Dec 8, 2017
1 parent 82279c3 commit 6635841
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion bbs/qawrite_update.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@
$upload[$i]['filesize'] = $filesize;

// 아래의 문자열이 들어간 파일은 -x 를 붙여서 웹경로를 알더라도 실행을 하지 못하도록 함
$filename = preg_replace("/\.(php|phtm|htm|cgi|pl|exe|jsp|asp|inc)/i", "$0-x", $filename);
$filename = preg_replace("/\.(php|pht|phtm|htm|cgi|pl|exe|jsp|asp|inc)/i", "$0-x", $filename);

shuffle($chars_array);
$shuffle = implode('', $chars_array);
Expand Down
2 changes: 1 addition & 1 deletion bbs/write_update.php
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@
$upload[$i]['filesize'] = $filesize;

// 아래의 문자열이 들어간 파일은 -x 를 붙여서 웹경로를 알더라도 실행을 하지 못하도록 함
$filename = preg_replace("/\.(php|phtm|htm|cgi|pl|exe|jsp|asp|inc)/i", "$0-x", $filename);
$filename = preg_replace("/\.(php|pht|phtm|htm|cgi|pl|exe|jsp|asp|inc)/i", "$0-x", $filename);

shuffle($chars_array);
$shuffle = implode('', $chars_array);
Expand Down
2 changes: 1 addition & 1 deletion install/install_db.php
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ function safe_install_string_check( $str ) {
// data 디렉토리 및 하위 디렉토리에서는 .htaccess .htpasswd .php .phtml .html .htm .inc .cgi .pl 파일을 실행할수 없게함.
$f = fopen($data_path.'/.htaccess', 'w');
$str = <<<EOD
<FilesMatch "\.(htaccess|htpasswd|[Pp][Hh][Pp]|[Pp]?[Hh][Tt][Mm][Ll]?|[Ii][Nn][Cc]|[Cc][Gg][Ii]|[Pp][Ll])">
<FilesMatch "\.(htaccess|htpasswd|[Pp][Hh][Pp]|[Pp][Hh][Tt]|[Pp]?[Hh][Tt][Mm][Ll]?|[Ii][Nn][Cc]|[Cc][Gg][Ii]|[Pp][Ll])">
Order allow,deny
Deny from all
</FilesMatch>
Expand Down

0 comments on commit 6635841

Please sign in to comment.