Era

ENUMERATION

NMAP

nmap -p- --open -sCV 10.10.11.79 -oG allPorts
########################################3333
PORT      STATE SERVICE    VERSION
21/tcp    open  ftp        vsftpd 3.0.5
80/tcp    open  http       nginx 1.18.0 (Ubuntu)
|_http-server-header: nginx/1.18.0 (Ubuntu)
|_http-title: Did not follow redirect to http://era.htb/
56322/tcp open  tcpwrapped

WEB

basic virtual hosting era.htb

We can see the web site and do a vhost scan and fuff scan -->

VHOST Scan

So I added the new vHost file.era.htb and then I visited it:

There are 5 endpoints:

  • manage.php

  • upload.php

  • reset.php

  • login.php

  • security_login.php

I’ll check the security_login.php:

If I test a non-existent user, It gives me an error “User not found”. So I’ll brute force for usernames with /usr/share/seclists/Usernames/Names/names.txt. There are five user registered:

WE HAVE USERS! Add it into wordlist users.tx

FTP BruteForce

I decided to bruteforce ftp with Hydraarrow-up-right:

Logging in we can find two directories: apache2_conf and php8.1_conf:

WEB LOGIN

I didn’t find anything, so I register in in the website and got in:

IDOR

It may be possible to perform a malicious file upload. My file got uploaded to http://file.era.htb/download.php?id=xxxx, so I’ll fuzz for existing files via IDOR. There are two files:

  • signing.zip

  • site-backup-30-08-24.zip

I’ll download both. Inside the backup there is a sqlite database, so I’ll open it with sqlbrowser:

DUMP SLQ DATABASE

We can read the admin security questions. As it didn’t work, I’ll try to crack he hashes:

I can now inside the website change the security questions for admin_ef01cab31aa with my user eldeim:

LOGIN TO ADMIN

admin : test : test : test

EXPLOTAION

Weaponization

Analyzing this other part of the singing.zip & code of upload.php:

singin.zip

To get rce we need to execute this in browser and dont forget to change <YOUR_IP>

In local shell do

Pivoting

I logged in as user yuri. I can now change to user eric user the until password

eric : america

I do a tty sanetize

Privilege Escalation

For root i ran linpeas and got this binary called monitor

  • To exploit this we need to make a malicious executable and upload it but we need to sign it too using the key we got in signing.zip

  • In your local machine do make a file exploit.c

  • To sign this we need to

  • Now run a python server upload this into this directory /opt/AV/periodic-checks

  • To make this exploitable to do this in eric shell

  • And in local machinesudo

Last updated