Communitygithub.com

分析Active Directory ACL滥用

使用ldap3检测Active Directory中危险的ACL配置错误。

分析Active Directory ACL滥用 是什么?

该技能专注于通过分析Active Directory对象的nTSecurityDescriptor属性来发现危险ACL(访问控制列表)配置错误。它利用ldap3 Python库连接域控制器,将二进制安全描述符解析为SDDL(安全描述符定义语言)格式,并识别出赋予非特权主体危险权限的ACL条目(ACE),例如GenericAll(完全控制)、WriteDACL(修改权限)、WriteOwner(获取所有权)和GenericWrite(修改属性)。此技能对于安全事件调查、构建检测规则以及验证针对ACL滥用相关攻击技术的监控覆盖范围非常有用。输出是一个详细的JSON报告,其中包含受影响的AD对象、非管理员受托者以及具体的攻击路径描述,类似于BloodHound等工具所发现的攻击路径。它支持在Python环境中运行,需要ldap3库以及具有对目标AD对象读取权限的域用户凭据。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/mukul975/Anthropic-Cybersecurity-Skills/tree/main/skills/analyzing-active-directory-acl-abuse

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

分析 Active Directory ACL 滥用

概述

Active Directory 访问控制列表 (ACL) 通过包含访问控制条目 (ACE) 的自由访问控制列表 (DACL) 来定义对 AD 对象的权限。配置错误的 ACE 可能会向非特权用户授予危险的权限,例如 GenericAll(完全控制)、WriteDACL(修改权限)、WriteOwner(获取所有权)和 GenericWrite(修改属性),这些权限作用于敏感对象(如域管理员组、域控制器或 GPO)。

本技能使用 ldap3 Python 库连接到域控制器,查询对象及其 nTSecurityDescriptor 属性,将二进制安全描述符解析为 SDDL(安全描述符定义语言)格式,并识别出向非管理主体授予危险权限的 ACE。这些配置错误是 BloodHound 等工具发现的基于 ACL 的攻击路径的基础。

使用时机

  • 调查涉及Active Directory ACL滥用的安全事件时
  • 为此领域构建检测规则或威胁猎取查询时
  • 当SOC分析师需要此分析类型的结构化流程时
  • 验证相关攻击技术的安全监控覆盖范围时

前提条件

  • Python 3.9 或更高版本,并安装 ldap3 库 (pip install ldap3)
  • 具有对 AD 对象读取权限的域用户凭据
  • 能够通过网络连接到域控制器的端口 389 (LDAP) 或 636 (LDAPS)
  • 了解 Active Directory 安全模型和 SDDL 格式

步骤

  1. 连接到域控制器:使用 ldap3 通过 NTLM 或简单身份验证建立 LDAP 连接。在生产环境中,使用 LDAPS(端口 636)进行加密连接。

  2. 查询目标对象:在目标 OU 或整个域中搜索对象,包括用户、组、计算机和 OU。请求 nTSecurityDescriptor、distinguishedName、objectClass 和 sAMAccountName 属性。

  3. 解析安全描述符:将二进制 nTSecurityDescriptor 转换为其 SDDL 字符串表示形式。解析 DACL 中的每个 ACE,提取受托者 SID、访问掩码和 ACE 类型(允许/拒绝)。

  4. 将 SID 解析为受托者:使用针对域的 LDAP 查询,将安全标识符 (SID) 映射为人类可读的帐户名称。识别内置组的熟知 SID。

  5. 检查危险权限:将每个 ACE 的访问掩码与危险权限位掩码进行比较:GenericAll (0x10000000)、WriteDACL (0x00040000)、WriteOwner (0x00080000)、GenericWrite (0x40000000),以及针对特定扩展权限的 WriteProperty。

  6. 过滤非管理员受托者:排除预期的管理受托者(域管理员、企业管理员、SYSTEM、管理员),标记非特权用户或组持有危险权限的 ACE。

  7. 映射攻击路径:针对每个发现,记录潜在的攻击链(例如,对用户的 GenericAll 允许重置密码,对组的 WriteDACL 允许将自身添加到组中)。

  8. 生成修复报告:输出一个 JSON 报告,包含所有危险的 ACE、受影响的 AD 对象、非管理员受托者以及推荐的修复步骤。

预期输出

{
  "domain": "corp.example.com",
  "objects_scanned": 1247,
  "dangerous_aces_found": 8,
  "findings": [
    {
      "severity": "critical",
      "target_object": "CN=Domain Admins,CN=Users,DC=corp,DC=example,DC=com",
      "target_type": "group",
      "trustee": "CORP\\helpdesk-team",
      "permission": "GenericAll",
      "access_mask": "0x10000000",
      "ace_type": "ACCESS_ALLOWED",
      "attack_path": "对 Domain Admins 组的 GenericAll 权限允许添加任意成员",
      "remediation": "移除 helpdesk-team 对 Domain Admins 组的 GenericAll ACE"
    }
  ]
}

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

abusing-dpapi-for-credential-access

Extract and decrypt Windows DPAPI-protected secrets (Credential Manager, browser logins/cookies, Wi-Fi credentials, KeePass keys) online or offline using SharpDPAPI, SharpChrome, Mimikatz, or Impacket

abusing-shadow-credentials-for-privesc

Take over Active Directory accounts by writing attacker-controlled public keys to msDS-KeyCredentialLink (Shadow Credentials) with pyWhisker, Whisker, or Certipy, then authenticate via PKINIT to recover the target

achieving-cmmc-level-2-compliance

>-

acquiring-disk-image-with-dd-and-dcfldd

Create forensically sound bit-for-bit disk images with dd or dcfldd on a Linux forensic workstation, preserving evidence integrity through hash verification (MD5/SHA) during acquisition. Use when imaging a suspect drive, USB device, or memory card for investigation, preserving volatile disk evidence during incident response, or producing a verified copy for legal or law-enforcement proceedings before any destructive analysis.

analyzing-android-malware-with-apktool

Perform static analysis of Android APK malware using apktool for resource decompilation, jadx for Java source recovery, and androguard for manifest inspection, dangerous permission-combination detection, and identification of obfuscated code, dynamic code loading, and reflection-based API calls. Use to statically triage a suspicious APK without executing it or to build mobile malware detection rules.

analyzing-api-gateway-access-logs

Parses API Gateway access logs (AWS API Gateway, Kong, Nginx) to detect

analyzing-apt-group-with-mitre-navigator

Query ATT&CK data with attackcti, mitreattack-python, and stix2, then build MITRE ATT&CK Navigator layers and multi-layer heatmap overlays mapping one or more APT groups

analyzing-azure-activity-logs-for-threats

Queries Azure Monitor activity logs and sign-in logs via azure-monitor-query

analyzing-bootkit-and-rootkit-samples

Analyzes bootkit and advanced rootkit malware infecting the Master

analyzing-browser-forensics-with-hindsight

Parse Chromium-based browser databases with Hindsight to extract and correlate browsing history, downloads, cookies, cached content, autofill data, saved passwords, and extensions from Chrome, Edge, Brave, Opera, and Vivaldi into a unified timeline (XLSX, JSON, or SQLite output). Use during incident response, insider-threat investigations, or criminal cases when you need to reconstruct a user

analyzing-campaign-attribution-evidence

Systematically evaluate cyber-campaign evidence to attribute an operation to a threat actor, using the Diamond Model and Analysis of Competing Hypotheses (ACH) to weigh infrastructure overlaps, TTP consistency, malware code similarity, and timing/language artifacts into confidence-weighted attribution assessments. Use when an incident investigation needs a defensible attribution confidence level.

analyzing-certificate-transparency-for-phishing

Monitor Certificate Transparency logs using crt.sh and Certstream to

analyzing-cloud-storage-access-patterns

Detect abnormal access in AWS S3, GCS, and Azure Blob Storage by analyzing CloudTrail Data Events, GCS audit logs, and Azure Storage Analytics for after-hours bulk downloads, new-IP access, and API-call spikes (e.g. GetObject) via statistical baselines and time-series anomaly detection. Use when investigating suspected cloud data exfiltration or building related detection rules.

analyzing-cobalt-strike-beacon-configuration

Extract and analyze Cobalt Strike beacon configuration from PE files

analyzing-cobaltstrike-malleable-c2-profiles

Parse and analyze Cobalt Strike Malleable C2 profiles with dissect.cobaltstrike (profiles and beacon-payload configs) and pyMalleableC2 (AST parsing) to extract HTTP/DNS transforms, URIs, headers, sleep/jitter, and injection behavior, then generate network detection signatures. Use when reverse-engineering a captured malleable profile or building detections against Cobalt Strike Beacon traffic.

analyzing-command-and-control-communication

Analyzes malware C2 communication over HTTP, HTTPS, DNS, and custom

analyzing-cyber-kill-chain

Analyzes intrusion activity against the Lockheed Martin Cyber Kill Chain

analyzing-disk-image-with-autopsy

Perform comprehensive forensic analysis of raw (dd), E01, or AFF disk images with Autopsy and The Sleuth Kit, recovering deleted files, examining metadata and embedded artifacts, keyword searching, and building investigation timelines with visual reports. Use for structured analysis of a forensic disk image or when stakeholders need visual reports from evidence.

analyzing-dns-logs-for-exfiltration

Analyzes DNS query logs to detect data exfiltration via DNS tunneling,

analyzing-docker-container-forensics

Investigate compromised Docker containers by analyzing images, layers,

相关技能