Spectra

hackthebox.com - © HACKTHEBOX

Intro

Box Info

🔗 Name

🎯 Target IP

10.129.240.86

📈 Difficulty level

🟩Easy

🐧OS

Linux


Recon

Start Reconnaissance

Visiting the http://10.129.240.86/ webpage

http://spectra.htb/main/ is a WordPress site.

http://spectra.htb/testing/index.php has an error:

  • Error establishing a database connection

Add the found values to the /etc/hosts file

Run ffuf to find the directories of the web server.

Let's browse http://spectra.htb/testing/ - file listing is enabled

Download the files locally

Try the same password for the administrator user at the login page:

http://spectra.htb/main/wp-login.php

  • it works with administrator:devteam01

Run a WpScan (just for fun)


Exploitation

  • https://www.hackingarticles.in/wordpress-reverse-shell/

Insert reverse shell into the WP theme

To perform a reverse shell using a WordPress 404 page, follow these steps:

  1. Log in to the WordPress admin panel and navigate to the theme editor

  2. Take note of the current theme being edited. Let's use an inactive theme, e.g. Twenty Nineteen and locate the 404.php file within the theme's files

  3. Replace the content of the 404.php file with a PHP reverse shell code. For example, you can use a simple bash reverse shell or the code from /usr/share/webshells/php/php-reverse-shell.php, modifying the IP address and port to match the attacker machine's details.

Once the 404.php file is updated with the reverse shell code, start a netcat listener on the attacker machine to receive the incoming connection. Access the modified 404.php page by navigating to the appropriate URL, such as

http://spectra.htb/main/wp-content/themes/twentynineteen/404.php

which will trigger the reverse shell.

Shell as user nginx


Foothold

Shell as user katie

  • Get a shell as katie. SSH with katie:SummerHereWeCome!!


Privilege Escalation

/sbin/initctl is a control interface for the Upstart init system (used in some older Ubuntu and Debian systems, like Ubuntu ≤ 15.04). It manages services defined in /etc/init/*.conf. If you can write or modify an Upstart config file, you can escalate privileges.

Shell as root

  • Since katie is in the developers groups, katie can modify the test.conf service

  • Get a shell as root:


Post Exploitation


Extra


Last updated

Was this helpful?