Performing Service Account Audit
Overview
Audit service accounts across enterprise infrastructure to identify orphaned, over-privileged, and non-compliant accounts. This skill covers discovery of service accounts in Active Directory, cloud platforms, databases, and applications, assessing privilege levels, identifying missing owners, and enforcing lifecycle policies.
Objectives
- Discover all service accounts across AD, cloud, databases, and applications
- Identify orphaned accounts with no valid owner or associated application
- Assess privilege levels and flag over-privileged service accounts
- Check for non-rotating passwords and weak authentication
- Map service account dependencies for safe remediation
- Generate compliance reports for SOX, PCI DSS, and HIPAA audits
Key Concepts
Service Account Types
- AD Service Accounts: Windows services, scheduled tasks, IIS app pools
- Managed Service Accounts (gMSA): AD-managed automatic password rotation
- Cloud IAM Service Accounts: AWS IAM roles/users, Azure service principals, GCP service accounts
- Database Service Accounts: Application connection accounts, replication accounts
- Application Service Accounts: API keys, bot accounts, integration accounts
Audit Dimensions
- Ownership: Who is responsible for this account?
- Purpose: What application/service uses this account?
- Privileges: What permissions does this account have?
- Authentication: How does this account authenticate (password, key, certificate)?
- Rotation: When was the credential last changed?
- Activity: When was this account last used?
Implementation Steps
Step 1: Discovery - Active Directory
- Query AD for all service accounts (filter by description, OU, naming convention)
- Identify accounts with
ServicePrincipalName set
- List accounts in privileged groups (Domain Admins, Enterprise Admins)
- Check for gMSA vs traditional service accounts
- Identify accounts with
PasswordNeverExpires flag
Step 2: Discovery - Cloud Platforms
- AWS: List IAM users with access keys, check last used date, identify unused roles
- Azure: Enumerate service principals, app registrations, managed identities
- GCP: List service accounts, check key age, identify unused permissions
Step 3: Assessment
- Flag accounts with admin/privileged group membership
- Check password age against rotation policy (90 days max)
- Identify accounts with no login activity in 90+ days
- Verify account ownership against CMDB/asset inventory
- Check for shared credentials (same password hash across accounts)
Step 4: Risk Classification
- Critical: Domain/cloud admin privileges, no password rotation
- High: Access to sensitive data, no identified owner
- Medium: Standard service permissions, password older than 90 days
- Low: Read-only access, managed credentials (gMSA, managed identity)
Step 5: Remediation
- Disable orphaned accounts after validation with application teams
- Convert traditional service accounts to gMSA where possible
- Rotate credentials older than policy threshold
- Reduce privileges to minimum required
- Assign owners and document dependencies
Security Controls
| Control |
NIST 800-53 |
Description |
| Account Management |
AC-2 |
Service account lifecycle |
| Account Review |
AC-2(3) |
Periodic review of accounts |
| Least Privilege |
AC-6 |
Minimum service account permissions |
| Authenticator Management |
IA-5 |
Service credential rotation |
| Audit Review |
AU-6 |
Review service account activity |
Common Pitfalls
- Disabling service accounts without verifying application dependencies first
- Not discovering service accounts outside of Active Directory
- Missing cloud service principals and managed identities
- Not checking for interactive logon rights on service accounts
- Failing to document dependencies before remediation
Verification
1---2name: performing-service-account-audit3description: Audit service accounts across enterprise infrastructure to identify orphaned, over-privileged, and non-compliant accounts. This skill covers discovery of service accounts in Active Directory, cloud pl4domain: cybersecurity5subdomain: identity-access-management6tags: [iam, identity, access-control, service-accounts, audit, governance]7version: "1.0"8author: mahipal9license: Apache-2.010---1112# Performing Service Account Audit1314## Overview15Audit service accounts across enterprise infrastructure to identify orphaned, over-privileged, and non-compliant accounts. This skill covers discovery of service accounts in Active Directory, cloud platforms, databases, and applications, assessing privilege levels, identifying missing owners, and enforcing lifecycle policies.1617## Objectives18- Discover all service accounts across AD, cloud, databases, and applications19- Identify orphaned accounts with no valid owner or associated application20- Assess privilege levels and flag over-privileged service accounts21- Check for non-rotating passwords and weak authentication22- Map service account dependencies for safe remediation23- Generate compliance reports for SOX, PCI DSS, and HIPAA audits2425## Key Concepts2627### Service Account Types281. **AD Service Accounts**: Windows services, scheduled tasks, IIS app pools292. **Managed Service Accounts (gMSA)**: AD-managed automatic password rotation303. **Cloud IAM Service Accounts**: AWS IAM roles/users, Azure service principals, GCP service accounts314. **Database Service Accounts**: Application connection accounts, replication accounts325. **Application Service Accounts**: API keys, bot accounts, integration accounts3334### Audit Dimensions35- **Ownership**: Who is responsible for this account?36- **Purpose**: What application/service uses this account?37- **Privileges**: What permissions does this account have?38- **Authentication**: How does this account authenticate (password, key, certificate)?39- **Rotation**: When was the credential last changed?40- **Activity**: When was this account last used?4142## Implementation Steps4344### Step 1: Discovery - Active Directory451. Query AD for all service accounts (filter by description, OU, naming convention)462. Identify accounts with `ServicePrincipalName` set473. List accounts in privileged groups (Domain Admins, Enterprise Admins)484. Check for gMSA vs traditional service accounts495. Identify accounts with `PasswordNeverExpires` flag5051### Step 2: Discovery - Cloud Platforms52- **AWS**: List IAM users with access keys, check last used date, identify unused roles53- **Azure**: Enumerate service principals, app registrations, managed identities54- **GCP**: List service accounts, check key age, identify unused permissions5556### Step 3: Assessment57- Flag accounts with admin/privileged group membership58- Check password age against rotation policy (90 days max)59- Identify accounts with no login activity in 90+ days60- Verify account ownership against CMDB/asset inventory61- Check for shared credentials (same password hash across accounts)6263### Step 4: Risk Classification64- **Critical**: Domain/cloud admin privileges, no password rotation65- **High**: Access to sensitive data, no identified owner66- **Medium**: Standard service permissions, password older than 90 days67- **Low**: Read-only access, managed credentials (gMSA, managed identity)6869### Step 5: Remediation70- Disable orphaned accounts after validation with application teams71- Convert traditional service accounts to gMSA where possible72- Rotate credentials older than policy threshold73- Reduce privileges to minimum required74- Assign owners and document dependencies7576## Security Controls77| Control | NIST 800-53 | Description |78|---------|-------------|-------------|79| Account Management | AC-2 | Service account lifecycle |80| Account Review | AC-2(3) | Periodic review of accounts |81| Least Privilege | AC-6 | Minimum service account permissions |82| Authenticator Management | IA-5 | Service credential rotation |83| Audit Review | AU-6 | Review service account activity |8485## Common Pitfalls86- Disabling service accounts without verifying application dependencies first87- Not discovering service accounts outside of Active Directory88- Missing cloud service principals and managed identities89- Not checking for interactive logon rights on service accounts90- Failing to document dependencies before remediation9192## Verification93- [ ] Service accounts inventoried across all platforms94- [ ] Each account has assigned owner95- [ ] Privileged service accounts documented with justification96- [ ] Password rotation compliance checked97- [ ] Orphaned accounts flagged for remediation98- [ ] gMSA migration candidates identified99- [ ] Compliance report generated