Implementing memory protection with dep aslr

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

Implementing memory protection with dep aslr is an AI agent skill from the GitHub repository killvxk/cybersecurity-skills-zh. 实施内存保护机制,包括 DEP(数据执行防护)、ASLR(地址空间布局随机化)、 CFG(控制流防护)和其他漏洞利用缓解措施,以防御内存损坏攻击。适用于加固端点 以抵御缓冲区溢出利用、ROP 链和代码注入的场景。适用于涉及内存保护、漏洞利用缓解、 DEP、ASLR 或 CFG 配置的请求。

How to use this skill

Skill file

使用 DEP 和 ASLR 实施内存保护

使用场景

在加固端点以抵御基于内存的漏洞利用时使用本技能,通过配置 DEP、ASLR、CFG 和 Windows Exploit Protection 实施系统级和应用程序级缓解措施。

操作流程

步骤 1:配置系统级缓解措施

# 启用系统范围的 DEP(数据执行防护)
# 引导配置:OptIn(默认)、OptOut(推荐)、AlwaysOn
bcdedit /set nx AlwaysOn

# 验证 ASLR 状态(现代 Windows 默认启用)
Get-ProcessMitigation -System
# MandatoryASLR、BottomUpASLR、HighEntropyASLR 应为 ON

# 启用所有系统级缓解措施
Set-ProcessMitigation -System -Enable DEP,SEHOP,ForceRelocateImages,BottomUp,HighEntropy

步骤 2:配置应用程序级缓解措施

# 加固高风险应用程序(浏览器、Office、PDF 阅读器)
Set-ProcessMitigation -Name "WINWORD.EXE" -Enable DEP,SEHOP,ForceRelocateImages,CFG,StrictHandle
Set-ProcessMitigation -Name "EXCEL.EXE" -Enable DEP,SEHOP,ForceRelocateImages,CFG,StrictHandle
Set-ProcessMitigation -Name "AcroRd32.exe" -Enable DEP,SEHOP,ForceRelocateImages,CFG
Set-ProcessMitigation -Name "chrome.exe" -Enable DEP,CFG,ForceRelocateImages
Set-ProcessMitigation -Name "msedge.exe" -Enable DEP,CFG,ForceRelocateImages

# 导出配置以供部署
Get-ProcessMitigation -RegistryConfigFilePath "C:\exploit_protection.xml"
# 通过 Intune 或 GPO 部署

步骤 3:通过 Intune/GPO 部署

Intune:端点安全 → 攻击面减少 → Exploit Protection
  导入 exploit_protection.xml 模板

GPO:计算机配置 → 管理模板 → Windows 组件
  → Windows Defender Exploit Guard → Exploit Protection
  → "使用通用的 Exploit Protection 设置" → 已启用
  → 指向网络共享上的 XML 文件

关键概念

| 术语 | 定义 |

|------|------|

| DEP | 将内存页面标记为不可执行,防止在数据区域执行 shellcode |

| ASLR | 随机化已加载模块的内存地址,以挫败硬编码的 ROP 小工具 |

| CFG | 在运行时验证间接调用目标,防止控制流劫持 |

| SEHOP | 验证 SEH 链完整性,防止基于 SEH 的漏洞利用 |

工具与系统

常见误区

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.