首页 > 解决方案 > (Fortify) 类别:Android 不良做法:缺少 Google Play 服务更新的安全提供程序(1 个问题)

问题描述

我们正在使用 Fortify 扫描我的 Android 源代码,但我无法摆脱这个问题:

类别:Android 不良做法:缺少 Google Play 服务更新的安全提供程序(1 个问题)

Fortify 指向这行代码:

工具:replace="android:allowBackup">

AndroidManifest.xml:37 null()
  <application
    android:name=".test"
    android:allowBackup="false"
    android:hardwareAccelerated="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:networkSecurityConfig="@xml/network_security_config"
    android:supportsRtl="true"
    android:theme="@style/AppTheme"
    tools:replace="android:allowBackup"> <!--FORTIFY POINTS TO THIS LINE-->

强化推荐:

修补安全提供程序的最简单方法是调用同步方法 installIfNeeded()。如果用户体验在等待操作完成时不会受到线程阻塞的影响,这是合适的,否则应该以异步方式完成。

更多关于这个问题

我已关注 Android 的 更新您的安全提供程序以防止 SSL 漏洞利用

并尝试了两种方法:

installIfNeed()installIfNeededAsync()

但问题仍然存在。我测试了我的代码,它工作正常。

这是我的清单:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="test">

    <uses-permission android:name="android.permission.INTERNET" />

    <application
        android:name=".test"
        android:allowBackup="false"
        android:hardwareAccelerated="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:networkSecurityConfig="@xml/network_security_config"
        android:supportsRtl="true"
        android:theme="@style/AppTheme"
        tools:replace="android:allowBackup">

        <meta-data
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />

        <provider
            android:name=".syncadapter.StubProvider"
            android:authorities="com.neseapl.nyp.provider"
            android:exported="false"
            android:syncable="true"/>

        <service
            android:name=".syncadapter.SyncService"
            android:exported="false">
            <intent-filter>
                <action android:name="android.content.SyncAdapter" />
            </intent-filter>
            <meta-data
                android:name="android.content.SyncAdapter"
                android:resource="@xml/syncadapter" />
        </service>

        <service
            android:name=".syncadapter.AuthenticatorService">
            <intent-filter>
                <action android:name="android.accounts.AccountAuthenticator"/>
            </intent-filter>
            <meta-data
                android:name="android.accounts.AccountAuthenticator"
                android:resource="@xml/account_authenticator" />
        </service>

        <activity
            android:name=".activities.Test"
            android:configChanges="orientation|screenSize">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

我的清单中缺少什么?谢谢!

标签: androidsecuritygoogle-play-servicesfortify

解决方案


我最近在 Fortify 上遇到了类似的问题。正如 Silvia Ragui 指出的,Fortify 没有正确分析这个运行时进程。虽然 installIfNeeded() 和 installIfNeededAsync() 将在您的 APK 的实际部署中更新安全提供程序,但是当您重新提交到 Fortify 时,它似乎并没有清除错误。

但是,根本问题是过时的安全提供程序,这通常是由于您的软件包中的播放服务库过时所致。

以下是直接来自 fortify 仪表板的建议:

Android 依靠安全提供程序来提供安全的网络通信。默认设备加密库通常是包含已知缺陷的旧版本 OpenSSL。为了克服这个问题,Google 提供了一种机制,让应用程序通过 Google Play Services ProviderInstaller 客户端“修补”其本地 OpenSSL 副本。已确定该应用程序未使用更新的提供程序,从而使该应用程序暴露于较早的已知 OpenSSL 漏洞和弱点。>

实际问题与 Silvia 日志中的最后一行相同:

W/GooglePlayServicesUtil Google Play 服务已过期

在我们的案例中,我们更新到我们包中的最新版本的 Play 服务并实施了上述修复(当我们这样做时,我们发现有一个小错误必须修复,并且可能阻止更新修补安全提供程序)

新版本成功解决了这个问题。我建议您将您更新到最新的 Play 服务,因为这也会更新安全提供程序。


推荐阅读