Recently I was reading an article about file_get_contents
and HTTPS.
One part that caught my attention is:
Of course, the allow_url_fopen setting also carries a separate risk of enabling Remote File Execution, Access Control Bypass or Information Disclosure attacks. If an attacker can inject a remote URI of their choosing into a file function they could manipulate an application into executing, storing or displaying the fetched file including those from any untrusted remote source. Itβs also worth bearing in mind that such file fetches would originate from localhost and thus be capable of bypassing access controls based on local server restrictions. As such, while allow_url_fopen is enabled by default, you should disable it without hesitation to maximise security.
I have 2 questions:
- What can an attacker do with
allow_url_fopen
and how he would do it? - Is
allow_url_fopen
always a security risk or only when you accept user input in fopen wrapper?
Other interesting links