Era (HTB)
into
Hello hackers. New HTB machine season machine. New as in the day of release lets get right into it.
enumeration
Port scanning
# Nmap 7.97 scan initiated Fri Aug 22 18:25:56 2025 as: nmap -vvv -p 21,80 -4 -Pn -sC -sV -vv -o nmap.scan 10.10.11.79
Nmap scan report for era.htb (10.10.11.79)
Host is up, received user-set (0.011s latency).
Scanned at 2025-08-22 18:25:56 +08 for 11s
PORT STATE SERVICE REASON VERSION
21/tcp open ftp syn-ack vsftpd 3.0.5
80/tcp open http syn-ack nginx 1.18.0 (Ubuntu)
| http-methods:
|_ Supported Methods: GET HEAD
|_http-title: Era Designs
|_http-server-header: nginx/1.18.0 (Ubuntu)
|_http-favicon: Unknown favicon MD5: 0309B7B14DF62A797B431119ADB37B14
Service Info: OSs: Unix, Linux; CPE: cpe:/o:linux:linux_kernel
Read data files from: /usr/bin/../share/nmap
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
# Nmap done at Fri Aug 22 18:26:07 2025 -- 1 IP address (1 host up) scanned in 10.67 seconds
This is odd. FTP, HTTP. let's see what we have
Web server enumeration.
As for the normal domain era.htb it does not have anything only static page. After performing subdomain enumeration using ffuf we can find a new subdomain called file .

Adding that to the hosts file. /etc/hosts we can navigate there to see few options.

All of them require login but there is no registration page. Enumerting the directoires going to show us some interesting ones.
we can see register.php naviagating there we will find the register page. after register it going to redirect us to the login page, and after that we can login into the system.

After playing around i found that when we upload a file and access it, it uses the id to access it. Maybe IDOR ?.
using caido i was able to find few. But the interesting one is 150 ID.

accessing there we going to file a zip file called signing.zip unzip it, to find certification (x509) and private key..
The unzip file contains the following files.
and another private key which is not protected. For now this does not do a whole a lot. But there is more.
finding more users.
So there is a big mistake here, First from the image above we can see that we can login using the security question, but the problem lies in how the server is able to find the user, when we provide a wrong username then we going to know that the username is wrong, and if it valid we going to know too. We can use that to our advantages to extract more users. I wrote this simple go code which enable you to dictionary attack that form to extract users.
After running this script i found these usernames.
among these user names the yuri user is the most interesting user as we can see from the certification file above that it matches the name yurivich@era.com using hydra i was able to find the password for the user yuri for the ftp server.

after finding these credential i was able to login into the ftp server but there was nothing so i was looking back and forth of my findings and i found that as showen the caido image there is another id which i did not check 54 when i came back to it, it was a zip file that contains a backup version of the site so a very big this i was missing :(

The most important thing is the db file init we can find more users and most important the admin..

using hash cat also i was able to crack two password of these which is for yuri which we already know and eric .
going more into the code we can see that the file download.php contains something intresting.

This is very interesting it uses streaming here to it possible to execute php wrappers. But it require admin access. we can simply use the reset security question reset to access it . After that we can try php wrappers. i tried the ssh2.exec and it actually work. This attempts to execute some command via ssh session on the local machine.
I used this payload.
and this is the whole get command
Do not forgot to set the listner nc -nvlp 8899 .

After this we already know eric password we can switch to him directly.
root.
After we access eric we can see that we are in a group called devs. searching for files belongs to that group. using find

We going to see these files also we have write access on monitor . At first glance you may say this is easy just change that monitor file to something malicious and execute it. RIGHT?. This is completely correct by if we do so we will see this message.

So before it executed it, it checks for the signature and if it valid it will execute it other wise it won't. Also this is a cron job from root will be executed every once and while. If i had to guess the useless key we find earlier is the one used for singing. So let's test that assumption.
wrong way.
After spending some time failing the way i was doing was wrong i was taking the while key.pem file which include the private key and the certificate both in one file. so i was using openssl to generate the signature.
where the monitor_not is this code.
When compiling the code above do not forgot to use the -static when compile to make sure no dynamic linking is needed.
So i was generating signature without problems. and using the objcopy i put the signature as section in the elf executable.
so the command above going to insert the signature into a section called text_sig . And that file should be the one that produce a valid signature when it executed. Anyway this is not the case this was producing invalid signature.
Correct way..
Am not sure if there is a way to complete it in openssl but when i searched about this i came across this github repo which include a tool used to provide the same thing adding a sign to a elf executable.
After compiling it using this command
we can use it to produce a sign elf .
Also do not forgot to split the keys into the key.pem into two sperate files.
So this going to take an algorithm private key and certificate. the last two is the executable name in this case mine was monitor and the output name monitor_signed. After it finish executing. we can run a python server to transfer the executable.
And from the target machine using wget we can get the executable.
After downloading it into the machine run this command to make it executable.
And finally change its name to machine the target one executed by the root which is monitor
Also before all of that do not forgot to set the listner in your attacking machine.

And once it execute by the cron job we shall receive the shell :)

Closing.
This machine was unique in its ideas and the way of ssh2.exec is amazing way and new thing to me. And the code signature was my first time dealing with such very interesting machine ...
Last updated