CVE-2026-55287 AI-generated analysis
platform/frameworks/base, android.accounts (GrantCredentialsPermissionActivity credential grant UI)
GrantCredentialsPermissionActivity now passes the auth token label, requesting package label, account name and account type label through TextUtils.makeSafeForPresentation (TRIM and FIRST_LINE flags, with MAX_SAFE_LABEL_LENGTH and DEFAULT_MAX_LABEL_SIZE_PX limits) before showing them in the credential grant dialog.
Root cause
In core/java/android/accounts/GrantCredentialsPermissionActivity.java the activity put strings directly into TextViews with no sanitization: authTokenLabel (set inside a runOnUiThread Runnable), packageLabel (resolved for each requesting package, falling back to the raw package name, and passed to newPackageView), mAccount.name and accountTypeLabel. A crafted string could therefore add line breaks or very long text and misrepresent what the user is being asked to approve in the grant dialog. The commit message calls this UI obfuscation via newline injection.
How the fix works
- core/java/android/accounts/GrantCredentialsPermissionActivity.java: adds a private helper makeSafe(String label). It returns the input unchanged if TextUtils.isEmpty(label); otherwise it returns TextUtils.makeSafeForPresentation(label, PackageItemInfo.MAX_SAFE_LABEL_LENGTH, PackageItemInfo.DEFAULT_MAX_LABEL_SIZE_PX, TextUtils.SAFE_STRING_FLAG_TRIM | TextUtils.SAFE_STRING_FLAG_FIRST_LINE).toString(). It also imports android.content.pm.PackageItemInfo for the constants.
- GrantCredentialsPermissionActivity: the runOnUiThread Runnable that sets the auth token type view now calls authTokenTypeView.setText(makeSafe(authTokenLabel)).
- GrantCredentialsPermissionActivity: the per-package loop now calls packagesListView.addView(newPackageView(makeSafe(packageLabel))). This covers both the label resolved from PackageManager and the fallback where packageLabel = pkg on NameNotFoundException.
- GrantCredentialsPermissionActivity: the account_name TextView is set with makeSafe(mAccount.name) and the account_type TextView with makeSafe(accountTypeLabel).
Completeness
- Covers the four display sites in the diff: auth token label, package label (including the raw package name fallback), account name, and account type label.
- Sanitization happens only at display time. The underlying values (mAccount.name, labels) are not changed anywhere else in the activity.
- makeSafe returns empty or null input unchanged, so behavior for those cases stays the same.
- SAFE_STRING_FLAG_FIRST_LINE keeps only the first line, so multi-line content is cut off rather than escaped. The material does not show other activities or dialogs that render account or authenticator labels, so coverage beyond this file is unknown.
Behavior changes
- Displayed labels are trimmed and cut at the first line, with the MAX_SAFE_LABEL_LENGTH and DEFAULT_MAX_LABEL_SIZE_PX limits applied. Legitimate labels that contain newlines or very long text will appear truncated.
- No functional change for empty or null labels.
Per major
- Android 14: same fix: platform/frameworks/base 129f80c33f1f in android-security-14.0.0_r29, byte-identical diff (same blob ids a89fae72d4ab..25e5f42cfa98); 8/8 lines present at android-security-14.0.0_r31.
- Android 15: same fix: platform/frameworks/base 78ff07aa12b8 in android-security-15.0.0_r17, cherry-pick of d143444ef510 with Change-Id Ief6f22746200360e97b3ccbc0b5abca8867139bb; 8/8 lines present at android-security-15.0.0_r19.
- Android 16: same fix: platform/frameworks/base e8ef27e17d89 in android-security-16.0.0_r8, byte-identical diff to 14/15; 8/8 lines present at android-security-16.0.0_r10.
- Android 17: same fix at shifted offsets: platform/frameworks/base 27be977cd805 in android-security-17.0.0_r1. It makes identical changes against a different base blob (d67bff2c02b2), with hunks at lines 126 and 156 instead of 110 and 140 and an android.graphics.Insets import next to the change. 8/8 lines present at android-security-17.0.0_r3.
Unknowns
- Which of the four displayed fields was the reported vector; the commit message only mentions newline injection in labels in general.
- Whether account-related UI outside this file shows the same strings without sanitization; the material shows only this activity.
- Exactly how makeSafeForPresentation handles characters other than newlines and surrounding whitespace (its implementation is not in the material).
- Where authTokenLabel and accountTypeLabel come from, and which component launches the activity.
- The exact rendering effect in the layout (the layout XML is not in the material).