Follow us on twitter

About

There is a security check that prevents the program from continuing execution if the user invoking it does not match a specific user id.

To do this level, log in as the level13 account with the password level13 . Files for this level can be found in /home/flag13.

Source code

 1#include <stdlib.h>
 2#include <unistd.h>
 3#include <stdio.h>
 4#include <sys/types.h>
 5#include <string.h>
 6
 7#define FAKEUID 1000
 8
 9int main(int argc, char **argv, char **envp)
10{
11  int c;
12  char token[256];
13
14  if(getuid() != FAKEUID) {
15    printf("Security failure detected. UID %d started us, we expect %d\n", getuid(), FAKEUID);
16    printf("The system administrators will be notified of this violation\n");
17    exit(EXIT_FAILURE);
18  }
19
20  // snip, sorry :)
21
22  printf("your token is %s\n", token);
23  
24}

Discussion