CTF
  • Intro
  • HTB
    • Love
    • Aton
    • Cereal
    • Tenet
    • Tabby
    • Ophiuchi
  • CTF Competitions
    • SANS CTF 2020
      • Web
        • WE01
        • WE02
        • WE03
        • WM01
        • WM02
        • WH01
        • WX01
      • Binary
        • BE01
        • BM01
        • BM02
        • BX01
      • Crypto
        • CE01
        • CE02
      • Forensics
        • FE01
        • FE02
        • FE03
      • Network
        • NH01
Powered by GitBook
On this page
  • About The Challenge
  • Solution

Was this helpful?

  1. CTF Competitions
  2. SANS CTF 2020
  3. Binary

BM02

PreviousBM01NextBX01

Last updated 4 years ago

Was this helpful?

About The Challenge

Type

Difficulty

Binary

Medium

‌

Solution

In this challenge a Linux binary were provided. It not easy in order to solve it we have to debug it and use some patching technique.

I used here IDA to debug the binary.

First of all, I created breakpoints at the ending of each function to change the direction and point to any direction or function I want.

As above figure shows that there is two paths that the function will follow after it completed. It is highlighted with red and green arrows, green arrow means the default path.

So here we have to modify that path and make the function jump to red arrow.

There many ways to do that, but preferred to do the complicated way.

Here I changed the value of register ZF to 1, after that the function pointed that will execute the false function (not the default).

After that, I moved to analysis the binary what it do while executing. I identified that their is function that having loop that print a letter every one time. That function is highlighted with red border in the figure below.

Then I made the binary execute and go through that function in order to print all letters.

Finally, I did the final path and changed the register CF value to 1 in order to make the binary exit from the loop function and put the value of the printed loop letters into the heap.

As shown in the above figure, the data are stored on the heap. Now we will check that that heap data contains.

After checking the heap we will discover that the loop function was printing every letter of the flag.

Flag: n1CePatCHiNG010189