CYBERBLOG
Exposed cloud credentials: contain, investigate and verify

An AWS credential-response runbook covering containment, CloudTrail evidence, temporary sessions, safe queries and verification before incident closure.
By Harpreet Singh, CISSP, CCSP · Reviewed November 27, 2026
A cloud access key appearing in a repository, build log or support attachment creates two urgent questions: what access must stop now, and what happened while the credential was usable? Deleting the visible secret answers neither question reliably. Copies may remain, another system may still depend on the key, and an earlier session may need separate containment.
This first 2 AM Incident Runbook gives responders a practical AWS-focused sequence: establish ownership, contain the relevant access, preserve an evidence timeline, investigate what the available logs can actually show, and verify the replacement workflow. It is written for authorized administrators and analysts. It does not require testing a leaked secret or reproducing an attack.
In this report
Start with ownership and a trustworthy response identity
Open an incident record through your normal process and name an incident lead, cloud owner and application owner. Record the discovery source, first known exposure time, affected environment and immediate business dependency. Separate what the team observed from what a scanner or third party reported. A scanner match may be a useful lead, but it is not proof that a complete, active credential was disclosed.
Work from a trusted responder identity and device. Do not authenticate with the exposed secret merely to see whether it works. Do not paste it into a search engine, ticket, chat or online checker. Store necessary evidence in approved restricted storage and reference it from the incident record. The key identifier can help correlate events, but it too should be handled according to the organization's information rules.
Confirm the owning AWS account and principal through trusted inventory and administrative records. Check whether the discovery concerns a long-term IAM key, temporary role credentials, an application API token or a signing secret. The same word “key” can describe different mechanisms. Assign a responder who understands that mechanism before making a broad change. AWS recommends temporary credentials in preference to long-term access keys where the workload supports them. [1]
Separate emergency containment from routine rotation
Routine rotation aims to move a healthy workload to a new credential with controlled disruption. An exposed credential is an incident decision: leaving it usable during a leisurely migration can prolong unwanted access. The incident lead and service owner must decide how quickly to deactivate the old key and how to keep the essential service operating. Record the reason for any interval in which it remains active.
Use the provider's supported administrative workflow to deactivate the affected long-term key, then remove it when evidence and recovery requirements permit. Inventory jobs, pipelines and integrations that relied on it. Introduce a replacement only through the approved secret store or workload identity mechanism, update the intended consumers and verify their behavior. Do not put the replacement into the same repository or logging path that caused the exposure. AWS's access-key update guide distinguishes disabling a key from deleting it and describes checking use during a planned change. [2]
If immediate deactivation interrupts a critical process, treat that as a visible incident trade-off with an accountable owner and a short completion window. A hidden exception is harder to contain than an acknowledged operational problem. Avoid disabling every identity in an account as a reflex: the response may otherwise lose logging, backups or recovery access at the moment those controls matter most.
Trace temporary sessions and other access created before containment
A role session is a separate object of investigation from the original long-term key. Determine whether the exposed identity could obtain temporary credentials or change another identity's access. Trace relevant session issuance and subsequent activity using the available identity fields and event records. Keep the chain explicit: source principal, issuance event, session identity, target account and resource.
AWS provides role-session revocation that applies a time-based deny to older sessions. Its documented workflow affects other users of the selected role too; it is not a harmless logout of one browser. Service-linked roles and IAM Identity Center permission-set sessions have different constraints. Confirm the applicable mechanism and impact before acting. [3]
Also review the permissions and resource policies governing temporary credentials. AWS notes that policy changes can take time to propagate and that resource-based access can require explicit treatment. A change to one identity policy does not justify claiming that every derived access route has ended. [4]
For your acceptance record, list the access paths actually addressed and the ones still uncertain. Include newly created keys, unexpected trust changes, unfamiliar workloads or altered resource permissions when the evidence supports investigation. These are review questions, not an assertion that every credential exposure creates persistence. Preserve the distinction between an attacker's capability and an action observed in your account.
Build a timeline that includes gaps
Record discovery, earliest defensible exposure, last known legitimate use, containment decision, enforcement, verification and replacement acceptance. Keep source event time and collection time separate. Normalize the working timeline to UTC while retaining original timestamps and known clock uncertainty. If the repository history shows the secret on Monday but the build artifact was created on Friday, do not silently use Monday as the start of exposure.
Maintain a coverage register beside the timeline. For each account, Region, service and interval, record the log source, event category, retention, collection status and owner. Mark unknown coverage explicitly. This lets the reviewer distinguish “no matching action in a complete selected source” from “no usable source for the question.” Those statements support different conclusions.
Preserve relevant configuration history, deployment records and secret-store audit records as well as cloud activity. A cloud event may identify a principal without explaining how its secret escaped. A build log may explain exposure without establishing subsequent access. Join the records by evidence and time, rather than assuming one source can tell the entire incident story.
Use the existing response-clock guide when handoffs or delayed approvals are the problem. Here the timeline's purpose is narrower: it supports credential-specific containment and scope, with a clear boundary around what can be concluded.
Know what CloudTrail Event history can answer
CloudTrail Event history provides the previous 90 days of management events for an AWS Region. It can support questions about recorded administrative activity. It does not replace a complete organization-wide investigation across every account, Region, resource and event category. Start by choosing the account and Region deliberately, then document the rest of the search scope. [5]
Object reads and other resource-level activity may require data events that were configured for the relevant resources before the incident. AWS says trails and event data stores do not log data events by default, and those events can incur additional charges. Turning on a selector now does not reconstruct a missing historical record. [6]
Do not use an empty management-event result as evidence that sensitive objects were never accessed. Equally, a successful management action does not prove data was stolen. Identify the specific question first: was a role assumed, was a policy altered, was an object read, or was an application operation performed? Then name the source capable of answering it and the interval that source actually covers.
Escalate collection failures early. If the incident needs data-access evidence that the available sources cannot provide, say so in the current assessment. That uncertainty can affect notification, recovery and risk decisions. It is more useful than an unsupported clean bill of health.
Use a read-only management-event lookup with a bounded scope
The following AWS CLI example looks for recorded management events associated with a known key identifier in one Region and a fixed UTC interval. Prerequisites are an authorized responder profile, permission to look up CloudTrail events, the correct account and Region, and dates within the Event history retention window. Replace the uppercase placeholders locally. They are not valid credentials. Do not substitute a secret access key into the lookup value.
Validation status: the command structure follows AWS's documented lookup-events interface; this exact example has not been executed against a cloud account. The operation reads event records. It does not revoke credentials or change resources. AWS documents a single lookup attribute and pagination behavior, so preserve pagination and record any truncation. [7]
aws cloudtrail lookup-events \
--profile INCIDENT_READONLY \
--region ca-central-1 \
--lookup-attributes AttributeKey=AccessKeyId,AttributeValue=KEY_ID_TO_REVIEW \
--start-time 2026-11-20T00:00:00Z \
--end-time 2026-11-27T00:00:00Z \
--output json \
--no-cli-pagerExpected shape: a JSON response containing an Events collection, with event identifiers and serialized CloudTrailEvent records when matches exist. Inspect those records rather than treating the number of matches as an abuse score. Record the exact invocation scope and protect the exported logs. Repeat only for other authorized account and Region scopes that the coverage plan identifies.
Interpret the event's action, identity, result, resource and context with the service owner. Authorized automation, shared egress and expected role use can look unfamiliar to a new analyst. Investigate discrepancies against deployment and change records. If there are no matches, verify account, Region, interval, key identifier and event category before deciding what that absence means. The next step is a coverage decision, not automatic incident closure.
Use CloudWatch only when the relevant logs are already present
CloudWatch Logs Insights can help review a selected log group that receives individual CloudTrail JSON events. Confirm the actual ingestion format first: a wrapper containing a Records array or a transformed schema needs different field paths. Choose the log group and UTC time range, verify that recent known events are present, and consider query cost before scanning a large interval.
This illustrative, unexecuted read-only query explicitly parses each message as one JSON event. It uses the documented JSON map access and comparison operators. If a field is absent, review the schema rather than assuming the action never happened. It is a hunting aid for an authorized investigation, not a production-tested detector. [8]
fields jsonParse(@message) as e
| filter e.userIdentity.accessKeyId = "KEY_ID_TO_REVIEW"
| fields @timestamp, e.eventTime, e.eventSource, e.eventName,
e.awsRegion, e.sourceIPAddress, e.errorCode, e.eventID
| sort @timestamp asc
| limit 200Expected output is a chronological table of matching records, limited here to 200 rows. That cap is for review convenience; it is not a complete export or a safe basis for counting all activity. Narrow or partition the interval and use an approved export process when completeness matters. Retain event identifiers so a reviewer can trace a conclusion back to its original record.
Compare source event time with ingestion timing where the pipeline exposes both. Legitimate jobs can produce the same event names and shared addresses as suspicious activity. Correlate application ownership and approved execution windows. Do not automate containment from this example without separate engineering, benign-case testing and an approved response boundary.
Keep API tokens and JWT signing secrets in their own evidence scope
An application token may authenticate requests at an API gateway or application without producing an AWS identity event for each request. A JSON Web Token, or JWT, is a signed set of claims; a signing secret is different from an AWS access key. AWS infrastructure hosting the application does not make CloudTrail a universal JWT-abuse log.
Ask the application owner which token identifiers, authentication outcomes, routes, source context and authorization decisions are logged. Do not log full bearer tokens, signing secrets or unnecessary personal data to make an investigation easier. Record key-version identifiers where the application's design supports them and the privacy review permits it. Preserve existing application and gateway logs through the approved process.
Rotation and invalidation depend on the token design, issuer, caching and verification configuration. Specify which old tokens or signatures the service should reject, which legitimate flows must continue and how the team will verify both. Avoid a universal “change the secret and all sessions end” instruction. The acceptance criterion belongs to the actual application, including its downstream services and cached trust configuration.
If those details are unavailable, retain the uncertainty and involve the application security owner. A cloud administrator can contain a cloud identity while still needing a separate application response. Combining both into one green ticket hides the unresolved boundary.
Verify denial, service continuity and the absence of new exposure
Verification should name a resource and an action. An incident record saying “key rotated” describes a change, not its effect. Use provider administrative state, trusted audit records and approved benign test identities or prearranged validation procedures to establish the intended restriction. This runbook does not ask readers to replay a leaked secret or perform an unauthorized access attempt.
Check the replacement workload through its normal path. Confirm that it reads its secret from the intended protected location, completes a representative task and handles failure without printing credentials. Examine new build output and application logs for accidental disclosure. A successful job followed by a new secret leak recreates the original problem with a different identifier.
Record the remaining sessions and exceptions separately. Verification has a time, scope and owner; it does not prove that no other credentials were exposed. Watch for continuing unexpected activity through the organization's normal monitoring process, then reassess whether it is delayed logging, legitimate work, an untreated identity path or a new event.
The earlier repository-credential verification guide addresses the specific revocation question. This runbook connects that question to cloud log coverage, session handling and incident acceptance without treating repository cleanup as containment.
A hypothetical deployment failure and its business consequence
Hypothetical example: a deployment key is copied into a public build log. The developer removes the log and updates the application's secret. A scheduled exporter still uses the old identity, while an earlier role session has not been assessed. The incident ticket closes because the web application works. These are invented teaching facts, not a reported customer incident.
The service owner later finds unexpected administrative activity during the unreviewed interval. Investigation now takes longer because responders cannot identify which consumers changed when, which sessions were addressed or which data events existed. The potential consequences include service interruption, investigation cost and uncertainty about data access. They are possible outcomes of the scenario, not measured loss estimates.
A better acceptance record would separate the exposed artifact, long-term key state, temporary-session decision, replacement consumers and evidence coverage. It would also assign the exporter owner an explicit deadline. That record does not prevent every intrusion, but it makes an unresolved access path visible while a decision can still be made.
For business leaders, the useful investment question is whether teams can identify and replace these dependencies without improvising. Secret inventory, scoped workload identities, protected logging and named response owners support that capability. A larger secret-scanning count alone does not demonstrate it.
Close the incident with an evidence statement and a next owner
Before closure, state what was exposed, the basis for its scope, the containment mechanism and time, the sessions considered, the legitimate workflows verified and the evidence gaps. Distinguish confirmed unauthorized activity, suspicious activity awaiting explanation and activity not observable in the available sources. Ask the responsible privacy or legal team to assess obligations from the actual facts and jurisdiction; a checklist cannot decide those obligations universally.
During the first week, correct the disclosure path and inspect comparable places where the same pipeline might expose secrets. Over the following month, reduce long-term credential dependence where practical, review permissions and test a benign response exercise. Keep each improvement attached to an owner and an acceptance condition rather than an open-ended promise to “harden cloud security.”
Knowledge check: does deleting a repository commit revoke the credential? No. Does an empty Event history search establish that no object was read? No. Does creating a replacement key prove an earlier role session is contained? No. Each question needs its own control and evidence.
Reviewed November 27, 2026. This is documentation-based defensive guidance with illustrative queries and a hypothetical example. No cloud account, leaked credential or production detection was tested. Recheck the linked provider guidance before an operational change.
Keep this field checklist with the incident record
- Identify the credential mechanism, owning account, principal and service owner.
- Use a trusted responder identity; keep secrets out of tickets and queries.
- Record exposure, containment and verification times with evidence references.
- Deactivate the affected credential through approved incident authority.
- Assess temporary sessions and other relevant access paths separately.
- Map account, Region, event category, retention and collection gaps.
- Verify intended restriction and representative replacement workload behavior.
- Document investigation limits, exceptions, owners and next review.
Download the one-page field checklist (PDF) · Download the blank evidence register (CSV)
Planning aids, not a tested detection or certification. Keep secrets and personal incident evidence in approved restricted systems.
Sources and further reading
- AWS IAM access-key management; reviewed November 27, 2026
- AWS access-key update; reviewed November 27, 2026
- AWS role-session revocation; reviewed November 27, 2026
- AWS temporary-credential permission controls; reviewed November 27, 2026
- AWS CloudTrail Event history; reviewed November 27, 2026
- AWS CLI lookup-events reference; reviewed November 27, 2026
- AWS CloudTrail data-event coverage; reviewed November 27, 2026
- AWS CloudWatch Logs Insights functions; reviewed November 27, 2026