| name | T1505.005_terminal-services-dll |
| description | Adversaries may abuse components of Terminal Services to enable persistent access to systems. |
| category | configuration |
| version | 18.1 |
| author | cyberstrike-official |
| tags | ["mitre-attack","enterprise","t1505.005","persistence","windows","sub-technique"] |
| technique_id | T1505.005 |
| tactic | persistence |
| all_tactics | ["persistence"] |
| platforms | ["Windows"] |
| mitre_url | https://attack.mitre.org/techniques/T1505/005 |
| tech_stack | ["windows"] |
| cwe_ids | ["CWE-276"] |
| chains_with | ["T1505","T1505.001","T1505.002","T1505.003","T1505.004","T1505.006"] |
| prerequisites | ["T1505"] |
| severity_boost | {"T1505":"Chain with T1505 for deeper attack path","T1505.001":"Chain with T1505.001 for deeper attack path","T1505.002":"Chain with T1505.002 for deeper attack path"} |
T1505.005 Terminal Services DLL
Sub-technique of: T1505
High-Level Description
Adversaries may abuse components of Terminal Services to enable persistent access to systems. Microsoft Terminal Services, renamed to Remote Desktop Services in some Windows Server OSs as of 2022, enable remote terminal connections to hosts. Terminal Services allows servers to transmit a full, interactive, graphical user interface to clients via RDP.
Windows Services that are run as a "generic" process (ex: svchost.exe) load the service's DLL file, the location of which is stored in a Registry entry named ServiceDll. The termsrv.dll file, typically stored in %SystemRoot%\System32\, is the default ServiceDll value for Terminal Services in HKLM\System\CurrentControlSet\services\TermService\Parameters\.
Adversaries may modify and/or replace the Terminal Services DLL to enable persistent access to victimized hosts. Modifications to this DLL could be done to execute arbitrary payloads (while also potentially preserving normal termsrv.dll functionality) as well as to simply enable abusable features of Terminal Services. For example, an adversary may enable features such as concurrent Remote Desktop Protocol sessions by either patching the termsrv.dll file or modifying the ServiceDll value to point to a DLL that provides increased RDP functionality. On a non-server Windows OS this increased functionality may also enable an adversary to avoid Terminal Services prompts that warn/log out users of a system when a new RDP session is created.
Kill Chain Phase
Platforms: Windows
What to Check
How to Test
Atomic Red Team Tests
The following tests are from Atomic Red Team and provide actionable ways to test this technique:
Atomic Test 1: Simulate Patching termsrv.dll
Simulates patching of termsrv.dll by making a benign change to the file and replacing it with the original afterwards.
Before we can make the modifications we need to take ownership of the file and grant ourselves the necessary permissions.