analyzing-persistence-mechanisms-in-linux

检测和分析 Linux 持久化机制,包括 crontab 条目、systemd 服务单元、LD_PRELOAD 劫持、bashrc 修改和 authorized_keys 后门,使用 auditd 和文件完整性监控

9 stars

Best use case

analyzing-persistence-mechanisms-in-linux is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

检测和分析 Linux 持久化机制,包括 crontab 条目、systemd 服务单元、LD_PRELOAD 劫持、bashrc 修改和 authorized_keys 后门,使用 auditd 和文件完整性监控

Teams using analyzing-persistence-mechanisms-in-linux should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/analyzing-persistence-mechanisms-in-linux/SKILL.md --create-dirs "https://raw.githubusercontent.com/killvxk/cybersecurity-skills-zh/main/skills/analyzing-persistence-mechanisms-in-linux/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/analyzing-persistence-mechanisms-in-linux/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How analyzing-persistence-mechanisms-in-linux Compares

Feature / Agentanalyzing-persistence-mechanisms-in-linuxStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

检测和分析 Linux 持久化机制,包括 crontab 条目、systemd 服务单元、LD_PRELOAD 劫持、bashrc 修改和 authorized_keys 后门,使用 auditd 和文件完整性监控

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# 分析 Linux 持久化机制

## 概述

攻击者通过 crontab 任务、systemd 服务/计时器单元、LD_PRELOAD 库注入、Shell 配置文件修改(.bashrc、.profile)、SSH authorized_keys 后门以及 init 脚本操控等方式在 Linux 系统上建立持久化(Persistence)。本技能扫描所有已知持久化向量,检查文件时间戳和完整性,并将发现结果与 auditd 日志关联,以构建持久化安装的时间线。

## 前置条件

- 目标 Linux 系统(或取证镜像)的 root 或 sudo 访问权限
- auditd 已配置针对持久化路径的文件监控规则
- Python 3.8+ 及标准库(os、subprocess、json)
- 可选:OSSEC/Wazuh 代理用于文件完整性监控告警

## 步骤

1. **扫描 Crontab 条目** — 枚举所有用户 crontab、/etc/cron.d/、/etc/cron.daily/ 和 anacron 任务中的可疑命令
2. **审计 Systemd 单元** — 检查 /etc/systemd/system/ 和 ~/.config/systemd/user/ 中非包管理器托管的服务和计时器单元
3. **检测 LD_PRELOAD 劫持** — 检查 /etc/ld.so.preload 和 LD_PRELOAD 环境变量中注入的共享库
4. **检查 Shell 配置文件** — 扫描 .bashrc、.bash_profile、.profile、/etc/profile.d/ 中注入的命令或反向 Shell
5. **检查 SSH Authorized Keys** — 审计所有 authorized_keys 文件中的未授权公钥及命令限制
6. **关联 Auditd 日志** — 搜索 auditd 日志中持久化路径的文件修改事件,构建安装时间线
7. **生成持久化报告** — 生成包含所有发现的持久化机制及风险评分的报告

## 预期输出

- 包含所有持久化机制及风险评分的 JSON 报告
- 基于 auditd 关联的持久化安装时间线
- MITRE ATT&CK 技术映射(T1053、T1543、T1574、T1546)
- 每个检测到的持久化机制的修复命令

Related Skills

performing-privilege-escalation-on-linux

9
from killvxk/cybersecurity-skills-zh

Linux 权限提升是指在已控制的系统上从低权限用户账户提升至 root 访问权限。红队通过利用错误配置、存在漏洞的服务、内核漏洞利用和弱权限来实现 root 访问。

performing-malware-persistence-investigation

9
from killvxk/cybersecurity-skills-zh

系统性地调查 Windows 和 Linux 系统上的所有持久化机制,以识别恶意软件如何在重启后存活并维持访问。

performing-linux-log-forensics-investigation

9
from killvxk/cybersecurity-skills-zh

对 Linux 系统日志(包括 syslog、auth.log、systemd journal、kern.log 和应用程序日志)进行取证调查,以重建用户活动、检测未授权访问并在被入侵的 Linux 系统上建立事件时间线。

hunting-for-startup-folder-persistence

9
from killvxk/cybersecurity-skills-zh

通过监控 Windows 启动目录中的可疑文件创建、分析 autoruns 条目以及使用 Python watchdog 进行实时文件系统监控,检测 T1547.001 启动文件夹持久化。

hunting-for-scheduled-task-persistence

9
from killvxk/cybersecurity-skills-zh

通过分析任务创建事件、可疑任务操作和异常调度模式,狩猎攻击者通过 Windows 计划任务实现的持久化。

hunting-for-registry-run-key-persistence

9
from killvxk/cybersecurity-skills-zh

通过分析 Sysmon 事件 ID 13 日志和注册表查询,检测 MITRE ATT&CK T1547.001 注册表 Run 键持久化,识别恶意自动启动条目。

hunting-for-registry-persistence-mechanisms

9
from killvxk/cybersecurity-skills-zh

狩猎 Windows 环境中基于注册表的持久化机制,包括 Run 键、Winlogon 修改、IFEO 注入和 COM 劫持。

hunting-for-persistence-via-wmi-subscriptions

9
from killvxk/cybersecurity-skills-zh

通过监控 WMI 消费者、过滤器和绑定创建事件,狩猎攻击者利用 Windows Management Instrumentation 事件订阅实现的持久化,这些订阅在系统事件触发时执行恶意代码。

hunting-for-persistence-mechanisms-in-windows

9
from killvxk/cybersecurity-skills-zh

系统性地狩猎 Windows 终端中的攻击者持久化机制,涵盖注册表、服务、启动文件夹和 WMI 事件订阅。

hunting-for-dns-based-persistence

9
from killvxk/cybersecurity-skills-zh

使用被动 DNS 数据库、SecurityTrails API 和 DNS 审计日志分析,狩猎 DNS 劫持、悬空 CNAME 记录、通配符 DNS 滥用和未授权区域修改等 DNS 持久化机制。

hardening-linux-endpoint-with-cis-benchmark

9
from killvxk/cybersecurity-skills-zh

使用 CIS Benchmark 建议对 Ubuntu、RHEL 和 CentOS 的 Linux 端点进行加固, 以减少攻击面、执行安全基线并满足合规要求。适用于部署新 Linux 服务器、修复审计发现 或为 Linux 基础设施建立安全基线的场景。

detecting-wmi-persistence

9
from killvxk/cybersecurity-skills-zh

通过分析 Sysmon 事件 ID 19、20 和 21 中的恶意 EventFilter、EventConsumer 和 FilterToConsumerBinding 创建,检测 WMI 事件订阅持久化。