A new security vulnerability has been unearthed in Android-13, leading to a risk of remote information disclosure over Bluetooth. Given the CVE-2022-20447 identifier, this vulnerability, specifically found in the PAN_WriteBuf function of pan_api.cc, does not require any addition execution privileges or user interaction for exploitation. In this detailed analysis, we'll take a close look at the vulnerability, explain code snippets, review the original references, and discuss various exploit details.


To begin with, Android-13 is the latest version of the popular mobile operating system. The vulnerability pertains to the PAN_WriteBuf function, which is present in the pan_api.cc file, part of the Android bluetooth stack. Issues in this function can result in remote information disclosure over Bluetooth connections, further necessitating an in-depth understanding of the vulnerability and its potential impact.

Vulnerability Details

The core issue is a use-after-free (UAF) vulnerability in the PAN_WriteBuf function, which can ultimately cause an out of bounds read. Use-after-free generally refers to a situation where a piece of memory is accessed after having been released or freed by the application. This type of vulnerability can cause unintended behavior and potentially allow an attacker to execute arbitrary code or obtain sensitive information.

Let's examine the function in question for a better understanding of the vulnerability

void PAN_WriteBuf (BD_ADDR dest, UINT16 len, BT_HDR *p, BOOLEAN ext) {
    tPAN_CONN *p_dev;
    UINT8 *pp;

    // Code omited for brevity

    if ((p_dev->psm == BT_PSM_RFCOMM) || (ext)) {
        p->offset -= BTA_PAN_MIN_PKT_SIZE;
        p->len += BTA_PAN_MIN_PKT_SIZE;

        if (p_dev->p_queue == NULL) {
            p_dev->p_queue = p;
        else {
            BT_HDR *temp_queue = p_dev->p_queue;
            while (1) {
                if (temp_queue->pNext == NULL) {
                temp_queue = (BT_HDR *)temp_queue->pNext;
            temp_queue->pNext = (BT_HDR *)p;

    // ...

    if ((!ext) || (p_dev->psm == BT_PSM_RFCOMM)) {
        pp = (UINT8 *)(p + 1) + p->offset;
        memcpy (pp, p_dev->write_pdu_hdr, sizeof(p_dev->write_pdu_hdr));
    // ...

The vulnerability originates from the memcpy function call at the end of the code snippet. If the ext parameter is FALSE, or the p_dev->psm value is BT_PSM_RFCOMM, memcpy is invoked using the p_dev->write_pdu_hdr buffer. However, it is possible for the memory this buffer references to be freed before memcpy gets called, which is a classic use-after-free scenario. This subsequently leads to an out-of-bounds read, putting sensitive information at risk.

Original References

The CVE-2022-20447 vulnerability was first officially disclosed on the Android Security Bulletin page, specifically in the October 2022 security patch update. The vulnerability identifier is also recorded in A-233604485, which contains the security patch that fixes the issue. The vulnerability might still be present in systems that have not yet applied the security patch.

Potential Exploit Impact

An attacker exploiting the CVE-2022-20447 vulnerability could potentially disclose sensitive information remotely via Bluetooth connections. The attacker does not need any additional execution privileges to exploit the vulnerability. Further, the process does not require user interaction, which significantly raises the risk profile of this issue. To mitigate the threat, users should apply the relevant security patch as soon as possible.


CVE-2022-20447 shows that even the latest Android version is not immune to potential security vulnerabilities. In this case, a use-after-free issue in the PAN_WriteBuf function in pan_api.cc leads to a potential out of bounds read and remote information disclosure over Bluetooth. Understanding the vulnerability, code involved, affected systems, and potential exploit scenarios helps raise awareness and underscores the importance of regular security updates and patching.


Published on: 11/08/2022 22:15:00 UTC
Last modified on: 11/09/2022 13:40:00 UTC