GuidePoint Security CTF 2021 - Calc (web)

1 minute read Published:

Writeup for the Guidepoint 2021 CTF Calc web challenge

Guidepoint Security CTF 2021 - Calc (web)

This is a basic OS command injection challenge. The web page for the challenge shows two input boxes for numbers it will then add together for you.

The page submits the two values you pass to it as the x and y GET parameters ( but these parameters are passed to an underlying OS command and are not escaped properly. By adding a ; we can break out of the command context and inject our own commands, we just have to make sure we URL encode any special characters that will otherwise mess up the URL. Just to be safe we also added a ;# at the end of our injected command so nothing that could be placed behind our injected command will affect it.

First we need take a look at the directory contents:

curl -v ''

We’ll see there is a file called calchdeyenbdw7wjh281y1hd771ujs718hq.txt, so next we just cat that file:

curl -v ''

And with that, our we get our flag for this challenge.