Google On-line Safety Weblog: Google & Arm

Google On-line Safety Weblog: Google & Arm


Who cares about GPUs?

You, me, and your complete ecosystem! GPUs (graphics processing models) are important in delivering wealthy visible experiences on cell gadgets. Nonetheless, the GPU software program and firmware stack has develop into a method for attackers to realize permissions and entitlements (privilege escalation) to Android-based gadgets. There are many points on this class that may have an effect on all main GPU manufacturers, for instance, CVE-2023-4295, CVE-2023-21106, CVE-2021-0884, and extra. Most exploitable GPU vulnerabilities are within the implementation of the GPU kernel mode modules. These modules are items of code that load/unload throughout runtime, extending performance with out the necessity to reboot the gadget.

Proactive testing is nice hygiene as it may result in the detection and backbone of recent vulnerabilities earlier than they’re exploited. It’s additionally one of the advanced investigations to do as you don’t essentially know the place the vulnerability will seem (that’s the purpose!). By combining the experience of Google’s engineers with IP homeowners and OEMs, we are able to make sure the Android ecosystem retains a robust measure of integrity.

Why examine GPUs?

When researching vulnerabilities, GPUs are a well-liked goal as a consequence of:

  1. Performance vs. Safety Tradeoffs

    No person desires a gradual, unresponsive gadget; any hits to GPU efficiency may lead to a noticeably degraded consumer expertise. As such, the GPU software program stack in Android depends on an in-process HAL mannequin the place the API & consumer area drivers speaking with the GPU kernel mode module are operating immediately inside the context of apps, thus avoiding IPC (interprocess communication). This opens the door for probably untrusted code from a 3rd celebration app with the ability to immediately entry the interface uncovered by the GPU kernel module. If there are any vulnerabilities within the module, the third celebration app has an avenue to use them. Consequently, a probably untrusted code operating within the context of the third celebration utility is ready to immediately entry the interface uncovered by the GPU kernel module and exploit potential vulnerabilities within the kernel module.

  2. Selection & Reminiscence Security

    Moreover, the implementation of GPU subsystems (and kernel modules particularly) from main OEMs are more and more advanced. Kernel modules for many GPUs are sometimes written in reminiscence unsafe languages equivalent to C, that are vulnerable to reminiscence corruption vulnerabilities like buffer overflow.

Can somebody do one thing about this?

Nice information, we have already got! Who’s we? The Android Crimson Workforce and Arm! We’ve labored collectively to run an engagement on the Mali GPU (extra on that under), however first, a quick introduction:

Android Crimson Workforce

The Android Crimson Workforce performs time-bound safety evaluation engagements on all facets of the Android open supply codebase and conducts common safety evaluations and assessments of inner Android elements. All through these engagements, the Android Crimson Workforce commonly collaborates with third celebration software program and {hardware} suppliers to investigate and perceive proprietary and “closed supply” code repositories and related supply code which are utilized by Android merchandise with the only real goal to establish safety dangers and potential vulnerabilities earlier than they are often exploited by adversaries outdoors of Android. This 12 months, the Android Crimson Workforce collaborated immediately with our trade companion, Arm, to conduct the Mali GPU engagement and additional safe tens of millions of Android gadgets.

Arm Product Safety and GPU Groups

Arm has a central product safety crew that units the coverage and follow throughout the corporate. In addition they have devoted product safety consultants embedded in engineering groups. Arm operates a scientific strategy which is designed to stop, uncover, and remove safety vulnerabilities. This features a Safety Improvement Lifecycle (SDL), a Monitoring functionality, and Incident Response. For this collaboration the Android Crimson Groups had been supported by the embedded safety consultants based mostly in Arm’s GPU engineering crew.

Working collectively to safe Android gadgets

Google’s Android Safety groups and Arm have been working collectively for a very long time. Safety necessities are by no means static, and challenges exist with all GPU distributors. By incessantly sharing experience, the Android Crimson Workforce and Arm had been capable of speed up detection and backbone. Investigations of recognized vulnerabilities, potential remediation methods, and hardening measures drove detailed analyses and the implementation of fixes the place related.

Latest analysis targeted on the Mali GPU as a result of it’s the most well-liked GPU in at present’s Android gadgets. Collaborating on GPU safety allowed us to:

  1. Assess the affect on the broadest phase of the Android Ecosystem: The Arm Mali GPU is among the most used GPUs by unique tools producers (OEMs) and is discovered in lots of well-liked cell gadgets. By specializing in the Arm Mali GPU, the Android Crimson Workforce may assess the safety of a GPU implementation operating on tens of millions of Android gadgets worldwide.
  2. Consider the reference implementation and vendor-specific modifications: Telephone producers usually modify the upstream implementation of GPUs. This tailors the GPU to the producer’s particular gadget(s). These modifications and enhancements are at all times difficult to make, and may generally introduce safety vulnerabilities that aren’t current within the unique model of the GPU upstream. On this particular occasion, the Google Pixel crew actively labored with the Android Crimson Workforce to higher perceive and safe the modifications they made for Pixel gadgets.

Enhancements

Investigations have led to vital enhancements, leveling up the safety of the GPU software program/firmware stack throughout a large phase of the Android ecosystem.

Testing the kernel driver

One key element of the GPU subsystem is its kernel mode driver. Throughout this engagement, each the Android Crimson Workforce and Arm invested vital effort trying on the Mali kbase kernel driver. As a result of its complexity, fuzzing was chosen as the first testing strategy for this space. Fuzzing automates and scales vulnerability discovery in a method not doable through handbook strategies. With assist from Arm, the Android Crimson Workforce added extra syzkaller fuzzing descriptions to match the newest Mali kbase driver implementation.

The crew constructed just a few customizations to allow fuzzing the Mali kbase driver within the cloud, with out bodily {hardware}. This supplied an enormous enchancment to fuzzing efficiency and scalability. With the Pixel crew’s help, we additionally had been capable of arrange fuzzing on precise Pixel gadgets. Via the mixture of cloud-based fuzzing, Pixel-based fuzzing, and handbook overview, we had been capable of uncover two reminiscence points in Pixel’s customization of driver code (CVE-2023-48409 and CVE-2023-48421).

Each points occurred within the gpu_pixel_handle_buffer_liveness_update_ioctl operate, which is applied by the Pixel crew as a part of gadget particular customization. These are each reminiscence points attributable to integer overflow issues. If exploited fastidiously alongside different vulnerabilities, these points may result in kernel privilege escalation from consumer area. Each points had been mounted and the patch was launched to affected gadgets in Pixel safety bulletin 2023-12-01.

Testing the firmware

Firmware is one other basic constructing block of the GPU subsystem. It’s the middleman working with kernel drivers and GPU {hardware}. In lots of instances, firmware performance is immediately/not directly accessible from the appliance. So “utility ⇒ kernel ⇒ firmware ⇒ kernel” is a recognized assault circulation on this space. Additionally, typically, firmware runs on embedded microcontrollers with restricted assets. Generally used safety kernel mitigations (ASLR, stack safety, heap safety, sure sanitizers, and so forth.) won’t be relevant to firmware as a consequence of useful resource constraints and efficiency affect. This will make compromising firmware simpler, in some instances, than immediately compromising kernel drivers from consumer area. To check the integrity of present firmware, the Android Crimson Workforce and Arm labored collectively to carry out each fuzzing and formal verification together with handbook evaluation. This multi-pronged strategy led to the invention of CVE-2024-0153, which had a patch launched in the July 2024 Android Safety Bulletin.

CVE-2024-0153 occurs when GPU firmware handles sure directions. When dealing with such directions, the firmware copies register content material right into a buffer. There are measurement checks earlier than the copy operation. Nonetheless, below very particular situations, an out-of-bounds write occurs to the vacation spot buffer, resulting in a buffer overflow. When fastidiously manipulated, this overflow will overwrite another essential constructions following the buffer, inflicting code execution within the GPU firmware.

The situations needed to achieve and probably exploit this concern are very advanced because it requires a deep understanding of how directions are executed. With collective experience, the Android Crimson Workforce and Arm had been capable of confirm the exploitation path and leverage the difficulty to realize restricted management of GPU firmware. This ultimately circled again to the kernel to acquire privilege escalation. Arm did a superb job to reply shortly and remediate the difficulty. Altogether, this highlights the energy of collaboration between each groups to dive deeper.

Time to Patch

It’s recognized that attackers exploit GPU vulnerabilities within the wild, and time to patch is essential to cut back threat of exploitation and shield customers. On account of this engagement, 9 new Safety Check suite (STS) exams had been constructed to assist companions routinely test their builds for lacking Mali kbase patches. (Safety Check Suite is software program supplied by Google to assist companions automate the method of checking their builds for lacking safety patches.)

What’s Subsequent?

The Arm Product Safety Workforce is actively concerned in security-focused trade communities and collaborates intently with its ecosystem companions. The engagement with the Android Crimson Workforce, as an illustration, gives precious enablement that drives greatest practices and product excellence. Constructing on this collaborative strategy, Arm is complementing its product safety assurance capabilities with a bug bounty program. This funding will broaden Arm’s efforts to establish potential vulnerabilities. For extra info on Arm’s product safety initiatives, please go to this product safety web page.

The Android Crimson Workforce and Arm proceed to work collectively to proactively increase the bar on GPU safety. With thorough testing, fast fixing, and updates to the safety take a look at suite, we’re bettering the ecosystem for Android customers. The Android Crimson Workforce appears ahead to replicating this working relationship with different ecosystem companions to make gadgets safer.

Leave a Reply

Your email address will not be published. Required fields are marked *