This weekend, apart from participating to CodeGate 2020 CTF Qualifier (and hopefully qualifying in the finals), I had the pleasure of playing FooBarCTF 2020, an interesting competition held by students from NIT Durgapur, India. While the latter wasn’t listed on CTFTime, it was still full of interesting challenges. Below you can find my writeup for some challenges, as well as a link to the second part.
This was the only challenge in the ‘stego’ category. Attached was an image with Marvel’s Endgame movie:
I ran the usual tools on it (exiftool, steghide, stegsolve) and I noticed an anomaly on the least significant bits. For example, red plane 2 looked like this:
That meant that the flag was probably hidden using lsb steganography. I tried using stegbrute, thinking that the flag was simply protected by a password, but it turned out that wasn’t the case. After looking through John H’s ctf-katana, I managed to extract the flag by using jsteg:
Flag: GLUG{51n6h4l_15_51n6l3?}
GET me if you can
This was more like a warm-up challenge; I was provided with an URL that hosted the following page:
Wanting to solve the challenge faster, I clicked the button without inspecting the page’s source code:
I noticed the URL contained a parameter named ‘auth’ that was set to ‘false’, so I changed it to ‘true’ and got the flag:
Flag: GLUG{5n0wd3n_3471n6_53cur17y}
Cookie store
The provided URL hosted a simple site:
The site didn’t offer me a lot of options, so I tried buying the flag and got an error:
I remembered the name of the challenge and realized that my points were stored unencrypted inside a cookie. I used a cookie editor and changed my points to 1337:
After that, I purchased the flag:
As a crypto enthusiast, I instantly recognized the reference to affine cipher. Also, the key was either (5,8) or (8,5), because usual reviews include ratings from a scale of 1 to 5 or 10. I decrypted the flag using cryptii:
Flag: GLUG{cookies_are_good}
Strong vaccine
After reading the challenge description, I was 100% sure this was an SQL injection challenge without accessing the site. As it turned out, I was right.
As this technique is very common, I won’t go into detail here.
Flag: GLUG{youre_a_ good_doc}
Client side is untrustworthy
The given URL only hosted a simple page:
However, upon closer inspection, the page seemed to contain an obfuscated javascript function that validates the password. After formatting it for a bit, the code looked like this:
I took every if statement and decoded the string that was compared with the inputted password using my browser’s console:
I then just spotted the flag, as the validation process was a bit faulty.
Flag: GLUG{this_is_bit_messy_42113}
Useless Website
The given site seemed to be a copied template:
However, after inspecting the web traffic, I found some interesting requests:
The last object mentioned something about actions.txt, so I accessed that file using my browser:
After the CTF was over, the admin told me that the object ids were assigned by MongoDB and were predictable. However, I didn’t know that when I solved the challenge, so I made a script that searched for valid objects. It’s based on the idea that the first bytes of the object id are the UNIX timestamp in hex format and the other part is just an incrementing number. The final script looked like this:
Also, ‘dates.txt’ just contained the contents of ‘actions.txt’ followed by the corresponding UNIX timestamps:
Running the above script, I got the following output:
Flag: GLUG{0bj3ct_ids_ar3nt_s3cr3ts}
I EZ
This one was very similar to ‘IZ’ from ISITDTU CTF 2018. To solve it, I followed this writeup. Final URL that returns the flag:
Flag: GLUG{c4571ng_7hr0u6h_7h3_3rr0r5}
Cardgen
This was one of my favorite challenges, along with the one involving ‘more’ (found in part II of this writeup). I solved it after the CTF ended, thinking that the contest is still running because of the timezone difference. The site was very elegant and I didn’t manage to find its template/source code online:
Basically, the site would generate FAKE credit cards with the inputted name on them. For example, this is a card I generated:
One interesting thing to notice is the URL for generated cards:
After a little bit of testing, I came up with the following url:
This resulted the card being created for 42, which, at the time of writing, is the result of 21 * 2:
This made me conclude that the site was vulnerable to a Flask Server-Side Template Injection (SSTI) vulnrability. After further testing, I realized there was a filter in place that would disallow characters like ‘ and ” and keywords such as ‘open’ and ‘read’:
After a lot of trial-and-error, I came up with the following two payloads:
Basically, the first one uses os.open() to create a file descriptor for ‘flag.txt’ and the second one uses that file descriptor (in this case 13337; should be replaced with the name on the card resulted from the first request) to read 100 characters from that file.
Flag: GLUG{j1nj4_n07_n1nj4_d!}
Stranger Things
If you’ve met me at least once, you probably already know that I suck at reversing. However, this challenge was really beginner-friendly and I was able to solve it. The first step was opening the binary in ghidra and viewing the list of functions:
The ‘encode’ function was used to encode the flag, so I focused on it:
A non-functioning equivalent in python would be:
This encoding function was easily reversible, so I wrote a function that decodes the resulting data:
Also, flagContainer contained the encoded flag; so I copied the hex values from ghidra and put them in the following script:
Running the above script, I got the flag:
Flag: GLUG{3l0n_0n_m4r5}
Teacher is absent
I remember seeing a similar hint at picoCTF; when a teacher is absent you get a substitute 🙂 The flag was encrypted using a simple substitution cipher. The cipher can be cracked using quipquip:
Flag: GLUG{THETHINGSYOUUSEDTOOWNNOWTHEYOWNYOU}
Julius not helping
Seeing the challenge title, I thought it was a simple Caesar cipher. However, from the french reference in the description, I concluded that the ciphertext was encrypted using the Vigenere cipher. I used gullaba.de to get the encryption key:
The flag is the key wrapped in GLUG{}
Flag: GLUG{ettubrute}
Happy to see me
This was a very similar challenge to ArbCrypt from SunshineCTF 2019. I used this writeup to solve the challenge.
Flag: GLUG{arb_you_sad_to_see_me}
U cant C me
I honestly don’t know how to explain the solution for this challenge. The flag.txt file contains a sequence of characters. In order to get its corresponding flag character for that sequence, you need to put a paper on your keyboard and draw a line between every 2 adjacent keys that you would push to get that character. For example, ‘uytfcvb’ would become ‘c’, because uyt is a vertical line, ‘tfc’ is a horizontal line and ‘cvb’ is another vertical line.
Flag: GLUG{cowisonthetop}
Rock n Roll Baby
The given file contained some readable words that looked like a song:
Python can be used to convert those numbers into readable text:
Flag: GLUG{rrrocknrn0113r}
Secure app
A .apk file was given. I used this online decompiler to get the Java source code, however, that turned out to be an overkill. The flag was located in the ‘AndroidManifest.xml’ file.
Flag: GLUG{7h15_15_53cur17y_57uff_4pp5}
Cant Read This
The given file was too big for me to put here. Basically, it was a JSFuck code. I used this site to get the compiled JavaScript code back:
Flag: GLUG{this_code_was_weird}
The EXORcist
The given python file contained a QR code given in binary. I used the following script to turn it into an image:
After that, I scanned the resulting image with my phone and got the following data:
Judging by the challenge title, I thought that the string probably represents the flag XORed with a key. I knew the flag started with ‘GLUG{‘, so I used python to calculate the key:
I could clearly see the key was ‘Hell’, so I used it to decrypt the flag:
Flag: GLUG{n0_fr33_r3d_bull}
Life is Hard
This was, again, very similar to Golly Gee Willikers from SunshineCTF 2019. I followed this writeup to solve it.
Flag: GLUG{7h15_700_5hall_d13}
WriteUp Part II
You can find my solutions for the shell category here.