AWS Access Key
Detects AWS access key IDs and other IAM unique identifiers by prefix, including long-term keys (AKIA) and the temporary keys AWS STS issues (ASIA). Confidence rises when the identifier sits next to a labelled secret access key or, for temporary credentials, a labelled session token.
- Type
- regex
- Engine
- universal
- Confidence
- high
- Confidence justification
- High confidence: the identifier has a documented prefix and a fixed length, and the enforce tiers need independent AWS evidence beside it. The session-token and secret-key evidence is label-anchored on the names AWS documents for its credentials file, environment variables and STS responses, so unlabelled Base64 near an identifier stays at discovery. AWS does not fix the session token's length, so the evidence regex asks only for its first 40 characters.
- Detection quality
- Verified
- Jurisdictions
- global
- Regulations
- Criminal Code Act 1995 (Cth)
- Frameworks
- CIS Controls, ISO 27001, NIST CSF, PCI-DSS, SOC 2
- Data categories
- credentials, security
- Scope
- specific
- Risk rating
- 5
- Platform compatibility
- Purview: Compatible, GCP DLP: Compatible, Macie: Compatible, Zscaler: Compatible, CrowdStrike DLP: Compatible, Palo Alto: Adapted from Purview, Netskope: Adapted from Purview
Pattern
(?-i)\b((?:A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16})\b
Corroborative evidence keywords
api key, api_key, apikey, access key, secret key, private key, auth token, authorization, access token, bearer, conn str, connection string, connectionstring, cookie, credential, database, host, [object Object], oauth, passphrase (+33 more)
Proximity: 300 characters
Should match
AGPA7M4N2P9Q6R8T3V5X— Exact 65 probe - structurally valid AWS identifier without independent IAM contextAWS access key ID: AKIA9Z8Y7X6W5V4U3T2S— Exact 75 probe - access key identifier with an AWS-specific field labelAWS IAM credential AWS_ACCESS_KEY_ID=ASIA6R5T4Y3U2I1O9P8L AWS_SECRET_ACCESS_KEY=Z9pL2mN7qR4sT8vW1xY5aB3cD6eF0gH2iJ4kL7mN— Exact 85 probe - access key ID independently paired with a populated secret keyexport AWS_ACCESS_KEY_ID=ASIA6R5T4Y3U2I1O9P8L export AWS_SESSION_TOKEN=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/— Exact 75 probe - temporary (ASIA) access key ID with a labelled session token in environment-variable form, no secret key[default] aws_access_key_id = ASIA6R5T4Y3U2I1O9P8L aws_secret_access_key = Z9pL2mN7qR4sT8vW1xY5aB3cD6eF0gH2iJ4kL7mN aws_session_token = ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/— Exact 85 probe - temporary credential set in credentials-file form (key ID, secret key and labelled session token){"Credentials": {"AccessKeyId": "ASIA6R5T4Y3U2I1O9P8L", "SecretAccessKey": "Z9pL2mN7qR4sT8vW1xY5aB3cD6eF0gH2iJ4kL7mN", "SessionToken": "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"}}— Exact 85 probe - temporary credential set as returned in an STS JSON response
Should not match
ASIA6R5T4Y3U2I1O9P8L ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/— Temporary access key ID next to a long Base64 string with no session-token label stays at discoveryASIA6R5T4Y3U2I1O9P8L session_token=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/— A generic session_token label is not the AWS label (aws_session_token / SessionToken)ASIA6R5T4Y3U2I1O9P8L aws_session_token = to-be-filled-in— Session-token label with no token value after it is not evidenceXKIAIOSFODNN7EXAMPLE— Invalid prefix (XKIA instead of AKIA/ASIA/etc.)AKIA123456789012345— Too few characters after prefix (15 instead of 16)AKIAIOSFODNN7EXAMP!E— Contains special character (!) not in allowed setAZURE_CLIENT_ID=AKIA9Z8Y7X6W5V4U3T2S— Sibling cloud-provider assignment does not provide AWS corroborationDocumentation example: AWS IAM credential AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY— AWS documentation placeholder pair is excludedtemplate example placeholder record identifier— Template/sample context should be excluded even when anchor words are present
Known false positives
- IAM unique IDs that are not credentials. AROA (role), AIDA (user), AGPA (group) and similar prefixes share the shape and appear in policies, CloudTrail logs and STS responses. Mitigation: On their own they stay at the 65 discovery tier. The 85 tier needs a labelled secret access key as well, which an identifier in a policy or log does not have.
- Expired temporary credentials. An ASIA key with its session token in an old log or ticket is usually dead, since STS credentials last from minutes to hours. Mitigation: The pattern cannot test validity. Treat a recent match as live; for older content, check the timestamp against the session duration before escalating.
- AWS documentation values such as AKIAIOSFODNN7EXAMPLE and ASIAIOSFODNN7EXAMPLE copied into runbooks and tutorials. Mitigation: The template-exclusion dictionary suppresses content framed as an example, but a bare copy of the documentation values with no such framing still matches.
References
- Criminal Code Act 1995 (Cth)
- IAM identifiers, unique ID prefixes - AWS IAM User Guide (AKIA is an access key; ASIA is a temporary AWS STS access key ID, unique only together with the secret access key and session token)
- Configuration and credential file settings - AWS CLI User Guide (aws_session_token setting; credentials-file examples pairing an ASIA key ID with aws_session_token)
- Environment variables - AWS CLI User Guide (AWS_SESSION_TOKEN is required with temporary credentials from AWS STS and overrides aws_session_token)
- Credentials data type - AWS STS API Reference (response fields AccessKeyId, SecretAccessKey and SessionToken)
- GetSessionToken - AWS STS API Reference (session token size is not fixed and no maximum should be assumed; sample response with a Base64 token)