Medium chrome Logic Error 📄 Reporter bug report 🔧 Commit mapped

Overview

Medium
Severity
CVSS
No
Exploited ITW
Fixed
Fix Status
ImpactInsufficient validation of untrusted input in CustomTabs
DescriptionInsufficient validation of untrusted input in CustomTabs
ComponentCustomTabs
Bug ClassLogic Error
Tracker513508305
Fix commitf90c8e8aa500 (chromium/src) +3/-0
CISA KEVNot listed
CreditedGoogle
Disclosed2026-06-30

Changed Functions

FunctionChangeNotes
if
chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabBottomBarDelegate.java
modified

Files Changed

  • chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabBottomBarDelegate.java
From f90c8e8aa500eb51a91062d563e5da3c7acd5ac8 Mon Sep 17 00:00:00 2001
From: Jinsuk Kim <[email protected]>
Date: Mon, 18 May 2026 04:39:57 -0700
Subject: [PATCH] [CCT] Prevent potential View ID Hijacking in BottomView

This CL clears the IDs of the dynamically generated views immediately
after they are set up, ensuring they cannot collide with internal R.id
values during layout searches.

Bug: 513508305
Change-Id: Idd96040ea44e7484b7d96dbc7cabd0764d50a4fd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7851581
Reviewed-by: Peter Conn <[email protected]>
Commit-Queue: Jinsuk Kim <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1632082}
---

diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabBottomBarDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabBottomBarDelegate.java
index 3eae1e9..6d6968e 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabBottomBarDelegate.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabBottomBarDelegate.java
@@ -172,6 +172,9 @@
         }
 
         if (mBottomBarContentView != null) {
+            // Set all views' ids to be View.NO_ID to prevent them clashing with
+            // chrome's resource ids. See http://crbug.com/513508305
+            transformViewIds(mBottomBarContentView);
             getBottomBarView().addView(mBottomBarContentView);
             mBottomBarContentView.addOnLayoutChangeListener(
                     new OnLayoutChangeListener() {
Loading diff…

Original Bug Report

reported by [email protected]

Potential View ID Hijacking in Custom Tabs via Unsanitized CustomButtonParams

Project Fortify, an experimental security project, has identified the following potential security issue. If you’re a feature owner CC-ed on this bug, please do your best to review these reports. Please see https://chromium.googlesource.com/chromium/src/+/main/docs/security/ai-generated-security-bugs-faq.md for more information.

Overview: A vulnerability in Chrome for Android’s Custom Tabs allows an external application to inject arbitrary View IDs into the browser’s Activity hierarchy. This enables an attacker to hijack internal view lookups, leading to browser process crashes or UI spoofing of trusted elements.

Affected files:

  • chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomButtonParamsImpl.java
  • chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabBottomBarDelegate.java
  • chrome/android/java/res_app/layout/main.xml

Estimated timestamp from git blame: 2020-12-11

Description

A potential vulnerability exists in Chrome for Android’s Custom Tabs (CCT) where an attacker-controlled application can hijack internal View IDs. By supplying a crafted CustomTabsIntent with specific EXTRA_TOOLBAR_ITEMS, an attacker can inject an ImageButton into the Chrome Activity hierarchy with an arbitrary ID that collides with Chrome’s internal resource IDs (e.g., R.id.toolbar, R.id.url_bar, R.id.menu_button_wrapper).

This occurs because CustomButtonParamsImpl.fromBundle() reads the KEY_ID from the intent’s bundle without any range or namespace validation. This ID is subsequently applied to a View via button.setId(mId) in CustomButtonParamsImpl.buildBottomBarButton(). Unlike the parallel RemoteViews path in CustomTabBottomBarDelegate.java, which uses transformViewIds() to strip IDs and prevent collisions, the legacy bottom bar button path performs no sanitization.

Potential Impact

  1. Denial of Service (Browser Crash): Internal Chrome components frequently use findViewById(R.id.target) and cast the result to a specific class. For example, BaseCustomTabRootUiCoordinator.java (line 438) calls mActivity.findViewById(R.id.toolbar) and casts it to CustomTabToolbar. Because the bottombar_stub is located at a lower index in the coordinator layout (index 7) than the control_container_stub (index 13) in main.xml, the depth-first search returns the attacker’s ImageButton. This causes a ClassCastException and an immediate browser process crash.
  2. UI Spoofing: Trusted Chrome UI elements, such as In-Product Help (IPH) bubbles, can be anchored to attacker-controlled buttons. For example, CustomTabHistoryIphController.java (line 94) anchors a history IPH bubble to R.id.menu_button_wrapper. Hijacking this ID allows an attacker to misdirect the user’s trust to an action defined by the attacker’s PendingIntent.

Suggested Reproduction Steps (Potential)

  1. Identify a target resource ID in Chrome (e.g., R.id.toolbar for a crash or R.id.menu_button_wrapper for spoofing).
  2. Construct a CustomTabsIntent and add a button to EXTRA_TOOLBAR_ITEMS where the KEY_ID in the bundle matches the target resource ID.
  3. Launch the Custom Tab from a separate app.
  4. Observe the browser process crash or the misanchored UI element.

Suggested Fix

The legacy button path in CustomTabBottomBarDelegate.java should be updated to sanitize view IDs. Specifically, in CustomTabBottomBarDelegate.showBottomBarIfNecessary(), any ImageButton generated via params.buildBottomBarButton() should have its ID reset to View.NO_ID or a safe, non-colliding value after being added to the layout, similar to how transformViewIds() handles the RemoteViews path.

Evaluated with Chrome root at commit: b3153093eb3c78c3e88ccf562bcbc20437a04b0e


Results so far have been promising, but there can be wrong deductions. Feel free to adjust as follows:

  • If you are familiar with the severity guidelines, you may adjust the severity.
  • If this is a false positive, and there’s no work to be done, please close as WAI.
  • If there is work to do here but not a vulnerability, please change the issue type to Task/Bug/FR.

Data from false positives will be used to improve accuracy over time. And please feel free to reach out to me directly if you have concerns or feedback on the project.

View on issue tracker