Pelican
Introduction
This write-up details the steps taken to solve the Pelican machine from Proving Grounds Practice. The approach includes reconnaissance, enumeration, exploitation, and privilege escalation to gain root access.
Reconnaissance
Initial Nmap Scan
To begin the process, an nmap
scan was conducted to identify open ports and services running on the target machine:
Enumeration
Port 139/445
Guest access is enabled on Samba, but there are no accessible shares.
Port 8080
The Jetty 1.0 service on port 8080 returned a 404 Not Found error, meaning there was no default page or directory listing available.
Port 8081
Port 8081 serves an nginx 1.14.2 instance, which redirects to an Exhibitor Zookeeper UI on port 8080.
Researching online, Exhibitor has a known remote code execution (RCE) vulnerability due to improper handling of configuration parameters.
Explotation
RCE Exploit
After identifying the Exhibitor web UI, I found a public exploit for remote code execution:
Steps to Exploit
Access the Exhibitor UI and navigate to the Config tab, and Enable Editing Mode by flipping the Editing switch to ON.
In the “java.env script” field, enter any command surrounded by $() or , for example, for a simple reverse shell:
Start a Netcat listener on the attacking machine:
Click Commit > All At Once > OK to apply the configuration change.
The command execution may take up to a minute before the reverse shell is received.
TTY Treatment
Once I had successfully established the reverse shell, the session was not as stable or user-friendly as it could be. The shell I obtained was non-interactive, meaning it didn’t allow me to perform typical interactive tasks like tab completion, command history, or using commands like sudo
properly.
To resolve this, I applied a TTY treatment to the shell, making it more stable and interactive. This was done by upgrading the shell to a fully interactive terminal using the following command:
After checking the contents of the charle's directory, I discovered the user flag.
Privilege Escalation
Identifying Privileged Binary - gcore
During privilege escalation enumeration, I discovered that the user charles has permission to execute the gcore
binary as root.
Understanding gcore
gcore is a utility used to generate core dumps of running processes. These dumps can contain sensitive information, such as:
Plaintext passwords
Cryptographic keys
Open file contents
This makes gcore a valuable tool for extracting credentials from memory.
Finding a SUID Binary - /usr/bin/password-store
Continuing enumeration, I identified a SUID binary:
This binary, when executed, likely interacts with credentials, making it an interesting target for memory dumping.
Exploiting gcore to Dump Memory
Since I can generate core dumps of root-owned processes, I decided to:
Execute the password-store binary.
Identify its process ID (PID).
Dump its memory using gcore.
Extract sensitive information from the dump.
Step 1: Execute password-store
Once running, I obtained its PID:
Step 2: Dump Process Memory
Using gcore
, I generated a core dump of the process:
This produced a binary dump file, core.490
Step 3: Extracting Credentials
Using strings
, I searched the core dump file for readable text, specifically looking for passwords:
After filtering the output, I discovered the root password:
With the root password extracted, I elevated privileges by switching to the root user:
Last updated