How InTrust can help decrease the frequency of failed RDP authorization attempts

How InTrust can help decrease the frequency of failed RDP authorization attempts

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

In this article, I will show how to InTrust set up an automatic response to password brute force attacks by adding a new rule to the firewall. InTrust is a for collecting, analyzing, and storing unstructured data, with hundreds of predefined responses to various types of attacks already in place. When a program is launched, it loads into the computer's memory. The executable file contains computer instructions and auxiliary libraries (for example, *.dll). Once the process is running, it can create additional threads. Threads allow the process to execute different sets of instructions simultaneously. There are many ways for malicious code to infiltrate memory and be executed; let's explore some of them.

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

How InTrust can help decrease the frequency of failed RDP authorization attempts

Events in the Windows logs use what are called Insertion Strings. Look at the matches for the event with code 4625 (this is a failed logon attempt) and you will see that the fields of interest are stored in InsertionString14 (Workstation Name) and InsertionString20 (Source Network Address). When attacked from the internet, the Workstation Name field will most likely be empty, so it is important to substitute the value from the Source Network Address field in its place.

The text of event 4625 looks approximately like this:

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, we will add the Source Network Address value to the event text.

How InTrust can help decrease the frequency of failed RDP authorization attempts

Then we 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 for configuring the 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 rule name and its description to avoid confusion later.

How InTrust can help decrease the frequency of failed RDP authorization attempts

Now you need to add this script as a response action to the rule, enable the rule, and make sure the corresponding rule is included in the monitoring policy for real-time mode. The agent must have the capability to run the response script, and the correct parameter must be specified.

How InTrust can help decrease the frequency of failed RDP authorization attempts

After the settings were applied, the number of failed authentications decreased by 80%. Profit? Absolutely!

How InTrust can help decrease the frequency of failed RDP authorization attempts

Sometimes there is a small uptick again, but that's due to new sources of attacks. Then everything goes down again.

In a week of operation, 66 IP addresses were added to the firewall rule.

How InTrust can help decrease the frequency of failed RDP authorization attempts

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

Username

Quantity

In percentages

administrator

1220235

40.78

admin

672109

22.46

user

219870

7.35

contoso

126088

4.21

contoso.com

73048

2.44

administrador

55319

1.85

server

39403

1.32

sgazlabdc01.contoso.com

32177

1.08

administrateur

32377

1.08

sgazlabdc01

31259

1.04

Share in the comments how you handle information security threat response. What system are you using, and how convenient is it?

If you're interested in seeing InTrust in action, please leave a request please fill out the feedback form on our website or message me privately.

Read our other articles on information security:

Identifying ransomware attacks, gaining access to the domain controller, and attempting to counteract these attacks

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

Tracking user lifecycle without pliers and duct tape

Who did this? Automating information security audits

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

Source: habr.com

Buy reliable website hosting with DDoS protection, VPS VDS servers 🔥 Buy reliable website hosting with DDoS protection, VPS VDS servers | ProHoster