Open item4 opened 8 years ago
mod_php
public_html
config.php
define
register_global
extract
$HTTP_GET_VARS
$_GET
magic_quotes_gpc
stripslashes
addslashes
mysql_real_escape_string
'
--
mysql_
strip_html
htmlspecialchars
filter_input
base64_encode
md5
password_hash
password_verify
password_need_rehash
filter_var
session_start
session_register
$_SESSION
dir
(int)
basename
realpath
ereg
preg_match
copy
move_uploaded_file
md5(time())
random_bytes
include
require
" "
' '
==
!=
===
!==
<?
<?php
?>
eval
동적 include도 때에 따라서 굉장히 위험한데, 이것도 추가하는 건 어떨까요?
ex.
$page = $_GET['p']; include "pages/$page";
/?p=../../../../etc/passwd
@marnitto 상당히 뒷북이지만 #5 번 이슈로 다루겠습니다
이슈가 너무 길어서 쪼개야 할 것 같은데...
mod_php
가 꺼지는 등의 상황을 대비하기 위해 전체 소스를public_html
이 아닌 다른 곳에 보관 (#7)config.php
에서 설정값으로 상수 사용 (define
)register_global
기반의 변수 사용 철폐register_global
을 재현한다고extract
같은거 쓰지 말기$HTTP_GET_VARS
같은 옛날 변수 사용 철폐 ($_GET
)magic_quotes_gpc
의존 중단 (stripslashes
)addslashes
함수 사용하지 말기 (mysql_real_escape_string
)'
나--
같은 값 입력하지 못하게 하지 않기 (#8)mysql_
함수 시리즈 사용 중단. PDO로 전환strip_html
/htmlspecialchars
→filter_input
)base64_encode
(@lifthrasiir)md5
같은거 쓰지 않기 (password_hash
,password_verify
,password_need_rehash
)filter_var
)session_start
)session_register
함수 사용하지 않기 ($_SESSION
)dir
)(int)
)basename
,realpath
)ereg
시리즈 사용하지 않기 (preg_match
)copy
→move_uploaded_file
)md5(time())
같은거 쓰지 않기 (random_bytes
)include
대신require
사용" "
보다' '
사용==
,!=
대신===
,!==
사용 (#3)<?
대신<?php
사용?>
가급적 사용하지 않기eval
사용하지 않기 (#11)