Preventing RFI Attacks With the PHP Function StreamWrapperRestore
The php function stream_wrapper_restore is used to restore the original functionality of the PHP built-in HTTP wrapper. This includes removing the NTLM authentication code and restoring the security barriers that were removed when the web developer took precautions against RFI attacks.
If you are a web developer, it is likely that the developers on your site have started taking precautions against RFI attacks and have blacklisted certain system level commands like system and cmd from being used in input parameters. But even though these barriers have been put in place, it is still possible to get the information that is needed to execute the command. The problem is that if the attacker is able to send a text file to your server it may contain the html element
In order to do this the attacker will use a file called phpinfo.txt and include it in a POST Request. This will be redirected to the server and the phpinfo will execute as part of the web page. This will allow the attacker to gain access to information about the webserver including usernames, passwords and other data that can be used in an attack.
In order to prevent this you can take the following steps. First, you will need to create a class that implements the stream functions for a specific protocol (HTTP in this case). This class should override all of the stream functions except fclose(). This class should also implement the basic functions require to make it work with the SOAPClient Object.