2023-05-03 11:06:20 +02:00
== Why is this an issue?
2021-06-04 06:06:22 +02:00
``++file_uploads++`` is an on-by-default PHP configuration that allows files to be uploaded to your site. Since accepting [.line-through]#candy# files from strangers is inherently dangerous, this feature should be disabled unless it is absolutely necessary for your site.
2021-04-28 16:49:39 +02:00
This rule raises an issue when ``++file_uploads++`` is not explicitly disabled.
2021-04-28 18:08:03 +02:00
2023-05-03 11:06:20 +02:00
=== Noncompliant code example
2021-04-28 16:49:39 +02:00
2022-02-04 17:28:24 +01:00
[source,php]
2021-04-28 16:49:39 +02:00
----
; php.ini
file_uploads=1 ; Noncompliant
----
2021-04-28 18:08:03 +02:00
2023-05-03 11:06:20 +02:00
=== Compliant solution
2021-04-28 16:49:39 +02:00
2022-02-04 17:28:24 +01:00
[source,php]
2021-04-28 16:49:39 +02:00
----
; php.ini
file_uploads=0
----
2021-04-28 18:08:03 +02:00
2023-05-03 11:06:20 +02:00
== Resources
2021-04-28 16:49:39 +02:00
2022-07-08 13:58:56 +02:00
* https://owasp.org/www-project-top-ten/2017/A6_2017-Security_Misconfiguration[OWASP Top 10 2017 Category A6] - Security Misconfiguration
2022-04-07 08:53:59 -05:00
* https://cwe.mitre.org/data/definitions/434[MITRE, CWE-434] - Unrestricted Upload of File with Dangerous Type
2021-04-28 18:08:03 +02:00
2021-06-02 20:44:38 +02:00
2021-06-03 09:05:38 +02:00
ifdef::env-github,rspecator-view[]
2021-09-20 15:38:42 +02:00
'''
== Implementation Specification
(visible only on this page)
2023-05-25 14:18:12 +02:00
=== Message
* Explicitly disable "file_uploads".
* Update this configuration to disable "file_uploads".
2021-09-20 15:38:42 +02:00
2021-06-08 15:52:13 +02:00
'''
2021-06-02 20:44:38 +02:00
== Comments And Links
(visible only on this page)
2023-05-25 14:18:12 +02:00
=== on 1 Sep 2015, 06:41:40 Linda Martin wrote:
\[~ann.campbell.2] from the sentence "This rule raises an issue when file_uploads *is not explicitly disabled.*" I understand taht the rule it will not raise any issue if and only if the following line is present in the file: "file_uploads=*0*" is correct ?
I yes, maybe a compliant code snippet could be aded, WDYT ?
=== on 1 Sep 2015, 13:51:36 Ann Campbell wrote:
Of course you're right [~linda.martin]. Done.
=== on 1 Sep 2015, 14:44:55 Linda Martin wrote:
\[~ann.campbell.2] thanks ou! LGTM!
2021-06-03 09:05:38 +02:00
endif::env-github,rspecator-view[]