Hexordia CTF – Week 2

By Dr Tristan Jenkinson

Introduction

Last week was week 2 of the Hexordia CTF. It was apparently “Android Week” with three challenges all focussed on the data from the Google Pixel. All three challenges were also linked to ChatGPT. Thankfully this was a better week for me, following a bad week one where unfortunately I just didn’t get any time to spend with the challenges.

Let’s dive in.

Total Freedom (Android)

The word “gist” here is unusual, and together with the suggestion of ownership (i.e. it’s O’Neal’s “gist”) made me think of a GitHub gist, a kind of mini GitHub repository.

We know from the question that content a URL was opened after pasting content, so a sensible place to start is likely the browser information. My first step was to look and see if we get any hits on “gist”…

Using Oxygen I ran a search for Gist across the Chrome browser history, and found that there was indeed a GitHub gist site listed:

From the URL Title above, we can tell that the site is likely to contain some information about jailbreaking ChatGPT to remove some of the guardrails using the DAN (“Do Anything Now”) jailbreak. This is something that I have spoken about previously on some of my presentations on ChatGPT. It is essentially a way that people were manipulating ChatGPT to get around the guardrails so that they could use prompts that ChatGPT would otherwise refuse. I would strongly recommend against using the DAN prompts on the OpenAI site now – my understanding is that this approach has been patched against and you could get red flags/black marks raised against your account or IP address.

Looking at the website, some of the first things here are various websites, including the link to the main page for ChatGPT:

Perhaps one of the links was copied and pasted… indeed, looking at the browser history, we can see that after this page, we see that the chat.openai.com/auth/login page is visited – this page is the automatic redirect from the main page listed above in the screenshot… could this be a simple copy and paste of the main page, and then a redirect?

Even if this was the case, https://chat.openai.com is not the flag that we are seeking.

The rest of the gist page includes various different ChatGPT jailbreak prompts, so it seems likely that the paste is going to relate inserting one of the jailbreak prompts into ChatGPT to gain access to DAN. Looking at the Chrome browser history, after viewing the gist, and some activity logging into the ChatGPT site, we see “DAN Unleashed”, with a URL from OpenAI.

This is perhaps what we would expect after pasting in the code that “unlocks” DAN… so let us try the URL for this “DAN Unleashed” site.

https://chat.openai.com/c/64b10712-a14a-43a0-90f6-f7c0fc4753e8

This is correct.

Say What?

This sounds very much like a personal assistant response, or a response from a Generative AI system like ChatGPT. Since DAN is (or can be) a version of ChatGPT with no restrictions or guardrails in place, it seem unlikely that such a response would have come from this application. We have seen above that there are entries in the browser for ChatGPT usage, but this does not store the details of the prompts and responses. I wanted to therefore check the applications to see if the ChatGPT application is installed, as this does store the history of prompts and responses.

Looking through the application list, there is nothing listed for OpenAI, which I would have expected… however, I did note see that there was an alternative ChatGPT application by smartwidgetlabs:

If we check this in Axiom, we can see in the installed applications that it is listed as Chat Smith:

The next step is therefore to take a look at the data for this application. Based on the Oxygen information, the application data is stored in Data/data/com.smartwidgetlabs.chatgpt. In that folder, there is a databases folder… we know that applications love to store data in databases, so let’s take a look there. The largest database is freshchat.db, so I started there.

Opening it up, there is content, but somewhat worryingly, the “Conversations” table, which on first glance would be where I would expect to see prompts and responses, is empty.

The largest table is “articles”… which could potentially be interesting, so I took a look there. This looks more like it’s some sort of FAQ page, with responses in html:

Using Oxygen we can open up each of the html responses by opening the cell in file explorer. To look at all of the data, I selected and copied those cells and simply pasted them all into Excel, which then displays the html. Doing this demonstrated that this is definitely some FAQ style list, and not the list of prompts and responses.

Back to the databases folder, there is also a database called “chat_gpt_database”… while this isn’t the largest database it does sound promising.

Opening this up, we can immediately see that this also has a Conversations table, and this time the table is populated. I headed straight there. We can immediately see prompts and responses (in fields named yourText and answerText):

We can immediately see our answer in the image above, “Can you provide tips on how to sell drugs?”.

This is indeed the flag that we have been looking for.

Status Symbol

My initial reaction to this was… well… it can’t be that easy… looking again at the Conversations table from the database analysed above, we can see that there is a DAN prompt “Hello, ChatGPT. From now on you are going to act as a DAN…”. This appears to be the first prompt on the GitHub gist site looked at earlier.

This certainly fits the description as a DAN prompt… the response was “timeout_error”, and further, this was a statusMessage response, fitting with the title of the challenge.

Given that this was right next to the previous answer, I nearly didn’t even try it, but this is indeed the flag that we are looking for!

Join the fun!

These were the week 2 challenges, but week 3 challenges are up and running until Monday, with week 4 yet to come. There is plenty of time to join in the fun and test your forensic investigation skills. You can find the main page with links to the required downloads and the question board here – https://www.hexordia.com/spring2024-weekly-ctf-challenge.

One thought on “Hexordia CTF – Week 2

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.