PicoCTF-2021 Writeup
  • README
  • Binary Exploitation
    • Binary Gauntlet 0
    • Binary Gauntlet 1
    • Stonks
    • What's your input?
  • Cryptography
    • Compress and Attack
    • Dachshund Attacks
    • Double DES
    • Easy Peasy
    • It is my Birthday 2
    • It's Not My Fault 1
    • Mini RSA
    • New Caesar
    • New Vignere
    • No Padding, No Problem
    • Pixelated
    • Play Nice
    • Scrambled: RSA
  • Forensics
    • Disk, disk, sleuth!
    • Disk, disk, sleuth! II
    • information
    • MacroHard WeakEdge
    • Matryoshka doll
    • Milkslap
    • Surfing the Waves
    • Trivial Flag Transfer Protocol
    • tunn3l v1s10n
    • Very very very Hidden
    • Weird File
    • Wireshark doo dooo do doo...
    • Wireshark twoo twooo two twoo...
  • Reverse Engineering
    • ARMssembly 0
    • ARMssembly 2
    • ARMssembly 3
    • ARMssembly 4
    • gogo
    • Hurry up! Wait!
    • keygenme-py
    • Let's get dynamic
    • Rolling My Own
    • Shop
    • speeds and feeds
    • Transformation
  • Web Exploitation
    • Ancient History
    • Bithug
    • GET aHEAD
    • It is my Birthday
    • More Cookies
    • Most Cookies
    • Scavenger Hunt
    • Some Assembly Required 1
    • Some Assembly Required 2
    • Some Assembly Required 3
    • Some Assembly Required 4
    • Super Serial
    • Web Gauntlet 2
    • Web Gauntlet 3
    • Who are you?
    • X marks the spot
Powered by GitBook
On this page
  • Problem
  • Solution
  • Flag

Was this helpful?

Edit on GitHub
  1. Binary Exploitation

Binary Gauntlet 1

PreviousBinary Gauntlet 0NextStonks

Last updated 2 years ago

Was this helpful?

Problem

Okay, time for a challenge. gauntlet nc mercury.picoctf.net 32853

Solution

  1. Decompile the binary using Ghidra:

    main function:

    undefined8 main(void)
    
    {
        char local_78 [104];
        char *local_10;
        
        local_10 = (char *)malloc(1000);
        printf("%p\n",local_78);
        fflush(stdout);
        fgets(local_10,1000,stdin);
        local_10[999] = '\0';
        printf(local_10);
        fflush(stdout);
        fgets(local_10,1000,stdin);
        local_10[999] = '\0';
        strcpy(local_78,local_10);
        return 0;
    }
  2. Alright, so same program as "Binary Gauntlet 0" except the flag is not printed on a crash and the memory address of local_78 is printed at the beginning of the program.

  3. We can write some shellcode to local_78, pad out to the return address, and overwrite the return address with the address of local_78 that is printed at the beginning.

  4. Run the solution and then run cat flag.txt to get the flag.

Flag

c6e16a1b4182c2801ed657d4c482af88

Program
script