MCPcopy Create free account
hub / github.com/LMS57/TempleOfPwn / easy_filter

Function easy_filter

shellcode/shellcode.c:13–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11int conn; //This is the connection file descriptor that will be used to distinguish client connections.
12
13static int easy_filter(void)
14{
15 struct sock_filter filter[] = {
16 /* Validate architecture. */
17 VALIDATE_ARCHITECTURE,
18 /* Grab the system call number. */
19 EXAMINE_SYSCALL,
20 /* List allowed syscalls. */
21 DISALLOW_SYSCALL(execve),
22 ALLOW_PROCESS,
23 };
24 struct sock_fprog prog = {
25 .len = (unsigned short)(sizeof(filter)/sizeof(filter[0])),
26 .filter = filter,
27 };
28
29 if (prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0)) {
30 printf("prctl(NO_NEW_PRIVS)");
31 goto failed2;
32 }
33 if (prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, &prog)) {
34 printf("prctl(SECCOMP)");
35 printf("Test\n");
36 goto failed2;
37 }
38 return 0;
39
40failed2:
41 if (errno == EINVAL){
42 printf("SECCOMP_FILTER is not available. :(\n");
43 exit(0);
44 }
45 return 1;
46}
47
48
49static int difficult_filter(void)

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected