Exploit database

GH-49753b08fbcec64093787273ddec5dd7

rnw29/cve-2024-21626-runc-lab

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2024-21626

15 sources

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

Repository files13
rnw29/cve-2024-21626-runc-labRevision d33f0f7f8fe9

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

host/host-demo.c

Suggested starting fileC · 1,443 bytes
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/utsname.h>
#include <unistd.h>

#define HOST_DEMO_MARKER "CVE21626_HOST_DEMO"

static unsigned int parse_delay(const char *text)
{
    char *end = NULL;
    unsigned long value;

    errno = 0;
    value = strtoul(text, &end, 10);
    if (errno != 0 || end == text || *end != '\0' || value < 1 || value > 120) {
        fprintf(stderr, "Delay must be an integer from 1 to 120 seconds.\n");
        exit(2);
    }

    return (unsigned int)value;
}

int main(int argc, char **argv)
{
    struct utsname info = {0};
    unsigned int delay = 15;

    /* A shebang launch supplies the script pathname after its optional
     * argument, so argc is normally 3 for both probe and hold modes. */
    if (argc >= 2 && strcmp(argv[1], "probe") == 0) {
        printf("ATTACK3B_FD_PROBE_OK marker=%s\n", HOST_DEMO_MARKER);
        return 0;
    }

    if (argc >= 2)
        delay = parse_delay(argv[1]);

    if (uname(&info) != 0)
        strcpy(info.nodename, "unavailable");

    printf("=== Sacrificial host executable ===\n");
    printf("Marker:       %s\n", HOST_DEMO_MARKER);
    printf("PID:          %ld\n", (long)getpid());
    printf("UID/EUID:     %ld/%ld\n", (long)getuid(), (long)geteuid());
    printf("UTS hostname: %s\n", info.nodename);
    printf("Sleeping:     %u seconds\n", delay);
    fflush(stdout);

    sleep(delay);
    return 0;
}