linuxSnookums

Privilege Escalation via writable /etc/passwd

Summary

  • FTP allowed anonymous login but directory listing failed.

  • Apache server hosted vulnerable Simple PHP Photo Gallery v0.8.

  • LFI and RFI exploits led to remote code execution via PHP reverse shell.

  • MySQL DBPASS for root found in webroot PHP config.

  • Credentials for local users recovered via double base64 decoding from MySQL.

  • Privilege escalation achieved by abusing write access to /etc/passwd.


🧡 Let's Unpack

πŸ”Ž Enumeration

nmap -p- 192.168.167.58
sudo nmap -A -T4 -sC -sN -oN nmapFull -p 21,22,80,111,139,445,3306,33060 192.168.167.58
  • FTP: vsftpd 3.0.2 allowed anonymous login (but no directory listing)

  • HTTP: Apache 2.4.6 hosted Simple PHP Photo Gallery v0.8

  • MySQL open on 3306 (unauth)

  • Samba, RPCBind, and SSH present

⚑ Initial Foothold

  • Exploited EDB-7786arrow-up-right on Simple PHP Photo Gallery

  • Used LFI to read /etc/passwd and RFI to execute PHP shell

  • Reverse shell connection received, gained shell access

πŸ” Credential Extraction

  • Found db_config.php in /var/www/html:

  • Logged into MySQL using:

  • Extracted user credentials from users table (double base64 encoded):

  • Decoded credentials:

    • michael : HockSydneyCertify123

    • josh : MobilizeHissSeedtime747

    • serena : OverallCrestLean000

  • SSH login as michael successful

πŸͺœ Privilege Escalation

  • michael had write access to /etc/passwd

  • Added root user manually using crafted password hash:

  • Gained root shell πŸŽ‰


Last updated