[quote name='Mura' date='Nov 16 2005, 08:25 PM']Anyway, I suppose this sort of begs the question... does anyone (glances in Johan's general direction :kitty: ) know about security risks in the method CodeGrrl used for dynamic includes?
<?php
include('header.inc');
include 'config.php'; // you can include the config file here once
if(!$_SERVER['QUERY_STRING']) {
?>
CONTENT
<?php
} elseif ($_SERVER['QUERY_STRING'] == "whatever") {
?>
CONTENT
<?php
} include('footer.inc');
?>
Could that be used to call external documents?[/quote]
Using the $_SERVER['QUERY_STRING'] method, at first glance, appears to be fine. (
PHP.net documentation of pre-defined variables, including the $_SERVER array). The important bit is what the programmer
does with that information. It is up to the programmer to, for example, check the 'QUERY_STRING' variable and make sure (1) the file exists, (2) the file is in the proper context (i.e. local vs. remote, basically not something the web server should not be accessing). THAT is where 99% of all vulnerabilities come from - programmers who do not check data the program receives. Never, ever trust your users to provide the right data. 99% of them will, but there will be that 1% who will input incorrect data because (1) they made a mistake, or (2) they're trying to break your program.
Hmmm... Sasha has taken the scripts offline due to other security risks. For the moment at least.
....
And for the record (just in case), my intention isn't to attack CodeGrrl... I love the site and the tutorials. I think we all understand that sometimes things like this just happen.
[post=\"116422\"]<{POST_SNAPBACK}>[/post]
I am encouraged that they took the scripts off-line while they fix them. Though to be honest I am troubled by the statement "We are unsure at the moment where these issues lie and how to fix them[...]". I also do not intend to attack CodeGrrl. Tutorials and open source are a wonderful way for people to learn new methods, techniques, tools, especially since php.net is better as a dictionary and not very well suited to learning the language. However it is starting to appear to me (and this is all my opinion) that the programmers there haven't quite grasped the full understanding of how powerful PHP is, and why any implementation needs to be locked down tighter than a snare drum.