Dangerous Code Hidden in Plain Sight for 12 years
CVE-2021-4034 codes for this exploitation
Local privilege escalation via pkexec
Watch the ✨ YouTube Video
make all && ./pwnkit && make clean
# Build the docker image
docker build -t pwnkit .
# Run the exploit
docker run -it pwnkit bash
make all && ./pwnkit && make clean
snyk container test pwnkit:latest --file=Dockerfile
# include <stdio.h>
# include <string.h>
int main(int argc, char **argv){
execvp(argv[1], &argv[1], 0);
}
----------------------------------------------------
# include <stdio.h>
# include <string.h>
int main(){
char cmd[100], input[10];
char *prefix = "zsh -c";
strcpy(cmd, prefix);
scanf("%3s", input);
strncpy(cmd + strlen(cmd), input, 3);
puts(cmd);
system(cmd);
return 0;
}
----------------------------------------------------
# include <stdio.h>
# include <string.h>
int main(){
execvp("date");
}