
06.07.2011, 17:09
|
|
Новичок
Регистрация: 15.05.2010
Сообщений: 0
С нами:
8417113
Репутация:
0
|
|
Сообщение от Nek1t
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]
Не вижу вариантов обхода фильтра...
В переменную $_FILES['pic']['type'] подставляем слово JPEG (MIME-Тип(Tamper Data)).
В переменную $_POST['logo_name'] пишем название шелла(shell.php) Заполняя конец NUL-байтом.
Ну и если в папке разрешено выполнение PHP скироптов(php3, php4, php5, php, phtml...), в теории мы должны получить шелл.
Во втором случае, если бы параметр не обрамлялся одинарными кавычками, возможно было бы использовать обратные кавычки.
|
|
|