Skip to content

feat: add TeamPCP behavior detection rules + domain corpus fix#69

Merged
sheeki03 merged 3 commits intomainfrom
feat/teampcp-behavior-rules
Mar 25, 2026
Merged

feat: add TeamPCP behavior detection rules + domain corpus fix#69
sheeki03 merged 3 commits intomainfrom
feat/teampcp-behavior-rules

Conversation

@sheeki03
Copy link
Copy Markdown
Owner

What

Three new command-shape rules inspired by the TeamPCP supply chain attack (March 2026), plus domain corpus expansion and hostname wiring fix.

New Rules

1. ProcMemAccess (High / Block)
Detects /proc/*/mem scraping via reader commands (cat, dd, strings, cp, grep). Wrapper-aware (sudo, env, env -S). Normalized args handle quoted paths. Excludes echo/printf (not file readers).

  • MITRE: T1003.007 (OS Credential Dumping: Proc Filesystem)

2. DockerRemotePrivEsc (Critical / Block)
Compound rule: requires Docker remote daemon (-H tcp://, --host=tcp://, DOCKER_HOST=tcp://) AND privilege escalation (--privileged or host root mount -v /:/..., --mount type=bind,src=/). Case-sensitive -H (uppercase only, lowercase -h is container hostname). Handles env -S and --split-string wrappers. Skips -e/--env container env args.

  • MITRE: T1611 (Escape to Host)

3. CredentialFileSweep (Medium / Warn)
Exec-only, per-segment, verb-gated. Fires when a read/archive command accesses 2+ credential paths (ssh keys, aws, docker, kube, gcloud, npm, pypi, gnupg, etc). 13 credential paths, full tier-1 coverage.

  • MITRE: T1552.001 (Credentials In Files)

Infrastructure

  • resolve_base_through_wrappers() — generic wrapper resolver for sudo/env/command/exec/nohup
  • unwrap_env_split_string_segment() — unwraps env -S "cmd" and env --split-string="cmd" for all 3 rules
  • Domain corpus: 8 verified security/AI vendor domains added to known_domains.csv
  • additional_known_domains wired into hostname confusable detection

Fixtures

21 golden fixtures covering positive, negative, and edge cases:

  • ProcMemAccess: cat, dd, sudo, echo-allow, status-allow, quoted
  • DockerRemotePrivEsc: -H, --host=, root mount, mount-src-last, env-wrapper, -e allow, -h allow, local allow, env -S, --split-string
  • CredentialFileSweep: tar, cat, single-allow, chmod-allow, sudo

Verification

  • cargo fmt + clippy + test: 902 passed, 0 failed
  • Manual shell testing: 19/19 cases correct
  • CodeRabbit CLI review: all actionable findings fixed

Three new command-shape rules inspired by TeamPCP supply chain attack:

1. ProcMemAccess (High/Block): detects /proc/*/mem scraping via reader
   commands (cat, dd, strings, cp, grep). Wrapper-aware (sudo, env).
   Normalized args to handle quoted paths. MITRE T1003.007.

2. DockerRemotePrivEsc (Critical/Block): compound rule requiring Docker
   remote daemon (-H tcp://, --host=tcp://, DOCKER_HOST=tcp://) AND
   privilege escalation (--privileged or host root mount -v /:/...).
   Handles --mount type=bind,src=/ and env wrapper forms. MITRE T1611.

3. CredentialFileSweep (Medium/Warn): exec-only, per-segment, verb-gated.
   Fires when a read/archive command accesses 2+ credential paths
   (ssh keys, aws, docker, kube, gcloud, npm, pypi, gnupg, etc).
   MITRE T1552.001.

Also:
- Expand known_domains.csv with security vendor + AI provider domains
- Wire policy.additional_known_domains into hostname confusable check
- 16 golden fixtures (positive + negative for each rule)
- resolve_base_through_wrappers() helper for wrapper-aware detection

Verified: cargo fmt + clippy + test (902 passed, 0 failed)
@sheeki03 sheeki03 changed the base branch from feat/credential-detection to main March 25, 2026 17:23
@sheeki03 sheeki03 merged commit 27e2ccc into main Mar 25, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant