What it does. Audit service accounts across enterprise infrastructure to identify orphaned, Part of mukul975/Anthropic-Cybersecurity-Skills (817 security skills) (mukul975/Anthropic-Cybersecurity-Skills).
Install
npx skills add mukul975/Anthropic-Cybersecurity-Skills --skill performing-service-account-audit, or copy the skill folder into ~/.claude/skills/performing-service-account-audit/.
- Raw file:
curl -sL https://raw.githubusercontent.com/mukul975/Anthropic-Cybersecurity-Skills/HEAD/skills/performing-service-account-audit/SKILL.md
SKILL.md (verbatim)
name: performing-service-account-audit
description: 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 pl
domain: cybersecurity
subdomain: identity-access-management
tags:
- iam
- identity
- access-control
- service-accounts
- audit
- governance
version: '1.0'
author: mahipal
license: Apache-2.0
nist_csf:
- PR.AA-01
- PR.AA-02
- PR.AA-05
- PR.AA-06
mitre_attack:
- T1078
- T1110
- T1556
- T1098
- T1069
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
- 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)
- 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
Other files in this skill
assets/template.md (verbatim)
Service Account Audit Template
Service Account Inventory
| Account Name |
Platform |
Type |
Owner |
Application |
Privilege |
Password Age |
Last Used |
Status |
|
|
|
|
|
|
|
|
|
Risk Classification
| Risk Level |
Criteria |
Action Required |
| Critical |
Domain admin + no rotation |
Immediate rotation, vault in PAM |
| High |
Privileged + no owner |
Assign owner within 7 days |
| Medium |
Standard + stale password |
Rotate within 30 days |
| Low |
Read-only + managed |
Include in next review cycle |
| Account |
Finding |
Assigned To |
Due Date |
Status |
|
|
|
|
|
Sign-Off
| Role |
Name |
Date |
| IT Security Lead |
|
|
| Compliance Officer |
|
|
references/api-reference.md (verbatim)
API Reference: Service Account Audit
Active Directory PowerShell Cmdlets
| Cmdlet |
Description |
Get-ADUser -Filter {ServicePrincipalName -ne '$null'} |
Find accounts with SPNs |
Get-ADServiceAccount -Filter * |
List managed service accounts |
Get-ADGroupMember -Identity "Domain Admins" |
List privileged group members |
Search-ADAccount -PasswordNeverExpires |
Find non-expiring passwords |
Search-ADAccount -AccountInactive -TimeSpan 90.00:00:00 |
Find inactive accounts |
AWS IAM CLI Commands
| Command |
Description |
aws iam list-users |
List all IAM users |
aws iam list-access-keys --user-name <name> |
List access keys for user |
aws iam get-access-key-last-used --access-key-id <id> |
Check key last used date |
aws iam list-user-policies --user-name <name> |
List inline policies |
aws iam list-attached-user-policies --user-name <name> |
List managed policies |
aws iam generate-credential-report |
Generate credential report |
Azure CLI Commands
| Command |
Description |
az ad sp list --all |
List all service principals |
az ad app list --all |
List all app registrations |
az ad app credential list --id <app-id> |
List credential expiration |
Risk Classification
| Level |
Score Range |
Criteria |
| Critical |
>= 40 |
Domain admin + stale password + no owner |
| High |
25-39 |
Privileged group membership or orphaned |
| Medium |
10-24 |
Password age exceeded or PasswordNeverExpires |
| Low |
0-9 |
Standard permissions, managed credentials |
Python Libraries
| Library |
Version |
Purpose |
subprocess |
stdlib |
Execute PowerShell and AWS CLI commands |
json |
stdlib |
Parse CLI output |
ldap3 |
>=2.9 |
Direct LDAP queries to Active Directory |
boto3 |
>=1.26 |
AWS IAM programmatic access |
References
references/standards.md (verbatim)
Standards - Service Account Audit
NIST Standards
- NIST SP 800-53 Rev 5: AC-2, AC-2(3), AC-6, IA-5, AU-6
- NIST SP 800-171: 3.1.1, 3.1.2, 3.5.1, 3.5.2
Industry Frameworks
- CIS Controls v8: Control 5.3 - Disable Dormant Accounts, Control 5.4 - Restrict Administrator Privileges
- MITRE ATT&CK: T1078 (Valid Accounts), T1136 (Create Account)
- PCI DSS 4.0: 7.2.5 - Review user access, 8.6 - Application/system account management
- SOX Section 404: Service account access controls for financial systems
- Microsoft AD: Get-ADServiceAccount, Get-ADUser with SPN filter
- AWS IAM: Access Analyzer, Credential Report, IAM Access Advisor
- Azure Entra ID: Service principal reports, App registration audit
- CyberArk DNA: Automated privileged account discovery
- Stealthbits (Netwrix): Service account discovery and monitoring
references/workflows.md (verbatim)
Service Account Audit Workflows
Workflow 1: Discovery Phase
- Export AD service accounts using PowerShell/LDAP queries
- Export cloud IAM service accounts (AWS credential report, Azure SP list, GCP SA list)
- Query databases for application-specific service accounts
- Consolidate into single inventory spreadsheet
- Cross-reference with CMDB for ownership data
Workflow 2: Assessment Phase
- Check each account against privilege policy
- Verify password/key rotation compliance (90-day max)
- Check last logon/activity date
- Validate owner assignment against HR data
- Flag accounts meeting orphaned/stale/over-privileged criteria
- Contact owners of over-privileged accounts for justification
- Plan gMSA migration for eligible Windows service accounts
- Disable orphaned accounts (staged: disable first, delete after 30 days)
- Rotate stale credentials immediately
- Update documentation, close findings, report to compliance
Back to mukul975/Anthropic-Cybersecurity-Skills (817 security skills) or Agent skills.