Skip to content
Memory corruption Advisory Advanced CVE-2024-7964

Use after free in Passwords (CVE-2024-7964)

A use-after-free vulnerability exists in Chrome's password manager on Android, where a Java object holds a native pointer to a C++ object that is destroyed when the frame navigates away, without notifying the Java side. An attacker with a compromised renderer could trigger a browser crash, potentially leading to further exploitation.

Anonymous Follow

Originally disclosed on Chrome VRP

Bounty$36,000 High View original
  • Fix shipped in 14 days

VULNERABILITY DETAILS On Android platform, a render process can call ShowKeyboardReplacingSurface to send a mojo message which instructs the browser to show a popup or accessory with password suggestions. On the browser side it calls to TouchToFillController::Show with the following sequence: (some of them run async)

ContentPasswordManagerDriver::ShowKeyboardReplacingSurface ChromePasswordManagerClient::ShowKeyboardReplacingSurface ChromePasswordManagerClient::MaybeShowAccountStorageNotice ChromePasswordManagerClient::ShowKeyboardReplacingSurfaceOnAccountStorageNoticeDone TouchToFillController::Show

And if there is no passkeys it then calls to NoPasskeysBottomSheetBridge::Show, which create a java object NoPasskeysBottomSheetBridge(java) [1]. The java object holds a native pointer to the C++ object NoPasskeysBottomSheetBridge [2], which is owned by TouchToFillController. When the frame is navigating away, TouchToFillController gets notified via WebContentsObserver and then reset the NoPasskeysBottomSheetBridge object [3]. During this process there is no code to notify the java side that NoPasskeysBottomSheetBridge is destroyed, which results in UAF when the native pointer is accessed through JNI call.

void Create(ui::WindowAndroid* window_android) override {      ==> [1]
  java_object_.Reset(Java_NoPasskeysBottomSheetBridge_Constructor(
      jni_zero::AttachCurrentThread(),
      reinterpret_cast<intptr_t>(bridge_.get()),
      window_android->GetJavaObject()));
}

NoPasskeysBottomSheetBridge(
        long nativeNoPasskeysBottomSheetBridge,
        WeakReference<Context> context,
        WeakReference<BottomSheetController> bottomSheetController) {
    mNativeBridge = nativeNoPasskeysBottomSheetBridge;      // ==> [2]
    mNoPasskeysSheet =
            new NoPasskeysBottomSheetCoordinator(context, bottomSheetController, this);
}

void TouchToFillController::OnDismiss() {
  view_.reset();
  no_passkeys_bridge_.reset();      // ==> [3]
  if (!ttf_delegate_) {
    // TODO(crbug.com/40274966): Remove this check when
    // PasswordSuggestionBottomSheetV2 is launched
    return;
  }
  // Unretained is safe here because TouchToFillController owns the delegate.
  ttf_delegate_->OnDismiss(base::BindOnce(
      &TouchToFillController::ActionCompleted, base::Unretained(this)));
}

[1] https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/touch_to_fill/password_manager/no_passkeys/android/no_passkeys_bottom_sheet_bridge.cc;l=25;drc=5203366d4cf174b9331ee33563e0520f10b60828 [2] https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/touch_to_fill/password_manager/no_passkeys/internal/android/java/src/org/chromium/chrome/browser/touch_to_fill/no_passkeys/NoPasskeysBottomSheetBridge.java;l=38;drc=5203366d4cf174b9331ee33563e0520f10b60828 [3] https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/touch_to_fill/password_manager/touch_to_fill_controller.cc;l=188;drc=5203366d4cf174b9331ee33563e0520f10b60828

VERSION Chrome Version: stable + dev Operating System: Android

REPRODUCTION CASE

  1. Apply the attached patch.diff, this is to simulate a compromised renderer

  2. Host poc.html at localhost

python3 -m http.server 8000 adb reverse tcp:8000 tcp:8000

  1. Launch asan build chromium on Android

out/Default/bin/chrome_public_apk run --args='--disable-features=PasswordSuggestionBottomSheetV2'

and navigate to http://localhost:8000/poc.html

Note that feature PasswordSuggestionBottomSheetV2 is disabled by default, but may be enabled on some custom builds. So we need to disable it explicitly here.

FOR CRASHES, PLEASE INCLUDE THE FOLLOWING ADDITIONAL INFORMATION Type of crash: browser Crash State: see asan.log for details

== ADDITIONAL INFO == compromised renderer requirement: yes miracle ptr protected: no

Bisection: This was introduced in https://chromium.googlesource.com/chromium/src/+/7aa06e75a81c6331613c36881da6cf3734a400d5

The original report as published on the Chromium issue tracker, by Anonymous. Images and videos are our own copies; raw HTML is shown as text. View it on Chromium issue tracker.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 6 min read.

Context

This report describes a use after free (UAF) in the Chrome password manager on Android, tracked as CVE-2024-7964. The affected component is the Touch To Fill flow, specifically the "no passkeys" bottom sheet that Chrome shows when a user taps a password field and the browser has no passkeys to offer for that site.

On Android, a render process can call ShowKeyboardReplacingSurface to send a mojo message that instructs the browser process to show a popup or accessory with password suggestions. The browser side then reaches TouchToFillController::Show. The report notes that some of these calls run asynchronously.

The bug is a lifetime mismatch between a C++ object owned by TouchToFillController and a Java object that holds a raw native pointer to it. When the frame navigates away, the C++ side is reset but the Java side is never told, so a later JNI call dereferences freed memory.

The platform metadata records the report as a Chrome VRP advisory, severity high, weakness use after free, asset Passwords, bounty 36,000.00 USD, disclosed 2024-08-21, researcher anonymous. The report itself does not state a CVSS score.

Setup

The researcher used an Android device with a Chrome build compiled with AddressSanitizer (asan). The report gives the following preconditions and tooling:

  • Platform: Android.
  • Chrome version: stable + dev.
  • A local HTTP server to host the proof of concept page.
  • adb reverse to make the host's port reachable from the device.
  • A patch, patch.diff, attached to the report, applied to the build to simulate a compromised renderer.
  • The feature PasswordSuggestionBottomSheetV2 must be disabled explicitly. The report says this feature is disabled by default but may be enabled on some custom builds, so it is disabled on the command line to be sure.

The report marks the compromised renderer requirement as yes and miracle ptr protected as no.

Finding it

The researcher traced the call chain from the renderer-initiated mojo message down to the bottom sheet. The sequence on the browser side is:

Text
ContentPasswordManagerDriver::ShowKeyboardReplacingSurface
  ChromePasswordManagerClient::ShowKeyboardReplacingSurface
    ChromePasswordManagerClient::MaybeShowAccountStorageNotice
      ChromePasswordManagerClient::ShowKeyboardReplacingSurfaceOnAccountStorageNoticeDone
        TouchToFillController::Show

The report notes that some of these steps run asynchronously. If there are no passkeys, the flow calls NoPasskeysBottomSheetBridge::Show, which creates a Java object NoPasskeysBottomSheetBridge(java). That Java object holds a native pointer to the C++ object NoPasskeysBottomSheetBridge, which is owned by TouchToFillController.

The problem appears when the frame navigates away. TouchToFillController is notified through WebContentsObserver and resets the NoPasskeysBottomSheetBridge object. Nothing in that path notifies the Java side that the native object has been destroyed. The Java object keeps its stale native pointer, and a later JNI call that uses it accesses freed memory, producing the UAF.

The report includes three source excerpts, each tied to a numbered reference.

Creation of the Java object and storage of the native pointer:

Text
void Create(ui::WindowAndroid* window_android) override {      ==> [1]
  java_object_.Reset(Java_NoPasskeysBottomSheetBridge_Constructor(
      jni_zero::AttachCurrentThread(),
      reinterpret_cast<intptr_t>(bridge_.get()),
      window_android->GetJavaObject()));
}

NoPasskeysBottomSheetBridge(
        long nativeNoPasskeysBottomSheetBridge,
        WeakReference<Context> context,
        WeakReference<BottomSheetController> bottomSheetController) {
    mNativeBridge = nativeNoPasskeysBottomSheetBridge;      // ==> [2]
    mNoPasskeysSheet =
            new NoPasskeysBottomSheetCoordinator(context, bottomSheetController, this);
}

void TouchToFillController::OnDismiss() {
  view_.reset();
  no_passkeys_bridge_.reset();      // ==> [3]
  if (!ttf_delegate_) {
    // TODO(crbug.com/40274966): Remove this check when
    // PasswordSuggestionBottomSheetV2 is launched
    return;
  }
  // Unretained is safe here because TouchToFillController owns the delegate.
  ttf_delegate_->OnDismiss(base::BindOnce(
      &TouchToFillController::ActionCompleted, base::Unretained(this)));
}

The three references point to the Chromium source at revision [redacted]:

  1. chrome/browser/touch_to_fill/password_manager/no_passkeys/android/no_passkeys_bottom_sheet_bridge.cc, line 25.
  2. chrome/browser/touch_to_fill/password_manager/no_passkeys/internal/android/java/src/org/chromium/chrome/browser/touch_to_fill/no_passkeys/NoPasskeysBottomSheetBridge.java, line 38.
  3. chrome/browser/touch_to_fill/password_manager/touch_to_fill_controller.cc, line 188.

The report also states that the bug was introduced in the commit at https://chromium.googlesource.com/chromium/src/+/[redacted].

Exploitation

Step 1: Simulate a compromised renderer

Apply the attached patch.diff to the Chrome build. The report says this patch exists to simulate a compromised renderer. The report does not include the contents of the patch, so the exact change it makes is not described here.

Step 2: Host the proof of concept page

Serve poc.html from localhost and forward the port to the Android device:

Bash
python3 -m http.server 8000
adb reverse tcp:8000 tcp:8000

The first command starts a static HTTP server on port 8000 of the host. The second makes the device's port 8000 reach the host's port 8000, so the device can load the page from http://localhost:8000/poc.html. The report does not include the contents of poc.html.

Step 3: Launch the asan build and navigate

Bash
out/Default/bin/chrome_public_apk run --args='--disable-features=PasswordSuggestionBottomSheetV2'

This runs the asan build of Chrome on the device with PasswordSuggestionBottomSheetV2 disabled. The report explains that the feature is disabled by default but may be enabled on some custom builds, so it is disabled explicitly here. Then navigate to:

Text
http://localhost:8000/poc.html

The renderer sends the ShowKeyboardReplacingSurface mojo message, the browser side reaches TouchToFillController::Show, and with no passkeys available it creates the NoPasskeysBottomSheetBridge Java object. Navigating the frame away triggers the reset of the native object through WebContentsObserver, and the stale pointer in the Java object is then used through JNI.

Step 4: Observe the crash

The report states the crash type is browser and that the crash state is in asan.log. The report does not reproduce the contents of asan.log, so the exact stack trace is not available here.

Root cause

The C++ NoPasskeysBottomSheetBridge is owned by TouchToFillController. The Java NoPasskeysBottomSheetBridge stores the native pointer in mNativeBridge and uses it for JNI calls. When the frame navigates away, TouchToFillController::OnDismiss calls no_passkeys_bridge_.reset(), which destroys the C++ object. No code in that path notifies the Java object that its native peer is gone, so the Java object keeps a dangling pointer. Any later JNI call that dereferences it is a use after free.

The report notes that miracle ptr protection is marked as no. It does not say whether any other mitigation was present. The report does not say whether any other mitigation was present.

Impact

The report classifies the crash as a browser process crash. The compromised renderer requirement is marked yes, so the trigger assumes the attacker already controls a render process. Under those conditions, the attacker can cause a use after free in the browser process by driving the Touch To Fill flow and then navigating the frame away.

Fix

It only identifies the missing notification from the C++ side to the Java side when NoPasskeysBottomSheetBridge is destroyed. A fix would need to make the Java object aware that its native peer has been reset, or otherwise prevent JNI calls from using the stale pointer after no_passkeys_bridge_.reset().

Variants to test

  • Other JNI bridge objects that hold a raw native pointer and are owned by a controller that can be reset on navigation. A positive result is a Java object whose native peer is destroyed without the Java side being notified, followed by a JNI call that uses the stale pointer.
  • Other bottom sheet or accessory flows reached from renderer-initiated mojo messages, especially ones with asynchronous steps between the message and the object creation. A positive result is a window where the frame can navigate away between creation and use.
  • Flows gated by feature flags that change which controller implementation is used, as with PasswordSuggestionBottomSheetV2 here. A positive result is a code path where the lifetime handling differs between flag states.
  • Objects created through jni_zero constructors that pass reinterpret_cast<intptr_t> of an owned pointer. A positive result is a constructor whose Java field is never cleared when the owner resets the C++ object.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 16 min read.

What happened, in plain words

This report describes a memory safety bug in Google Chrome on Android, in the part of the browser that offers to fill in your saved passwords. The bug is called a use after free, tracked as CVE-2024-7964. The platform records it as a Chrome VRP advisory, severity high, weakness use after free, asset Passwords, bounty 36,000.00 USD, disclosed 2024-08-21, researcher anonymous. The report itself does not state a CVSS score.

To understand the bug you need three ideas.

  1. A browser is split into processes. The part that reads web pages and runs their code is called the renderer (or render process). The part that draws the window, manages tabs and talks to the operating system is called the browser process. They are kept apart on purpose: if a web page manages to break its renderer, the rest of the browser should survive. A renderer that has been broken into by an attacker is called a compromised renderer.
  2. Processes talk to each other through messages. Chrome uses its own message system called mojo. A mojo message is like a sealed note passed between the two processes. The renderer can ask the browser process to do things, such as show a popup.
  3. Two languages meet at a border. Chrome on Android is written mostly in C++ (the browser engine) but the user interface is written in Java (the Android app layer). The two sides call each other through a bridge called JNI (Java Native Interface). When Java wants to call a C++ object, it holds a number that points at that C++ object in memory. That number is called a native pointer. If the C++ object is deleted but Java still holds the number, Java is holding a dangling pointer: an address that no longer belongs to anything. Using it is the use after free.

The affected feature is the Touch To Fill flow. When you tap a password field on a website, Chrome may pop up a small panel at the bottom of the screen (a bottom sheet) offering to fill in a saved password. If Chrome has no passkeys for that site, it shows a different sheet, the "no passkeys" bottom sheet. A passkey is a modern kind of login credential stored on your device instead of a typed password; the report only needs you to know that Chrome checks whether any exist before deciding which sheet to show.

The bug is a lifetime mismatch. The C++ object NoPasskeysBottomSheetBridge is owned by a controller called TouchToFillController. The Java object NoPasskeysBottomSheetBridge holds a raw native pointer to that C++ object. When the page navigates away, the C++ side is reset (the object is destroyed), but the Java side is never told. A later JNI call then dereferences freed memory.

Setup

The researcher used an Android device with a Chrome build compiled with AddressSanitizer (asan). AddressSanitizer is a debugging tool built into a special test build of a program: it watches memory and shouts loudly, with a log file, when the program touches memory it should not. Normal Chrome does not have it; the researcher built a special version for testing.

The report gives the following preconditions and tooling:

  • Platform: Android.
  • Chrome version: stable + dev. "Stable" is the normal release channel; "dev" is the earlier, less polished channel used by developers.
  • A local HTTP server to host the proof of concept page. A proof of concept (PoC) is a small, deliberately harmless demonstration that triggers the bug.
  • adb reverse to make the host's port reachable from the device. adb is the Android Debug Bridge, a command line tool that lets a computer talk to an Android device over USB. adb reverse forwards a port on the device back to the computer.
  • A patch, patch.diff, attached to the report, applied to the build to simulate a compromised renderer. A patch is a small file describing changes to source code. The report does not include the contents of the patch, so the exact change it makes is not described here.
  • The feature PasswordSuggestionBottomSheetV2 must be disabled explicitly. A feature flag is a switch inside Chrome that turns a piece of code on or off. The report says this feature is disabled by default but may be enabled on some custom builds, so it is disabled on the command line to be sure.

The report marks the compromised renderer requirement as yes and miracle ptr protected as no. **MiraclePtr is a Chrome defence that keeps C++ objects alive a little longer so that a use after free is less likely to be exploitable. The report marks miracle ptr protected as no.

Finding it

The researcher traced the call chain from the renderer-initiated mojo message down to the bottom sheet. A call chain is the list of functions that call one another, like a chain of people passing a message along. The sequence on the browser side is:

Text
ContentPasswordManagerDriver::ShowKeyboardReplacingSurface
  ChromePasswordManagerClient::ShowKeyboardReplacingSurface
    ChromePasswordManagerClient::MaybeShowAccountStorageNotice
      ChromePasswordManagerClient::ShowKeyboardReplacingSurfaceOnAccountStorageNoticeDone
        TouchToFillController::Show

Line by line, in plain words:

  • ContentPasswordManagerDriver::ShowKeyboardReplacingSurface: the first function on the browser side that receives the request to show the password suggestion surface. The :: means "this function belongs to this class".
  • ChromePasswordManagerClient::ShowKeyboardReplacingSurface: the password manager client takes over.
  • ChromePasswordManagerClient::MaybeShowAccountStorageNotice: Chrome checks whether it should first show a notice about where passwords are stored (for example, in your Google account).
  • ChromePasswordManagerClient::ShowKeyboardReplacingSurfaceOnAccountStorageNoticeDone: once that notice step is finished, the flow continues.
  • TouchToFillController::Show: the controller that actually drives the bottom sheet is asked to show it.

The report notes that some of these steps run asynchronously. Asynchronous means "not immediately": a step can start, hand control back, and finish later.

If there are no passkeys, the flow calls NoPasskeysBottomSheetBridge::Show, which creates a Java object NoPasskeysBottomSheetBridge(java). That Java object holds a native pointer to the C++ object NoPasskeysBottomSheetBridge, which is owned by TouchToFillController. "Owned" here means the controller is responsible for creating and destroying it.

The problem appears when the frame navigates away. A frame is one rectangular area of a web page; the top-level frame is the page itself, and pages can contain inner frames. Navigating away means the page (or frame) loads a different address, so the old page is torn down. TouchToFillController is notified through WebContentsObserver and resets the NoPasskeysBottomSheetBridge object. WebContentsObserver is a Chrome helper that lets a piece of code subscribe to events about a tab, such as "this tab is navigating". Nothing in that path notifies the Java side that the native object has been destroyed. The Java object keeps its stale native pointer, and a later JNI call that uses it accesses freed memory, producing the UAF.

The report includes three source excerpts, each tied to a numbered reference.

Creation of the Java object and storage of the native pointer:

Text
void Create(ui::WindowAndroid* window_android) override {      ==> [1]
  java_object_.Reset(Java_NoPasskeysBottomSheetBridge_Constructor(
      jni_zero::AttachCurrentThread(),
      reinterpret_cast<intptr_t>(bridge_.get()),
      window_android->GetJavaObject()));
}

NoPasskeysBottomSheetBridge(
        long nativeNoPasskeysBottomSheetBridge,
        WeakReference<Context> context,
        WeakReference<BottomSheetController> bottomSheetController) {
    mNativeBridge = nativeNoPasskeysBottomSheetBridge;      // ==> [2]
    mNoPasskeysSheet =
            new NoPasskeysBottomSheetCoordinator(context, bottomSheetController, this);
}

void TouchToFillController::OnDismiss() {
  view_.reset();
  no_passkeys_bridge_.reset();      // ==> [3]
  if (!ttf_delegate_) {
    // TODO(crbug.com/40274966): Remove this check when
    // PasswordSuggestionBottomSheetV2 is launched
    return;
  }
  // Unretained is safe here because TouchToFillController owns the delegate.
  ttf_delegate_->OnDismiss(base::BindOnce(
      &TouchToFillController::ActionCompleted, base::Unretained(this)));
}

Line by line, in plain words:

  • void Create(ui::WindowAndroid* window_android) override { starts a C++ function called Create that takes a pointer to an Android window object. override means it replaces a function declared in a parent class. The ==> [1] marker points to reference 1, the C++ source file.
  • java_object_.Reset(Java_NoPasskeysBottomSheetBridge_Constructor( begins creating the Java object. Reset replaces whatever the C++ side was holding with the new Java object.
  • jni_zero::AttachCurrentThread(), attaches the current thread to the Java virtual machine so that Java code can be called. jni_zero is a Chrome helper library that generates JNI glue code.
  • reinterpret_cast<intptr_t>(bridge_.get()), takes the address of the C++ object (bridge_.get()) and converts it to an integer (intptr_t). This integer is the native pointer that will be handed to Java. reinterpret_cast is a C++ cast that says "treat these bits as this other type".
  • window_android->GetJavaObject())); passes the Java window object as the third argument.
  • } closes the function.
  • NoPasskeysBottomSheetBridge( starts the Java constructor, the function that builds the Java object.
  • long nativeNoPasskeysBottomSheetBridge, is the first parameter: the native pointer, arriving as a Java long (a 64-bit integer).
  • WeakReference<Context> context, is a weak reference to the Android context. A weak reference does not keep the object alive; if nothing else holds it, it can be garbage collected.
  • WeakReference<BottomSheetController> bottomSheetController) { is a weak reference to the bottom sheet controller.
  • mNativeBridge = nativeNoPasskeysBottomSheetBridge; // ==> [2] stores the native pointer in a Java field called mNativeBridge. The ==> [2] marker points to reference 2, the Java source file. This is the line that creates the dangling pointer later.
  • mNoPasskeysSheet = starts assigning the coordinator object.
  • new NoPasskeysBottomSheetCoordinator(context, bottomSheetController, this); creates the coordinator that draws the sheet, passing the context, the controller and this (the Java object itself).
  • } closes the constructor.
  • void TouchToFillController::OnDismiss() { starts the C++ function that runs when the sheet is dismissed or the flow ends.
  • view_.reset(); destroys the view object.
  • no_passkeys_bridge_.reset(); // ==> [3] destroys the C++ NoPasskeysBottomSheetBridge. The ==> [3] marker points to reference 3, the controller source file. This is the line that frees the memory Java still points at.
  • if (!ttf_delegate_) { checks whether the delegate (the object that handles the result of the flow) exists.
  • // TODO(crbug.com/40274966): Remove this check when is a comment noting a future cleanup, tied to a Chromium bug number.
  • // PasswordSuggestionBottomSheetV2 is launched continues the comment.
  • return; exits early if there is no delegate.
  • } closes the check.
  • // Unretained is safe here because TouchToFillController owns the delegate. is a comment explaining why it is safe to pass a raw pointer to the delegate: the controller owns it.
  • ttf_delegate_->OnDismiss(base::BindOnce( calls the delegate's OnDismiss, wrapping a follow-up call so it runs later. base::BindOnce creates a callable that runs exactly once.
  • &TouchToFillController::ActionCompleted, base::Unretained(this))); is the follow-up: call ActionCompleted on this controller, using an unretained pointer to this.
  • } closes the function.

The three references point to the Chromium source at revision [redacted]. A revision is a specific saved snapshot of the source code, identified by a long hash, so that anyone can look at exactly the same lines later.

  1. chrome/browser/touch_to_fill/password_manager/no_passkeys/android/no_passkeys_bottom_sheet_bridge.cc, line 25.
  2. chrome/browser/touch_to_fill/password_manager/no_passkeys/internal/android/java/src/org/chromium/chrome/browser/touch_to_fill/no_passkeys/NoPasskeysBottomSheetBridge.java, line 38.
  3. chrome/browser/touch_to_fill/password_manager/touch_to_fill_controller.cc, line 188.

The report also states that the bug was introduced in the commit at https://chromium.googlesource.com/chromium/src/+/[redacted]. A commit is a saved change to the source code; this link points to the change that first brought the bug in. Finding the introducing commit is called bisection: you narrow down which change caused the problem by testing points in history.

Exploitation

Step 1: Simulate a compromised renderer

Apply the attached patch.diff to the Chrome build. The report says this patch exists to simulate a compromised renderer. The report does not include the contents of the patch.

Step 2: Host the proof of concept page

Serve poc.html from localhost and forward the port to the Android device:

Bash
python3 -m http.server 8000
adb reverse tcp:8000 tcp:8000

Line by line, in plain words:

  • python3 -m http.server 8000 starts a tiny web server using Python 3. The -m http.server part means "run the built-in HTTP server module", and 8000 is the port number. A port is a numbered door on a computer that network traffic can go through. This server serves files from the current folder, so poc.html must be in that folder.
  • adb reverse tcp:8000 tcp:8000 tells the Android device: any connection to port 8000 on the device should be forwarded back to port 8000 on the computer. This is needed because the phone and the computer are separate machines; without it, localhost on the phone would mean the phone itself, not the computer.

The first command starts a static HTTP server on port 8000 of the host. The second makes the device's port 8000 reach the host's port 8000, so the device can load the page from http://localhost:8000/poc.html. The report does not include the contents of poc.html.

Step 3: Launch the asan build and navigate

Bash
out/Default/bin/chrome_public_apk run --args='--disable-features=PasswordSuggestionBottomSheetV2'

Line by line, in plain words:

  • out/Default/bin/chrome_public_apk is the path to the built Chrome Android package inside the build output folder. out/Default is where the build system puts its results; bin is a folder of executables; chrome_public_apk is the build target name.
  • run is a subcommand that installs and launches the app on the connected device.
  • --args='--disable-features=PasswordSuggestionBottomSheetV2' passes a command line argument to Chrome. --disable-features= is a Chrome switch that turns off named features; here it turns off PasswordSuggestionBottomSheetV2.

This runs the asan build of Chrome on the device with PasswordSuggestionBottomSheetV2 disabled. The report explains that the feature is disabled by default but may be enabled on some custom builds, so it is disabled explicitly here. The report says the feature is disabled by default but may be enabled on some custom builds, so it is disabled explicitly here.

Then navigate to:

Text
http://localhost:8000/poc.html

This is the address of the proof of concept page on the local server, reached through the port forwarding set up in step 2. The renderer sends the ShowKeyboardReplacingSurface mojo message, the browser side reaches TouchToFillController::Show, and with no passkeys available it creates the NoPasskeysBottomSheetBridge Java object. Navigating the frame away triggers the reset of the native object through WebContentsObserver, and the stale pointer in the Java object is then used through JNI. In everyday terms: the page asks Chrome to show the password sheet, Chrome builds the sheet and hands Java a note saying "the C++ object lives at this address", then the page leaves, Chrome throws the C++ object away, and Java later reads the note and knocks on a door that no longer exists.

Step 4: Observe the crash

The report states the crash type is browser and that the crash state is in asan.log. The report does not reproduce the contents of asan.log, so the exact stack trace is not available here. A stack trace is the list of function calls that were active at the moment of the crash, like a receipt showing the path that led there. The report states the crash type is browser, not the renderer.

Root cause

The C++ NoPasskeysBottomSheetBridge is owned by TouchToFillController. The Java NoPasskeysBottomSheetBridge stores the native pointer in mNativeBridge and uses it for JNI calls. When the frame navigates away, TouchToFillController::OnDismiss calls no_passkeys_bridge_.reset(), which destroys the C++ object. No code in that path notifies the Java object that its native peer is gone, so the Java object keeps a dangling pointer. Any later JNI call that dereferences it is a use after free. "Dereference" means following the pointer to read or write the memory it points at.

A simple comparison: you write a friend's address on a sticky note. Your friend moves out. Nobody tells you. You later drive to the old address and walk into a stranger's house. The sticky note is the native pointer, the move is reset(), and the walk-in is the JNI call.

The report does not describe any existing defence that should have caught this. It does note that miracle ptr protection is marked as no, which is consistent with the pointer being held across the JNI boundary rather than in a normal C++ smart pointer. A smart pointer is a C++ object that automatically frees the thing it points at when it is no longer needed; a raw pointer is just a number with no such safety net. The report does not say whether any other mitigation was present.

Impact

The report classifies the crash as a browser process crash. The compromised renderer requirement is marked yes, so the trigger assumes the attacker already controls a render process. Under those conditions, the attacker can cause a use after free in the browser process by driving the Touch To Fill flow and then navigating the frame away. In plain words: the report proves a crash and a memory safety violation, not a full takeover.

Fix

It only identifies the missing notification from the C++ side to the Java side when NoPasskeysBottomSheetBridge is destroyed. A fix would need to make the Java object aware that its native peer has been reset, or otherwise prevent JNI calls from using the stale pointer after no_passkeys_bridge_.reset().

Variants to test

These are other places a researcher might look for the same kind of mistake. A variant is a similar bug in a nearby piece of code.

  • Other JNI bridge objects that hold a raw native pointer and are owned by a controller that can be reset on navigation. A positive result is a Java object whose native peer is destroyed without the Java side being notified, followed by a JNI call that uses the stale pointer.
  • Other bottom sheet or accessory flows reached from renderer-initiated mojo messages, especially ones with asynchronous steps between the message and the object creation. A positive result is a window where the frame can navigate away between creation and use.
  • Flows gated by feature flags that change which controller implementation is used, as with PasswordSuggestionBottomSheetV2 here. A positive result is a code path where the lifetime handling differs between flag states.
  • Objects created through jni_zero constructors that pass reinterpret_cast<intptr_t> of an owned pointer. A positive result is a constructor whose Java field is never cleared when the owner resets the C++ object.

Glossary

  • AddressSanitizer (asan): a debugging tool built into a special test build of a program that detects invalid memory access and writes a log when it happens.
  • adb (Android Debug Bridge): a command line tool that lets a computer communicate with an Android device.
  • adb reverse: an adb command that forwards a port on the device back to the computer.
  • Asynchronous: not immediate; a step can start, hand control back, and finish later.
  • Bottom sheet: a panel that slides up from the bottom of a mobile screen.
  • Browser process: the part of a browser that draws the window, manages tabs and talks to the operating system.
  • Bisection: narrowing down which change introduced a bug by testing points in the code's history.
  • Call chain: the list of functions that call one another in sequence.
  • Commit: a saved change to source code, identified by a hash.
  • Compromised renderer: a render process that an attacker controls.
  • CVE: a public identifier for a known security vulnerability.
  • Dangling pointer: a pointer to memory that has already been freed.
  • Dereference: following a pointer to read or write the memory it points at.
  • Feature flag: an internal switch that turns a piece of code on or off.
  • Frame: one rectangular area of a web page; the top-level frame is the page itself, and pages can contain inner frames.
  • JNI (Java Native Interface): the bridge that lets Java code call C++ code and vice versa.
  • jni_zero: a Chrome helper library that generates JNI glue code.
  • MiraclePtr: a Chrome defence that keeps C++ objects alive longer so a use after free is less likely to be exploitable.
  • Mojo: Chrome's message system for communication between processes.
  • Native pointer: a number that identifies the address of a C++ object in memory.
  • Passkey: a modern login credential stored on your device instead of a typed password.
  • Patch: a small file describing changes to source code.
  • Port: a numbered door on a computer that network traffic can go through.
  • Proof of concept (PoC): a small, deliberately harmless demonstration that triggers a bug.
  • Raw pointer: a plain memory address with no automatic safety net.
  • Renderer (render process): the part of a browser that reads web pages and runs their code.
  • Revision: a specific saved snapshot of source code, identified by a long hash.
  • Smart pointer: a C++ object that automatically frees the thing it points at when it is no longer needed.
  • Stack trace: the list of function calls active at the moment of a crash.
  • Touch To Fill: the Chrome flow that offers to fill in saved passwords when you tap a password field.
  • Use after free (UAF): using memory after it has been freed, which can crash the program or be exploited.
  • Variant: a similar bug in a nearby piece of code.
  • Weak reference: a reference that does not keep an object alive; the object can be garbage collected if nothing else holds it.
  • WebContentsObserver: a Chrome helper that lets code subscribe to events about a tab, such as navigation.

More by Anonymous

View all

2,270 more disclosed reports, best first.

More from Google Chrome

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.