Android kernel vulnerability and exploit with full source code
A memory corruption vulnerability in the Qualcomm QSEECOM driver allowed an attacker with access to the driver to cause an integer overflow in a kernel address calculation, leading to an arbitrary kernel write. This could enable privilege escalation and arbitrary code execution within the kernel.
bits-please.blogspot.com
Published on bits-please.blogspot.com
In this blog post we'll go over a Linux kernel privilege escalation vulnerability I discovered which enables arbitrary code execution within the kernel.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the driver failed to verify that the user-supplied shared buffer length matched the actual ION buffer size, allowing an integer overflow in the kernel address calculation.
Impact
An attacker with access to the QSEECOM driver could achieve arbitrary kernel write, leading to privilege escalation and code execution within the kernel.
What the attacker needed
Access to qseecom driver (e.g., via mediaserver); ability to allocate ION memory
The fix
The vulnerability was fixed by Qualcomm, as stated in the timeline.
How it was found
- Allocate a small ION buffer and map a huge fake shared buffer in user space using mmap.
- Call the QSEECOM IOCTL to set memory parameters, passing the fake buffer address and length.
- Trigger the QSEECOM_IOCTL_SEND_MODFD_CMD_REQ IOCTL with crafted request buffer address and offset to cause an integer overflow.
- Observe the write primitive by inspecting a user-space dropzone for changes.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
The QSEECOM driver lets Android apps talk to a secure part of the phone called TrustZone. The driver trusted a size value from the user without checking it properly, so a malicious app could trick the kernel into writing data to an address it chose, potentially taking full control of the phone.
What is Memory corruption?
Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.