Tag Archives: Remote

allow_url_include

The PHP option allow_url_include normally allows a programmer to include() a remote file (as PHP code) using a URL rather than a local file path. For security reasons, this feature should be disabled. If a script claims to require this feature, you should look into alternative software, as the use of this feature indicates serious design flaws.

There are a number of reasons why URL includes should always be avoided:

It’s insecure – if your application can be tricked into including content from a URL outside itself (and there are a number of common ways this can happen), an attacker can force your application to start running code from their own web site.

It’s inefficient – if your PHP script includes content from a URL, then the web server must make HTTP requests to generate the page. This makes your page load much slower than necessary, especially if the site you’re loading content from is responding slowly.

It’s unreliable, for the same reasons – if the web server you are loading content from occasionally fails to respond, your web site also sometimes fails to load properly.

It’s usually unnecessary – in most cases, allow_url_include can be avoided either by including the content directly (if it is being loaded from a domain you host) or by loading and printing the content without evaluating it as PHP.

Remote Code Injection

Remote code injections attempt to run the attacker’s code on a server, often by exploiting the functionality of the include or require functions.

The eval(), exec(), system(), and shell_exec() functions are vulnerable to remote code injections.

Include / Require attacks occur when including and executing files (possible from remote servers and includes remote code execution)

Counter Measures

• Check data against a whitelist

• Remove paths using basename()

• Set allow_url_include = off in php.ini that helps somewhat but not sufficient, as some attack vectors remain open