NIST SP 800-53 Rev. 5 · Access Control

AC-2(3) on AWS

Stale privileged access — a published SQL (Athena) + Lambda query you can run against Amazon Athena over the IAM credential report, with the evidence it needs, the settings you decide, and what a result does and does not establish.

Why this matters

An administrator account nobody has used in months, still holding full powers

Administrative access tends to be granted for a project, a migration, or an emergency, and then never withdrawn. The person moved to another team, or the work finished, but the account keeps its powers. It is not being used, which is exactly why nobody notices it — and an unused account with full powers is a quiet prize for anyone who obtains its password.

Why this check earns its place. Dormancy is the signal. An administrator using their access daily is doing their job; one who has not signed in for months almost certainly does not need the access, and the check reports the second without pestering the first.

What it reads
The organization's list of who holds administrative roles, compared against its record of who has actually signed in.
What it reports
Accounts holding administrative powers that nobody has signed into for longer than the organization allows.

See related public disclosures on the Signals page →

ControlAC-2(3) — Disable Accounts
PlatformAWS (SQL (Athena) + Lambda)
SeverityMedium
ValidationNot tenant-validated

What this finds

Privileged role held by an identity with no successful authentication inside the inactivity threshold.

The requirement

The organization must disable accounts within an organization-defined time period when the account has been inactive for an organization-defined period, has expired, or is no longer associated with a user or role.

NIST SP 800-53 Rev. 5 — AC-2(3) (Account Management | Disable Accounts).

NIST requires inactive accounts to be disabled within a defined period but does not set the period. The 90-day threshold, the definition of privileged, and break-glass exclusions are local parameters.

How this maps to the CISA performance goals

The Cross-Sector Cybersecurity Performance Goals are a voluntary baseline published by CISA — the U.S. federal agency for critical-infrastructure cybersecurity — written for organizations too small to employ security staff. This control speaks to:

  • 3.H — Implement the principles of least privilege
    Privileged accounts left in place beyond their use are a standing violation of least privilege.
  • 3.D — Revoke credentials for departing staff (partial — see note)
    Overlaps only where the stale account belongs to someone who has left. Staleness is the broader condition.

See the full coverage map, including the goals no query can answer →

Evidence this query needs

Privileged role register privileged_role_register.csv

Defines which roles your organisation treats as privileged, who owns each one, and how often it must be reviewed. Cloud platforms know which roles exist; only you know which ones matter and who is accountable for them.

Minimum fields: role_name, platform, privilege_classification

Three fields make the staleness and MFA checks work. The ownership fields are what make AC-6(7) answerable at all — without them that check has nothing to test against.

The query

Published as ac-2-3-stale-privileged.aws.sql. Reads iam_credential_report, privileged_role_register (supplied). Requires: iam:GenerateCredentialReport; iam:GetCredentialReport; athena:StartQueryExecution.

Before this returns anything, iam_credential_report has to be reaching Amazon Athena over the IAM credential report, and privileged_role_register (supplied) has to be landed there. If not, the query reports nothing found — which looks exactly like nothing wrong. What has to be switched on first →

-- AC-2(3) -- privileged IAM users with no recent recorded activity
WITH last_activity AS (
    SELECT
        c.user_name,
        c.arn,
        greatest(
            coalesce(c.password_last_used,          DATE '1970-01-01'),
            coalesce(c.access_key_1_last_used_date, DATE '1970-01-01'),
            coalesce(c.access_key_2_last_used_date, DATE '1970-01-01')
        ) AS last_used
    FROM iam_credential_report c
)
SELECT
    a.user_name, a.arn, r.role_name, a.last_used,
    date_diff('day', a.last_used, current_date) AS days_since_activity,
    'AWS IAM' AS source_system
FROM last_activity a
JOIN privileged_role_register r
  ON r.platform = 'aws'
 AND lower(r.role_name) = lower(a.user_name)
WHERE r.break_glass = false
  AND date_diff('day', a.last_used, current_date) > 90
ORDER BY days_since_activity DESC;

Open this pack on AWS to adjust the settings and download it →

The interactive version opens on AWS — the platform on this page — even if your environment profile does not list it.

Settings you decide

NIST states the objective and leaves these to your organization. The interactive version of this pack applies them to the query for you.

Inactivity threshold (days) (default 90)
Privileged IAM users with no recorded activity in this many days are reported.
Limit to specific accounts (optional)
Paste IAM user names, one per line.

Running it continuously

EventBridge Scheduler → Lambda → Security Hub

Schedule:         EventBridge Scheduler, rate(1 day)
Compute:          Lambda (Python 3.12), 120s timeout
Step 1:           GenerateCredentialReport, poll until COMPLETE
Step 2:           GetCredentialReport, decode CSV
Step 3:           Join to the supplied privileged role register
Step 4:           BatchImportFindings -> Security Hub
Severity label:   MEDIUM
RelatedRequirements: NIST.800-53.r5 AC-2(3)
Idempotency:      Id = sha256(user_name + "stale-privileged")

The credential report is generated on demand, so the Lambda must request it and poll before parsing. Privilege classification comes from your register, not from AWS.

What a result does not prove

Inactivity alone does not establish that access is unnecessary. Missing activity may reflect licensing, retention limits, non-interactive use, or an authentication path outside the queried source.

Validation status for this platform: Not tenant-validated. Structure, query generation, and preflight are covered by the project's automated test suites. This pack has not been executed against a live tenant, account, or index. Validate it in a non-production scope before relying on any result.

Before you act on a result

  • Is this a human, service, break-glass, or seasonal identity?
  • Is authentication history complete and retained for the full review window?
  • Does the identity authenticate through a path this data source does not capture?
  • Is the elevated role still required for current responsibilities?

Common questions

How do I check for stale privileged access in AWS?
Run the published SQL (Athena) + Lambda query on this page against Amazon Athena over the IAM credential report. It reads iam_credential_report, privileged_role_register (supplied) and reports: Privileged role held by an identity with no successful authentication inside the inactivity threshold.
What permissions are needed to run this AWS query?
iam:GenerateCredentialReport; iam:GetCredentialReport; athena:StartQueryExecution.
What evidence does AC-2(3) need that AWS cannot produce?
Privileged role register (privileged_role_register.csv). Defines which roles your organisation treats as privileged, who owns each one, and how often it must be reviewed. Cloud platforms know which roles exist; only you know which ones matter and who is accountable for them. At minimum it must carry: role_name, platform, privilege_classification.
Does a result from this query mean the control has failed?
Inactivity alone does not establish that access is unnecessary. Missing activity may reflect licensing, retention limits, non-interactive use, or an authentication path outside the queried source.

Terms used on this page

NIST SP 800-53the U.S. federal catalogue of security requirements
The catalogue of security and privacy requirements published by the National Institute of Standards and Technology, a U.S. federal agency. U.S. government systems are measured against it, and many private organizations adopt it voluntarily. Each requirement has an identifier such as AC-2. Official source →
CISACybersecurity and Infrastructure Security Agency
The U.S. federal agency responsible for national critical-infrastructure cybersecurity. Its publications are works of the U.S. government and are free to use. Official source →
CPGCross-Sector Cybersecurity Performance Goals
A voluntary baseline of security practices published by the U.S. Cybersecurity and Infrastructure Security Agency, written specifically for organizations too small to employ security staff. It is a short, plainly written starting list rather than a full standard. Official source →
not tenant-validatednever executed against real data
The check has passed the project's automated tests for structure and syntax, but has never been run against real data anywhere. Test it in a safe scope before relying on any result.

Every term this project uses →

The same control on other platforms