The cross-harness, self-improving memory layer for AI agents. Join our community: https://discord.com/invite/zdNChS2fBu
Go agent-ai-cliagent-harnessesagent-securitybrowser-extensionciclaude-codecloudcodexcursordetection-engineeringjevknowledge-basememorymobile-device-managementobservabilitysecuritysecurity-information-and-event-managementsecurity-toolstelemetrytraces
id: shell-history-secret-scan
version: 1
title: Shell history read or scanned for credentials
description: >
A command reads a shell history file (.bash_history, .zsh_history, .history,
fish_history) — either dumping it whole (cat/less/tail) or grepping it for
credential-shaped names. Shell history persists secrets passed as inline command
arguments; an agent scraping it can recover tokens, passwords, and credential
URLs.
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("(?i)(\\.bash_history|\\.zsh_history|fish_history|(^|/|\\s)\\.history\\b)") &&
e.command.command.matches("(?i)\\b(cat|less|more|tail|head|grep|egrep|rg|strings|cp|xxd|od)\\b")
emit:
reason: "Shell history file read or scanned (inline secrets persist in history)"
tests:
- name: cat_bash_history
verdict: match
events:
- event: { action: command.executed }
command: { command: "cat ~/.bash_history" }
session: { id: s1 }
- name: grep_zsh_history_for_token
verdict: match
events:
- event: { action: command.executed }
command: { command: "grep -i token ~/.zsh_history" }
session: { id: s1 }
- name: tail_fish_history
verdict: match
events:
- event: { action: command.executed }
command: { command: "tail -n 500 ~/.local/share/fish/fish_history" }
session: { id: s1 }
- name: list_directory_only
verdict: no_match
events:
- event: { action: command.executed }
command: { command: "ls -la ~" }
session: { id: s1 }
- name: history_builtin_no_read_tool
verdict: no_match
events:
- event: { action: command.executed }
command: { command: "history 20" }
session: { id: s1 }
- name: unrelated_cat
verdict: no_match
events:
- event: { action: command.executed }
command: { command: "cat README.md" }
session: { id: s1 }