Skip to content

Commit 9fb2a37

Browse files
Merge branch 'main' into deprecatemac
2 parents e14c349 + c58d59e commit 9fb2a37

File tree

2 files changed

+181
-0
lines changed

2 files changed

+181
-0
lines changed
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
[metadata]
2+
creation_date = "2025/04/11"
3+
integration = ["aws"]
4+
maturity = "production"
5+
updated_date = "2025/04/16"
6+
7+
[rule]
8+
author = ["Elastic"]
9+
description = """
10+
Identifies the usage of the AWS CLI with a user agent string containing `distrib#kali`, which suggests the request
11+
was made from a Kali Linux distribution. This may indicate offensive security tooling or unauthorized use of the AWS CLI
12+
from a potentially adversarial environment.
13+
"""
14+
false_positives = [
15+
"""
16+
While rare, legitimate users or red teamers may use Kali Linux for security assessments. Confirm the identity of the
17+
user, their purpose, and whether the activity was authorized.
18+
""",
19+
]
20+
from = "now-9m"
21+
index = ["logs-aws.cloudtrail-*"]
22+
language = "kuery"
23+
license = "Elastic License v2"
24+
name = "AWS CLI with Kali Linux Fingerprint Identified"
25+
note = """## Triage and Analysis
26+
27+
### Investigating AWS CLI with Kali Linux Fingerprint Identified
28+
29+
The `user_agent.original` field in AWS CloudTrail logs reveals the operating system and toolchain used to make API calls. The substring `distrib#kali` strongly implies the use of Kali Linux, a common OS used by offensive security professionals and adversaries.
30+
31+
#### Possible Investigation Steps
32+
33+
- Identify the User: Check `user.name`, `user.arn`, and `aws.cloudtrail.user_identity.*` to determine which IAM identity was used.
34+
- Review Access Pattern: Correlate API calls from this user agent with sensitive actions such as `PutObject`, `CreateUser`, `AttachUserPolicy`, etc.
35+
- Investigate Source IP: Examine whether the request originated from an expected network or a suspicious VPN or cloud provider address.
36+
- Check for Initial Access: Look for session tokens being issued (e.g., `GetSessionToken`) or reused (`AssumeRole`) prior to this event.
37+
38+
### False Positive Analysis
39+
40+
- Rare but possible in security assessments or internal red teaming. Validate the action context (user, IP, time of day, etc).
41+
42+
### Response and Remediation
43+
44+
- Revoke Credentials: If unauthorized, revoke keys or sessions immediately.
45+
- Harden IAM Policies: Restrict sensitive IAM privileges, especially if used by CI/CD or automation roles.
46+
- Alert on Repeat Usage: Add recurring monitoring for suspicious user agents including `kali`, `curl`, or known toolkits.
47+
"""
48+
references = [
49+
"https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-event-reference-user-identity.html",
50+
"https://www.sygnia.co/blog/sygnia-investigation-bybit-hack/",
51+
]
52+
risk_score = 47
53+
rule_id = "f80ea920-f6f5-4c8a-9761-84ac97ec0cb2"
54+
severity = "medium"
55+
tags = [
56+
"Domain: Cloud",
57+
"Data Source: AWS",
58+
"Data Source: Amazon Web Services",
59+
"Data Source: AWS CloudTrail",
60+
"Tactic: Initial Access",
61+
"Use Case: Cloud Threat Detection",
62+
"Resources: Investigation Guide",
63+
]
64+
timestamp_override = "event.ingested"
65+
type = "query"
66+
67+
query = '''
68+
event.dataset: "aws.cloudtrail" and user_agent.original: (aws-cli*distrib#kali* or Boto3*distrib#kali*)
69+
'''
70+
71+
72+
[[rule.threat]]
73+
framework = "MITRE ATT&CK"
74+
[[rule.threat.technique]]
75+
id = "T1078"
76+
name = "Valid Accounts"
77+
reference = "https://attack.mitre.org/techniques/T1078/"
78+
[[rule.threat.technique.subtechnique]]
79+
id = "T1078.004"
80+
name = "Cloud Accounts"
81+
reference = "https://attack.mitre.org/techniques/T1078/004/"
82+
83+
84+
85+
[rule.threat.tactic]
86+
id = "TA0001"
87+
name = "Initial Access"
88+
reference = "https://attack.mitre.org/tactics/TA0001/"
89+
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
[metadata]
2+
creation_date = "2025/04/11"
3+
integration = ["aws"]
4+
maturity = "production"
5+
updated_date = "2025/04/15"
6+
7+
[rule]
8+
author = ["Elastic"]
9+
description = """
10+
Identifies attempts to register or enable an IAM Virtual MFA device using temporary credentials (access keys
11+
starting with 'ASIA'). This may indicate an adversary attempting to escalate privileges or establish persistence using
12+
stolen session tokens.
13+
"""
14+
false_positives = [
15+
"""
16+
Legitimate users or automation tools may register MFA devices using temporary session credentials, especially in
17+
CI/CD or administrative workflows. Validate the source IP, user agent, and context of the registration.
18+
""",
19+
]
20+
from = "now-9m"
21+
index = ["filebeat-*", "logs-aws.cloudtrail-*"]
22+
language = "kuery"
23+
license = "Elastic License v2"
24+
name = "AWS IAM Virtual MFA Device Registration Attempt with Session Token"
25+
note = """## Triage and Analysis
26+
27+
### Investigating AWS IAM Virtual MFA Device Registration Attempt with Session Token
28+
29+
AWS temporary security credentials that begin with `ASIA` indicate they are session tokens. An attempt to create or enable a Virtual MFA device using such credentials is uncommon and may indicate malicious activity.
30+
31+
#### Possible Investigation Steps
32+
33+
- **Identify the User**: Check `user.name`, `user.arn`, and `aws.cloudtrail.user_identity.*` fields to determine which IAM entity made the request.
34+
- **Check for Prior Reconnaissance or Access**: Correlate this event with any prior calls to `GetSessionToken`, `GetCallerIdentity`, or `ListUsers` to see if an adversary was enumerating IAM users.
35+
- **Source Context**: Review `source.ip`, `user_agent`, and `event.origin` to determine whether this came from a legitimate device or a suspicious endpoint (e.g., Kali, Mythic, unknown VPN).
36+
- **Validate MFA Setup**: Look for follow-up attempts to call `sts:get-session-token` or `iam:EnableMFADevice` using this same session.
37+
38+
### False Positive Analysis
39+
40+
- This may occur if an admin or automation tool is legitimately setting up a new MFA device using temporary credentials.
41+
- Review the IP, agent, and context to differentiate expected automation from unauthorized access.
42+
43+
### Response and Remediation
44+
45+
- **Revoke Credentials**: If unauthorized, revoke the access keys or terminate the session.
46+
- **Reset MFA and Passwords**: Rotate credentials for the affected IAM user.
47+
- **Review IAM Policies**: Limit permissions to register MFA devices to trusted roles only.
48+
- **Enable CloudTrail Alerts**: Monitor IAM changes more broadly with CloudTrail-based alerts.
49+
"""
50+
references = ["https://www.sygnia.co/blog/sygnia-investigation-bybit-hack/"]
51+
risk_score = 47
52+
rule_id = "e4feea34-3b62-4c83-b77f-018fbef48c00"
53+
severity = "medium"
54+
tags = [
55+
"Domain: Cloud",
56+
"Data Source: AWS",
57+
"Data Source: Amazon Web Services",
58+
"Data Source: AWS CloudTrail",
59+
"Data Source: AWS IAM",
60+
"Tactic: Persistence",
61+
"Use Case: Identity and Access Audit",
62+
"Resources: Investigation Guide",
63+
]
64+
timestamp_override = "event.ingested"
65+
type = "query"
66+
67+
query = '''
68+
event.dataset: "aws.cloudtrail"
69+
and event.provider: "iam.amazonaws.com"
70+
and event.action: ("CreateVirtualMFADevice" or "EnableMFADevice")
71+
and aws.cloudtrail.user_identity.access_key_id: ASIA*
72+
'''
73+
74+
75+
[[rule.threat]]
76+
framework = "MITRE ATT&CK"
77+
[[rule.threat.technique]]
78+
id = "T1098"
79+
name = "Account Manipulation"
80+
reference = "https://attack.mitre.org/techniques/T1098/"
81+
[[rule.threat.technique.subtechnique]]
82+
id = "T1098.005"
83+
name = "Device Registration"
84+
reference = "https://attack.mitre.org/techniques/T1098/005/"
85+
86+
87+
88+
[rule.threat.tactic]
89+
id = "TA0003"
90+
name = "Persistence"
91+
reference = "https://attack.mitre.org/tactics/TA0003/"
92+

0 commit comments

Comments
 (0)