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: gpg-keyring-access
version: 2
title: Agent read a GPG private key or exported a secret key
description: >
The agent either read a file under the GnuPG private-key directory
(private-keys-v1.d/, secring.gpg, .gnupg/openpgp-revocs.d/ certificate
revocation, .gnupg/trustdb.gpg trust database, .gnupg/gpg-control files) OR
invoked gpg or gpg2 with --export-secret-key(s), --export-secret-subkey(s),
or --gen-key. Private GPG keys sign commits and decrypt sensitive mail; an
agent touching a private keyring is a high-value exfil signal. The rule
is anchored on the path or on a gpg subcommand, and explicitly excludes
the public keyring (pubring.gpg, *.asc public keys) since reading public
keys is a routine signature-verification operation.
severity: high
status: experimental
posture: detect
taxonomy:
beacon_category: credential-access
owasp_llm: LLM02
mitre_atlas: AML.T0024
match: >
(e.event.action == "file.read" && (
e.file.path.matches("(?i)(^|/)\\.gnupg/private-keys-v1\\.d/") ||
e.file.path.matches("(?i)(^|/)secring\\.gpg$") ||
e.file.path.matches("(?i)(^|/)\\.gnupg/(openpgp-revocs\\.d/|trustdb\\.gpg$)") ||
e.file.path.matches("(?i)(^|/)\\.gnupg/[^/]+\\.key$")
)) || (
e.event.action == "command.executed" && (
e.command.command.matches("(?i)(^|[;&|]\\s*|\\bsudo\\s+)\\s*gpg2?\\b[^;&|]*--export-secret-(k|sub)\\w*\\b") ||
e.command.command.matches("(?i)(^|[;&|]\\s*|\\bsudo\\s+)\\s*gpg2?\\b[^;&|]*--gen-key\\b") ||
e.command.command.matches("(?i)(^|[;&|]\\s*|\\bsudo\\s+)\\s*gpg2?\\b[^;&|]*--card-status\\b[^;&|]*--with-keygrip\\b")
)
)
emit:
reason: "Agent accessed a GPG private key (file read or secret-export invocation)"
tests:
- name: read_private_keys_dir
verdict: match
events:
- event: { action: file.read }
file: { path: "/home/u/.gnupg/private-keys-v1.d/ABC123.key" }
session: { id: s1 }
- name: read_secring_gpg
verdict: match
events:
- event: { action: file.read }
file: { path: "/home/u/.gnupg/secring.gpg" }
session: { id: s1 }
- name: read_trustdb
verdict: match
events:
- event: { action: file.read }
file: { path: "/home/u/.gnupg/trustdb.gpg" }
session: { id: s1 }
- name: gpg_export_secret_keys
verdict: match
events:
- event: { action: command.executed }
command: { command: "gpg --export-secret-keys --armor 0xDEADBEEF" }
session: { id: s1 }
- name: gpg_export_secret_subkeys
verdict: match
events:
- event: { action: command.executed }
command: { command: "gpg --export-secret-subkeys 0xCAFEBABE > /tmp/keys.asc" }
session: { id: s1 }
- name: gpg_export_secret_key_singular
verdict: match
events:
- event: { action: command.executed }
command: { command: "gpg --armor --export-secret-key ABCDEF12 > key.asc" }
session: { id: s1 }
- name: gpg2_export_secret_keys
verdict: match
events:
- event: { action: command.executed }
command: { command: "gpg2 --export-secret-keys --armor > all.asc" }
session: { id: s1 }
- name: gpg_export_secret_abbreviated
verdict: match
events:
- event: { action: command.executed }
command: { command: "gpg --armor --export-secret-k ABCDEF12" }
session: { id: s1 }
- name: gpg_export_secret_sub_abbreviated
verdict: match
events:
- event: { action: command.executed }
command: { command: "gpg --export-secret-sub ABCDEF12! > sub.asc" }
session: { id: s1 }
- name: gpg_export_public_key
verdict: no_match
events:
- event: { action: command.executed }
command: { command: "gpg --armor --export ABCDEF12 > pub.asc" }
session: { id: s1 }
- name: read_public_keyring
verdict: no_match
events:
- event: { action: file.read }
file: { path: "/home/u/.gnupg/pubring.kbx" }
session: { id: s1 }
- name: gpg_list_keys
verdict: no_match
events:
- event: { action: command.executed }
command: { command: "gpg --list-keys" }
session: { id: s1 }
- name: gpg_verify_signature
verdict: no_match
events:
- event: { action: command.executed }
command: { command: "gpg --verify release.tar.gz.asc" }
session: { id: s1 }