1 # OverTheWire Advent Bonanza 2019
5 Time: about 4h without writeup
10 Santa is stranded on the Christmas Islands and is desperately trying to reach his trusty companion via cellphone. We've bugged the device with a primitive keylogger and have been able to decode some of the SMS, but couldn't make much sense of the last one. Can you give us a hand?
15 The challenge was really fun because it was a nice coding challenge and reminded me about the good old times. You are given four `.csv` files produced by the keylogger but only three are already decoded and the task is to decode the last sent message. In a given C header file is information about the keys and their meaning.
19 At first I was very confused about the `keys.h` header file. Why do different characters and numbers map to a specific keypad number? After some time I noticed that this keylogger is from a phone like back in the old days where you have to press a button multiple times to get the desired letter. Remember the phones that have real physical buttons. For example if you press the button `2` three times fast enough in a row you get according to `N7110_KEYPAD_TWO_ABC_CHARS "abc2"` the letter `c`. This is nearly everything that is needed to solve the challenge.
21 One thing to put attention at while coding is if you have the same character multiple times in a row. This is the reason why there is a timestamp along with the pressed button. If the time between two button presses is too high but the pressed button is the same as the button pressed before it should be counted as a new button click and therefore a new character.
23 The special button `N7110_KEYPAD_MENU_RIGHT` has also been used which deletes on button press the last character entered.
25 To execute the code which decrypts the message just run `node challenge1.js` which outputs the following:
28 alright pal herse ye flag good lucj enteking it with those hooves lol its aotw{l3ts_dr1nk_s0m3_eggn0g_y0u_cr4zy_d33r}0m.. .l ,p
31 The solution for the challenge is `l3ts_dr1nk_s0m3_eggn0g_y0u_cr4zy_d33r`.
38 Time: about 4h without writeup
43 'Moo may represent an idea, but only the cow knows.' - Mason Cooley
44 Service: http://3.93.128.89:1204
49 Opening the service located at the given IP you are given an interface where you can enter a message, choose a type of cow and then click `say`. This prints an ASCII cow which says your message. At the bottom of the site the used `cowsay` version is linked (https://packages.ubuntu.com/bionic/cowsay).
53 After opening the site and printing the first cow on to the site I noticed that there is an option to select the desired type of cow. The repository of cowsay at https://github.com/schacon/cowsay/tree/master/cows shows that there are per default some cow "skins" available but `custom` is none of them.
55 Choosing the `custom` cow you will be presented with a text field to enter your cow. In the manual of `cowsay` (see https://man.cx/cowsay if not installed on your system) is the following written:
58 A cowfile is made up of a simple block of perl(1) code, which assigns a picture of a cow to the variable $the_cow.
61 This can also be seen in the example cows previously linked. So I just tried to early end the string with `EOC` and doing a `print system("ls");` to list all the files which worked.
63 So the complete code for exploitation is:
70 to list all the the files and then
74 print system("cat flag");
77 which prints the flag `AOTW{th3_p3rl_c0w_s4ys_M0oO0o0O}`.
84 Time: about 6h without writeup
89 Santa's little helpers are notoriously good at solving Sudoku puzzles, so they made a special variant...
94 After downloading an archive you are given a `.txt` file with the challenge description. The task is to solve a given Sudoku with 12 equations that must hold for the solved Sudoku. The equations all look similar to this one: `B9 + B8 + C1 + H4 + H4 = 23`.
98 To solve the challenge I wrote at first a simple JS function that checks if a valid Sudoku also fulfills the equations given. Therefore I installed a small library which solves a given Sudoku on a random basis. This solution might work but would take forever because the possiblity is high that the generated solutions of the library are often the same as already solved ones.
100 I stopped continuing working on the challenge because someone else already solved it with `z3py` by just adopting the Sudoku example (see https://ericpony.github.io/z3py-tutorial/guide-examples.htm). A theorem prover is definitely a better, easier and faster way to solve this challenge.
102 My try can still be run with `yarn` and `node challenge5.js`.
109 Time: about 6h without writeup
114 It's not just leprechauns that hide their gold at the end of the rainbow, elves hide their candy there too.
115 Service: http://3.93.128.89:1217/
120 Opening the website presents you with a simple clicker game where you at first enter your name and are then presented with an UI where you can do the following things:
124 - `upgrade collection speed`
126 - `show growth chart`
127 - `erase progress and restart adventure`
129 The goal is to collect as many snowflakes as possible or at least this is usually the goal of a clicker game.
133 At first the `buy a flag` button got my attention but the button is disabled and it says that you need `10^63` snowflakes. This is too much that you can make it by playing the game. So I tried sending a custom set amount to the server at `http://3.93.128.89:1217/client` with data `{"action": "collect", "amount": 1e63}` and some variations but unfortunately this is checked on the server side and you can only increase the amount of snowflakes by the amount you are supposed to. Also the other endpoints are not very helpful. Another interesting endpoint is `http://3.93.128.89:1217/history/client` where all previously sent requests are shown. But also with this endpoint the amount of snowflakes can not be increased. I also thought that it's maybe possible to do an underflow with the `melt` action but as far as I found out you can only decrease the amount of snowflakes by one at a time and there server is rate limited because if you send too much requests in a short period of time you get the message:
137 "error": "Throttled at one request per second. Please note that this challenge does NOT require brute forcing, and does NOT require sending an excessive number of requests."
141 I tried sending different data to all the different endpoints in the website uses but no luck. Often the server just throws a `500` but I didn't managed to find a way for exploiting this. The server used is `Werkzeug/0.16.0 Python/2.7.17` as it can be found in the response header but unfortunately the debugging mode is not enabled.
143 The challenge is also marked as `crypto` and the only thing that points into that direction is the use of the cookie. To buy the flag there is maybe the cookie of an account needed which has enough snowflakes to buy the flag. But I didn't find a way to get more out of the cookie and haven't found any other cookie in the server responses.
145 Later the Mattermost people discovered by bruteforcing that there is another endpoint located at `http://3.93.128.89:1217/history/control`.