Detection rules › Panther

AWS command executed on the command line

Severity
medium
Log types
Osquery.Differential
Tags
Osquery, Linux, Execution:User Execution
Reference
https://attack.mitre.org/techniques/T1078/
Source
github.com/panther-labs/panther-analysis

An AWS command was executed on a Linux instance

MITRE ATT&CK coverage

TacticTechniques
ExecutionT1204 User Execution

Rule body yaml

AnalysisType: rule
Filename: osquery_linux_aws_commands.py
RuleID: "Osquery.Linux.AWSCommandExecuted"
DisplayName: "AWS command executed on the command line"
Enabled: true
LogTypes:
  - Osquery.Differential
Tags:
  - Osquery
  - Linux
  - Execution:User Execution
Reports:
  MITRE ATT&CK:
    - TA0002:T1204
Severity: Medium
Description: An AWS command was executed on a Linux instance
Runbook: See which other commands were executed, and then remove IAM role causing the access
Reference: https://attack.mitre.org/techniques/T1078/
SummaryAttributes:
  - name
  - action
Tests:
  - Name: AWS command executed on MacOS
    ExpectedResult: false
    Log:
      {
        "name": "pack_incident-response_shell_history",
        "action": "added",
        "decorations": { "platform": "darwin" },
        "columns":
          {
            "command": "aws sts get-caller-identity",
            "uid": "1000",
            "directory": "/home/ubuntu",
            "username": "ubuntu",
          },
      }
  - Name: AWS command executed
    ExpectedResult: true
    Log:
      {
        "name": "pack_incident-response_shell_history",
        "action": "added",
        "columns":
          {
            "command": "aws s3 ls",
            "uid": "1000",
            "directory": "/home/ubuntu",
            "username": "ubuntu",
          },
      }
  - Name: Tail command executed
    ExpectedResult: false
    Log:
      {
        "name": "pack_incident-response_shell_history",
        "action": "added",
        "columns":
          {
            "command": "tail -f /var/log/all",
            "uid": "1000",
            "directory": "/home/ubuntu",
            "username": "ubuntu",
          },
      }
  - Name: Command with quote executed
    ExpectedResult: false
    Log:
      {
        "name": "pack_incident-response_shell_history",
        "action": "added",
        "columns":
          {
            "command": "git commit -m 'all done'",
            "uid": "1000",
            "directory": "/home/ubuntu",
            "username": "ubuntu",
          },
      }
  - Name: Invalid command ignored
    ExpectedResult: false
    Log:
      {
        "name": "pack_incident-response_shell_history",
        "action": "added",
        "columns":
          {
            "command": "unopened '",
            "uid": "1000",
            "directory": "/home/ubuntu",
            "username": "ubuntu",
          },
      }

Detection logic

Condition

not (action ne "added" or name not contains "shell_history" or decorations.platform in "darwin")
columns.command is_not_null

This rule also runs imperative logic the parser cannot express as a filter; the conditions above are the structured part it could extract.

Exclusions

Top-level NOT(...) conjuncts: predicates this rule actively suppresses.

FieldKindExcluded values
namecontainsshell_history
actionneadded
decorations.platformeqdarwin

Indicators

Each row is a field, operator, and value that the rule matches. The corpus column counts how many other rules in the catalog look for the same combination: high numbers point to widely-used, community-vetted indicators. Blank or 1 shows that the indicator is specific to this rule.

FieldKindValues
columns.commandis_not_null
  • (no value, null check)
namecontains
  • shell_history

Output fields

Fields the rule emits when it matches. Chronicle authors list these in the outcome block; they appear on the detection and $risk_score drives alerting. Sentinel / Defender XDR rules build them up through project / summarize / extend stages. Sentinel maps these into alert fields via entityMappings and customDetails; Defender XDR custom detections surface them as alert fields directly.

FieldSource
usernamecolumns.username
hostIdentifier