Kuboid
Open Luck·Kuboid.in
Black Hat2023
Open in YouTube ↗

Physical Attacks Against Smartphones

Black Hat3,343 views36:29about 2 years ago

This talk demonstrates two physical attack vectors against Android smartphones: command injection in a system-level service to gain root access on a locked bootloader, and a USB descriptor overwrite vulnerability in the Exynos secondary bootloader. The speaker details how these vulnerabilities allow for arbitrary memory read/write, bypassing secure boot and enabling code execution. The research highlights that even hardened devices with secure boot can be compromised through physical access and low-level protocol manipulation. The presentation includes a live demonstration of bypassing bootloader security to gain root access.

Bypassing Android Secure Boot: Physical Attacks on Locked Bootloaders

TLDR: This research demonstrates how physical access to Android devices can bypass secure boot mechanisms through command injection in system-level services and USB descriptor manipulation. By exploiting these low-level protocols, researchers can gain root access or execute arbitrary code even on devices with locked bootloaders. These findings emphasize that physical security remains a critical, often overlooked, layer in the mobile threat model.

Modern mobile security relies heavily on the assumption that a locked bootloader prevents unauthorized code execution. We treat the boot chain as a trusted foundation, assuming that if the hardware is locked, the OS integrity is guaranteed. However, this research from Black Hat 2023 proves that physical access to a device, combined with a deep understanding of low-level protocols, can effectively dismantle these protections. For anyone performing mobile penetration testing or hardware security research, these techniques are a reminder that the "locked" state is not an absolute barrier.

Command Injection in System-Level Services

The first case study focuses on gaining root access on a device where standard bootloader unlocking is disabled. On many Android devices, the bootloader is the primary gatekeeper. When an OEM disables the standard fastboot oem unlock path, they often rely on proprietary engineering applications to manage device state.

The research identified a system-level service responsible for archiving and backing up application data. This service, which runs with root privileges, was found to be vulnerable to command injection through its file-handling logic. Specifically, the service failed to sanitize file names when performing backup operations. By crafting a file name containing backticks, an attacker can force the service to execute arbitrary shell commands as root.

# Example of a malicious file name payload
`sleep 30000`.zip

While SELinux is typically present on these devices to restrict process interactions, the research found that the command injection vulnerability allowed for access to application data, even if it did not immediately grant full system control. The key takeaway here is that system-level services often operate with elevated privileges and are rarely audited with the same rigor as user-facing applications. If you are testing an Android device, look for services that interact with the file system or perform backup tasks; these are prime candidates for injection vulnerabilities.

USB Descriptor Overwrite on Exynos Chipsets

The second, more technical attack targets the secondary bootloader on Samsung devices using the Exynos 850 chipset. The vulnerability lies in the USB protocol implementation within the bootloader, specifically during the handling of control transfers.

USB control transfers use standard parameters, including bmRequestType, bRequest, wValue, and wIndex. The research discovered that the bootloader failed to validate the direction of these transfers. By sending a malformed GET_DESCRIPTOR request, an attacker can trigger a buffer overflow in the control transfer buffer. Because the bootloader does not check the size of the data being sent, it is possible to overwrite adjacent memory.

This memory corruption allows for an arbitrary read/write primitive within the bootloader’s context. By brute-forcing memory, researchers can identify pointers to other descriptors and eventually gain full read/write access to the device's L1 memory. This effectively bypasses secure boot, as the attacker can modify the kernel in memory before it is executed.

For those interested in the technical implementation, the research highlights how USB control transfers are often treated as trusted by bootloader code. If you are auditing hardware, focus on the USB stack implementation. Tools like Heimdall can be used to interact with these low-level protocols, providing a starting point for fuzzing and vulnerability discovery.

Real-World Implications for Pentesters

These attacks are not theoretical; they require physical access, but they bypass the most significant software-based security controls on the device. In a red team engagement, if you can obtain a physical device, you are no longer limited by the OS-level restrictions. You can extract data, modify the kernel, or install persistent backdoors that survive standard reboots.

The impact is severe. By gaining root access or kernel-level execution, you can disable Android's security features like file-based encryption or root detection mechanisms. This is particularly relevant for forensic analysis or when attempting to bypass enterprise-managed security policies.

Defensive Considerations

Defending against these attacks is difficult because they exploit the trust relationship between hardware and low-level firmware. OEMs should prioritize the hardening of their secondary bootloaders and ensure that all USB protocol implementations strictly validate control transfer parameters. Furthermore, implementing Hardware-backed Keystore can help mitigate the impact of kernel-level compromises by ensuring that cryptographic keys remain inaccessible even if the OS is subverted.

Physical security is not just about locking the screen; it is about ensuring that the entire boot chain is resilient against low-level protocol manipulation. As researchers, we must continue to push into these lower layers, as that is where the most effective bypasses are found. If you are working on a security assessment, do not assume the bootloader is a black box. Treat it as part of the attack surface.

Talk Type
research presentation
Difficulty
expert
Has Demo Has Code Tool Released


Black Hat USA 2023

118 talks · 2023
Browse conference →
Premium Security Audit

We break your app before they do.

Professional penetration testing and vulnerability assessments by the Kuboid Secure Layer team. Securing your infrastructure at every layer.

Get in Touch
Official Security Partner
kuboid.in