Search

[REV] BBomb - Phase 1

Year
2021
CTF Name
DawgCTF
Category
REV
Type

1. Description

Welcome to the CyberDawgs Binary Bomb challenge series! The "bbomb" binary contains a series of mini reversing challenges broken into 9 phases. Each phase becomes incresingly more difficult, but it is not required to solve a phase to move onto the next. Simply press enter for a phase's input to skip it. Additionally, known phase solutions can be stored in a file named "flags.txt". See the binary's welcome message for the format and requirements. When submitting to this scoreboard, wrap the phase's solution in DawgCTF{}. Happy reversing!
Starting off easy... reversing (things) is fun!
Author: treap_teap

2. Write up

# file bbomb bbomb: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=8f217b2296d755bc32dfa4ec47939a8a95b7c803, not stripped # ./bbomb You can store known flags in a file named 'flag.txt' in the same directory as this binary. Enter 1 flag per line, any empty lines will default to user input, and leave 1 empty line after the last flag. An example to store phase 1, 2, and 4's flags: ---- phAse1_Fl4g pHA5e2_FLag phaS34_Fl4g ---- (Note: This file must use Unix line endings. If you edit this file on a Windows machine, run 'dos2unix' on the file) Welcome to the binary bomb! Tick tock... To skip a phase, press enter as the phase's input Flag file 'flags.txt' not found in this directory - using user input. Starting off easy... reversing (things) is fun! (Wrap all flags in DawgCTF{} when submitting to the scoreboard) Phase 1 answer:
Bash
복사
바이너리를 실행하면 위와 같은 문구가 나오는 것을 확인했다. 이를 기반으로 해당 바이너리를 분석했다.
바이너리는 단계별로 문제를 풀도록 설정되있고 각 단계를 풀 때 이전 단계를 풀지 않아도 풀 수 있도록 구성되있다.
각 단계마다 defuse() 함수가 존재하는데 이는 각 단계별로 정답을 체크해주는 함수였다. 모든 단계의 함수의 반환값이 1인 경우 success() 함수가 실행되면서 정답임을 알려주는 문구를 출력한다. 따라서 단계별 함수 내에서 반환값이 1이 되는 조건을 만족 시켜줘야한다.
phase1() 함수는 아래와 같이 동작한다.
메모리를 동적으로 할당한 뒤 사용자한테 문자열을 입력 받음
"Gn1r7s_3h7_Gn15Rev3R" 문자열과 입력받은 문자열을 비교하는데 이때 문자열 비교는 역순으로 비교하고 있다.
ex) flag[0]과 input[strlen(input)-1] 비교, flag[1]과 input[strlen(input)-2] 비교
따라서 "Gn1r7s_3h7_Gn15Rev3R" 문자열을 거꾸로 입력하면 이 문제가 풀린다.
#./bbomb ........ ........ Starting off easy... reversing (things) is fun! (Wrap all flags in DawgCTF{} when submitting to the scoreboard) Phase 1 answer: R3veR51nG_7h3_s7r1nG You did it!!
Bash
복사

3. FLAG

DawgCTF{R3veR51nG_7h3_s7r1nG}