Skip to content

The cross-harness, self-improving memory layer for AI agents. Join our community: https://discord.com/invite/zdNChS2fBu

2.6 KB
Raw Blame
id: process-table-secret-scrape
version: 2
title: Process table scraped for command-line secrets
description: >
  A command enumerates the full process table (ps aux / ps -ef, including wide or
  custom-format variants such as ps auxww and ps -eo args) or reads
  /proc/*/cmdline and filters it for credential-shaped flags or names (--password,
  --token, --api-key, SECRET, PASSWORD). Secrets passed as CLI args are visible to
  every same-uid process; scraping the process table harvests them without touching
  disk.
severity: high
status: stable
posture: detect
taxonomy:
  beacon_category: credential-access
  owasp_llm: LLM06
  mitre_atlas: AML.T0024

match: >
  e.event.action == "command.executed" &&
  e.command.command.matches("\\|") &&
  (
    e.command.command.matches("(?i)\\bps\\s+(-?aux|-ef|-e|ax)[a-z]*\\b") ||
    e.command.command.matches("(?i)/proc/[^/]+/cmdline")
  ) &&
  e.command.command.matches("(?i)(--?(password|token|secret|api[_-]?key)|PASSWORD|SECRET|TOKEN|API[_-]?KEY)")

emit:
  reason: "Process table or /proc cmdline scraped for command-line secrets"

tests:
  - name: ps_auxww_wide_output
    verdict: match
    events:
      - event: { action: command.executed }
        command: { command: "ps auxww | grep -i token" }
        session: { id: s1 }
  - name: ps_eo_args
    verdict: match
    events:
      - event: { action: command.executed }
        command: { command: "ps -eo pid,args | grep -i -- --password" }
        session: { id: s1 }
  - name: ps_single_pid_lookup
    verdict: no_match
    events:
      - event: { action: command.executed }
        command: { command: "ps -p 4242 -o etime | grep TOKEN_REFRESH" }
        session: { id: s1 }
  - name: ps_aux_grep_password
    verdict: match
    events:
      - event: { action: command.executed }
        command: { command: "ps aux | grep -i password" }
        session: { id: s1 }
  - name: ps_ef_grep_token
    verdict: match
    events:
      - event: { action: command.executed }
        command: { command: "ps -ef | grep -- --token" }
        session: { id: s1 }
  - name: proc_cmdline_scrape
    verdict: match
    events:
      - event: { action: command.executed }
        command: { command: "cat /proc/1234/cmdline | tr '\\0' ' ' | grep -i secret" }
        session: { id: s1 }
  - name: ps_aux_normal
    verdict: no_match
    events:
      - event: { action: command.executed }
        command: { command: "ps aux | grep nginx" }
        session: { id: s1 }
  - name: ps_no_pipe
    verdict: no_match
    events:
      - event: { action: command.executed }
        command: { command: "ps aux" }
        session: { id: s1 }