./ ../ $_GET['pathname'], , . , realpath ( .. . "" ), strpos (, ) , , /files/ ,
/site/my_stuf/secretfile.txt /files/
( "", "secretfile.txt" ( ) dir, ... , , , - ... , , , , )
, , ../ GET; , files, files/ , , ../, ?
I donโt know if this is all paranoid (or a better solution exists), but I used a similar approach for url-based directory / files, which allows โdirectโ access to my siteโs subdirectory, and I certainly wanted to be sure that there was no way to escape from this directory.
source
share