[metadata]
creation_date = "2020/07/13"
maturity = "production"
updated_date = "2020/10/26"

[rule]
anomaly_threshold = 50
author = ["Elastic"]
description = """
A machine learning job detected an unusual error in a CloudTrail message. These can be byproducts of attempted or
successful persistence, privilege escalation, defense evasion, discovery, lateral movement, or collection.
"""
false_positives = [
    """
    Rare and unusual errors may indicate an impending service failure state. Rare and unusual user error activity can
    also be due to manual troubleshooting or reconfiguration attempts by insufficiently privileged users, bugs in cloud
    automation scripts or workflows, or changes to IAM privileges.
    """,
]
from = "now-60m"
interval = "15m"
license = "Elastic License"
machine_learning_job_id = "rare_error_code"
name = "Rare AWS Error Code"
note = """### Investigating Unusual CloudTrail Error Activity ###
Detection alerts from this rule indicate a rare and unusual error code that was associated with the response to an AWS API command or method call. Here are some possible avenues of investigation:
- Examine the history of the error. Has it manifested before? If the error, which is visible in the `aws.cloudtrail.error_code field`, manifested only very recently, it might be related to recent changes in an automation module or script.
- Examine the request parameters. These may provide indications as to the nature of the task being performed when the error occurred. Is the error related to unsuccessful attempts to enumerate or access objects, data, or secrets? If so, this can sometimes be a byproduct of discovery, privilege escalation, or lateral movement attempts.
- Consider the user as identified by the `user.name` field. Is this activity part of an expected workflow for the user context? Examine the user identity in the `aws.cloudtrail.user_identity.arn` field and the access key id in the `aws.cloudtrail.user_identity.access_key_id` field which can help identify the precise user context. The user agent details in the `user_agent.original` field may also indicate what kind of a client made the request.
- Consider the source IP address and geolocation for the calling user who issued the command. Do they look normal for the calling user? If the source is an EC2 IP address, is it associated with an EC2 instance in one of your accounts or could it be sourcing from an EC2 instance not under your control? If it is an authorized EC2 instance, is the activity associated with normal behavior for the instance role or roles? Are there any other alerts or signs of suspicious activity involving this instance?"""
references = ["https://www.elastic.co/guide/en/security/current/prebuilt-ml-jobs.html"]
risk_score = 21
rule_id = "19de8096-e2b0-4bd8-80c9-34a820813fff"
severity = "low"
tags = ["Elastic", "Cloud", "AWS", "ML"]
type = "machine_learning"

