Synapse

Gaining Access

Nmap scan:

$ nmap -p- --min-rate 3000 -Pn 192.168.201.149
Starting Nmap 7.93 ( https://nmap.org ) at 2023-07-15 12:30 +08
Nmap scan report for 192.168.201.149
Host is up (0.17s latency).
Not shown: 65530 closed tcp ports (conn-refused)
PORT    STATE SERVICE
21/tcp  open  ftp
22/tcp  open  ssh
80/tcp  open  http
139/tcp open  netbios-ssn
445/tcp open  microsoft-ds

SMB + FTP Rabbit Holes

FTP doesn't accept anonymous logins, and SMB with no credentials doesn't show us any share that we can access:

$ smbmap -H 192.168.201.149
[+] IP: 192.168.201.149:445     Name: 192.168.201.149                                   
        Disk                                                    Permissions     Comment
        ----                                                    -----------     -------
        print$                                                  NO ACCESS       Printer Drivers
        IPC$                                                    NO ACCESS       IPC Service (Samba 4.9.5-Debian)

It is thus likely that there's a web exploit, so we can start proxying traffic through Burpsuite.

Web Enum -> SSI Injection

Port 80 was running a custom dashboard:

The File Manager was running elFinder, but we cannot access it since we need administrative access:

I checked the user tab, and found that the user was called mindsflee:

All of options were under construction, except for the one on the right most.

From my enumeration, this seems to be the most vulnerable point. I attempted to upload some PHP webshells, but it seems only images are allowed.

There was one weird part, which was the url=inspect.shtml portion, since I had never seen that before. Searching for shtml gives us results for Server Side Includes (SSI).

Hacktricks has done a page on SSI Injection that we could try.

We can try some of the payloads:

If we follow the redirect, we get this:

We now have RCE on the machine, and we can easily get a reverse shell using this:

Privilege Escalation

GPG Creds -> Mindsflee Shell

Within the /home/mindsflee directory, there are some files of interest:

The .gnupg file contains some creds. Download these files back to our machine, and we can then try to decrypt it. Using gpg, we can attempt to import this key but it requires a passphrase.

We can crack this using gpg2john and john:

Using this, we can then import the key using gpg and decrypt the file:

Using this password, we can su to mindsflee.

Sudo Privileges -> Socket Injection

The mindsflee user can use sudo with the Python script we found:

Here's the content of the script:

This program seems to open a Socket as root using the configuration of synapse_commander.s after we input any number from 1-3, since option 4 and all others would just re-run the script.

Again, Hacktricks has a page for this:

In one SSH session, run the Python script and input '1'. In another SSH session, run this command:

When we enter that command, the script starts waiting for data to be sent in, which it passes to os.system(datagram). This would result in RCE as root:

We can then easily get a root shell:

Last updated