android - Google Play 警告 : Your app contains a Cross-App Scripting Vulnerability

标签 android android-webview android-security google-play-console

大家好,

我收到了一封来自 google play 的电子邮件,内容涉及我发布的一个或多个应用程序中的跨应用程序脚本漏洞。我在我的应用程序中使用 WebView,所以他们说我的应用程序包含 webView 跨应用程序脚本问题,该问题可能允许恶意应用程序窃取用户 cookie 和其他数据。他们给出了我将要采取的行动,那就是

Action required

Please follow the steps below to fix the issue with your apps (listed at the end of this email). You can refer to the notice in your Play Console for the deadline to fix this problem. After this deadline, updates to affected apps will be blocked if the vulnerability is still present. Your published APK version will remain unaffected. Additional details

WebViews that enable JavaScript and load data read from untrusted Intents can be tricked by malicious apps into executing JavaScript code in an unsafe context. You should prevent this vulnerability in one of the following ways:

Option 1: Ensure that affected activities are not exported

Find any Activities with affected WebViews. If these Activities do not need to take Intents from other apps you can set android:exported=false for the Activities in your Manifest. This ensures that malicious apps cannot send harmful inputs to any WebViews in these Activities.

Option 2: Protect WebViews in exported activities

If you want to set an Activity with an affected WebView as exported then we recommend that you make the following changes:

Update your targetSdkVersion

Ensure that your targetSdkVersion meets Google Play's target API level requirement. Apps with a targetSdkVersion of 16 or lower evaluate JavaScript URLs passed to loadUrl in the currently loaded page context. Targeting SDK version 16 or lower and calling loadUrl using unsanitized input from untrusted Intents lets attackers execute harmful scripts in the affected WebView.

Protect calls to evaluateJavascript

Ensure that parameters to evaluateJavascript are always trusted. Calling evaluateJavascript using unsanitized input from untrusted Intents lets attackers execute harmful scripts in the affected WebView.

Prevent unsafe file loads

Ensure that affected WebViews cannot load the cookie database. WebViews that load unsanitized file:// URLs from untrusted Intents can be attacked by malicious apps in the following way. A malicious web page can write script tags into the cookies database and then a malicious app can send an Intent with a file:// URL pointing to your WebView cookies database. The malicious script will execute if the cookies database is loaded in a WebView and can steal session information.

You can ensure that affected WebViews cannot load the WebView cookies database in two ways. You can either disable all file access or you can verify that any loaded file:// URLs point to safe files. Note that an attacker can use a symbolic link to trick checks on the URL path. To prevent such an attack, be sure to check the canonical path of any untrusted file:// URL before loading instead of just checking the URL path.

所以我的问题是

  1. 如果我进行电子邮件中提到的更改,这将如何影响我的应用程序?

  2. 我的应用的任何功能会被禁用吗?

最佳答案

转到 android Manifest,如果 web Activity 有 android:exported=”true“,将其更改为 android:exported=”false“

转到 list ,并在 Webview Activity 中添加以下行

<meta-data android:name="android.webkit.WebView.EnableSafeBrowsing"
android:value="true" />

关于android - Google Play 警告 : Your app contains a Cross-App Scripting Vulnerability,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53095398/

相关文章:

java - 难以从其他 Activity/类(class)控制 webview

Android - 隐藏 API clientId 和 clientSecret 的最佳方式

java - HTTP ://a href link not working in Android

android - Webview 抖动/跳跃

android - android SearchView 的搜索类型是什么?

android - 没有重定向的 WebView 回溯历史

android - android应用程序的渗透测试技术是什么?

java - Android 根文件夹读写权限

android - 如何在我的应用程序中添加第三个按钮

javascript - 确定并绑定(bind)点击或 "touch"事件