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.
When to Use
- When conducting security assessments that involve performing service account audit
- When following incident response procedures for related security events
- When performing scheduled security testing or auditing activities
- When validating security controls through hands-on testing
Prerequisites
- Familiarity with identity access management concepts and tools
- Access to a test or lab environment for safe execution
- Python 3.8+ with required dependencies installed
- Appropriate authorization for any testing activities
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?
Workflow
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.010metadata:11 source: https://skillmd.com/skills/micsapp/performing-service-account-audit12---1314# Performing Service Account Audit1516## Overview17Audit 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.181920## When to Use2122- When conducting security assessments that involve performing service account audit23- When following incident response procedures for related security events24- When performing scheduled security testing or auditing activities25- When validating security controls through hands-on testing2627## Prerequisites2829- Familiarity with identity access management concepts and tools30- Access to a test or lab environment for safe execution31- Python 3.8+ with required dependencies installed32- Appropriate authorization for any testing activities3334## Objectives35- Discover all service accounts across AD, cloud, databases, and applications36- Identify orphaned accounts with no valid owner or associated application37- Assess privilege levels and flag over-privileged service accounts38- Check for non-rotating passwords and weak authentication39- Map service account dependencies for safe remediation40- Generate compliance reports for SOX, PCI DSS, and HIPAA audits4142## Key Concepts4344### Service Account Types451. **AD Service Accounts**: Windows services, scheduled tasks, IIS app pools462. **Managed Service Accounts (gMSA)**: AD-managed automatic password rotation473. **Cloud IAM Service Accounts**: AWS IAM roles/users, Azure service principals, GCP service accounts484. **Database Service Accounts**: Application connection accounts, replication accounts495. **Application Service Accounts**: API keys, bot accounts, integration accounts5051### Audit Dimensions52- **Ownership**: Who is responsible for this account?53- **Purpose**: What application/service uses this account?54- **Privileges**: What permissions does this account have?55- **Authentication**: How does this account authenticate (password, key, certificate)?56- **Rotation**: When was the credential last changed?57- **Activity**: When was this account last used?5859## Workflow6061### Step 1: Discovery - Active Directory621. Query AD for all service accounts (filter by description, OU, naming convention)632. Identify accounts with `ServicePrincipalName` set643. List accounts in privileged groups (Domain Admins, Enterprise Admins)654. Check for gMSA vs traditional service accounts665. Identify accounts with `PasswordNeverExpires` flag6768### Step 2: Discovery - Cloud Platforms69- **AWS**: List IAM users with access keys, check last used date, identify unused roles70- **Azure**: Enumerate service principals, app registrations, managed identities71- **GCP**: List service accounts, check key age, identify unused permissions7273### Step 3: Assessment74- Flag accounts with admin/privileged group membership75- Check password age against rotation policy (90 days max)76- Identify accounts with no login activity in 90+ days77- Verify account ownership against CMDB/asset inventory78- Check for shared credentials (same password hash across accounts)7980### Step 4: Risk Classification81- **Critical**: Domain/cloud admin privileges, no password rotation82- **High**: Access to sensitive data, no identified owner83- **Medium**: Standard service permissions, password older than 90 days84- **Low**: Read-only access, managed credentials (gMSA, managed identity)8586### Step 5: Remediation87- Disable orphaned accounts after validation with application teams88- Convert traditional service accounts to gMSA where possible89- Rotate credentials older than policy threshold90- Reduce privileges to minimum required91- Assign owners and document dependencies9293## Security Controls94| Control | NIST 800-53 | Description |95|---------|-------------|-------------|96| Account Management | AC-2 | Service account lifecycle |97| Account Review | AC-2(3) | Periodic review of accounts |98| Least Privilege | AC-6 | Minimum service account permissions |99| Authenticator Management | IA-5 | Service credential rotation |100| Audit Review | AU-6 | Review service account activity |101102## Common Pitfalls103- Disabling service accounts without verifying application dependencies first104- Not discovering service accounts outside of Active Directory105- Missing cloud service principals and managed identities106- Not checking for interactive logon rights on service accounts107- Failing to document dependencies before remediation108109## Verification110- [ ] Service accounts inventoried across all platforms111- [ ] Each account has assigned owner112- [ ] Privileged service accounts documented with justification113- [ ] Password rotation compliance checked114- [ ] Orphaned accounts flagged for remediation115- [ ] gMSA migration candidates identified116- [ ] Compliance report generated