rspec/rules/S3334/php/rule.adoc

30 lines
1.1 KiB
Plaintext
Raw Normal View History

2021-04-28 16:49:39 +02:00
``++allow_url_fopen++`` and ``++allow_url_include++`` allow code to be read into a script from URL's. The ability to suck in executable code from outside your site, coupled with imperfect input cleansing could lay your site bare to attackers. Even if your input filtering is perfect today, are you prepared to bet your site that it will always be perfect in the future?
This rule raises an issue when either property is explicitly enabled in _php.ini_ and when ``++allow_url_fopen++``, which defaults to enabled, is not explicitly disabled.
2021-04-28 16:49:39 +02:00
== Noncompliant Code Example
----
; php.ini Noncompliant; allow_url_fopen not explicitly disabled
allow_url_include=1 ; Noncompliant
----
2021-04-28 16:49:39 +02:00
== Compliant Solution
----
; php.ini
allow_url_fopen=0
allow_url_include=0
----
2021-04-28 16:49:39 +02:00
== See
* https://www.owasp.org/index.php/Top_10-2017_A1-Injection[OWASP Top 10 2017 Category A1] - Injection
* https://cwe.mitre.org/data/definitions/829.html[MITRE, CWE-829] - Inclusion of Functionality from Untrusted Control Sphere
* https://www.sans.org/top25-software-errors/#cat2[SANS Top 25] - Risky Resource Management