plaid / plaid-link-android

Plaid Link Android SDK
https://plaid.com/docs/link/android
MIT License
114 stars 48 forks source link

Security Issue: Debuggable WebViews Allow Malicious Apps to Access Sensitive Data #236

Closed GangChenGoCode closed 6 months ago

GangChenGoCode commented 1 year ago

The problem

The following vulnerable source code was identified:

public final Object invokeSuspend(Object p2)
{
    kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsKt.getCOROUTINE_SUSPENDED();
    if (this.label != 0) {
        throw new IllegalStateException(call to 'resume' before 'invoke' with coroutine);
    } else {
        kotlin.ResultKt.throwOnFailure(p2);
        android.webkit.WebView.setWebContentsDebuggingEnabled(1);
        return kotlin.Unit.INSTANCE;
    }
}

Environment

Android OS Version above KitKat
Android Devices/Emulators all

Steps to Reproduce

Static Code Scanning

Expected Result

Screenshots

screenshots

REGULATORY COMPLIANCE

This issue may be out of compliance with the following laws, policies, and standards:

OWASP Mobile Security M1 - Improper Platform Usage

OWASP ASVS: Application Security Verification Standard Configurations for production should be hardened to protect against common attacks, such as debug consoles, raise the bar for Cross-site Scripting (XSS) and Remote File Inclusion (RFI) attacks, and to eliminate trivial information discovery "vulnerabilities" that are the unwelcome hallmark of many penetration testing reports. (OWASP_ASVS_V_14_3)

GangChenGoCode commented 1 year ago

Appreciated any follow-ups here @zsweigart

snehas13 commented 1 year ago

Request you to resolve this issue at the earliest.

techouse commented 6 months ago

Has this been addressed?

melissaosullivan commented 6 months ago

Hi, I think this actually is not a concern. I can see how it is confusing because there is a method called maybeSetWebviewDebugging which takes a parameter, but the parameter taken is not a boolean but the context. The method is:

  private suspend fun maybeSetWebviewDebugging(context: Context) {
    if (0 != context.applicationInfo.flags and ApplicationInfo.FLAG_DEBUGGABLE) {
      withContext(Dispatchers.Main) {
        WebView.setWebContentsDebuggingEnabled(true)
      }
    }
  }

So this is following the guidelines for explicitly setting only WebViews in debug builds to debuggable. Additionally we are removing the parameter in the next release so this will no longer be a source of confusion. Thanks!

GangChenGoCode commented 6 months ago

thanks @melissaosullivan