NCS 2021 Writeup

My writeup for the National Cyber Scholarship Competition 2021


Project maintained by codekrafter Hosted on GitHub Pages — Theme by mattgraham

go back home

BE02

Briefing

Download the file and find a way to get the flag.

Contents: rot13

Walkthrough

This challenge provided a binary file, which when ran provides the following output:

===================================
ROT IN sHELL :: ROT13's your input!
===================================
>

when I provide a sample input, it simply provides a ROT13 version of the input (a simple ceaser cipher):

> abc

ROT13 output:
> nop

next I wanted to see if the flag was simply a string inside of the executable, so I ran strings on it and got lots of junk (which is normal as binary data sometimes shows as short UTF-8 strings), along with the following:

SegmentaH
tion fauH
*** stacH
k smashiH
ng detecH
ted ***:H
 <unknowH
n> termiH
natef
Aborted H
(core duH
mpedf
AWAVI
AUATL
[]A\A]A^A_
[36m===================================
[31mROT IN sHELL
[0m :: 
[33mROT13's your input!
[31m%s
[32m%s
[32mROT13 output:

This contains the strings that are printed out when you run it, but also the top there is a sentence that is broken up, but something along the lines of “segmentation fault stack smashing detected”. Stack smashing is when you override the stack of a program, so a very simple way to do it is to provide tons of input to the application and hopefully it overflows. I wrote a basic python string to repeat a bunch of “a”s, and piped it into the application:

$ python -c 'print("a" * 500)' | ./rot13

That returned the following which contains the flag:

==================================
ROT IN sHELL :: ROT13's your input!
===================================
> 
Segmentation fault.
*** stack smashing detected ***: <unknown> terminated                                                           
Aborted (core dumped)                                                                                           

Flag: luckyNumber13