CVE-2023-4435: Improper Input Validation (CWE-20)
value: Improper Input Validation in GitHub repository hamza417/inure prior to build88.
CWE description: The product receives input or data, but it does
        not validate or incorrectly validates that the input has the
        properties that are required to process the data safely and
        correctly.
CVSS v3 base score: 5.5
Published: 2023-08-20T01:15Z
Repository: https://github.com/hamza417/inure
Language: Kotlin
Files changed: SECURITY.md, app/src/main/AndroidManifest.xml, app/src/main/assets/html/changelogs.html, app/src/main/java/app/simple/inure/activities/association/BashAssociation.kt, app/src/main/java/app/simple/inure/ui/preferences/subscreens/ComponentManager.kt
Commit date: 2023-08-15 20:25:21 +0530
Commit message: Build88

  - Fixed SH file exploit

Diff: diff --git a/SECURITY.md b/SECURITY.md
index 347fbcf2..9e67f582 100644
--- a/SECURITY.md
+++ b/SECURITY.md
@@ -9,20 +9,25 @@ If you believe you've discovered a security vulnerability in this project, I enc
 you to report it to me confidentially. To report a security vulnerability, please follow these steps:
 
 1. **Do Not Disclose Publicly:** Please do not share potential vulnerabilities publicly until I have
 had a chance to address them.
 
-2. **Email Notification:** Send an email to [Hamza Rizwan](mailto:hamzarizwan243@gmail.com) describing 
-the potential vulnerability. Please include the following details in your report:
+2. **Email Notification:** Send an email to [Hamza Rizwan](mailto:hamzarizwan243@gmail.com)
+   describing
+   the potential vulnerability. Please include the following details in your report:
 
     - Description of the vulnerability and the potential impact.
     - Steps to reproduce the vulnerability.
     - Any relevant technical details that could assist in reproducing or understanding the issue.
 
-3. **Wait for Response:** You should receive an acknowledgment of your report within a few hours. I will work with you to understand and verify the issue.
+3. **Wait for Response:** You should receive an acknowledgment of your report within a few hours. I
+   will work
+   with you to understand and verify the issue.
 
-4. **Cooperation:** I appreciate your cooperation in keeping the details of the vulnerability confidential until we've resolved the issue.
+4. **Cooperation:** I appreciate your cooperation in keeping the details of the vulnerability
+   confidential
+   until we've resolved the issue.
 
 ## Responsible Disclosure Guidelines
 
 I kindly request that security researchers:
 
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index e3fce81d..b6137548 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -526,10 +526,11 @@
         <activity
             android:name=".activities.association.BashAssociation"
             android:exported="true"
             android:icon="@mipmap/ic_terminal"
             android:label="@string/execute"
+            android:enabled="false"
             android:launchMode="singleTask"
             android:roundIcon="@mipmap/ic_terminal_round">
             <intent-filter>
                 <action android:name="android.intent.action.VIEW" />
 
diff --git a/app/src/main/assets/html/changelogs.html b/app/src/main/assets/html/changelogs.html
index 2c8f6529..0ab13598 100644
--- a/app/src/main/assets/html/changelogs.html
+++ b/app/src/main/assets/html/changelogs.html
@@ -57,10 +57,13 @@
 <h4>Security</h4>
 
 <ul>
     <li>Fixed a few issues with unlocker detection.</li>
     <li>Internal code protection.</li>
+    <li>Disabled support for execute as Android default FS model doesn't allow efficient file
+        parsing and using this also poses a major security risk.
+    </li>
 </ul>
 
 <br>
 <br>
 <div class="wrap-collapsible">
diff --git a/app/src/main/java/app/simple/inure/activities/association/BashAssociation.kt b/app/src/main/java/app/simple/inure/activities/association/BashAssociation.kt
index 869823ab..2dc5a6cf 100644
--- a/app/src/main/java/app/simple/inure/activities/association/BashAssociation.kt
+++ b/app/src/main/java/app/simple/inure/activities/association/BashAssociation.kt
@@ -11,10 +11,15 @@ import java.io.File
 class BashAssociation : BaseActivity() {
 
     override fun onCreate(savedInstanceState: Bundle?) {
         super.onCreate(savedInstanceState)
 
+        showWarning("ERR: This is not supported anymore, kindly use the terminal app to run scripts")
+
+        return
+
+        @Suppress("UNREACHABLE_CODE")
         intent.data?.let {
             contentResolver.openInputStream(it)?.use { inputStream ->
                 val file = File(applicationContext.cacheDir?.path + "/" + DocumentFile.fromSingleUri(applicationContext, it)!!.name)
                 file.outputStream().use { outputStream ->
                     inputStream.copyTo(outputStream)
diff --git a/app/src/main/java/app/simple/inure/ui/preferences/subscreens/ComponentManager.kt b/app/src/main/java/app/simple/inure/ui/preferences/subscreens/ComponentManager.kt
index a88eb2c9..7e8bef23 100644
--- a/app/src/main/java/app/simple/inure/ui/preferences/subscreens/ComponentManager.kt
+++ b/app/src/main/java/app/simple/inure/ui/preferences/subscreens/ComponentManager.kt
@@ -7,11 +7,10 @@ import android.view.ViewGroup
 import androidx.lifecycle.lifecycleScope
 import app.simple.inure.R
 import app.simple.inure.activities.association.ApkInstallerActivity
 import app.simple.inure.activities.association.AppInformationActivity
 import app.simple.inure.activities.association.AudioPlayerActivity
-import app.simple.inure.activities.association.BashAssociation
 import app.simple.inure.activities.association.ImageActivity
 import app.simple.inure.activities.association.InformationActivity
 import app.simple.inure.activities.association.ManifestAssociationActivity
 import app.simple.inure.activities.association.TTFViewerActivity
 import app.simple.inure.activities.association.TextViewerActivity
@@ -47,11 +46,11 @@ class ComponentManager : ScopedFragment() {
                     Triple(R.mipmap.ic_launcher, R.string.app_information, AppInformationActivity::class.java),
                     Triple(R.mipmap.ic_launcher, R.string.installer, ApkInstallerActivity::class.java),
                     Triple(R.mipmap.ic_launcher, R.string.manifest, ManifestAssociationActivity::class.java),
                     Triple(R.mipmap.ic_launcher, R.string.text_viewer, TextViewerActivity::class.java),
                     Triple(R.mipmap.ic_launcher, R.string.ttf_viewer, TTFViewerActivity::class.java),
-                    Triple(R.mipmap.ic_terminal, R.string.execute, BashAssociation::class.java),
+                    // Triple(R.mipmap.ic_terminal, R.string.execute, BashAssociation::class.java),
             )
 
             list.sortBy {
                 getString(it.second)
             }

Vulnerable code: 2. **Email Notification:** Send an email to [Hamza Rizwan](mailto:hamzarizwan243@gmail.com) describing 
the potential vulnerability. Please include the following details in your report:
3. **Wait for Response:** You should receive an acknowledgment of your report within a few hours. I will work with you to understand and verify the issue.
4. **Cooperation:** I appreciate your cooperation in keeping the details of the vulnerability confidential until we've resolved the issue.
import app.simple.inure.activities.association.BashAssociation
                    Triple(R.mipmap.ic_terminal, R.string.execute, BashAssociation::class.java),
Fixed code: 2. **Email Notification:** Send an email to [Hamza Rizwan](mailto:hamzarizwan243@gmail.com)
   describing
   the potential vulnerability. Please include the following details in your report:
3. **Wait for Response:** You should receive an acknowledgment of your report within a few hours. I
   will work
   with you to understand and verify the issue.
4. **Cooperation:** I appreciate your cooperation in keeping the details of the vulnerability
   confidential
   until we've resolved the issue.
            android:enabled="false"
    <li>Disabled support for execute as Android default FS model doesn't allow efficient file
        parsing and using this also poses a major security risk.
    </li>
        showWarning("ERR: This is not supported anymore, kindly use the terminal app to run scripts")

        return

        @Suppress("UNREACHABLE_CODE")
                    // Triple(R.mipmap.ic_terminal, R.string.execute, BashAssociation::class.java),