Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
goelp14
GitHub Repository: goelp14/easyctf-iv-problems
Path: blob/master/rop1/rop1.c
671 views
1
#define _GNU_SOURCE
2
#include <stdlib.h>
3
#include <stdio.h>
4
#include <string.h>
5
#include <unistd.h>
6
7
void get_flag()
8
{
9
system("/bin/cat flag.txt");
10
}
11
12
void get_input()
13
{
14
char inp[64];
15
gets(inp);
16
printf("You said: %s\n", inp);
17
}
18
19
int main(int argc, char** argv)
20
{
21
gid_t gid = getegid();
22
setresgid(gid,gid,gid);
23
get_input();
24
return 0;
25
}
26
27