explaingit

sgkdev/ptrace_may_dream

13CAudience · researcherComplexity · 5/5ActiveSetup · hard

TLDR

A proof-of-concept exploit for CVE-2026-46333, a race in ptrace_may_access that lets a local user steal a file descriptor from accounts-daemon over D-Bus.

Mindmap

mindmap
  root((ptrace_may_dream))
    Inputs
      Retry count
      Thread count
      FD slot
    Outputs
      Stolen D-Bus FD
      Modified user account
    Use Cases
      Reproduce CVE locally
      Study kernel race bugs
      Test patch effectiveness
    Tech Stack
      C
      Linux kernel
      D-Bus

Things people build with this

USE CASE 1

Reproduce CVE-2026-46333 on a patched test VM to verify defenses

USE CASE 2

Study the pidfd_getfd race against process exit in ptrace_may_access

USE CASE 3

Test detection rules for D-Bus FD theft from accounts-daemon

USE CASE 4

Compare RHEL 10 and Fedora 44 behavior under the same exploit

Tech stack

CLinuxD-Bus

Getting it running

Difficulty · hard Time to first run · 1day+

Targets specific kernels on RHEL 10 and Fedora 44, requires editing a hardcoded password, and is a destructive PoC that should only run on isolated test systems.

In plain English

This repository is a proof of concept exploit for a Linux kernel security flaw, tracked as CVE-2026-46333. The README explains, in technical terms, that the bug is a race condition inside a kernel function called ptrace_may_access. When a process is dying and the kernel has already released its memory map, the access check that normally protects one process from peeking into another is skipped. The exploit races a system call called pidfd_getfd against process exit to steal file descriptors from a more privileged process. In plain terms, the kernel briefly opens a small window where an unprivileged user on the same Linux machine can reach into a privileged program and borrow one of its open connections. The README says the demonstration targets a system service called accounts-daemon. By stealing the daemon's connection to D-Bus, the program then sends commands that change another user account, setting its shell, account type, and password, which promotes the attacker to an administrator with a known password. The author notes that the exploit hardcodes the password it sets and tells anyone building it to edit that value in the source first. It has been tested on Red Hat Enterprise Linux 10 and Fedora 44, where the D-Bus broker exposes its socket on file descriptor number 5. Building and running, according to the README, is just make followed by ptrace_may_dream, with optional flags for the number of retries, the number of threads, and which file descriptor slot to target. The README closes with a joke quoting the kernel: the process is dead, long live the process. The repository has no separate license file mentioned and no other documentation.

Copy-paste prompts

Prompt 1
Walk me through what ptrace_may_access does and why the race in CVE-2026-46333 matters
Prompt 2
Show me how pidfd_getfd is used to steal a file descriptor in this PoC
Prompt 3
Help me build the exploit on a Fedora 44 test VM and read the make output
Prompt 4
Explain why FD 5 is the accounts-daemon D-Bus socket and how to verify that
Prompt 5
Generate a kernel patch sketch that closes the ptrace_may_access race
Open on GitHub → Explain another repo

Generated 2026-05-22 · Model: sonnet-4-6 · Verify against the repo before relying on details.