Skip to content
KitploitKITPLOIT
ToolsExploitsBlog
Log in
Submit
ToolsExploitsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

FeedsContactPrivacy© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
CVE-2026-46242-Analysis — Analysis and C reproducer for CVE-2026-46242, a Linux kernel eventpoll ep_remove() race use-after-free in nested epoll, with patch diff and KASAN verification steps. | Kitploit
Tools/GitHubGitHub/villager1314/cve-2026-46242-analysis
Memory ForensicsVulnerability AnalysisExploitationPapers & ResearchLearning & EducationBinary Exploitation
GitHubvillager1314/cve-2026-46242-analysis

CVE-2026-46242-Analysis

Analysis and C reproducer for CVE-2026-46242, a Linux kernel eventpoll ep_remove() race use-after-free in nested epoll, with patch diff and KASAN verification steps.

Share
View Repository
1211 month agoNot yet reviewed

CVE-2026-46242 — Linux Kernel eventpoll ep_remove() Race UAF (Nested epoll)

Reproducer / PoC (trigger-verification type): Linux & Android (NDK) This repository is intended solely for verifying patch status and for research/learning on your own test devices; it contains no privilege-escalation/exploitation primitives.

CVSS 3.1 CWE-416 Fix


1. Vulnerability Overview

字段内容
CVE IDCVE-2026-46242
标题eventpoll: fix ep_remove struct eventpoll / struct file UAF
类型Use-After-Free(CWE-416),竞态条件
CNAkernel.org(Linux CNA)
CVSS v3.17.8 High — CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
CISA KEV未收录(截至 2026-10)
公开日期2026-05-30(预留 2026-05-13;oss-security 披露 2026-07-08)
修复提交(mainline)a6dc643c69311677c574a0f17a3f4d66a5f3744b
引入问题提交(Fixes:)58c9b016e128 (v6.4, 2023) — "epoll: use refcount to reduce ep_mutex contention"
修复者Christian Brauner <[email protected]>
报告者Jaeyoung Chung <[email protected]>
影响文件fs/eventpoll.c(仅一个文件,+10/−6 行)

Affected Versions

The vulnerability was introduced in v6.4 (2023-06). Note two special windows: the introducing commit was later backported into 5.15 / 6.1 stable, so these two older LTS branches are affected only within very narrow version ranges:

BranchAffectedFixed version (≥)Stable fix commit
5.10 LTSNot affected——
5.15 LTS5.15.209 ~ 5.15.221 (introduced by backport)5.15.222a10fbbe74e1c
6.1 LTS6.1.175 ~ 6.1.177 (introduced by backport)6.1.1783e1144d2515d
6.6 LTS6.4 ~ 6.6.1436.6.1442de4db145b29
6.12 LTS~ 6.12.946.12.959324de74a3a5
6.18~ 6.18.326.18.33ef4ca02e9536
7.0~ 7.0.97.0.10ced39b6a8062
mainline< 7.17.1a6dc643c6931

Android Relevance

Among Android GKI kernels, the 6.6 / 6.12 branches fall within the affected range (e.g., the 6.6 GKI on the Pixel 10 series); 5.10 GKI is not affected, and 6.1 GKI is affected only when the kernel happens to fall within the 6.1.175~6.1.177 window. The mainline fix commit is dated 2026-04-23, and the CVE was published on 2026-05-30. Devices with an earlier SPL most likely have not merged this fix, so please rely on the kernel version number (adb shell cat /proc/version and getprop ro.build.version.security_patch).

Disambiguation: Some articles online refer to this CVE as "Bad Epoll"; that codename does not match the official record and is a misnomer (there are also rumors confusing it with CVE-2026-43499). Refer to the CVE record and the kernel.org commit as authoritative.


2. Technical Details

2.1 Background: Nested epoll and file->f_ep

epoll allows nested monitoring: epoll_ctl(e1, EPOLL_CTL_ADD, e2, ...) can attach another epoll fd e2 into e1. In this case, the kernel creates an epitem (epi) for the struct file of e2 and links epi->fllink into the ->refs hash list embedded in the monitored eventpoll (that is, e2's own struct eventpoll).

struct file->f_ep points to the eventpoll associated with that file; eventpoll_release_file() (slow path) sets f_ep to NULL under f_lock and detaches all related epis, mutually excluding with ep_remove() via f_lock.

2.2 Race Scenario

ep_remove() (triggered by EPOLL_CTL_DEL or by closing the outer epoll, via ep_remove_file()) under the protection of file->f_lock first clears file->f_ep, but then continues to use @file within the critical section (is_file_epoll(), hlist_del_rcu() via the list head, spin_unlock).

Meanwhile, a concurrent __fput() on another CPU takes the eventpoll_release() fastpath, observes a transient f_ep == NULL within this window, and therefore skips eventpoll_release_file(), proceeding directly to f_op->release / file_free():

 ep_remove() 线程                        close(inner_epfd) → __fput()
   ep_remove_file()
     spin_lock(&file->f_lock)
     file->f_ep = NULL;                  __fput() fastpath:
     ...                                   if (file->f_ep)  // 观察到 NULL
     is_file_epoll(file)   // 仍用 file      → 跳过 eventpoll_release_file()
     hlist_del_rcu(&epi->fllink)           f_op->release = ep_eventpoll_release()
       *pprev = next  // 写已释放内存!       → ep_clear_and_put() → ep_free()
     spin_unlock(&file->f_lock)              kfree(eventpoll)  // ← 释放

Why it is a UAF write: In the epoll-watches-epoll scenario, the ->refs list head embedded in the freed struct eventpoll is exactly the location pointed to by epi->fllink.pprev, and *pprev = next in hlist_del_rcu() writes a pointer value into freed kmalloc-192 memory.

Making matters worse: struct file belongs to SLAB_TYPESAFE_BY_RCU, so the slab slot for @file may be reclaimed and reused by alloc_empty_file()—f_lock and f_ep are reinitialized, while ep_remove() nominally still holds that lock. Ultimately this can result in an attacker-controlled kmem_cache_free() targeting the wrong slab cache.

2.3 Fix

At the top of ep_remove(), use epi_fget() to pin @file, and use whether the pin succeeds as the gate for entering the critical section:

  1. Pin succeeds → the @file reference count cannot reach zero, __fput() is blocked, and the watched eventpoll also stays alive until hlist_del_rcu() and the use of f_lock are complete, closing both UAFs at once;
  2. Pin fails → this means __fput() is already in progress. Because the bailout occurs before f_ep is cleared, the release path will take the eventpoll_release_file() slow path and block on ep->mtx, and the orphan epi will be cleaned up by it;
  3. A successful pin itself proves there is no race with eventpoll_release_file(), so the redundant epi->dying recheck under f_lock is removed (the lockless READ_ONCE(epi->dying) fast path is retained).

See patches/a6dc643c6931.patch for the full diff.


3. PoC Description (Trigger Verification, Not a Privilege-Escalation Exploit)

poc/ provides a race trigger: multiple groups of threads run high-intensity loops

  • Each round: create an outer epoll e1 and an inner epoll e2, and use epoll_ctl(e1, ADD, e2) to establish nested watching (the vulnerability precondition);
  • Thread A (DEL thread): after spinning and waiting for the start signal, call epoll_ctl(e1, EPOLL_CTL_DEL, e2) — this goes through ep_remove();
  • Thread B (close thread): after the same start signal, call close(e2) — this goes through __fput() → eventpoll_release() fastpath.

When the instantaneous window in which ep_remove_file() clears f_ep happens to collide with the fastpath check in __fput(), hlist_del_rcu() on an unpatched kernel writes into eventpoll memory that has already been freed by ep_free(). With a KASAN kernel, reports such as BUG: KASAN: use-after-free in ep_remove / hlist_del_rcu or slab-out-of-bounds in ep_free can be observed; without KASAN, it usually manifests as an occasional oops/panic or silent heap corruption.

Download Tool

Most Popular

View all →

Discover the most used tools by our community.

  • 1

    OsintHunter

    letox4/osinthunter

    🎯 The ultimate OSINT toolkit: investigation graph, confidence scoring, alias families, map, timeline and reports. 49 modules, 400+ sites, no API keys required.

    668
  • 2

    ghostlock-app

    yukonga/ghostlock-app

    GhostLock One-Tap Execution App (CVE-2026-43499)

    496
  • 3

    ARTEX

    baarai/artex

    LLM multi-agent autonomous penetration testing platform with planner/worker agents, asset and exploration graphs, MITM traffic recording, and vulnerability retesting.

    394
  • 4

    redforge

    cybersecurity91/redforge

    Browser-side red team toolkit with 102 offline tools for recon, payload generation, credential attacks, crypto, encoding and engagement reporting.

    339
  • 5

    CyberStrikeAI

    ed1s0nz/cyberstrikeai

    The system of action for AI-native cybersecurity—where intent becomes governed execution, evidence becomes operational memory, and every operation improves the next.

    258
  • 6

    antifox

    antifox-ai/antifox

    AI multi-agent autonomous penetration testing platform that runs recon, attack-surface discovery, exploitation validation and evidence-backed report delivery.

    254

Explore all tools

Browse our collection of tools

View all tools →