Pwn Challenges

Ghost

Description

Find the flag.

$ nc 139.144.184.150 4000

Attachment: Linkarrow-up-right

Analysis

After opening file in Ghidra the main function looks like this (I renamed variables):

int main(void) {
  long in_FS_OFFSET;
  char buffer [64];
  int variableToOverwrite;
  char code [264];
  long local_10;
  
  local_10 = *(long *)(in_FS_OFFSET + 0x28);
  printCatArt();
  puts("Ghostly Haunting: Mysterious Apparitions Spotted in Abandoned Mansion!");
  fflush(stdout);
  variableToOverwrite = 0;
  printf("ghost code: ");
  gets(code);
  strcpy(buffer,code);
  if (variableToOverwrite == 0x44434241) {
    puts("BDSEC{you_need_to_find_flag_in_server!}");
  }
  else {
    puts("You have escaped the ghost!");
  }
  if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
                    /* WARNING: Subroutine does not return */
    __stack_chk_fail();
  }
  return 0;
} 

So there's a variable on the stack and we have to overwrite it somehow. Program get user input, copies it to buffer, and nothing. Input is lost.

Program has all protections enabled, so how to we overwrite the variable?

Attack Vector: Human error

As you can see code is bigger then buffer, meaning we can write on the stack. First we will need offset.

Solution

circle-check

anyaForger

Description

Let's see if you can get the flag.

$ nc 139.144.184.150 31337

Attachment: Linkarrow-up-right

Analysis

Checksec:

Ghidra code, function vuln:

Let's find offset.

Solution

circle-check

callme

Description

Call me & get the flag.

$ nc 139.144.184.150 3333

Attachment: Linkarrow-up-right

Analysis

Checksec:

From Ghidra, main function:

There's function callme which we will need to call to get the flag!

Let's open it up in gdb and start taking some notes.

Solution

circle-check

Last updated