Recruit - Write-up - TryHackMe

Information

Room#

  • Name: Recruit
  • Profile: tryhackme.com
  • Difficulty: Medium
  • Description: Infiltrate Recruit's new portal. Map the site, hunt for flaws, and gain unauthorised access

Recruit

Write-up

Overview#

Install tools used in this WU on BlackArch Linux:

sudo pacman -S curl

Web reconnaissance - SSRF#

On the home page (/) we can find a login form, try a few SQL injection payloads, fail and switch to something else.

There is also a Access API link pointing to /api.php to gives us so documentation about an API. Especially the /file.php?cv=<URL> endpoint that may be able to fetch CVs.

  • URL: http://nul3j00rf5gj4hx46d278hoan1tshj58.oastify.com ➡️ Only local files are allowed
  • file path: /etc/passwd ➡️ Only local files are allowed
  • file protocol (absolute path): file:///etc/passwd ➡️ Access denied
  • file protocol (relative path): file://api.php or file://file.php

Source code review#

We can't read /var/www/db.php because it's outside /var/www/html whitelisted root path.

User flag#

Logging in with hr and $HR_PASSWORD allows to fetch the user flag.

Admin flag - SQL injection#

Now we can read dashboard.php to try to elevate our privilegies.

Looking at how the search is performed, we can trigger an SQL injection to read the admin's password.

SELECT * FROM candidates WHERE name LIKE '%
    ' UNION SELECT null,null,password,null FROM users -- -
%'

Connecting with ADMIN give the admin's flag.

Share