How InTrust can help reduce RDP login failures

How InTrust can help reduce RDP login failures

Anyone who has tried to run a virtual machine in the cloud is well aware that the standard RDP port, if left open, will almost immediately be attacked by waves of password attempts from various IP addresses around the world.

In this article, I will show you how to InTrust you can configure an automatic response to password guessing in the form of adding a new rule to the firewall. InTrust is CLM platform for collecting, analyzing and storing unstructured data, which already has hundreds of preset reactions to various types of attacks.

In Quest InTrust, you can configure response actions when a rule is triggered. From the log collector agent, InTrust receives a message about an unsuccessful authorization attempt on the workstation or server. To configure the addition of new IP addresses to the firewall, you need to copy an existing custom rule for detecting multiple failed authorizations and open its copy for editing:

How InTrust can help reduce RDP login failures

Events in the Windows logs use the so-called InsertionString. Look up matches for event ID 4625 (this is an unsuccessful logon to the system) and you will see that the fields of interest to us are stored in InsertionString14 (Workstation Name) and InsertionString20 (Source Network Address). When attacking from the Internet, the Workstation Name field will most likely be empty, so this place is important substitute the value from Source Network Address.

This is what the text of event 4625 looks like

An account failed to log on.
Subject:
	Security ID:		S-1-5-21-1135140816-2109348461-2107143693-500
	Account Name:		ALebovsky
	Account Domain:		LOGISTICS
	Logon ID:		0x2a88a
Logon Type:			2
Account For Which Logon Failed:
	Security ID:		S-1-0-0
	Account Name:		Paul
	Account Domain:		LOGISTICS
Failure Information:
	Failure Reason:		Account locked out.
	Status:			0xc0000234
	Sub Status:		0x0
Process Information:
	Caller Process ID:	0x3f8
	Caller Process Name:	C:WindowsSystem32svchost.exe
Network Information:
	Workstation Name:	DCC1
	Source Network Address:	::1
	Source Port:		0
Detailed Authentication Information:
	Logon Process:		seclogo
	Authentication Package:	Negotiate
	Transited Services:	-
	Package Name (NTLM only):	-
	Key Length:		0
This event is generated when a logon request fails. It is generated on the computer where access was attempted.
The Subject fields indicate the account on the local system which requested the logon. This is most commonly a service such as the Server service, or a local process such as Winlogon.exe or Services.exe.
The Logon Type field indicates the kind of logon that was requested. The most common types are 2 (interactive) and 3 (network).
The Process Information fields indicate which account and process on the system requested the logon.
The Network Information fields indicate where a remote logon request originated. Workstation name is not always available and may be left blank in some cases.
The authentication information fields provide detailed information about this specific logon request.
	- Transited services indicate which intermediate services have participated in this logon request.
	- Package name indicates which sub-protocol was used among the NTLM protocols.
	- Key length indicates the length of the generated session key. This will be 0 if no session key was requested.

Additionally, add the Source Network Address value to the event text.

How InTrust can help reduce RDP login failures

Then you need to add a script that will block the IP address in the Windows firewall. Below is an example that can be used for this.

Script to configure firewall

param(
         [Parameter(Mandatory = $true)]
         [ValidateNotNullOrEmpty()]   
         [string]
         $SourceAddress
)

$SourceAddress = $SourceAddress.Trim()
$ErrorActionPreference = 'Stop'
$ruleName = 'Quest-InTrust-Block-Failed-Logons'
$ruleDisplayName = 'Quest InTrust: Blocks IP addresses from failed logons'

function Get-BlockedIps {
    (Get-NetFirewallRule -Name $ruleName -ErrorAction SilentlyContinue | get-netfirewalladdressfilter).RemoteAddress
}

$blockedIps = Get-BlockedIps
$allIps = [array]$SourceAddress + [array]$blockedIps | Select-Object -Unique | Sort-Object

if (Get-NetFirewallRule -Name $ruleName -ErrorAction SilentlyContinue) {
    Set-NetFirewallRule -Name $ruleName -RemoteAddress $allIps
} else {
    New-NetFirewallRule -Name $ruleName -DisplayName $ruleDisplayName -Direction Inbound -Action Block -RemoteAddress $allIps
}

Now you can change the name of the rule and its description so that later there is no confusion.

How InTrust can help reduce RDP login failures

Now we need to add this script as a response to the rule, enable the rule, and make sure the corresponding rule is enabled in the real-time monitoring policy. The agent must have the ability to run a response script enabled and the correct parameter must be specified.

How InTrust can help reduce RDP login failures

After the settings were made, the number of unsuccessful authorizations decreased by 80%. Profit? What more!

How InTrust can help reduce RDP login failures

Sometimes a small increase occurs again, but this is due to the emergence of new sources of attacks. Then everything goes downhill again.

During the week of work, 66 IP addresses got into the firewall rule.

How InTrust can help reduce RDP login failures

Below is a table with 10 common usernames that were used for authorization attempts.

Username

Quantity

In percents

administrator

1220235

40.78

admin

672109

22.46

user

219870

7.35

contoso

126088

4.21

contoso.com

73048

2.44

administrator

55319

1.85

server

39403

1.32

sgazlabdc01.contoso.com

32177

1.08

administrator

32377

1.08

sgazlabdc01

31259

1.04

Tell us in the comments how your response to information security threats is built. What system do you use, how convenient is it.

If you are interested in seeing InTrust in action, leave a request in the feedback form on our website or write to me in a personal.

Read our other articles on information security:

We identify the attack of the ransomware virus, gain access to the domain controller and try to resist these attacks

What can be useful from the logs of a workstation based on Windows OS (popular article)

User lifecycle tracking without pliers and duct tape

And who did it? We automate information security audit

How to reduce the cost of ownership of a SIEM system and why you need Central Log Management (CLM)

Source: habr.com

Add a comment