L’interface est localisée ; les présentations et documents des Skills sont traduits automatiquement par IA dans votre langue. Le code, les commandes, chemins et termes techniques restent en version originale, et le document de l’auteur fait foi.
Explorer les Skills
Productivité · SKILL.md

analyzing-persistence-mechanisms-in-linux

analyzing-persistence-mechanisms-in-linux

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

Independent GitHub snapshot · Automated classification · Original documentation governs

Documentation de la Skill

GitHub

name: analyzing-persistence-mechanisms-in-linux description: 检测和分析 Linux 持久化机制,包括 crontab 条目、systemd 服务单元、LD_PRELOAD 劫持、bashrc 修改和 authorized_keys 后门,使用 auditd 和文件完整性监控 domain: cybersecurity subdomain: threat-hunting tags: [linux-persistence, crontab, systemd, ld-preload, auditd, threat-hunting, incident-response] version: "1.0" author: mahipal license: Apache-2.0

分析 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)
  • 每个检测到的持久化机制的修复命令
Skills enregistrées