Offsec: Sunset Midnight

Another box. Another WordPress install. And another reminder why enumeration > assumptions. Let’s break down Sunset: Midnight step by step.

Nmap Scan

Started with a full TCP scan.

Web Enumeration (Port 80)

Visiting the site revealed:

  • Default WordPress installation
  • User: admin
  • Plugin: simple-poll-master
  • Version: 1.5.0

At first glance, nothing obvious. But after researching the plugin version, I found that version 1.4.1 had a known SQL injection — and reports suggested 1.5.0 was also vulnerable.

The vulnerable endpoint:

With parameter:

SQL Injection with sqlmap

It worked — but extraction was slow. Since MySQL (MariaDB) was exposed on port 3306, I pivoted.

MySQL Enumeration (Port 3306)

After identifying valid credentials using hydra, I logged in directly to MariaDB.

Listing databases:

Found:

  • wordpress_db

Checking users:

Then inside WordPress DB:

Found:

  • admin user
  • WordPress password hash

Cracking hashes didn’t work. But then I realized: I was root in the database. Instead of cracking — just change it.

WordPress accepts MD5 during login and rehashes automatically. Logged in successfully as admin.

Gaining RCE via WordPress

Editing the theme directly failed:

However, modifying an installed plugin worked:

I injected a simple reverse shell and triggered it via the browser:

Got a shell.

Lateral Movement – Credential Reuse

While enumerating, I discovered that user jose reused credentials. SSH access worked with the reused password. Always try credential reuse — especially after database compromise.

Privilege Escalation

While performing standard enumeration (linpeas, manual checks), I found:

Permissions:

SUID binary running as root.

Analyzing the Binary

Using strings:

Revealed:

The binary calls:

But it does not use an absolute path. This means it relies on $PATH. Classic PATH hijacking opportunity.

Exploiting PATH Hijacking

Create a fake service binary:

Prepend /tmp to PATH:

Run the vulnerable binary:

Root shell:

Lessons Learned

This box highlights several important concepts:

  1. Exposed databases drastically increase attack surface.
  2. SQL injection doesn’t always need full data extraction — sometimes logic abuse is faster.
  3. If you control the database, you control the application.
  4. Credential reuse is still one of the most reliable privilege escalation techniques.
  5. SUID binaries must use absolute paths.
  6. PATH hijacking remains a classic but powerful attack vector.