CVE-2026-58817 AI-generated analysis
platform/frameworks/base, package manager manifest parsing (ParsingUtils, knownActivityEmbeddingCerts)
Adds validation to the knownActivityEmbeddingCerts manifest attribute parsing in ParsingUtils: certificate digest strings whose length is not 64 characters are dropped, and a parse error is returned if more than 50 digests remain.
Root cause
The knownActivityEmbeddingCerts parsing method in core/java/com/android/internal/pm/pkg/parsing/ParsingUtils.java accepted whatever the app's resources supplied. For an array resource it did Set.of(res.getStringArray(...)) with no limit on the number of entries and no check on the content or length of each entry. For a string resource or literal string it wrapped the value in Set.of without length validation. Per the commit message, an app could therefore bloat its manifest with an arbitrary number of arbitrary-length "certificate" strings, which are later used in signature verification at app launch, causing performance degradation (DoS, rated High in the bulletin).
How the fix works
- core/java/com/android/internal/pm/pkg/parsing/ParsingUtils.java, knownActivityEmbeddingCerts parsing method: introduces constants MAX_KNOWN_ACTIVITY_EMBEDDING_CERTS = 50 and CERT_DIGEST_SHA256_LENGTH = 64, and replaces the nullable Set<String> with a List<String> knownEmbeddingCertificates declared just before the resource-id lookup (sa.getResourceId).
- Array-resource branch: entries are collected via knownEmbeddingCertificates.addAll(Arrays.asList(knownCerts)). String-resource branch: knownEmbeddingCertificates.add(res.getString(...)). The previous null guards around Set.of are removed, and the emptiness check becomes knownEmbeddingCertificates.isEmpty(). Both resource branches now return validateCerts(knownEmbeddingCertificates, input) instead of input.success(set).
- Literal-string branch (resource id 0): after the existing empty-string error check, the string is added to the list and validateCerts is called instead of returning Set.of(knownCert).
- New private static validateCerts(List<String> certs, ParseInput input): first removes every entry whose length() != 64 (certs.removeIf). Then, if certs.size() > 50, it returns input.error("The number of knownActivityEmbeddingCerts exceeds the maximum allowed limit of 50"). Otherwise it returns input.success(Set.copyOf(certs)).
Completeness
- Covers all three input forms of the attribute (string array resource, string resource, literal string), since they all funnel through validateCerts.
- Length validation is only a character-count check (exactly 64). The content is not checked for hex characters, so any 64-character string still passes.
- Invalid-length entries are removed before the count check, so a manifest may still carry an unbounded number of non-64-character strings. They are read into the list and iterated by removeIf at parse time, but they are not kept in the returned set.
- If every entry is filtered out by the length check, the method returns success with an empty set rather than an error (the isEmpty check runs before validateCerts).
- Only this parse site in ParsingUtils.java is changed (single-file diff). The material does not show the code that later consumes the set at launch time.
Behavior changes
- Stricter validation: an app declaring more than 50 digests of valid length now fails parsing with a new error message.
- Digest strings whose length is not 64 are silently dropped instead of being kept. The commit comment states this is to minimize app compat issues.
- Set.copyOf replaces Set.of, so duplicate digest entries in an array resource no longer throw IllegalArgumentException from Set.of. Duplicates are deduplicated instead.
- Null guards on getStringArray/getString results were removed, so a null value would now surface as a NullPointerException rather than the previous 'resource is null' error. Android 14 keeps the null check, but it now applies to the list, which is never null.
- An attribute whose only entries are of invalid length now yields success with an empty set instead of the original values.
Per major
- Android 14: adapted fix: commit 1453b34c0ea5 in android-security-14.0.0_r29 applies the same logic to services/core/java/com/android/server/pm/pkg/parsing/ParsingUtils.java (different path). Minor differences: the `knownEmbeddingCertificates == null ||` guard is retained, and the else branch keeps the now-unused local `final String knownCert = res.getString(...)` and calls res.getString a second time. Patched region present at android-security-14.0.0_r31 (8/8 lines).
- Android 15: same fix: commit a6ff1f594051 in android-security-15.0.0_r17 at core/java/com/android/internal/pm/pkg/parsing/ParsingUtils.java; patched region present at android-security-15.0.0_r19 (8/8 lines).
- Android 16: same fix: commit 431c43bd57cc in android-security-16.0.0_r8, identical diff (same blob ids 26822c649db7..d846d0d334e6); present at android-security-16.0.0_r10 (8/8 lines).
- Android 17: same fix: commit bbf84d307ba6 in android-security-17.0.0_r1, identical diff; present at android-security-17.0.0_r3 (8/8 lines).
Unknowns
- The name and signature of the patched parsing method are not shown in the diff hunk (only its body).
- The launch-time signature verification code that consumes the set, and the exact performance impact, are not in the material.
- The material does not show whether a sibling knownCerts parsing path for permissions (suggested by the retained comment about 'the permission should only be granted to a single known signer') has similar validation.
- Which manifest element (activity or application) carries the attribute is not shown.