Recon :
a quick rustscan to find open ports on the target

Scanning : then a nmap scan for banner grabbing for the open ports

# Nmap 7.94SVN scan initiated Thu Oct 24 18:25:45 2024 as: /usr/lib/nmap/nmap -p 22,80 -sCV -oN assertion.txt 192.168.170.94
Nmap scan report for 192.168.170.94
Host is up (0.043s latency).
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 7.6p1 Ubuntu 4ubuntu0.3 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey:
| 2048 6e:ce:aa:cc:02:de:a5:a3:58:5d:da:2b:ef:54:07:f9 (RSA)
| 256 9d:3f:df:16:7a:e1:59:58:84:4a:e3:29:8f:44:87:8d (ECDSA)
|_ 256 87:b5:6f:f8:21:81:d3:3b:43:d0:40:81:c0:e3:69:89 (ED25519)
80/tcp open http Apache httpd 2.4.29 ((Ubuntu))
|_http-server-header: Apache/2.4.29 (Ubuntu)
|_http-title: Assertion
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
# Nmap done at Thu Oct 24 18:25:54 2024 -- 1 IP address (1 host up) scanned in 8.80 seconds
Enumeration :
From the nmap scan, we could deduce that Os runs Linux and specifically.
There is a apache web server running, would enumerate it.
The website is about fitness.

fuzzing for hidden endpoints

/pages shows this php files.

From the main page, clicked on the about-us

Test for lfi 
using payload of /etc/passwd,there is an error “file does not exist”
could try other payloads or automate it by fuzzing..
While manually trying different payloads and methologies, the box creator sends us messages..
Will continue testing..
Tried everything i knew but was futile, reading over stackoverflow, someone talked about this attack,
simple detailed explanation on how it works..

going 1 step from the html directory, the local.txt file

Next, to attempt privilege escalation to the user..
importing linpeas

There is unknown binary, will enumerate more..

great

the /usr/bin/aria2c
executable, which is a command line download utility. We can use it to overwrite some important files. For example, we can use it to overwrite the root’s authorized_keys file.
It can be used read files as well or

read it normally.. 
in this scenario, will copy the existing passwd file and add a new user with root rights and copy to the target to the /etc directory using the aria2c binary.


then switch user to Tom and enter the password (Password@973)

got the last flag..
Thanks for reading..