
06.07.2011, 16:44
|
|
Участник форума
Регистрация: 07.03.2008
Сообщений: 141
С нами:
9567396
Репутация:
23
|
|
PHPLIVE 3.2.2
Есть доступ к админке, но сделана она параноиком, фильтруется там все, что можно.
Есть два интересных момента.
Первый:
PHP код:
[COLOR="#000000"][COLOR="#0000BB"][/COLOR][COLOR="#007700"]if ([/COLOR][COLOR="#0000BB"]$action[/COLOR][COLOR="#007700"]==[/COLOR][COLOR="#DD0000"]"upload_logo"[/COLOR][COLOR="#007700"])
{
[/COLOR][COLOR="#0000BB"]$pic_name[/COLOR][COLOR="#007700"]=[/COLOR][COLOR="#0000BB"]$_FILES[/COLOR][COLOR="#007700"][[/COLOR][COLOR="#DD0000"]'pic'[/COLOR][COLOR="#007700"]][[/COLOR][COLOR="#DD0000"]'name'[/COLOR][COLOR="#007700"]] ;
[/COLOR][COLOR="#0000BB"]$now[/COLOR][COLOR="#007700"]=[/COLOR][COLOR="#0000BB"]time[/COLOR][COLOR="#007700"]() ;
[/COLOR][COLOR="#0000BB"]$filename[/COLOR][COLOR="#007700"]=[/COLOR][COLOR="#0000BB"]eregi_replace[/COLOR][COLOR="#007700"]([/COLOR][COLOR="#DD0000"]" "[/COLOR][COLOR="#007700"],[/COLOR][COLOR="#DD0000"]"_"[/COLOR][COLOR="#007700"],[/COLOR][COLOR="#0000BB"]$pic_name[/COLOR][COLOR="#007700"]) ;
[/COLOR][COLOR="#0000BB"]$filename[/COLOR][COLOR="#007700"]=[/COLOR][COLOR="#0000BB"]eregi_replace[/COLOR][COLOR="#007700"]([/COLOR][COLOR="#DD0000"]"%20"[/COLOR][COLOR="#007700"],[/COLOR][COLOR="#DD0000"]"_"[/COLOR][COLOR="#007700"],[/COLOR][COLOR="#0000BB"]$filename[/COLOR][COLOR="#007700"]) ;
[/COLOR][COLOR="#0000BB"]$filesize[/COLOR][COLOR="#007700"]=[/COLOR][COLOR="#0000BB"]$_FILES[/COLOR][COLOR="#007700"][[/COLOR][COLOR="#DD0000"]'pic'[/COLOR][COLOR="#007700"]][[/COLOR][COLOR="#DD0000"]'size'[/COLOR][COLOR="#007700"]] ;
[/COLOR][COLOR="#0000BB"]$filetype[/COLOR][COLOR="#007700"]=[/COLOR][COLOR="#0000BB"]$_FILES[/COLOR][COLOR="#007700"][[/COLOR][COLOR="#DD0000"]'pic'[/COLOR][COLOR="#007700"]][[/COLOR][COLOR="#DD0000"]'type'[/COLOR][COLOR="#007700"]] ;
if ([/COLOR][COLOR="#0000BB"]eregi[/COLOR][COLOR="#007700"]([/COLOR][COLOR="#DD0000"]"gif"[/COLOR][COLOR="#007700"],[/COLOR][COLOR="#0000BB"]$filetype[/COLOR][COLOR="#007700"]) )
[/COLOR][COLOR="#0000BB"]$extension[/COLOR][COLOR="#007700"]=[/COLOR][COLOR="#DD0000"]"GIF"[/COLOR][COLOR="#007700"];
elseif ([/COLOR][COLOR="#0000BB"]eregi[/COLOR][COLOR="#007700"]([/COLOR][COLOR="#DD0000"]"jpeg"[/COLOR][COLOR="#007700"],[/COLOR][COLOR="#0000BB"]$filetype[/COLOR][COLOR="#007700"]) )
[/COLOR][COLOR="#0000BB"]$extension[/COLOR][COLOR="#007700"]=[/COLOR][COLOR="#DD0000"]"JPEG"[/COLOR][COLOR="#007700"];
[/COLOR][COLOR="#0000BB"]$filename[/COLOR][COLOR="#007700"]=[/COLOR][COLOR="#0000BB"]$_POST[/COLOR][COLOR="#007700"][[/COLOR][COLOR="#DD0000"]'logo_name'[/COLOR][COLOR="#007700"]].[/COLOR][COLOR="#DD0000"]"_[/COLOR][COLOR="#0000BB"]$now[/COLOR][COLOR="#DD0000"].[/COLOR][COLOR="#0000BB"]$extension[/COLOR][COLOR="#DD0000"]"[/COLOR][COLOR="#007700"];
if ([/COLOR][COLOR="#0000BB"]eregi[/COLOR][COLOR="#007700"]([/COLOR][COLOR="#DD0000"]"gif"[/COLOR][COLOR="#007700"],[/COLOR][COLOR="#0000BB"]$filetype[/COLOR][COLOR="#007700"]) ||[/COLOR][COLOR="#0000BB"]eregi[/COLOR][COLOR="#007700"]([/COLOR][COLOR="#DD0000"]"jpeg"[/COLOR][COLOR="#007700"],[/COLOR][COLOR="#0000BB"]$filetype[/COLOR][COLOR="#007700"]) )
{
if([/COLOR][COLOR="#0000BB"]move_uploaded_file[/COLOR][COLOR="#007700"]([/COLOR][COLOR="#0000BB"]$_FILES[/COLOR][COLOR="#007700"][[/COLOR][COLOR="#DD0000"]'pic'[/COLOR][COLOR="#007700"]][[/COLOR][COLOR="#DD0000"]'tmp_name'[/COLOR][COLOR="#007700"]],[/COLOR][COLOR="#DD0000"]"../web/[/COLOR][COLOR="#0000BB"]$session_setup[/COLOR][COLOR="#007700"][[/COLOR][COLOR="#0000BB"]login[/COLOR][COLOR="#007700"]][/COLOR][COLOR="#DD0000"]/[/COLOR][COLOR="#0000BB"]$filename[/COLOR][COLOR="#DD0000"]"[/COLOR][COLOR="#007700"]) )
{
[/COLOR][COLOR="#0000BB"]chmod[/COLOR][COLOR="#007700"]([/COLOR][COLOR="#DD0000"]"../web/[/COLOR][COLOR="#0000BB"]$session_setup[/COLOR][COLOR="#007700"][[/COLOR][COLOR="#0000BB"]login[/COLOR][COLOR="#007700"]][/COLOR][COLOR="#DD0000"]/[/COLOR][COLOR="#0000BB"]$filename[/COLOR][COLOR="#DD0000"]"[/COLOR][COLOR="#007700"],[/COLOR][COLOR="#0000BB"]0777[/COLOR][COLOR="#007700"]) ;
if ([/COLOR][COLOR="#0000BB"]$_POST[/COLOR][COLOR="#007700"][[/COLOR][COLOR="#DD0000"]'logo_name'[/COLOR][COLOR="#007700"]] ==[/COLOR][COLOR="#DD0000"]"LOGO"[/COLOR][COLOR="#007700"])
{
if ([/COLOR][COLOR="#0000BB"]file_exists[/COLOR][COLOR="#007700"]([/COLOR][COLOR="#DD0000"]"../web/[/COLOR][COLOR="#0000BB"]$session_setup[/COLOR][COLOR="#007700"][[/COLOR][COLOR="#0000BB"]login[/COLOR][COLOR="#007700"]][/COLOR][COLOR="#DD0000"]/[/COLOR][COLOR="#0000BB"]$LOGO[/COLOR][COLOR="#DD0000"]"[/COLOR][COLOR="#007700"]) &&[/COLOR][COLOR="#0000BB"]$LOGO[/COLOR][COLOR="#007700"])
[/COLOR][COLOR="#0000BB"]unlink[/COLOR][COLOR="#007700"]([/COLOR][COLOR="#DD0000"]"../web/[/COLOR][COLOR="#0000BB"]$session_setup[/COLOR][COLOR="#007700"][[/COLOR][COLOR="#0000BB"]login[/COLOR][COLOR="#007700"]][/COLOR][COLOR="#DD0000"]/[/COLOR][COLOR="#0000BB"]$LOGO[/COLOR][COLOR="#DD0000"]"[/COLOR][COLOR="#007700"]) ;
[/COLOR][COLOR="#0000BB"]$LOGO[/COLOR][COLOR="#007700"]=[/COLOR][COLOR="#0000BB"]$filename[/COLOR][COLOR="#007700"];
}
[/COLOR][/COLOR]
Не вижу вариантов обхода фильтра...
Второй ($COMPANY_NAME задается пользователем):
PHP код:
[COLOR="#000000"][COLOR="#0000BB"][/COLOR][COLOR="#007700"]function[/COLOR][COLOR="#0000BB"]Util_Format_CleanVariable[/COLOR][COLOR="#007700"]([/COLOR][COLOR="#0000BB"]$string[/COLOR][COLOR="#007700"])
{
[/COLOR][COLOR="#FF8000"]// take out common malicious characters that are
// typically NOT used on standard inputs
[/COLOR][COLOR="#0000BB"]$string[/COLOR][COLOR="#007700"]=[/COLOR][COLOR="#0000BB"]preg_replace[/COLOR][COLOR="#007700"]([/COLOR][COLOR="#DD0000"]"/[$#;?]|(eval\()|(eval +\()|(char\()|(char +\()|(exec\()|(exec +\()/i"[/COLOR][COLOR="#007700"],[/COLOR][COLOR="#DD0000"]""[/COLOR][COLOR="#007700"],[/COLOR][COLOR="#0000BB"]trim[/COLOR][COLOR="#007700"]([/COLOR][COLOR="#0000BB"]rtrim[/COLOR][COLOR="#007700"]([/COLOR][COLOR="#0000BB"]$string[/COLOR][COLOR="#007700"]) ) ) ;
return[/COLOR][COLOR="#0000BB"]$string[/COLOR][COLOR="#007700"];
}
[/COLOR][COLOR="#0000BB"]$COMPANY_NAME[/COLOR][COLOR="#007700"]=[/COLOR][COLOR="#0000BB"]addslashes[/COLOR][COLOR="#007700"]([/COLOR][COLOR="#0000BB"]Util_Format_CleanVariable[/COLOR][COLOR="#007700"]([/COLOR][COLOR="#0000BB"]$COMPANY_NAME[/COLOR][COLOR="#007700"]) ) ;
[/COLOR][COLOR="#0000BB"]$conf_string[/COLOR][COLOR="#007700"]=[/COLOR][COLOR="#DD0000"]"0LEFT_ARROW0?php
\$LOGO = '[/COLOR][COLOR="#0000BB"]$LOGO[/COLOR][COLOR="#DD0000"]' ;
\$COMPANY_NAME = '[/COLOR][COLOR="#0000BB"]$COMPANY_NAME[/COLOR][COLOR="#DD0000"]' ;
\$SUPPORT_LOGO_ONLINE = '[/COLOR][COLOR="#0000BB"]$SUPPORT_LOGO_ONLINE[/COLOR][COLOR="#DD0000"]' ;
\$SUPPORT_LOGO_OFFLINE = '[/COLOR][COLOR="#0000BB"]$SUPPORT_LOGO_OFFLINE[/COLOR][COLOR="#DD0000"]' ;
\$SUPPORT_LOGO_AWAY = '[/COLOR][COLOR="#0000BB"]$SUPPORT_LOGO_AWAY[/COLOR][COLOR="#DD0000"]' ;
\$VISITOR_FOOTPRINT = '[/COLOR][COLOR="#0000BB"]$VISITOR_FOOTPRINT[/COLOR][COLOR="#DD0000"]' ;
\$THEME = '[/COLOR][COLOR="#0000BB"]$THEME[/COLOR][COLOR="#DD0000"]' ;
\$POLL_TIME = '[/COLOR][COLOR="#0000BB"]$POLL_TIME[/COLOR][COLOR="#DD0000"]' ;
\$INITIATE = '[/COLOR][COLOR="#0000BB"]$INITIATE[/COLOR][COLOR="#DD0000"]' ;
\$INITIATE_IMAGE = '[/COLOR][COLOR="#0000BB"]$INITIATE_IMAGE[/COLOR][COLOR="#DD0000"]' ;
\$IPNOTRACK = '[/COLOR][COLOR="#0000BB"]$IPNOTRACK[/COLOR][COLOR="#DD0000"]' ;
\$LANG_PACK = '[/COLOR][COLOR="#0000BB"]$LANG_PACK[/COLOR][COLOR="#DD0000"]' ;?0RIGHT_ARROW0"[/COLOR][COLOR="#007700"];
[/COLOR][COLOR="#0000BB"]$conf_string[/COLOR][COLOR="#007700"]=[/COLOR][COLOR="#0000BB"]preg_replace[/COLOR][COLOR="#007700"]([/COLOR][COLOR="#DD0000"]"/0LEFT_ARROW0/"[/COLOR][COLOR="#007700"],[/COLOR][COLOR="#DD0000"]""[/COLOR][COLOR="#007700"],[/COLOR][COLOR="#0000BB"]$conf_string[/COLOR][COLOR="#007700"]) ;
[/COLOR][COLOR="#0000BB"]$fp[/COLOR][COLOR="#007700"]=[/COLOR][COLOR="#0000BB"]fopen[/COLOR][COLOR="#007700"]([/COLOR][COLOR="#DD0000"]"../web/[/COLOR][COLOR="#0000BB"]$session_setup[/COLOR][COLOR="#007700"][[/COLOR][COLOR="#0000BB"]login[/COLOR][COLOR="#007700"]][/COLOR][COLOR="#DD0000"]/[/COLOR][COLOR="#0000BB"]$session_setup[/COLOR][COLOR="#007700"][[/COLOR][COLOR="#0000BB"]login[/COLOR][COLOR="#007700"]][/COLOR][COLOR="#DD0000"]-conf-init.php"[/COLOR][COLOR="#007700"],[/COLOR][COLOR="#DD0000"]"wb+"[/COLOR][COLOR="#007700"]) ;
[/COLOR][COLOR="#0000BB"]fwrite[/COLOR][COLOR="#007700"]([/COLOR][COLOR="#0000BB"]$fp[/COLOR][COLOR="#007700"],[/COLOR][COLOR="#0000BB"]$conf_string[/COLOR][COLOR="#007700"],[/COLOR][COLOR="#0000BB"]strlen[/COLOR][COLOR="#007700"]([/COLOR][COLOR="#0000BB"]$conf_string[/COLOR][COLOR="#007700"]) ) ;
[/COLOR][COLOR="#0000BB"]fclose[/COLOR][COLOR="#007700"]([/COLOR][COLOR="#0000BB"]$fp[/COLOR][COLOR="#007700"]) ;
[/COLOR][/COLOR]
eval просто заменяется на альтернативу, а вот что делать с экранированием кавычек, ";" и т.д.? Безнадежный случай?
|
|
|