Quote:
Originally Posted by chrishirst
Correct, but what if the end user need more than a page called 'test'
While your code will work for one instance and will need editing and extending to cover each page that is added.
Code that will block potentially malicious includes (anything external) while checking that a local page exists with that name will make the code flexible and extendable.
|
Correct. but doing that will make another vulnerability in the code.
1- Limiting it to just local files doesn't mean it is 100% safe because it can be used to view protected files or non php files. like perl or cgi which will show the code directly if included in php file ex: include '/home/username/public_html/perlcode.cgi'
2- another thing is if $_GET['id'] for example equals '/secured-zone/secured-data.txt' assuming secured-data.txt file has important users information like passwords or even login information to some services in the server itself. doing checks if file is local only will not detect such an attack and will result in the server getting hacked.
3- can be used to execute uploaded files like uploading a file using some other upload form in the same site/server. doing so place that file in /tmp directory or /home/username/tmp. that file can be remain undeleted if not handled properly by the uploader script.
anyway having such a bug with allowing included using $_GET['id'] as an argument for the file can allow the intruder to upload a file and execute it on the server.
That are only 3 vulnerabilities that I thought of while replying you but I think there are more to mention.
Flexibility & Extendability are a good thing to do but making sure the script secured is much more important, I think.
Last edited by nayes84; 05-18-2010 at 01:26 PM..
|