Web Full Path Disclosure Array Parameter Injection Illegal
Web. Full Path Disclosure • Array[] Parameter Injection • Illegal Session Injection • Direct Access to files that requires preloaded library files
Arrays in html • В html с помощью формы можно оправить массив • <form method="post"> • <select multiple name="id[]"> • <option value="1">1</option> • <option value="2">2</option> • <option value="3">3</option> • </select> • <input type="submit" value="send"> • </form>
What happens on the server? • Результат для http: //test 1. ru/fullpath/? ololo[]=1&ololo[]=2&trololo=3&ololo[]=4 • Array ( • [ololo] => Array ( • [0] => 1 • [1] => 2 • [2] => 4 • ) • [trololo] => 3 • ) • Видно, что в массиве GET содержится массив ololo и переменная trololo
Disabled property • <form action="" method="get"> – – – <input type="text" name="a[]" value="123" /> <input type="text" name="a[]" value="1234" /> <input type="text" name="b" value="xzc" /> <input type="text" name="z" value="zzzz" disabled="true"/> <input type="submit"/> • </form> • <? php • echo '<pre>', print_r($_GET, true), '</pre>'; • //output • Array ( [a] => Array ( [0] => 123 [1] => 1234 ) [b] => xzc ) • Disabled fields not send to server
Where is the problem? • Пусть в коде сервера исполняется следующий код • <? php • $f = fopen($_GET['ololo'], "a"); • ? > • Результат исполнения: Warning: fopen() expects parameter 1 to be string, array given in Z: hometest 1. ruwwwfullpathindex. php on line 2
Illegal Session Injection • Null Session Cookie • В случае если сайт используется сессии, можно удалить значение для PHPSESSID например введя в строку браузера javascript: void(document. cookie="PHPSESSID="); • Это вызовет ошибку на стороне сервера • Warning: session_start() [function. session-start]: The session id contains illegal characters, valid characters are a-z, A-Z, 0 -9 and '-, ' in home/example/public_html/includes/functions. php on line 2
Illegal Session Injection • Invalid Session Cookie • Достаточно похожа на Null Session Injection, но вместо пустой сессии идентификатор заменяется на недопустимое значение • javascript: void(document. cookie='PHPSESSID=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'); • Warning: session_start(): The session id is too long or contains illegal characters, valid characters are a-z, A-Z, 0 -9 and '-, ' in /home/example/public_html/includes/functions. php on line 2
Direct Access to files that requires preloaded library files • • Рассмотрим пример. /include/shared. php: – function make. Ololo(){ echo 'ololo'; } • . /index. php – include_once('. /include/shared. php'); – include_once('. /Test. Class. php'); • . /Test. Class. php – class Test. Class { – public function Test. Class() { – make. Ololo(); – } – $test. Class = new Test. Class(); • • http: //test 1. ru/fullpath/index. php всё хорошо выведет ololo http: //test 1. ru/fullpath/Test. Class. php выведет ошибку Fatal error: Call to undefined function make. Ololo() in Z: hometest 1. ruwwwfullpathTest. Class. php on line 4
FPD Prevention • Нужно проверять передаваемые типы • Отключить отображение ошибок: – php. ini: display_errors = 'off‘ –. htaccess: php_flag display_errors off – PHP script: ini_set('display_errors', false);
Useful links • http: //hakipedia. com/index. php/Full_Path_Disclosur e • https: //www. owasp. org/index. php/Full_Path_Disclo sure • Потренироваться можно здесь http: //securityoverride. org/challenges/reconnaissan ce/ Challenge 4 Full Path Disclosure identification via Array, Challenge 5 Full Path Disclosure identification • И здесь http: //quest. darkbyte. ru/ , какой таск догадайтесь сами =)
- Slides: 18