[WINPEAS] Add privilege escalation check: LDAP BOF Collection – In‑Memory LDAP Too... #528
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🔧 Automated Privilege Escalation Check Addition
🤔 Privilege Escalation Reasoning
The content describes multiple Active Directory–based privilege escalation patterns that are generic to Windows domain environments rather than CTF-style edge cases or one-off software bugs. These are standard, widely applicable misconfigurations/abuses that winpeas can and already partially does look for:
ACL-based AD privilege escalation:
GenericAll,GenericWrite,WriteDACL,WriteOwner, or attribute-level rights; then manipulate DACLs/ownership to gain broader control.get-writable,get-acl,add-ace,add-genericall,add-genericwrite,set-owner.Direct account takeover / group-based escalation via LDAP writes:
Domain Admins.set-password,add-groupmemberused after finding writable users/groups.Kerberoasting and AS‑REP roasting enablement by attribute control:
servicePrincipalNameon an account, you can make it Kerberoastable; if you can setDONT_REQ_PREAUTH(UAC flag), you can make it AS‑REP roastable.add-spn,add-asreproastable, and reading withget-spn,get-uac.Delegation and Resource-Based Constrained Delegation (RBCD) abuse:
msDS-AllowedToDelegateTo), or RBCD (msDS-AllowedToActOnBehalfOfOtherIdentity), enabling S4U2Proxy impersonation chains.get-delegation,get-rbcd, macrosadd-unconstrained,add-constrained,add-rbcd.sidHistory-based stealth escalation:
sidHistoryis writable, add a privileged SID (e.g., Domain Admins) to a low-privilege account’ssidHistoryto silently inherit those privileges.add-sidhistory.sidHistoryis a known, general AD misconfiguration/path to stealth privilege escalation, not tied to custom binaries or uncommon software.Object movement to attacker-controlled OUs:
move-objectand discussion of OU abuse.movepermissions plus delegated OU permissions as an escalation path is generic and widely applicable.All of these operate in a standard Windows domain context, abusing AD ACLs, delegation, and attributes that are intrinsic to Active Directory. They do not rely on one-off scripts, fixed CVEs in obscure software, or CTF‑style contrivances. Hence, they are appropriate for winpeas enhancement (enumeration and detection logic), not linpeas.
🤖 Implementation Details
PEASS winpeas agent completed successfully with 109 items. Agent Comment: Summary:
ActiveDirectoryInfowith a newPrintAdObjectControlPathscheck that enumerates high-value objects plus a capped sample of users/groups/computers, parses their DACLs, and flags when the current security principal already has impactful rights (GenericAll/GenericWrite/WriteDACL/WriteOwner/CreateChild, reset-password extended rights, replication/DCSync rights, or attribute-specific control over member/SPN/UAC/msDS-AllowedToActOnBehalfOfOtherIdentity/msDS-AllowedToDelegateTo/sidHistory/unicodePwd). Findings are deduplicated, scored, and printed with actionable guidance, leveraging schema/extended-rights lookups that are cached to avoid repeated LDAP queries.winPEAS/winPEASexe/README.mdunder “New (AD-aware) checks” so users know what the additional output means.Testing:
dotnet build winPEAS.sln(fails – container lacks the .NET Framework 4.8 reference assemblies / developer pack, so the build cannot complete here).🏗️ Builder Agent Response
WinPEAS validation agent completed successfully with 155 items. Agent Comment: Summary:
git status -sb,git diff --stat) and confirmed the only modified WinPEAS sources werewinPEASexe/README.mdand the heavily expandedChecks/ActiveDirectoryInfo.cs.winPEAS/winPEASexe/winPEAS) pluswinPEAS.csprojto ensure the new check is compiled, and validated the project file’s XML structure viapython -m xml.etree.ElementTree.sed/grepto verify namespace usage, class/member definitions, and common C# pitfalls (missing braces, invalid string literals, etc.).using winPEAS.Info.FilesInfo.Certificates;directive fromActiveDirectoryInfo.csto avoid CS8019 build warnings and keep the file scoped only to the dependencies it actually uses.Validation:
dotnet msbuild winPEAS.sln /t:Clean /p:Configuration=Release(passes).dotnet msbuild winPEAS.sln /t:Build /p:Configuration=Release(fails because this Linux runner lacks the .NET Framework 4.8 reference assemblies: MSB3644). This is an environment limitation; no project errors were reported before the framework check.python - <<'PY' ... ET.parse('winPEAS.csproj')confirms the project file remains well-formed XML.Issues fixed:
using winPEAS.Info.FilesInfo.Certificates;directive that was no longer referenced anywhere in the file, preventing unnecessary compiler warnings and keeping the dependency surface minimal. (No other syntax, namespace, or project-structure problems were found in the touched files.)Outstanding:
Confidence: High
This PR was automatically created by the HackTricks Feed Bot. Please review the implementation carefully and test thoroughly before merging.