AverageSecurityGuy

Security, Programming, Pentesting

About

Mastodon

Linked In

Projects

Cheat Sheets

Book

15 July 2011

Psexec is your friend

by {"login"=>"averagesecurityguy", "email"=>"stephen@averagesecurityguy.info", "display_name"=>"averagesecurityguy", "first_name"=>"", "last_name"=>""}

Obtaining Domain Admin Access Using Psexec

On a recent pentest, one of the goals was to gain domain admin access to the network. If you can compromise a domain controller you can use the commands net user username password /ADD /DOMAIN and net group "Domain Admins" username /ADD /DOMAIN. I found the domain controllers but was unable to identify a suitable vulnerability that would allow me to access them. However, I found another box on the domain that was vulnerable to MS08-067 (yes, there are still boxes that have not been patched for this vulnerability). Using metasploit I was able to get a meterpreter shell on this box. I then used the ps command to find out what processes were running. I found a few processes running under the administrator account for the domain. Next, I migrated to one of the processes and used the upload command in meterpreter to upload psexec to the box. Meterpreter uploads files to the default path for the user. Next, I used the shell command to drop into a shell and ran the commands psexec \\nameofdc net user username password /ADD /DOMAIN and psexec \\nameofdc net group "Domain Admins" username /ADD /DOMAIN. I now had my own user account with domain admin credentials.

A Few Notes

tags: Backtrack5 - metasploit