<html><body><p>Google Chrome Browser 111.0.5563.64 AXPlatformNodeCocoa Fatal OOM/Crash (macOS)

Vendor: Google LLC
Product web page:
Affected version: 111.0.5563.64 (Official Build) (x86_64)
                  110.0.5481.100 (Official Build) (x86_64)
                  108.0.5359.124 (Official Build) (x86_64)
                  108.0.5359.98 (Official Build) (x86_64)
Fixed version: 112.0.5615.49 (Official Build) (x86_64)

Summary: Google Chrome browser is a free web browser used for
accessing the internet and running web-based applications. The
Google Chrome browser is based on the open source Chromium web
browser project. Google released Chrome in 2008 and issues several
updates a year.

Desc: Fatal OOM/crash of Chrome browser while detaching/attaching
tabs on macOS.

Commit fix:

"The original cl landed many months ago, but
is the only change that didn't revert cleanly."

macOS a11y: Implement accessibilityHitTest for remote app shims (PWAs)

Implements accessibility hit testing for RemoteCocoa so that Hover Text
and VoiceOver mouse mode can read the accessible objects under the
user's pointer. Cross-process plumbing was needed because RemoteCocoa
bridges to native controls in a separate app shim process and must
report accessibility trees from the browser process via the
undocumented NSAccessibilityRemoteUIElement mechanism.

This CL does the following:

1. Unblocks remote accessibilityHitTest by calling setRemoteUIApp:YES
   in the browser process. This enables the browser process to accept
   redirected accessibilityHitTest calls to the object corresponding to
   any NSAccessibilityRemoteUIElement returned by the original
   accessibilityHitTest at the app shim process.

2. (For Browser UI) Overrides NativeWidgetMacNSWindowTitledFrame's
   accessibilityHitTest to have a custom implementation with
   NSAccessibilityRemoteUIElement support so that custom window
   controls can be found. Additionally, adjusts the BrowserView bounds
   so that AXPlatformNodeCocoa's accessibilityHitTest (which doesn't
   support view targeting) can return controls in the web app frame

3. (For Web Content) Implements RenderWidgetHostViewCocoa's
   accessibilityHitTest for instances in the app shim to return a
   NSAccessibilityRemoteUIElement corresponding to their counterparts
   in the browser process so that web content objects can be found.

Tested on: macOS 12.6.1 (Monterey)
           macOS 13.3.1 (Ventura)

Vulnerability discovered by Gjoko 'LiquidWorm' Krstic

Advisory ID: ZSL-2023-5770
Advisory URL:



1. Grab a tab and detach it.
2. Bring back the tab.
3. Do this 2-3 times attaching / re-attaching the tab.
4. Chrome will hang (100% CPU) / Out-of-Memory (OOM) for 7-8 minutes.
5. Process crashes entirely.

Ref: Issue 1400682 (Ticket created: Dec 13, 2022)
Ref: terminal PoC by (

// Copyright (c) Microsoft Corporation. All rights reserved.

#include <applicationservices>

#include <iostream>
#include <sstream>
#include <vector>

    AXError _AXUIElementGetWindow(AXUIElementRef, CGWindowID *);
    CFTypeID AXTextMarkerGetTypeID();

std::ostream&amp; bold_on(std::ostream&amp; os)
    if (isatty(STDOUT_FILENO))
        return os &lt;&lt; "\e[1m";
    return os;

std::ostream&amp; bold_off(std::ostream&amp; os)
    if (isatty(STDOUT_FILENO))
        return os &lt;&lt; "\e[0m";
    return os;

std::string from_cfstr(CFTypeRef cf_ref)
    if (cf_ref != nullptr &amp;&amp; CFGetTypeID(cf_ref) == CFStringGetTypeID())
        const auto cf_str = static_cast<cfstringref>(cf_ref);
        const auto max_length = static_cast<size_t>(CFStringGetMaximumSizeForEncoding(
            CFStringGetLength(cf_str), kCFStringEncodingUTF8)) + 1;

        auto result = std::string(max_length, '\0');
        if (CFStringGetCString(cf_str,, static_cast<cfindex>(max_length), kCFStringEncodingUTF8))
            if (const auto pos = result.find('\0'); pos != std::string::npos)
            return result;
    return {};

std::string ax_element_id(AXUIElementRef value)
    // AX element cache - AX elements are backed by CFData
    // (referring to 'remote' AX objects) and this data is
    // 'stable' across 'volatile' instances of AXUIElement.
    // 'hash and equality' of AX elements are based on this
    // data and therefore, we can use AXUIElement objects as
    // 'keys' in a dictionary with values, identifying these
    // objects (uniquely).
    const static auto ax_elements = CFDictionaryCreateMutable(kCFAllocatorDefault, 0,
        &amp;kCFTypeDictionaryKeyCallBacks, &amp;kCFTypeDictionaryValueCallBacks);

    auto ax_id = CFDictionaryGetValue(ax_elements, value);

    if (ax_id == nullptr)
        if (const auto uuid = CFUUIDCreate(kCFAllocatorDefault))
            if (const auto uuid_s = CFUUIDCreateString(kCFAllocatorDefault, uuid))
                CFDictionarySetValue(ax_elements, value, uuid_s);


        ax_id = CFDictionaryGetValue(ax_elements, value);

    return from_cfstr(ax_id);

template <typename t="">
T ax_attribute_value(AXUIElementRef e, CFStringRef name)
    if (e != nullptr)
        auto ref = T{};
        if (AXUIElementCopyAttributeValue(e, name, (CFTypeRef *) &amp;ref) == kAXErrorSuccess)
            return ref;
    return nullptr;

void ax_traverse(AXUIElementRef elem, uint32_t depth)
    const auto max_depth = 10;
    if (depth &gt; max_depth)

    const auto indent = [&amp;]()
        for (auto x = 0; x &lt; depth; x++)
            std::cout &lt;&lt; "  ";

    auto wid = CGWindowID{};
    if (_AXUIElementGetWindow(elem, &amp;wid) != kAXErrorSuccess)
        wid = 0;

    const auto role = ax_attribute_value<cftyperef>(elem, kAXRoleAttribute);

    std::cout &lt;&lt; bold_on &lt;&lt; "[*** DEPTH: " &lt;&lt; depth &lt;&lt; ", ROLE: " &lt;&lt; from_cfstr(role) &lt;&lt;
        ", ID: " &lt;&lt; ax_element_id(elem) &lt;&lt; ", WINDOW: " &lt;&lt; wid &lt;&lt; " ***]" &lt;&lt; bold_off &lt;&lt;

    if (const auto children = ax_attribute_value<cfarrayref>(elem, kAXChildrenAttribute))
        for (CFIndex idx = 0; idx &lt; CFArrayGetCount(children); idx++)
            const auto element = static_cast<axuielementref>(CFArrayGetValueAtIndex(children, idx));
            ax_traverse(element, depth + 1);

int main(int argc, char* const argv[])
    auto pid = 0;

    if (argc &gt; 1)
        if (!AXIsProcessTrusted())
            std::cerr &lt;&lt; "Please 'AX approve' Terminal in System Preferences" &lt;&lt; std::endl;
            exit(1); // NOLINT
        pid = std::stoi(argv[1]);
        std::cerr &lt;&lt; "usage: axtester <pid>" &lt;&lt; std::endl;
        exit(1); // NOLINT

    if (const auto app = AXUIElementCreateApplication(pid))
        auto observer = AXObserverRef{};
        auto ret = AXObserverCreate(pid, [](auto /*unused*/, AXUIElementRef /*unused*/, CFStringRef name, auto ctx)
                auto myapp = (__AXUIElement*)(ctx);
                auto hint = CFStringGetCStringPtr(name,kCFStringEncodingUTF8);
                std::cout &lt;&lt; "Hint: " &lt;&lt; hint &lt;&lt; std::endl;
                ax_traverse(myapp, 0);
            }, &amp;observer);

        if (kAXErrorSuccess != ret)
            std::cerr &lt;&lt; "Fail to create observer" &lt;&lt; std::endl;
            return -1;

        std::cout &lt;&lt; "title:" &lt;&lt; AXObserverAddNotification(observer, app, kAXTitleChangedNotification, (void*)app) &lt;&lt; std::endl;
        std::cout &lt;&lt; "focus_window:" &lt;&lt; AXObserverAddNotification(observer, app, kAXFocusedWindowChangedNotification, (void*)app) &lt;&lt; std::endl;
        std::cout &lt;&lt; "focus_element:" &lt;&lt; AXObserverAddNotification(observer, app, kAXFocusedUIElementChangedNotification, (void*)app) &lt;&lt; std::endl;
        std::cout &lt;&lt; "move:" &lt;&lt; AXObserverAddNotification(observer, app, kAXWindowMovedNotification, (void*)app) &lt;&lt; std::endl;
        std::cout &lt;&lt; "resize:" &lt;&lt; AXObserverAddNotification(observer, app, kAXWindowResizedNotification, (void*)app) &lt;&lt; std::endl;
        std::cout &lt;&lt; "deminiaturized:" &lt;&lt; AXObserverAddNotification(observer, app, kAXWindowDeminiaturizedNotification, (void*)app) &lt;&lt; std::endl;
        std::cout &lt;&lt; "miniaturize:" &lt;&lt; AXObserverAddNotification(observer, app, kAXWindowMiniaturizedNotification, (void*)app) &lt;&lt; std::endl;
        CFRunLoopAddSource(CFRunLoopGetCurrent(), AXObserverGetRunLoopSource(observer), kCFRunLoopDefaultMode);

    return 0;

--codeaibot explains--

This is a C++ program that uses the Accessibility API (AX) provided
by macOS to traverse the user interface of a running application and
print out information about the accessibility elements that it finds.

The program takes a single argument, which is the process ID (PID) of
the application to examine. If no argument is provided, the program
displays a usage message and exits.

The main() function first checks if the Terminal app has been granted
accessibility privileges by calling the AXIsProcessTrusted() function.
If it hasn't, the program displays an error message and exits.

If the Terminal app has been granted accessibility privileges, the program
creates an AXUIElementRef object for the application using the AXUIElementCreateApplication()
function, passing in the PID as an argument.

The ax_traverse() function is then called with the root accessibility
element of the application as an argument. This function recursively
traverses the accessibility tree of the application, printing out
information about each element it encounters.

The program also defines several helper functions for working with Core
Foundation types (from_cfstr(), ax_element_id(), and ax_attribute_value()),
as well as some functions for printing formatted output to the console
(bold_on() and bold_off()).

-- / --

As this issue is not a security issue nor results in security consequences,
this report is not eligible for a VRP reward.

Thank you Amy!