rspec/rules/S4507/xml/rule.adoc

70 lines
2.6 KiB
Plaintext
Raw Normal View History

2021-02-08 19:11:39 +01:00
In the application manifest element of an android application, setting ``https://developer.android.com/guide/topics/manifest/application-element#debug[debuggable]`` property to ``++true++`` could introduce a security risk.
2020-06-30 12:49:37 +02:00
2021-02-02 15:02:10 +01:00
2020-06-30 12:49:37 +02:00
It's more easy to perform reverse engineering and inject arbitrary code in the context of a debuggable application.
== Ask Yourself Whether
2021-01-27 13:42:22 +01:00
* the development of the app is completed and the ``++debuggable++`` property is set to _true_
* the app will be published on the Play Store or distributed in any other ways and the ``++debuggable++`` property is set to _true_
2020-06-30 12:49:37 +02:00
You are at risk if you answered yes to any of those questions.
== Recommended Secure Coding Practices
2021-02-16 11:54:08 +01:00
It is not recommended to release debuggable application. Avoid hardcoding the debug mode in the manifest because the build tool will add the property automatically and assign the correct value depending on the build type.
2020-06-30 12:49:37 +02:00
== Sensitive Code Example
2021-02-11 16:56:46 +01:00
In ``++AndroidManifest.xml++`` the android debuggable property is set to ``++true++``:
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 -->
----
== 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 -->
----
== See
* https://owasp.org/Top10/A05_2021-Security_Misconfiguration/[OWASP Top 10 2021 Category A5] - Security Misconfiguration
* 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
* https://owasp.org/www-project-mobile-top-10/2016-risks/m10-extraneous-functionality[OWASP Mobile Top 10 2016 Category M10] - Extraneous Functionality
* 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
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::../message.adoc[]
'''
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]