Skip to main content
Vulnerability Database/CVE-2024-31331

CVE-2024-31331: Google Android Privilege Escalation Flaw

CVE-2024-31331 is a privilege escalation vulnerability in Google Android that exploits a logic error in PackageManagerService.java, allowing attackers to hide services from Settings and gain elevated privileges. This article covers technical details, affected versions, security impact, and recommended mitigation strategies.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2024-31331 Overview

CVE-2024-31331 is a local privilege escalation vulnerability in the Android PackageManagerService.java component. The flaw resides in the setMimeGroup method, where a logic error allows a malicious application to hide a service from the Settings interface. This concealment prevents users from identifying or disabling the running service through standard Android management tools. Exploitation requires local access and user interaction, but no elevated privileges prior to the attack. The vulnerability affects Android versions 12.0, 12.1, 13.0, and 14.0, and is tracked under [CWE-783] (Operator Precedence Logic Error). Google addressed the issue in the July 2024 Android Security Bulletin.

Critical Impact

A malicious application can hide itself from Settings and achieve local privilege escalation with User-level execution rights, undermining user visibility and control over installed services.

Affected Products

  • Google Android 12.0
  • Google Android 12.1
  • Google Android 13.0 and 14.0

Discovery Timeline

  • 2024-07-09 - CVE-2024-31331 published to NVD
  • 2024-07-01 - Android Security Bulletin released with patch
  • 2026-06-17 - Last updated in NVD database

Technical Details for CVE-2024-31331

Vulnerability Analysis

The vulnerability resides in the setMimeGroup function of PackageManagerService.java, a core component of the Android framework responsible for managing installed packages. The flaw is a logic error that allows an application to manipulate MIME group assignments in a way that hides a corresponding service from the Settings application. Because the service is concealed from the user interface, an attacker's application can continue running services without the user being able to review, stop, or uninstall them through normal means. The vulnerability is categorized under [CWE-783], indicating faulty operator precedence or conditional evaluation in the affected logic path.

Root Cause

The root cause is improper validation inside setMimeGroup, which handles dynamic MIME type group updates for installed packages. The method does not correctly enforce visibility invariants when updating MIME group state. As a result, a crafted sequence of calls can cause the Settings UI to omit the affected service from its application listings.

Attack Vector

Exploitation requires a malicious application to be installed on the device and executed by the user. Once running, the application invokes setMimeGroup with specific parameters that trigger the logic error, hiding its service component from Settings. User interaction is required to launch the malicious app, but no additional privileges are needed beyond standard user-level execution. The vulnerability is local in nature; it cannot be triggered remotely without first delivering an application to the device.

No public proof-of-concept code is available. For patch-level technical details, see the Android Source Code Update.

Detection Methods for CVE-2024-31331

Indicators of Compromise

  • Applications running background services that do not appear in the Settings → Apps listing.
  • Unexpected package components invoking setMimeGroup with unusual MIME group identifiers.
  • Persistent CPU, network, or battery usage attributed to packages with no visible service entries in the UI.

Detection Strategies

  • Enumerate installed packages and running services using adb shell dumpsys package and dumpsys activity services, then compare results against the Settings UI listing to identify hidden components.
  • Review mobile device management (MDM) telemetry for applications requesting unusual MIME group modifications or running undisclosed services.
  • Monitor Android build fingerprints to confirm devices have applied the July 2024 security patch level or later.

Monitoring Recommendations

  • Deploy mobile threat defense tooling that inspects installed APKs and flags applications abusing PackageManagerService APIs.
  • Track Android security patch level (ro.build.version.security_patch) across the device fleet and alert on devices below 2024-07-01.
  • Audit newly installed applications from untrusted sources, prioritizing those requesting background service execution.

How to Mitigate CVE-2024-31331

Immediate Actions Required

  • Apply the July 2024 Android Security Bulletin patch (security patch level 2024-07-01 or later) to all affected devices.
  • Restrict application installation to Google Play and other vetted sources by disabling installation from unknown sources.
  • Audit installed applications on managed devices and remove any package that cannot be accounted for in Settings.

Patch Information

Google released the fix in the Android Security Bulletin - July 2024. The upstream code change is available in the Android Open Source Project commit c8694bb. Device manufacturers distribute the fix through their respective over-the-air update channels. Users should install the latest available system update from their device vendor.

Workarounds

  • No vendor-supplied workaround exists; patching is the only supported remediation.
  • Enforce enterprise mobility management policies that block sideloading and require minimum Android security patch levels before granting corporate resource access.
  • Educate users to review requested permissions and avoid installing applications from untrusted developers until patches are deployed.

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.