This commit is contained in:
firmianay
2018-02-09 14:53:39 +08:00
parent ee9d0f0c56
commit 7cea3e7a22
2 changed files with 124 additions and 27 deletions

View File

@ -0,0 +1,29 @@
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
void main() {
char *path;
struct {
char canary[16];
char buffer[80];
} buf;
memset(buf.canary, 47, 1); // put a '/' before the buffer
memset(buf.buffer, 48, sizeof(buf.buffer));
//path = getcwd(NULL, 0);
//puts(path);
chroot("/tmp");
//path = getcwd(NULL, 0);
//puts(path);
realpath("../../../../BBBB", buf.buffer);
if (!strcmp(buf.canary, "/BBBB")) {
puts("Vulnerable");
} else {
puts("Not vulnerable");
}
}