Keymaster

[Web] Keymaster part 1 - 400

We are given with the link to to https://keymaster.project-ag.org

Keymaster Home Page

There’s some registration functionality within the website we successfully registered an account.

Dashboard HTML

When we tried logging in, it returns also a JWT string for succeeding authentications.

Dashboard flag

In the main UI (no screenshots, sorry :( ), you can create your own secret notes and then edit or delete them. As you can see below, we have no secrets yet.

Dashboard flag

However, turns out there’s an IDOR vulnerability allowing us to access other people’s secret notes by adding a numeric value after /api/secrets/ like /api/secrets/1.

Dashboard flag

So we tried extracting other secrets through scripting.

Dashboard flag

Once done, here’s the result we managed to obtain:

Dashboard flag

Out of all of this, what caught interest us is this specific secret note that seems to be a signing key for JWT.

Dashboard flag

So we went to Cyberchef and sign our own JWT with admin privs…

Dashboard flag

And when we set it on our Authorization header, it says that we are already admin!

Dashboard flag

At this point of the challenge, we were stuck. Fortunately, we thought of trying to do insert an SQL Injection payload within the user_id parameter from JWT body we have.

Dashboard flag

As can be seen above, an SQL error returned. So we proceeded with checking out the columns:

Dashboard flag

Dashboard flag

We successfully reflected UNION injection with 1,2,3 columns values. Next we tried to see what database we’re targetting. What worked is version() in the second column.

Dashboard flag

Dashboard flag

And we confirmed it’s a PostgresQL database. Then we tried grabbing all tables from PostgreSQL server.

Dashboard flag

Dashboard flag

And then, as can be seen above, there’s “flags” table that stands out a bit. So we tried querying its columns.

Dashboard flag

Dashboard flag

It has “id”, “flag”, and “description” columns. We can grab those directly.

Dashboard flag

Dashboard flag

And we got the flag!

[Web] Keymaster Part 2 - 100

The part requires another flag and when we dumped all the secret notes, we have also found a string that has a tcon flag format. We submitted it and it worked.

Dashboard flag

me

I am Jethro Magbanua (FriedTempura / Altelus).