Saturday, August 18, 2018

New life

Yo guys, it’s been a long time!

So many things have happened, but to make story short: I got married, had a baby boy, met 2 great Singaporeans last month, and now I’m in Thailand.

The “garlic snow pizza” was awesome, and so was the beer (picture to be added later)

And SOAP is probably the biggest invention of all time, if you know what I mean ;-)

Monday, December 26, 2016

3DS CTF 2016

3DS CTF was an interesting CTF, which unlike normal CTFs, went on for a whole week. I had plenty of time to enjoy the challenges. Below are write-ups for some of them.

Stego 100: Excaliflag

The file is a png image with nothing hidden in the binary data. Quick analysis with Steganabara shows that there's not much distortion with the RGB values, this means the flag is either hidden in the LSB values, or an advanced method is used. For only 100 points, of course the former is true.

Playing with the blue bits in Steganabara's Bit Mask Filter and you'll get the flag:

Stego 300: 0liver "Imaged"

By looking at the magic bytes in the binary data, it's easy to see that there is a png image appended at the end of the jpg image. Looking at the png image, it's clear that the flag is hidden in the R and G values of the first few lines. Extract the R and G values and you'll get an ELF file that prints out the flag.

Stego 300: We also have memes!

The flag is hidden in the image using an algorithm in which p and offset are unknown. However, they are small enough to be brute-forced. The flag format is 3DS{}, so this is more like a known plain-text attack with the image as the ciphertext.

(to be continued)

Update: not continued because it's been a long time and I don't remember the continuation. Also, I'm busy (and lazy :P)

Sunday, December 18, 2016

WhiteHat Grandprix 2016

This is probably the worst CTF I've played. Server was always overloading (probably DDoS'ed and/or pwned). Also the anti-bruteforce mechanism made sure that you couldn't login when someone else was brute-forcing your account (It's very possible that the hackers already got access to your profile data - hope you didn't use the CTF password anywhere else). There were other problems, but they don't bother me anymore.

Below are some write-ups if you're interested. I don't quite remember the names and because some teams were able to submit flags after the contest ended they took everything down.

Web 100: Bánh bột lọc

If you look at the source you'll see the backed-up page. From there, you need to find a pair of username/password that meets the condition: $username.'1337' = md5($password). Some coding and the job is done (probably Linux experts can do faster than me).

The ones I used were 234417335475b7eb761e5f8accae1337 - huna12

Web 100: Bánh căn

For some stupid reason the page allows you to execute arbitrary php functions using get query. However, many important functions are blacklisted (from the hint). In the end, this query did the job: ?assert=require('php://filter/convert.base64-encode/resource=index.php')

Crypto 100
This is basically a substitution cipher. You lookup the characters corresponding to your numbers using the table. For some numbers that are multiplication of 2 other numbers, use them as row/column indices.

I solved this one by replacing the high-frequency numbers with characters and used SCBSolvr to do the rest.

Crypto 300

The key is generated from a 8-byte seed so it has a very big weakness: it's repeating after every 72 bytes. Using known plain-text attack you can recover the key and decrypt the text.

Reverse 100: Nem rán

After decompiling you get the python code. It's basically ROR so just ROL and it's done. Because it's rotation, you can quickly define ROL as ROR(bitsize - shifted_bits)

Forensics 100: Bánh giầy

Using Wireshark you can recover the secret file, which is a zip archive. Crack the zip using brute-force attack (password is 4-char long) and you'll get the flag.

Misc 100: Bánh đa kê

The flags are hidden in 32 files among 10000 folders. The server allows you to execute some Linux commands, and of course some important commands are blacklisted. In the end, the command I used was egrep -r '.' . | sort

Tuesday, December 6, 2016


I'm back, somehow.

Been busy, hard disk crashed, bad things happened, etc.

Restarting things from scratch, somehow.

Tuesday, May 13, 2014

ASIS CTF Quals 2014

A great CTF with a lot of interesting steganos has ended. Too bad the event took place on workdays, so our team didn't have much time for it (probably many other teams shared the same problem). We ended up at #10, which wasn't too bad :P Below you can find write-ups for a few challs I solved.

Trivia 50: Image

The file was actually an amazing image of the once popular NES game Battle City, and as a fan of Nintendo I had the emulator ready to play it :P Just complete the first stage and you'll get the flag: 8BIT_RULEZ (although it is a bit different from what is written and caused a lot of confusions for everyone :P)

Web 75: Hidden flag

A web challenge with barely any description, however the title suggests that the flag should be hidden somewhere. It didn't take us much time to notice the HTTP header named x-flag with the value ASIS_b6b?244608c2?c2e869cb56?67b64?b1. Now obviously the task was to find the full hash. My first thought was using a dictionary attack to find a string that generates a hash with the same pattern, but because of work I didn't really have any time to try it :P

At one point, some members in our team noticed that when a wrong solution was submitted, the response was almost instant. This suggested that there should be a javascript check somewhere. From here it didn't take much time for us to find the sha256 hash and recover the full flag: ASIS_b6be244608c27c2e869cb56167b649b1

Stego 100: Spy Paper

The image was quite big and it was quite easy for me to overlook every detail :P Fortunately redoc found anomalies in the blue channels and these dots reminded me of punched tape, which was very close to the final solution. We were able to quickly figure out the parity bits and decrypt the second part, however we could not find anything meaningful from the first part:

After a lot of time spending on it, we came to realize that this could be printer steganography, and the first part could be date and time. With that we were able to fully decrypt the flag: 9/6/19 13:22:44 E4sy_0n3.

Crypto 150: Random Image

This isn't a hard chall, the code seems to randomly create a new image based on the flag but in fact there is quite a big correlation between the "random" result and the original one. Specifically, if the value of the pixel is less than 250, the resulting pixel is the result of some operation on the coordinates xored with a random value which is the same for all pixels. We do not know the random value however we know the result of the operation on the coordinates and by xoring the encrypted image with this value all pixels with values less than 250 should stand out. Here is the final result of the decryption:

Stego 175: White noise

This is an easy prey for my powerful Steganabara, and that was the reason why our team quickly became the first solver. A quick histogram analysis shows that the values in the green and blue channels are evenly distributed, and the reason behind this is that they were made to be used as coordinates to rearrange the pixels.

However, the red channel only has 1 value: 128, so it is pointless if you rearrange the whole image, you'll get just a red square. This got me stumped for a little while, until I realized that the order of arrangement could be important too. With this I only used the first 30 lines of the image for rearrangement, and got the flag: