Re: 'include' Considered Harmful

From: Date: Fri, 24 Jun 2005 20:51:47 +0000
Subject: Re: 'include' Considered Harmful
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-16898@lists.php.net to get a copy of this message
Why not simply disable allow_url_fopen on your server or servers? With it set off, you get these errors: Warning: main() [function.main]: URL file-access is disabled in the server configuration in .../test.php on line 3 Warning: main(http://www.google.com/) [function.main]: failed to open stream: no suitable wrapper could be found in .../test.php on line 3 Warning: main() [function.include]: Failed opening 'http://www.google.com/' for inclusion (include_path='.') in .../test.php on line 3 Now, yes, some scripts work better with that setting on, but it is *the* setting to disable if you're worried about naive programmers. You can even allow them to turn it back on with Apache's .htaccess. -[Unknown]
I believe that the 'include' operator is intrinsically harmful. As evidence I introduce three exhibits: Google for "php security flaw". The very first page you find will explain how a very common use of 'include' is insecure. As the second bit of evidence, I introduce the fact both of the naive php programmers working on my server introduced this security flaw in separate web pages. As the third bit of evidence, I point out that crackers have created security tools designed specifically to exploit this flaw.


« previous php.internals (#16898) next »