Skip to content

meltedinhex/analyst-ai-pack / skills/hunting-persistence-on-linux

hunting-persistence-on-linux

Flagged

Hunts for Linux persistence by inspecting cron, systemd units, shell rc files, SSH authorized_keys, and common autostart locations for attacker-added entries. Activates for requests to hunt Linux persistence, audit cron/systemd for backdoors, or find unauthorized autostart and authorized_keys entries.

FileKindSize
LICENSEother340 B
SKILL.mdskill md2.7 KB
references/api-reference.mdmarkdown1.2 KB
scripts/analyst.pyscript2.8 KB
---
name: hunting-persistence-on-linux
description: 'Hunts for Linux persistence by inspecting cron, systemd units, shell rc files, SSH
  authorized_keys, and common autostart locations for attacker-added entries. Activates for
  requests to hunt Linux persistence, audit cron/systemd for backdoors, or find unauthorized
  autostart and authorized_keys entries.'
domain: cybersecurity
subdomain: threat-hunting
tags:
  - threat-hunting
  - linux
  - persistence
  - cron
  - systemd
version: 1.0.0
author: analyst-ai-pack
license: Apache-2.0
mitre_attack:
  - T1053.003
  - T1543.002
  - T1098.004
d3fend:
  - D3-FA
  - D3-PSA
references:
  - 'MITRE ATT&CK T1543.002 Systemd Service — https://attack.mitre.org/techniques/T1543/002/'
  - 'MITRE ATT&CK T1053.003 Cron — https://attack.mitre.org/techniques/T1053/003/'
---

# Hunting Persistence on Linux

## When to Use

- You have collected Linux persistence-relevant files (cron entries, systemd units, shell rc
  files, `authorized_keys`, autostart) and want to flag suspicious entries.
- You are triaging a suspected compromised Linux host's persistence surface.

**Do not use** this on a live root shell as a substitute for proper IR collection — feed it
collected copies. It reads files statically and executes nothing.

## Prerequisites

- Collected persistence artifacts (cron files, unit files, rc files, `authorized_keys`).

## Safety & Handling

- Read files statically; treat their contents as untrusted.

## Workflow

### Step 1: Scan persistence files

```bash
python scripts/analyst.py scan /path/to/collected
```

Recursively scans known persistence locations and flags entries containing download/exec patterns
(`curl|wget ... | sh`, `base64 -d | bash`, reverse-shell one-liners, `nc -e`), suspicious paths
(`/tmp`, `/dev/shm`), and unexpected `authorized_keys` additions.

### Step 2: Categorize by mechanism

Group findings by mechanism: cron, systemd, rc/profile, SSH keys, autostart.

### Step 3: Confirm

Compare against a known-good baseline of expected services/keys; investigate deviations.

### Step 4: Document

Record each persistence entry, its mechanism, and the suspicious indicator.

## Validation

- Findings are grouped by persistence mechanism.
- Reverse-shell/download-exec one-liners are flagged with the matched pattern.
- `authorized_keys` additions are surfaced for review.

## Pitfalls

- Legitimate admin cron/systemd entries — baseline before alerting.
- Persistence in less-common spots (udev, PAM, LD_PRELOAD) not covered by basic scans.
- Encoded/obfuscated payloads hiding the true command.

## References

- See [`references/api-reference.md`](references/api-reference.md) for the scanner.
- ATT&CK T1543.002 and T1053.003 (linked in frontmatter).
rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first.Stars: 194kUpdated Claude CodeCodexVerifiedInstall