Join our Newsletter — 33% off our NHI Course
Home› Guides› How to audit user rights assignments for service…
Guide Non-Human Identity (NHI)

How to audit user rights assignments for service accounts: find and remove dangerous Windows privileges

PDF for newsletter subscribers · free to read online

← All guides
By NHI Mgmt Group, under the editorial direction of Lalit Choda Updated 19 November 2026 16 min read
On this page

A Windows service account is only as safe as the user rights it holds, and a single extra assignment such as Debug programs or Impersonate a client after authentication can turn an ordinary service compromise into control of the whole server. User Rights Assignment is the part of Windows security policy that decides which accounts can log on in which way (as a service, as a batch job, interactively, over the network) and which accounts hold powerful privileges such as SeDebugPrivilege and SeImpersonatePrivilege. These settings are rarely reviewed after a server is built. Installers add rights, administrators grant them to fix a failing job, and Group Policy objects accumulate exceptions that nobody remembers. This guide shows identity, Windows and security operations teams how to audit those assignments for service accounts: what each high-risk right does, what Microsoft documents as the defaults, how to collect the effective assignments across an estate, how to decide what each service account actually needs, and how to monitor for changes once the estate is clean.

The guide focuses on the audit itself. For the wider lifecycle of service accounts (inventory, ownership, credential rotation and migration to managed accounts) see the Service Account Security Guide and the Windows Services and Service Account Security Guide.

Key takeaways

  • User rights come in two kinds: logon rights (such as Log on as a service, SeServiceLogonRight) and privileges (such as Debug programs, SeDebugPrivilege). Audit both, because they are monitored differently.
  • Microsoft documents that Debug programs is assigned only to Administrators by default. Any service account holding it outside that group is a finding to justify or remove.
  • Impersonate a client after authentication is held by default by Administrators, Local Service, Network Service and Service, and services started by the Service Control Manager receive it through the Service group. Audit which accounts run services, not only which accounts are named in policy.
  • Task Scheduler automatically grants Log on as a batch job when a task is scheduled with a stored user name and password, so batch rights drift without anyone editing Group Policy.
  • Collect effective settings from hosts, not only from Group Policy objects: local policy, installers and Task Scheduler all change the result.
  • Event 4704 records user rights being assigned, but Microsoft documents that it generates only for user rights, not logon rights. Event 4672 shows when a logon session receives sensitive privileges and is the best runtime signal for service accounts.

Why user rights matter for service accounts

Service accounts are non-human identities that run continuously, usually with stored or managed credentials, often on many servers. Their user rights decide two things. First, how the account may sign in: a service account that also holds interactive or remote desktop logon rights can be used by a person, which defeats most of the controls placed on human administrators. Second, what the process can do once running: a service with Debug programs can read the memory of other processes, and a service with Impersonate a client after authentication can act with the identity of clients that connect to it.

Microsoft's own description of the Debug programs right is direct: the right can be exploited to capture sensitive device information from system memory or to access and modify kernel or application structures, and some attack tools exploit it to extract hashed passwords and other private security information. For impersonation, Microsoft describes an attacker with the right who could create a service, mislead a client into connecting to it, and then impersonate that computer to elevate the attacker's level of access to that of the device. These are the techniques MITRE ATT&CK catalogues as T1134 Access Token Manipulation, including T1134.001 Token Impersonation/Theft, and they sit close to T1003 OS Credential Dumping.

The practical consequence is that a compromised web application, database or agent running under a service account inherits every right that account holds. Auditing user rights is therefore a blast radius exercise: it limits what an attacker gains from the first foothold.

The rights to audit first

All of the settings below live in Group Policy at Computer Configuration\Windows Settings\Security Settings\Local Policies\User Rights Assignment. The constant names are the identifiers you will see in exported policy and in event logs.

Policy nameConstantTypeDefault documented by MicrosoftAudit question
Log on as a serviceSeServiceLogonRightLogon rightNetwork Service as the effective default on domain controllers, member servers and clientsIs every account here a known, owned service account?
Log on as a batch jobSeBatchLogonRightLogon rightAdministrators, Backup Operators and Performance Log Users on domain controllers and stand-alone servers; Administrators on clientsWhich scheduled tasks put accounts here, and are they still needed?
Debug programsSeDebugPrivilegePrivilegeAdministratorsDoes any service account hold it at all?
Impersonate a client after authenticationSeImpersonatePrivilegePrivilegeAdministrators, Local Service, Network Service, ServiceAre any named accounts here beyond the defaults?

Microsoft's event 4672 documentation lists a wider set of privileges it treats as sensitive. Include them in the same audit, because each gives a service account powers well beyond running its own code:

  • SeTcbPrivilege (Act as part of the operating system)
  • SeAssignPrimaryTokenPrivilege (Replace a process-level token)
  • SeCreateTokenPrivilege (Create a token object)
  • SeBackupPrivilege and SeRestorePrivilege (Back up and Restore files and directories)
  • SeTakeOwnershipPrivilege (Take ownership of files or other objects)
  • SeLoadDriverPrivilege (Load and unload device drivers)
  • SeSecurityPrivilege (Manage auditing and security log) and SeAuditPrivilege (Generate security audits)
  • SeSystemEnvironmentPrivilege (Modify firmware environment values)
  • SeEnableDelegationPrivilege (Enable computer and user accounts to be trusted for delegation)

Log on as a service and Log on as a batch job

Microsoft describes Log on as a service as the setting that determines which service accounts can register a process as a service, and notes that running a process under a service account circumvents the need for human intervention. Its best practice is short: minimise the number of accounts that are granted this user right. It also notes that the Network Service account has this right by definition and that it is not granted through the Group Policy setting, so do not treat its absence from a GPO as meaning it is absent from the host.

The risk statement is worth reading carefully. Microsoft says the risk is reduced because only users with administrative privileges can install and configure services, but that an attacker who has already reached that level could configure the service to run with the Local System account. In audit terms, Log on as a service is less about direct privilege and more about inventory: every account in this list is a non-human identity that should have an owner, a purpose and a credential management plan.

Log on as a batch job works differently because it changes itself. Microsoft documents that when the Add Scheduled Task Wizard is used to schedule a task to run under a particular user name and password, that user is automatically assigned the right, and the Task Scheduler service then logs on the user as a batch job. To override that behaviour, Microsoft points to the Deny log on as a batch job setting. Its countermeasure is to allow the computer to manage the right automatically if scheduled tasks need to run under specific accounts, or otherwise to configure the right for only the Local Service account.

Two consequences for the audit follow. Batch rights will appear on hosts even if no Group Policy grants them, and every account found there points to a scheduled task that stores a credential. Pair the batch right list with a scheduled task inventory so each assignment can be traced to a task, an owner and a stored password that will need rotating.

Both logon rights have deny counterparts. Microsoft states that Deny log on as a service supersedes Log on as a service if an account is subject to both. Deny rights are the reliable way to keep a class of accounts (for example, human administrator accounts) from ever being used to run services, and to keep service accounts out of interactive sign-in; see How to detect interactive logons by service accounts for the detection side of that control.

Debug programs and impersonation

Debug programs. Microsoft documents that by default members of the Administrators group have this right, that it is assigned only to administrators by default, and that this helps mitigate the risk. The countermeasure is to remove the accounts of all users and groups that do not require it. In practice, very few production services need to debug other processes. Where a vendor asks for it, record the request, the vendor's justification and an expiry, and prefer granting it only on the specific hosts and for the period the vendor tooling actually runs. A service account that is also a member of the local Administrators group already holds this right through the group, so the audit must expand group membership, not only read named assignments.

Impersonate a client after authentication. This right is built into how Windows services work, which is why the audit has to be more careful. Microsoft explains that services started by the Service Control Manager have the built-in Service group added by default to their access tokens, and that COM servers started by the COM infrastructure and configured to run under a specific account also have the Service group added, so these processes are assigned the right when they start. The documented countermeasure is that on member servers only the Administrators and Service groups (Local Service, Network Service and Service) should have the right assigned.

The audit question for impersonation is therefore twofold. First, are there any named accounts or groups in the policy beyond the documented defaults? Those are findings. Second, which accounts run services at all? Because every service process receives the right through the Service group, the protection lies in limiting which accounts run services, which services are exposed to untrusted clients, and which hosts those services share with more valuable workloads. That is where service account inventory and server tiering meet. See the Windows Privilege Escalation Techniques Guide for the defensive view of how these privileges are abused.

Collecting effective assignments across an estate

An audit that reads only Group Policy objects will miss a large share of real assignments. Effective rights on a host are the result of domain GPOs, local security policy, installers that edit local policy, and Task Scheduler's automatic batch grants. Build the collection in four layers:

  1. Group Policy. Export every GPO that defines User Rights Assignment settings and record which organisational units each one is linked to. This shows intended state and where exceptions were made.
  2. Effective host policy. On a representative sample of each server role, and on all high-value servers such as domain controllers and identity infrastructure, collect the effective User Rights Assignment as the host applies it, using your configuration management or endpoint management tooling. Record principals by security identifier as well as name so renamed or deleted accounts do not disappear from the results.
  3. Group expansion. Expand every group in every assignment, including nested and local groups, so you can say which service accounts actually hold each right. Local Administrators membership deserves its own column because it carries Debug programs with it.
  4. Service and task context. For each host, list services and scheduled tasks with the account they run under. This turns a list of rights into a list of running identities with rights.

Store the results in one table keyed by host, right and principal. That single table becomes the baseline for every later step and for change monitoring.

Deciding what each service account needs

With the table built, classify every service account assignment into one of four outcomes:

  • Expected default. Built-in principals holding the rights Microsoft documents as defaults, such as Network Service for Log on as a service or the Service group for impersonation. Record and move on.
  • Justified. A named service account holding a logon right it needs on the hosts where its service runs, with an owner and a ticket. Keep, but scope the assignment to the right hosts.
  • Over-broad. A justified right granted too widely, for example Log on as a service granted to a service account on every server through a domain-wide GPO when it runs on three. Narrow it.
  • Unjustified. Sensitive privileges such as Debug programs, Act as part of the operating system or Create a token object held by a service account without a documented need, or any right held by an account nobody owns. Remove after testing, or disable the account.

The governing principle is least privilege, as in NIST SP 800-53 Rev. 5 control AC-6 Least Privilege. Where accounts can be moved to managed service accounts, do it at the same time: a group managed service account removes the stored password problem that makes batch and service logon rights so attractive to attackers. See How to convert AD service accounts to gMSA.

Remediating safely

Removing a right from a running service can stop it, sometimes only at the next restart or the next scheduled run, which is how audit remediation causes outages weeks later. Reduce that risk:

  • Change one right for one account on one host group at a time, and restart the affected services deliberately during a change window so failures appear immediately rather than at the next patch reboot.
  • Use event 4672 (described below) before the change to see whether a service logon session actually receives a sensitive privilege; a privilege that never appears in its sessions over a full business cycle is a strong candidate for removal.
  • Express the final state in Group Policy, not by hand on hosts, so that the intended assignment is reapplied and drift is overwritten.
  • Use deny rights to make the intent explicit: deny interactive and remote desktop logon for service accounts, and deny Log on as a service and Log on as a batch job for human administrator accounts.
  • For batch rights granted automatically by Task Scheduler, fix the task (move it to a managed account or to a service with its own identity) rather than fighting the automatic grant.

Monitoring for changes

Once the estate is clean, two events from the Windows Security log keep it that way. The event names and fields below come from Microsoft's documentation; any query you build from them is illustrative and must be adapted to your log platform.

4704(S): A user right was assigned. Logged under the Audit Authorization Policy Change subcategory, this event generates every time local user right policy is changed and a user right is assigned to an account, with a separate event for each account. Its fields include Subject\Security ID, Target Account\Account Name and New Right\User Right (in XML, SubjectUserSid, TargetSid and PrivilegeList). Microsoft recommends reporting it whenever the subject is not SYSTEM, because the event is typically triggered by SYSTEM, and comparing the new right to your list of rights that should not be enabled, especially on high-value servers. Microsoft also documents that this event generates only for user rights, not logon rights, so it will not show changes to Log on as a service or Log on as a batch job. Cover those with the periodic baseline comparison from your collection process.

4672(S): Special privileges assigned to new logon. Logged under Audit Special Logon, this event generates for new logons when any of the sensitive privileges listed earlier is assigned to the session, with the subject fields and a Privileges field (PrivilegeList in XML). Microsoft recommends monitoring for this event where the subject is not LOCAL SYSTEM, NETWORK SERVICE or LOCAL SERVICE and is not an administrative account expected to have the privileges, and using it to watch for privileges that should never be granted, or granted only to a few accounts, giving SeDebugPrivilege as the example. For service accounts this is the most useful runtime signal: a service account whose sessions start showing SeDebugPrivilege is either misconfigured or being abused.

An illustrative alert logic, to adapt to your SIEM:

  • Event 4704 where the subject is not SYSTEM, or where the new right is in your sensitive list and the target is a service account.
  • Event 4672 where the subject is a service account from your inventory and the privilege list contains SeDebugPrivilege, SeTcbPrivilege, SeCreateTokenPrivilege or SeAssignPrimaryTokenPrivilege.

Feed alerts to the team that owns service account inventory as well as to the SOC. See the Active Directory Security Monitoring and Event IDs Guide for collection and audit policy set-up.

Common failure patterns

  • Reading GPOs only. Local policy and Task Scheduler grants never appear in the domain view, so the audit reports a clean estate that is not.
  • Ignoring group membership. A service account in local Administrators holds Debug programs through the group, and a named-assignment review never shows it.
  • Treating impersonation as an anomaly. Every service process receives SeImpersonatePrivilege through the Service group, so alerting on its mere presence produces noise; focus on named additions and on which accounts run services.
  • Relying on 4704 for logon rights. Microsoft documents that 4704 covers user rights, not logon rights, so batch and service logon changes slip past it.
  • Removing rights without restarting. The service keeps running on its existing token until the next restart, and the outage arrives weeks later with no obvious cause.
  • No owner for the account. Rights are removed, the service fails, and the right is put back permanently because nobody can confirm what the service needs.

Practitioner checklist

  • Export every GPO that defines User Rights Assignment and map it to its linked organisational units.
  • Collect effective user rights, by SID, from all high-value servers and a sample of every server role.
  • Expand nested and local groups, including local Administrators, for every assignment.
  • Join rights to the services and scheduled tasks each account runs, and to the account owner.
  • Confirm no service account holds Debug programs, Act as part of the operating system, Create a token object or Replace a process-level token without a documented, time-limited exception.
  • Confirm Impersonate a client after authentication on member servers is limited to Administrators and the Service groups.
  • Scope Log on as a service and Log on as a batch job to the hosts where each account actually runs.
  • Apply deny logon rights for service accounts (interactive) and human administrators (service and batch).
  • Enable Audit Authorization Policy Change and Audit Special Logon, and alert on 4704 and 4672 as described.
  • Re-run the baseline comparison on a schedule to catch logon right changes that 4704 does not record.

Standards and references

Microsoft's user rights pages are archived under previous versions and were last updated in 2017; confirm defaults against your Windows release before changing production policy.

Related NHI Mgmt Group resources: Service Account Security Guide · Windows Services and Service Account Security Guide · How to detect interactive logons by service accounts · MITRE ATT&CK T1134 Access Token Manipulation

PDF for subscribers

Take this guide with you

Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

PDF Downloads for Newsletter Subscribers

Get the guide

Enter your details and we’ll email you a download link.

The full guide is free to read online. The PDF is a thank you for subscribing.

Fill in all fields marked * and tick both boxes to continue.