From 77816855215298646c69afadf542f284187dd19a Mon Sep 17 00:00:00 2001 From: "Gabriel K. Gegenhuber" Date: Mon, 20 Jan 2020 01:15:00 +0000 Subject: [PATCH] add tasteless-ctf writeup --- writeups/ggegenhuber/tasteless19.md | 52 +++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 writeups/ggegenhuber/tasteless19.md diff --git a/writeups/ggegenhuber/tasteless19.md b/writeups/ggegenhuber/tasteless19.md new file mode 100644 index 0000000..d796350 --- /dev/null +++ b/writeups/ggegenhuber/tasteless19.md @@ -0,0 +1,52 @@ +# web-gabbr +This was the first challenge I looked into. + +It was a website that provided some basic chatroom functionality. +A chatroom was identified by a randomly generated UUID. At first invocation (or when no specific chatroom is specified in the url) a new chatroom is created. +The username is randomly generated as well, a new user can be requested at any time. +Besides joining other chatrooms, the website also allows to report a chatroom to an administrator. When triggering this functionality the admin joins the room and takes some time to inspect its messages. + +After getting familiar with the basic functions of the service (burp was used to intercept the traffic) and playing arround with websockets (which were used for the actual chat functionality) my safest bet was that we need to exploit the admin via XSS. +However I noticed that some other people that had far more knowledge about web security were working on the challenge as well. They were already closer to solving the challenge (bypassing the CSP) and I didn't want to join them and slow them down, therefore I switched to another challenge (timewarp) that was just newly added to the ctf. + +# web-timewarp +This was the second challenge I tried to solve. I was at SBA during the ctf and teamed up with @saschauer. Besides that I was also reporting/discussing my findings/thoughts with some other people at mattermost to avoid congruent work (since it kind of happened to me at the first challenge). + +The challenge description was: +``` +!!! challenge will shutdown at approx 01:30 UTC !!! + +If you haven't solved it until then, we don't think you'll be able to do it. +``` + +The day the ctf took place was the day of the daylight savings time change (03:00 --> 02:00). + +The challenge webpage had two endpoints (/token and /timewarp). The first one was used to generate a token (e.g. Z2l2ZUZsYWcvRXVyb3BlL0Jlcmxpbg==.U2F0IE9jdCAyNiAxNzoxNDo1NCAyMDE5.lKr4zkB4W0V9VZBnLLyT5ucqp0lCZxMpWEmZRPoZpKlmMHuXcBOg7Aeu6wJClpwYLNJCw_NmzBP6uVDSDyARAw==). +The generated token can then be submitted at the second page, however it seems like a token is only valid for some seconds and expires before the second page can fully validate it. + +The `.` inside the token was used as delimiter, so the token consisted of 3 parts: +`Z2l2ZUZsYWcvRXVyb3BlL0Jlcmxpbg==` +`.` +`U2F0IE9jdCAyNiAxNzoxNDo1NCAyMDE5` +`.` +`lKr4zkB4W0V9VZBnLLyT5ucqp0lCZxMpWEmZRPoZpKlmMHuXcBOg7Aeu6wJClpwYLNJCw_NmzBP6uVDSDyARAw==` + +When base64 decoded whe got: +`giveFlag/Europe/Berlin` +`.` +`Sat Oct 26 17:14:54 2019` +`.` +`94aaf8ce40785b457d5590672cbc93e6e72aa7494267132958499944fa19a4a966307b977013a0ec07aeeb0242969c182cd242c3f366cc13fab950d20f201103` (decoded in hex, since it contains non-ascii chars) + +At first we just tried to set the timestamp to a time in the future, encode it again and send it to the server but all we got was an integrity error. +The second guess was that we also need to find out which hashing algorithm is used for the checksum (last part of the token) and which part of the message is used as input for the hashing. When solving that riddle we could manually change the time, recalculate the hash and hand in our crafted token. + +After randomly trying out to identify the used checksum algorithm (when the source files of the ctf were released it turned out to be ed25519) and groping in the dark for quite some time we had some other ideas (e.g. forcing the endpoint to change its server location from `Europe/Berlin` to something else by sending requests from a foreign IP) but none of it worked out successfully. + +Of course we also thought that we might just wait until the clock is reset by one hour to solve the challenge but we quickly discared that idea, since it seemed way to easy to be the actual solution. + +However it actually was that easy, so all our investigations were irrelevant and handing in a previously generated token after the timechange was the solution. :) + +# Retrospective +It was fun but also frustrating. +Especially the time we used to try to solve the second challenge was kind of needless, but since I was working in a group with other comrades in suffering it was not that bad at all (misery loves company :D) and we were able to laugh about it in the end. :) -- 2.43.0