Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
wgpsec avatar

Log Evasion

  • 23 installs
  • 1.6k repo stars
  • Updated July 19, 2026
  • wgpsec/aboutsecurity

Helps with ai & agent building tasks during AI-assisted development.

About

log-evasion is a Claude Code skill for ai & agent building. It helps solo builders move faster with AI-assisted coding.

  • log-evasion
  • AI & Agent Building
  • AI-coding skill

Log Evasion by the numbers

  • 23 all-time installs (skills.sh)
  • +2 installs in the week ending Jul 27, 2026 (Skillselion tracking)
  • Ranked #10,004 of 16,546 AI & Agent Building skills by installs in the Skillselion catalog
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/wgpsec/aboutsecurity --skill log-evasion

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs23
repo stars1.6k
Last updatedJuly 19, 2026
Repositorywgpsec/aboutsecurity

What it does

Helps with ai & agent building tasks during AI-assisted development.

Files

SKILL.mdMarkdownGitHub ↗

日志分析与日志逃逸

核心原则:最好的反日志策略是不产生日志,而非事后删除

⛔ 深入参考

  • Windows Event Log 详细 ID 映射与清除 → references/windows-eventlog.md
  • Linux audit/syslog 绕过技术 → references/linux-log-evasion.md

---

Part A: 蓝队视角 — 日志检测关键点

Windows 关键 Event ID

Event ID日志源含义红队动作触发
4624Security登录成功PTH/PTT/RDP
4625Security登录失败密码喷洒
4648Security显式凭据登录runas/PsExec
4672Security特权分配特权提升
4688Security新进程创建工具执行
4698Security计划任务创建持久化
4720Security用户创建后门账户
5140Security网络共享访问横向移动
5156Security网络连接C2 通信
7045System服务安装持久化/PsExec
1102Security日志清除⛔ 反取证暴露!
4104PowerShell脚本块日志PS 攻击工具
4103PowerShell模块日志PS 命令执行
1Sysmon进程创建(含hash)所有工具执行
3Sysmon网络连接C2 通信
8SysmonCreateRemoteThread进程注入
10Sysmon进程访问LSASS dump
11Sysmon文件创建工具落盘

Linux 关键日志

日志位置记录内容
auth.log/secure/var/log/SSH 登录、sudo、su
wtmp/var/log/登录/注销记录
btmp/var/log/失败登录
lastlog/var/log/最后登录时间
audit.log/var/log/audit/auditd 规则匹配
syslog/messages/var/log/系统事件
journal/var/log/journal/systemd 日志
.bash_history~/命令历史

SIEM 常见检测规则(需要绕过的)

Sigma 规则示例(蓝队部署):
├─ 进程注入: Sysmon EventID 8 (CreateRemoteThread to lsass)
├─ 凭据 Dump: EventID 10 (OpenProcess to lsass)
├─ 横向移动: EventID 4648 + 4624 LogonType 3
├─ 持久化: EventID 7045 (新服务) / 4698 (新计划任务)
├─ 日志清除: EventID 1102 / 104 → 高优先级告警!
└─ PowerShell: EventID 4104 含 "IEX" / "Invoke-" / "-enc"

---

Part B: 红队视角 — 日志逃逸

策略 1: 阻止日志产生(最优)

Windows:
├─ 禁用 ETW Provider → 阻止 PowerShell/AMS 日志
│   patch ntdll!EtwEventWrite → ret
│   或 NtTraceEvent hook
├─ 关闭 ScriptBlock Logging
│   reg: HKLM\SOFTWARE\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging → 0
├─ 使用 .NET 避免 PowerShell 日志
│   C# 直接调用 .NET → 不走 PS 引擎 → 无 4104
├─ Thread detach from ETW
│   patch 当前线程的 ETW context → 不再产生事件
└─ Sysmon 绕过
    unload sysmon driver / patch 事件回调

Linux:
├─ 操作前: unset HISTFILE; export HISTSIZE=0; export HISTFILESIZE=0
├─ 或: set +o history
├─ 使用空格前缀命令(bash HISTCONTROL=ignorespace)
├─ kill -9 auditd(需 root,会产生停止日志)
└─ auditctl -e 0(关闭审计,更隐蔽)

策略 2: 绕过日志(不触发检测规则)

绕过 Sysmon:
├─ 进程注入: 避免 CreateRemoteThread → 用 APC/Callback/Early Bird
├─ LSASS 访问: 避免直接 OpenProcess → 用 Handle 复制/MiniDump
├─ 网络: 使用 raw socket → Sysmon EID 3 可能不捕获
└─ 文件: 使用已存在文件名/路径 → 不触发新文件规则

绕过 PowerShell 日志:
├─ 降级攻击: powershell -version 2(无 ScriptBlock 日志)
├─ 使用 C#/.NET: 直接反射调用 → 无 PS 日志
├─ AMSI bypass → 阻止脚本内容被记录
└─ 使用 WMI/COM → 不走 PowerShell 引擎

绕过 4688 进程创建:
├─ 进程名伪装: 复制合法程序名执行
├─ 使用 LOLBins: rundll32/mshta/certutil → 合法进程
├─ 父进程欺骗: 设置 PPID 为正常进程
└─ 命令行混淆: 环境变量展开、特殊字符

策略 3: 精准清除(已产生日志时的补救)

⛔ NEVER 清空整个日志 → EventID 1102 会立即告警!
⛔ ALWAYS 精准删除特定条目

Windows 精准清除:
├─ 方式 1: 停止 EventLog 服务 → 修改 .evtx 文件 → 重启服务
│   net stop eventlog(需 SYSTEM)
│   修改 evtx 二进制结构删除特定记录
│   net start eventlog
├─ 方式 2: Danderspritz eventlogedit(NSA 工具)
│   精准删除指定 EventID 的记录,修复文件校验
├─ 方式 3: Invoke-Phant0m
│   杀掉 EventLog 服务的所有线程 → 服务在但不写日志
└─ 方式 4: MiniNT 注册表键
    HKLM\SYSTEM\CurrentControlSet\Control\MiniNT → 阻止日志写入

Linux 精准清除:
├─ auth.log: sed -i '/特定IP/d' /var/log/auth.log
├─ wtmp: utmpdump /var/log/wtmp > tmp.txt
│         编辑删除特定行
│         utmpdump -r < tmp.txt > /var/log/wtmp
├─ lastlog: 工具修改特定用户的 lastlog 记录
├─ audit.log: aureport 确认记录 → sed 删除
└─ journal: journalctl --vacuum-time=1s(⛔ 会清全部)

策略 4: 实时日志转发对抗

现代企业会实时转发日志到 SIEM → 本地删除无效!

应对方案:
├─ 从一开始就不产生日志(策略 1)→ 最优
├─ 绕过 Sysmon/ETW(策略 2)→ 不产生特定事件
├─ 使用 SSH 隧道/DNS 隧道 → 网络日志中混入合法流量
├─ 操作时间选择 → 凌晨/节假日 → SOC 响应慢
└─ 理解 SIEM 规则阈值 → 低于告警阈值操作
    例:密码喷洒锁定阈值 5次 → 每用户只尝试 2 次

对照表

蓝队监控触发条件红队对策
EventID 4624任何登录正常时段+合法用户名
EventID 4688新进程LOLBins / PPID spoofing
EventID 4104PS 脚本.NET / AMSI bypass / PS v2
Sysmon EID 1进程+hash修改已知白名单程序
Sysmon EID 8远程线程APC / Timer callback
Sysmon EID 10进程访问Handle duplicate
auditdsyscall审计关闭 auditd / 直接 syscall
网络日志连接记录域前置 / CDN / 合法服务

Related skills

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.