I'm performing a static analisysanalysis on a PHP code and came across with this situation:
include_once SYSTEM_PATH . 'languages/content-' . $_COOKIE ['lang'] . '.php';
If I try to hack with this HTTP request:
GET /en-us HTTP/1.1
Host: xxxx.com
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:32.0) Gecko/20100101 Firefox/32.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: pt-BR,pt;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Cookie: xxx=eng.php/../../../anotherfile
Connection: keep-alive
The response is this:
ErrorException:
include_once(/export/htdocs/xxxx.com/base/languages/content-eng.php/../../../anotherfile.php): failed to open stream: No such file or directory
The file languages/content-eng.php
exists on the server.
The file languages/../../../anotherfile.php
exists on the server too (I have acessaccess to the file system).
Is there any way to exploit this vulnerability through lang
cookie?