Defense Evasion
The adversary is trying to avoid being detected. https://attack.mitre.org/tactics/TA0005/
Firewall Modification
Allowing RDP
PowerShell
Set-itemproperty 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\' -Name "fDenyTSConnections" -value 0
Set-ItemProperty 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp\' -Name "UserAuthentication" -value 1
Enable-NetFirewallRule -DisplayGroup "Remote Desktop"Windows Commands
reg add "hklm\system\currentControlSet\Control\Terminal Server" /v "AllowTSConnections" /t REG_DWORD /d 0x1 /f
reg add "hklm\system\currentControlSet\Control\Terminal Server" /v "fDenyTSConnections" /t REG_DWORD /d 0x0 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fAllowToGetHelp /t REG_DWORD /d 1 /f
netsh advfirewall set rule group="remote administration" new enable="yes"
netsh advfirewall firewall set rule group="remote administration" new enable=yes
netsh advfirewall firewall set rule group="remote desktop" new enable=Yes
netsh advfirewall firewall set rule group="remote desktop" new enable=Yes profile=domain
netsh advfirewall firewall set rule group="remote desktop" new enable=Yes profile=private
netsh firewall add portopening TCP 3389 "Remote Desktop"
netsh firewall set service RemoteDesktop enable
netsh firewall set service RemoteDesktop enable profile=ALL
netsh firewall set service RemoteAdmin enable
sc config TermService start= auto
net start TermserviceAMSI Bypasses
A classic resource: https://amsi.fail/
Microsoft Defender for Endpoint
Note: Events are cached on the system, so as soon as traffic is established again, the floodgates will open.
Getting Current Status
Adding an Exclusion
Scanning a File with Defender
Disabling Defender
Disable Defender on Reboot\
A BlackByte TTP
Reviewing AppLocker Policies
You can also review the AppLocker policies by enumerating the Registry manually:
Blocking MS Defender Connections
Default Writable Folders for Execution Control Bypass
Try putting your payload in one of the following directories:
PowerShell Execution
Nested PowerShell Bypass
32-Bit PowerShell Bypass
PowerShell disabled for you? Try running the 32-bit copy of it:
Last updated