[rule]
description = """
Detects execution of common cloud and DevOps CLI commands used to print or export access tokens, often as a child of a
Bun process. This pattern may indicate supply chain compromise where a malicious npm or Bun package invokes host CLIs to
harvest cloud credentials during install or runtime scripts.
"""
id = "a8c3e891-4f2d-4b7e-9c1a-6e5d8b2f0a43"
license = "Elastic License v2"
name = "Potential Cloud Credential Harvesting via Bun"
os_list = ["macos"]
reference = [
"https://futuresearch.ai/blog/litellm-pypi-supply-chain-attack/",
"https://socket.dev/blog/sandworm-mode-npm-worm-ai-toolchain-poisoning",
"https://www.koi.security/blog/postmark-mcp-npm-malicious-backdoor-email-theft",
]
version = "1.0.3"
query = '''
process where event.type == "start" and event.action in ("start", "exec") and
process.parent.name : ("bun", "bun.exe") and process.parent.command_line : ("*.js", "*.mjs", "*.ts") and
process.command_line like~ (
"*gcloud config config-helper --format json*",
"*gh auth token*",
"*az account get-access-token*",
"*kubectl*get*secret*"
) and
not process.args in ("az account get-access-token --output json --resource https://database.windows.net", "az account get-access-token --output json --resource https://storage.azure.com", "https://storage.azure.com")
'''
min_endpoint_version = "7.15.0"
optional_actions = []
[[actions]]
action = "kill_process"
field = "process.parent.entity_id"
state = 0
tree = true
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1195"
name = "Supply Chain Compromise"
reference = "https://attack.mitre.org/techniques/T1195/"
[[threat.technique.subtechnique]]
id = "T1195.001"
name = "Compromise Software Dependencies and Development Tools"
reference = "https://attack.mitre.org/techniques/T1195/001/"
[threat.tactic]
id = "TA0001"
name = "Initial Access"
reference = "https://attack.mitre.org/tactics/TA0001/"
[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1528"
name = "Steal Application Access Token"
reference = "https://attack.mitre.org/techniques/T1528/"
[[threat.technique]]
id = "T1552"
name = "Unsecured Credentials"
reference = "https://attack.mitre.org/techniques/T1552/"
[[threat.technique.subtechnique]]
id = "T1552.001"
name = "Credentials In Files"
reference = "https://attack.mitre.org/techniques/T1552/001/"
[threat.tactic]
id = "TA0006"
name = "Credential Access"
reference = "https://attack.mitre.org/tactics/TA0006/"
[internal]
min_endpoint_version = "7.15.0"