Windows server 2008 - blocking RDP hijack attempts?

Overspeed

Limp Gawd
Joined
Feb 21, 2008
Messages
227
So my server began to crawl this afternoon. I logged into it via RDP and found that there were 200+ winlogin.exe, csrss.exe and loginui.exe processes running utilizing 100% of the server CPU. I checked the System Security event viewer and found that my server was experiencing an RDP hijack attack. I went through all failed audit, recorded the IP addresses and blocked them in the firewall. Shortly after the attack ceased.

This is something I seem to have to do often (block IPs). I would like to craft a firewall rule (if possible) that will deny all RDP login attempts with the exception of IP address that I specify (my own for example). Is this possible in the Windows server 2008 firewall?

Here is an example of one of the thousands of login attempts:

---------------------------------------------------------------------------------------------------

An account failed to log on.

Subject:
Security ID: SYSTEM
Account Name: hostway42$
Account Domain: WORKGROUP
Logon ID: 0x3e7

Logon Type: 10

Account For Which Logon Failed:
Security ID: NULL SID
Account Name: user
Account Domain: NN1609

Failure Information:
Failure Reason: Unknown user name or bad password.
Status: 0xc000006d
Sub Status: 0xc0000064

Process Information:
Caller Process ID: 0x6e5c
Caller Process Name: C:\Windows\System32\winlogon.exe

Network Information:
Workstation Name: hostway42
Source Network Address: 66.188.27.98
Source Port: 32944

Detailed Authentication Information:
Logon Process: User32
Authentication Package: Negotiate
Transited Services: -
Package Name (NTLM only): -
Key Length: 0
 
is the port 3389 forwarded out externally so people can log into it ? ( ie a port open on the firewall )
 
I typicaly do this on my hardware router/firewall. To only accept requests from my specified IP's. May be a bit easier then messing with Windows firewall configs?
 
My server is leased. I have no access to any sort of hardware firewall, all I have is the Windows firewall.
 
My server is leased. I have no access to any sort of hardware firewall, all I have is the Windows firewall.

What do you mean ?

Is it colocated ?

If so then it's behind a firewall right ?
How do you gain access to it ?

External ip then remote port ?

Why don't you have a VPN connection to it for rdp ?
 
Its a leased server. no hardware firewall. I access it via RDP. I would like to create a window firewall rule that says block any type of RDP connection unless it is from my IP.
 
Its a leased server. no hardware firewall. I access it via RDP. I would like to create a window firewall rule that says block any type of RDP connection unless it is from my IP.

Put a firewall in front of it. Having a server, and using windows firewall is really not recommended these days.
 
My server is leased. I have no access to any sort of hardware firewall, all I have is the Windows firewall.

Change the RDP port. I have all my boxes port forwarded but the incoming port is not the default one. Helps a lot with this stuff.

You can do this in the registry.
 
Change the RDP port. I have all my boxes port forwarded but the incoming port is not the default one. Helps a lot with this stuff.

You can do this in the registry.

helps a little bit, till some one does a port scan on the box, and or keeps hammering on it. OBVIOUSNESS some one is trying to get in. Only a matter of time tho..
 
You should be able to create a windows FW rule under advanced security that is a deny all, then create a rule to allow from your IP. Well i suppose you should have the rule to allow from your IP before denying all. :)
 
I use iptables to limit connection attempts to 5 in a 5 minute window ( firewall in front of the rdp server ). Doesn't eliminate the problem, but it curbs it significantly, and dramatically reduces the ability to brute a password.
 
Thank you all for your suggestions. The final solution was easy. I simply edited the pre-existing rule in the firewall for RDP. It was to set "allow any IP" on the Scope tab. I changed it to "these IPs only" and added mine. As soon as I applied the rule, all the failed audits in the event viewer ceased.
 
Thank you all for your suggestions. The final solution was easy. I simply edited the pre-existing rule in the firewall for RDP. It was to set "allow any IP" on the Scope tab. I changed it to "these IPs only" and added mine. As soon as I applied the rule, all the failed audits in the event viewer ceased.

Make sure you have a backdoor so that you can still get in if your IP changes or your regular internet connection goes down. Something like a Powershell SSH session could save your butt in a pinch.

EDIT: Why not just set up a VPN and use that instead? OpenVPN is free, easy to set up, and has virtually no attack surface (at least compared to RDP). The built-in Windows IPSec server also works great.
 
Make sure you have a backdoor so that you can still get in if your IP changes or your regular internet connection goes down. Something like a Powershell SSH session could save your butt in a pinch.

EDIT: Why not just set up a VPN and use that instead? OpenVPN is free, easy to set up, and has virtually no attack surface (at least compared to RDP). The built-in Windows IPSec server also works great.

thats what i suggested, run the vpn server ON his server, and don't open RDP to the world.
 
Don't do this. You never know when your IP address will change.

X2 I would highly suggest you just change the port.

I dont see ANY attempts to connect to my boxes by anyone but me, when they are on another port. Simple, and effective. Yes, if someone is targeting YOUR box then a portscan will reveal the real port but 99.999% of the people doing this stuff out there are just scanning on default ports to find easy targets.
 
I use iptables to limit connection attempts to 5 in a 5 minute window ( firewall in front of the rdp server ). Doesn't eliminate the problem, but it curbs it significantly, and dramatically reduces the ability to brute a password.

Tell me more about this rule.
 
Tell me more about this rule.

We use 5 per one minute for logging and access purposes here.

Code:
-m limit -limit 5/min

Add that to your rule to invoke the limiter at 5 connections that match per minute. You can easily do a -j LOG to log the offending packets or a -j DROP to just stop them outright.
 
Back
Top