Currently working as a Senior Consultant at Netcompany spending my full-time job solving the SharePoint riddles. In the free time I'm expanding my understanding of cybersecurity through hacking activities. Git fanboy.
There is something I wanted to try since I've watched videos of people creating games without any programming knowledge whatsoever. After I have created a honeypot using the ChatGPT v3, I'm ready to solve the CTF using AI only: ChatGPT and Bing AI (mostly strict mode) - latter because it has internet access.
For the readability reason, I'm not going to paste whole conversations, but the important bits.
Recon
For me, the competition starts before launching the first challenge. In the introductory part, I can read that
In this room, every task will allow you to gain access to a new Midsummer Corp employee. On every account you can also find a piece of the final puzzle fernflower_flag[1-6].png, which you will need to complete the last quest.
It indicates that the final flag or answer (the Crown Jewels) is distributed in six parts and placed somewhere on the file systems (presumably) of six accounts. The number of challenges (Puck, Leshy, Baba Yaga, Boruta, Twardowski and Popiel) is also six - so that is a match - one account, one challenge - one part of the final flag.
It is also worth noting that two years ago I have participated in the CTF organized by the Securing and my write-up won that year's competition. If you haven't read it yet, I strongly recommend it because it was my first experience of Securing team potential - just see what platform did they use to host the event ๐.
The Setting
Legend has it that the fern flower appears on the eve of the summer solstice at the stroke of midnight. It can only be found deep in the forest, where it grows in a secret and hidden spot known only to the bravest and most skilled of seekers. Those who are lucky enough to find it and pick it up at the right moment are granted great powers and blessings and may even have their wishes come true.
Securing chosen Kupala Night as a topic of this CTF.
I like that because the elusive fern flower is a great analogy to the flag that participants are looking for in the competition.
Also, what ChatGPT didn't mention - fern flower does not exist. Ferns do not bloom.
If you are not familiar with that legend of blooming fern, here are some of my recommendations to familiarize with:
absolutely amazing Polish folk rock band - ลปywioลak (Elemental); their songs focus on the Kupala Night and Slavic mythology
Anyway, let's look at the challenges names in the context of that all - are those names chosen arbitrary or do they have some meaning that could help to solve tasks?
And maybe bot can drop us some ideas of what the challenges may be about?
Interesting - but here is crucial to remember one thing - when OpenAI model doesn't know the answer, it comes up with some (here, here and here). This is just how these kinds of model works. For example, I've asked a Bing AI to find some information about one of the challenges suggested by ChatGPT - and it looks like the bot just made that one up.
The Platform
The application is based on the NextCloud server (GitHub - nextcloud/server). The software and the configuration have been intentionally made vulnerable.
According to the GitHub it is a PHP server with JavaScript frontend for the data storage/management.
Tag cloud:
Interestingly, there is a hacktoberfest tag there. I've dug deeper and found out Nextcloud is participating in Hacktoberfests in the years 2016 and 2017 (post from 2016). So just for future reference, I'm adding a pull requests list applied during that event because of the following reasons:
Securing team could be using an older version of Nextcloud Server,
Securing team could be introducing/reverting some pull requests to include vulnerabilities,
both
Ok, let's start with the actual challenge.
Midsummer Corp (sanity check)
For the sake of consistency - most actions I'll be performing on the Kali Linux, partially becasue I couldn't connect openvpn on Windows.
I'm connecting to the VPN sudo openvpn thm-eu1.vpn and test the connection using curl -IL 10.10.21.207 to roughly see what headers are being exchanged. Some of them:
The sanity check question is to find the base URL of the application. When you look closely - on the footer there is some text (which often contains redirection to the landing page). This is how the page looks like when adding a following CSS rule.
* {
color: white;
}
So I hover on the Midsummer Corp link - it leads to https://files.midsummer.corp.local/.
I'm adding that to the hosts and browsing the page again. Unfortunately, the page seems not to be served over HTTPS.
# THM
10.10.21.207 files.midsummer.corp.local
From now on, I'll be using the Request Blocking feature of Firefox to not load the background image - the page looks much easier to browse and the size of the image is huge!
Source Code
To be honest - that's the longest .htaccess file I've ever seen - 132 lines.
$ wc -l .htaccess
132 .htaccess
I've then asked Bing AI to explain to me what some of the sections of that file are doing.
When comparing this file with the current version on the GitHub - there are additional lines under the #### DO NOT CHANGE ANYTHING ABOVE THIS LINE #### comment.
Ok so, unfortunately, it's not as outdated as I thought it would be - the current version at the time of writing this article is 26.0.2. Couple of interesting commits missing in the 26.0.0