📜 ⬆️ ⬇️

Protection of Microsoft service accounts

Protection of user accounts in the corporate network based on the MS Windows domain is a typical and simple task. Everything is already implemented and regulated (for example, in MS TechNet Password Best practices or in 17/21 orders of the FSTEC ):


But what to do with "service" technology accounts?
Such records are in any corporate network and are used, for example, for:

We also assign to this list administrator accounts, if they are used for the above tasks.
We will continue to talk about the features of the protection of service accounts.

Why do you need to "special" to protect service accounts?

Because it is impossible to apply the same security policies to them as to ordinary user entries, namely:

It turns out that the network has a lot of service accounts that are not protected from brute force and over the years non-removable password. And if we consider that during the operation of the service, not one engineer could attach to his service, we consider the password known to a wide circle of people.
Protection for service accounts is lower than that of user accounts, and using them you can do anything on the network, especially since they are often endowed with extended privileges.
The following are techniques to minimize the risk of unauthorized use of service accounts. All of them have been tested and implemented in the corporate network.

Auto unlock and alert


Disabling account lockout policies in case of entering the wrong password is fraught with a complete lack of protection against password guessing.
You can apply the following solution:

As a result, although we do not stop trying to find a password, we notify the administrator, giving him the opportunity to quickly respond to the incident.
')
Implementation:
On the domain controller in the event scheduler, configure the task triggered by the lock event of a specific service account:
Event properties -> Tab: Triggers -> Create -> Assign date: At event -> Parameters: Custom -> Create event filter ... -> Tab: XML ->
<QueryList> <Query Id="0" Path="Security"> <Select Path="Security">*[System[(EventID=4740)]] and *[EventData[Data[@Name='TargetUserName'] and (Data='[USERNAME]')]] and *[EventData[Data[@Name='SubjectDomainName'] and (Data='[DOMAIN NAME]')]]</Select> </Query> </QueryList> 

Where:
[USERNAME] - the name of the controlled account;
[DOMAIN NAME] - domain name.

Next, set up an action for this event — launching a script that takes the name of an account as an argument, removes the lock from it, and sends an e-mail notification.
In our case, this is a powershell script, run with arguments:

 -ExecutionPolicy RemoteSigned -Command "& {C:\Scripts\Unlock.ps1 -user [USERNAME] }" 

The basis of the script are the commands:
 Import-Module ActiveDirectory //    Unlock-ADAccount $user //      Get-EventLog -LogName 'Security' -newest 10000 | Where-Object {$_.EventID -eq 4740 -and $_.ReplacementStrings[0] -eq "$user"} | Select-Object -first 1 //   ,        Net.Mail //  . 

This event in the task scheduler must be duplicated for each service account under control. If there are too many such records, then it makes sense to upgrade the solution to:

Lock full work


Most of the service accounts are used to run specific services or to work on servers. So, for them, you can disable all the extra features. For example, to prohibit the possibility of local access to computers on the network.
Microsoft proposes to do this with the appropriate policy located here: Security Settings \ Local Policies \ User Rights Assignment \ Local Login . But sometimes using this policy is difficult, then you can use the following method:

As a result, even if the account password is compromised, it will be problematic to log into the network computers with it.

Suspicious Activity Monitoring


If an account is created for working with a database or authorizing an application, then it has nothing to do on file servers or a domain controller. Of course, with properly configured access rights, it will not go there, but who will give a guarantee? Therefore, it is necessary to conduct various kinds of monitoring of suspicious activity on the part of official accounts. For these purposes you can use:

Describe the monitoring options on the example of specific protection systems in this article will be superfluous, given that they have their own in each network, I will cite only events that it makes sense to “catch”:

Summing up


Compromising and subsequent unauthorized use of service accounts are a serious threat to any corporate network and when building a protection system, greater attention should be paid to their protection and control. Using generic policies for service accounts is not suitable. It is necessary to understand what functionality can be blocked, and what needs to be put under control.

Source: https://habr.com/ru/post/246189/


All Articles