Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. Web-development
  3. Question
Web-development

How is PHP allow_url_fopen risky?

Asked by Naina Pandey Oct 17, 2022 1.8K views 1 answer
Share

About this question

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 want to know What an attacker can do with allow_url_fopen and how would he do it?

Is allow_url_fopen always a security risk or only when you accept user input in the fopen wrapper?

Your answer

1 Answer

More Web-development discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest from the JanBask Blog

Guides, tips and career advice from JanBask experts.