Using Chrome’s accessibility APIs to search out safety bugs

0
285
Using Chrome’s accessibility APIs to search out safety bugs


Chrome’s consumer interface (UI) code is advanced, and typically has bugs.

Are these bugs safety bugs? Specifically, if a consumer’s clicks and actions lead to reminiscence corruption, is that one thing that an attacker can exploit to hurt that consumer?

Our safety severity tips say “yes, sometimes.” For instance, an attacker might very doubtless persuade a consumer to click on an autofill immediate, however it is going to be a lot tougher to persuade the consumer to step by way of a complete circulate of various dialogs.

Even if these bugs aren’t the most simply exploitable, it takes a substantial amount of time for our safety shepherds to make these determinations. User interface bugs are sometimes flakey (that’s, not reliably reproducible). Also, even when these bugs aren’t essentially deemed to be exploitable, they might nonetheless be annoying crashes which trouble the consumer.

It can be nice if we might discover these bugs mechanically.

If solely the entire tree of Chrome UI controls have been uncovered, one way or the other, such that we might enumerate and work together with every UI management mechanically.

Aha! Chrome exposes all of the UI controls to assistive expertise. Chrome goes to nice lengths to make sure its complete UI is uncovered to display screen readers, braille gadgets and different such assistive tech. This tree of controls contains all of the toolbars, menus, and the construction of the web page itself. This structural definition of the browser consumer interface is already typically utilized in different contexts, for instance by some password managers, demonstrating that investing in accessibility has advantages for all customers. We’re now taking that funding and leveraging it to search out safety bugs, too.

Specifically, we’re now “fuzzing” that accessibility tree – that’s, interacting with the completely different UI controls semi-randomly to see if we will make issues crash. This method has a lengthy pedigree.

Screen reader expertise is a bit completely different on every platform, however on Linux the tree could be explored utilizing Accerciser.

Screenshot of Accerciser exhibiting the tree of UI controls in Chrome

All we now have to do is discover the identical tree of controls with a fuzzer. How laborious can or not it’s?

“We do this not because it is easy, but because we thought it would be easy” – Anon.

Actually we by no means thought this is able to be simple, and some completely different bits of tech have needed to fall into place to make this doable. Specifically,

  • There are a lot of mixtures of the way to work together with Chrome. Truly randomly clicking on UI controls most likely gained’t discover bugs – we wish to leverage coverage-guided fuzzing to assist the fuzzer choose mixtures of controls that appear to succeed in into new code inside Chrome.
  • We want any such bugs to be real. We subsequently have to fuzz the precise Chrome UI, or one thing very related, fairly than exercising components of the code in an unrealistic unit-test-like context. That’s the place our InProcessFuzzer framework comes into play – it runs fuzz instances inside a Chrome browser_test; basically an actual model of Chrome.
  • But such browser_tests have a excessive startup price. We have to amortize that price over hundreds of take a look at instances by operating a batch of them inside every browser invocation. Centipede is designed to try this.
  • But every take a look at case gained’t be idempotent. Within a given invocation of the browser, the UI state could also be successively modified by every take a look at case. We intend so as to add concatenation to centipede to resolve this.
  • Chrome is a loud atmosphere with a lot of timers, which can effectively confuse coverage-guided fuzzers. Gathering protection for such a big binary is gradual in itself. So, we don’t know if coverage-guided fuzzing will efficiently discover the UI paths right here.

All of those issues are widespread to the opposite fuzzers which run within the browser_test context, most notably our new IPC fuzzer (weblog posts to comply with). But the UI fuzzer offered some particular challenges.

Finding UI bugs is just helpful in the event that they’re actionable. Ideally, which means:

  • Our fuzzing infrastructure provides a radical set of diagnostics.
  • It can bisect to search out when the bug was launched and when it was mounted.
  • It can decrease advanced take a look at instances into the smallest doable reproducer.
  • The take a look at case is descriptive and says which UI controls have been used, so a human might be able to reproduce it.

These necessities collectively imply that the take a look at instances ought to be secure throughout every Chrome model – if a given take a look at case reproduces a bug with Chrome 125, hopefully it’s going to accomplish that in Chrome 124 and Chrome 126 (assuming the bug is current in each). Yet that is tough, since Chrome UI controls are deeply nested and infrequently nameless.

Initially, the fuzzer picked controls merely based mostly on their ordinal at every degree of the tree (as an example “control 3 nested in control 5 nested in control 0”) however such take a look at instances are unlikely to be secure because the Chrome UI evolves. Instead, we settled on an method the place the controls are named, when doable, and in any other case recognized by a mixture of position and ordinal. This yields take a look at instances like this:

motion {
path_to_control {
named {
title: “Test – Chromium”
}
}
path_to_control {
nameless {
position: “panel”
}
}
path_to_control {
nameless {
position: “panel”
}
}
path_to_control {
nameless {
position: “panel”
}
}
path_to_control {
named {
title: “Bookmarks”
}
}
take_action {
action_id: 12
}
}

Fuzzers are unlikely to stumble throughout these management names by likelihood, even with the instrumentation utilized to string comparisons. In truth, this by-name method turned out to be solely 20% as efficient as choosing controls by ordinal. To resolve this we added a customized mutator which is wise sufficient to place in place management names and roles that are recognized to exist. We randomly use this mutator or the usual libprotobuf-mutator to be able to get the most effective of each worlds. This method has confirmed to be about 80% as fast as the unique ordinal-based mutator, whereas offering secure take a look at instances.

Chart of code protection achieved by minutes fuzzing with completely different methods

So, does any of this work?

We don’t know but! – and you’ll comply with alongside as we discover out. The fuzzer discovered a few potential bugs (at the moment entry restricted) within the accessibility code itself however hasn’t but explored far sufficient to find bugs in Chrome’s basic UI. But, on the time of writing, this has solely been operating on our ClusterFuzz infrastructure for just a few hours, and isn’t but engaged on our protection dashboard. If you’d prefer to comply with alongside, control our protection dashboard because it expands to cowl UI code.

LEAVE A REPLY

Please enter your comment!
Please enter your name here