Analyzing persistence mechanisms in linux

From killvxk/cybersecurity-skills-zh · View interactive version

Analyzing persistence mechanisms in linux is an AI agent skill from the GitHub repository killvxk/cybersecurity-skills-zh. 检测和分析 Linux 持久化机制,包括 crontab 条目、systemd 服务单元、LD_PRELOAD 劫持、bashrc 修改和 authorized_keys 后门,使用 auditd 和文件完整性监控

How to use this skill

Skill file

分析 Linux 持久化机制

概述

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

前置条件

步骤

  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. 生成持久化报告 — 生成包含所有发现的持久化机制及风险评分的报告

预期输出

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.