Planets

Writeup for Planets (Web) - WHY CTF (2025) πŸ’œ

Description

I just started programming and created my first website, an overview of all the planets in our solar system. Can you check if I didn't leave any security issues in it?

Solution

We have a simple web page showing different planets.

Checking the HTTP history, there is an interesting POST request to /api.php - the body contains an SQL query.

The response has a JSON object containing all the planets and their properties. Of course, we suspect SQL injection and this was a quick one; we can run SQLMap to dump the database.

SQL Injection

I start by copying the HTTP request content from burp into a file called req, then run SQLMap in batch mode (auto-answer questions).

We get a successful payload.

Confirmation that the DB is MySQL.

Next, we can list the databases.

We should check planets and see what tables it contains.

The abandoned_planets table sounds interesting, we'll list the columns.

Dump the interesting fields from the database.

We have our first flag 😼

Flag: flag{9c4dea2d8ae5681a75f8e670ac8ba999}

Last updated