2023-02-07 15:04:20 +01:00
Development tools and frameworks usually have options to make debugging easier for developers. Although these features are useful during development, they should never be enabled for applications deployed in production.
2020-06-30 12:49:37 +02:00
2023-07-04 18:38:07 +02:00
Activating a development feature in production can have an important range of consequences depending on its use:
2021-02-02 15:02:10 +01:00
2023-07-04 18:38:07 +02:00
* Technical information leak; generally by disclosing verbose logging information to the application's user.
* Arbitrary code execution; generally with a parameter that will allow the remote debugging or profiling of the application.
2023-02-07 15:04:20 +01:00
2023-07-04 18:38:07 +02:00
In all cases, the attack surface of an affected application is increased. In some cases, such features can also make the exploitation of other unrelated vulnerabilities easier.
2020-06-30 12:49:37 +02:00
== Ask Yourself Whether
2023-07-04 18:38:07 +02:00
* The development of the app is completed and the development feature is activated.
2023-10-30 10:33:56 +01:00
* The app is distributed to end users with the development feature activated
2020-06-30 12:49:37 +02:00
2023-02-07 15:04:20 +01:00
There is a risk if you answered yes to any of those questions.
2020-06-30 12:49:37 +02:00
== Recommended Secure Coding Practices
2023-07-04 18:38:07 +02:00
Applications should be released without any development feature activated. When such features are required when in
the development process of the application, they should only apply to a build variant that is dedicated to
development environments. That variant should not be set as the default build configuration to prevent any unattended development feature exposition.
2020-06-30 12:49:37 +02:00
== Sensitive Code Example
2023-07-04 18:38:07 +02:00
In ``++AndroidManifest.xml++`` the android debuggable property is set to ``++true++``. The application will therefore be debuggable.
2020-06-30 14:49:38 +02:00
2023-01-09 15:29:41 +01:00
[source,xml]
2020-06-30 12:49:37 +02:00
----
<application
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:debuggable="true"
android:theme="@style/AppTheme">
</application> <!-- Sensitive -->
----
2023-07-04 18:38:07 +02:00
In a `web.config` file, the `customErrors` element's `mode` attribute is set to `Off`. The application will disclose unnecessarily verbose information to its users upon error.
[source,xml]
----
<configuration>
<system.web>
<customErrors mode="Off" /> <!-- Sensitive -->
</system.web>
</configuration>
----
2020-06-30 12:49:37 +02:00
== Compliant Solution
2021-02-11 16:56:46 +01:00
In ``++AndroidManifest.xml++`` the android debuggable property is set to ``++false++``:
2022-02-04 17:28:24 +01:00
[source,xml]
2020-06-30 12:49:37 +02:00
----
<application
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:debuggable="false"
android:theme="@style/AppTheme">
</application> <!-- Compliant -->
----
2023-07-04 18:38:07 +02:00
In a `web.config` file, the `customErrors` element's `mode` attribute is set to `On`:
[source,xml]
----
<configuration>
<system.web>
<customErrors mode="On" /> <!-- Compliant -->
</system.web>
</configuration>
----
2020-06-30 12:49:37 +02:00
== See
2021-11-01 15:00:32 +01:00
* https://owasp.org/Top10/A05_2021-Security_Misconfiguration/[OWASP Top 10 2021 Category A5] - Security Misconfiguration
2021-06-10 10:04:10 +02:00
* https://mobile-security.gitbook.io/masvs/security-requirements/0x12-v7-code_quality_and_build_setting_requirements[Mobile AppSec Verification Standard] - Code Quality and Build Setting Requirements
2022-07-08 13:58:56 +02:00
* https://owasp.org/www-project-mobile-top-10/2016-risks/m10-extraneous-functionality[OWASP Mobile Top 10 2016 Category M10] - Extraneous Functionality
2022-04-07 08:53:59 -05:00
* https://cwe.mitre.org/data/definitions/215[MITRE, CWE-215] - Information Exposure Through Debug Information
2020-06-30 12:49:37 +02:00
* https://developer.android.com/studio/publish/preparing[developer.android.com] - Prepare for release
2023-07-04 18:38:07 +02:00
* https://learn.microsoft.com/en-us/aspnet/web-forms/overview/getting-started/getting-started-with-aspnet-45-web-forms/aspnet-error-handling[learn.microsoft.com] - ASP.NET Error Handling
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)
include::../message.adoc[]
2021-06-08 15:52:13 +02:00
'''
2021-06-02 20:44:38 +02:00
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
2023-06-22 10:38:01 +02:00
2021-06-03 09:05:38 +02:00
endif::env-github,rspecator-view[]