PermX

https://app.hackthebox.com/machines/PermX

Port scanning

PORT   STATE SERVICE VERSION
22/tcp open  ssh     OpenSSH 8.9p1 Ubuntu 3ubuntu0.10 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey:
|   256 e2:5c:5d:8c:47:3e:d8:72:f7:b4:80:03:49:86:6d:ef (ECDSA)
|_  256 1f:41:02:8e:6b:17:18:9c:a0:ac:54:23:e9:71:30:17 (ED25519)
80/tcp open  http    Apache httpd 2.4.52
|_http-server-header: Apache/2.4.52 (Ubuntu)
|_http-title: eLEARNING
Service Info: Host: 127.0.0.1; OS: Linux; CPE: cpe:/o:linux:linux_kernel

Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 11.72 seconds

Subdomain scanning

Web vuln

We see it's using Chamilo LMS, basic googling about it's recent vuln gives POC

https://github.com/m3m0o/chamilo-lms-unauthenticated-big-upload-rce-poc POC LINK

Shell

www-data

Follow the POC steps and get a reverse shell.

www-data -> mtz

This will list all files that contains password variable/text.

We will find cli-config.php where we see all imp variables,

out of which I found this useful

configuration.php

Now we can ssh and be user mtz

Ohh btw, how I find user mtz??? Here's how ⬇️

mtz -> root

File content:

What is setfacl?

To sum it up, it's alternative of chmod with more extra features.

Exploit

How's the script working:

  1. It checks if given file is under /home/mtz (so a normal user should not change other imp files)

  2. The argument should not have .. (it should stay under /home/mtz)

  3. The given argument should be file

With given 3 rules, it's very easy to bypass this. We wil create a symbolic link, under /home/mtz, so that we can edit different sources files too

Now let's become root, i'll simply update my uid from 1000 to 0

Yay πŸŽ‰

_____________heapbytes's still pwning....

Last updated