
Reconhecimento e exploração do Active Directory para Red Teams através dos Active Directory Web Services (ADWS).
Reconhecimento e exploração do Active Directory para Red Teams via Active Directory Web Services (ADWS).
SharpADWS é uma ferramenta de reconhecimento e exploração do Active Directory para Red Teams que coleta e modifica dados do Active Directory através do protocolo Active Directory Web Services (ADWS).
Normalmente, a enumeração ou manipulação do Active Directory ocorre através do protocolo LDAP. O SharpADWS tem a capacidade de extrair ou modificar dados do Active Directory sem se comunicar diretamente com o servidor LDAP. Sob o ADWS, as consultas LDAP são encapsuladas em uma série de mensagens SOAP e enviadas ao servidor ADWS usando um canal criptografado NET TCP Binding. O servidor ADWS então descompacta a consulta LDAP localmente e a encaminha para o servidor LDAP em execução no mesmo controlador de domínio.
O Active Directory Web Services (ADWS) é ativado automaticamente quando o Active Directory Domain Services (ADDS) é instalado, tornando o SharpADWS universal em todos os ambientes de domínio.
Um dos principais benefícios de usar ADWS para pós-exploração LDAP é que ele é relativamente desconhecido e, como o tráfego LDAP não é enviado pela rede, não é facilmente detectado por ferramentas de monitoramento comuns. O ADWS executa um serviço completamente diferente do LDAP, está disponível na porta TCP 9389 e usa o protocolo SOAP como interface.
Ao pesquisar o ADWS, notamos que, por ser um serviço web SOAP, a execução real da consulta LDAP é feita localmente no controlador de domínio. Isso proporciona vários efeitos colaterais interessantes que se mostram benéficos. Por exemplo, ao analisar consultas LDAP em um controlador de domínio, você pode notar que as consultas se originam de logs 127.0.0.1, que em muitos casos serão ignorados.
Um benefício secundário disso é que a atividade não aparece em DeviceEvents sob o tipo de ação LDAPSearch, o que significa que muito poucos dados de telemetria estão disponíveis.
O SharpADWS implementa os protocolos MS-ADDM, MS-WSTIM e MS-WSDS. Você pode usar o código-fonte deste projeto para implementar facilmente as seguintes operações no Active Directory Web Services:
O argumento de linha de comando -h pode ser usado para exibir as seguintes informações de uso:```cmd
C:\Users\Marcus>SharpADWS.exe -h
SharpADWS 1.0.0-beta - Copyright (c) 2024 WHOAMI (whoamianony.top)
-h Display this help screen
Connection options: -d Specify domain for enumeration -u Username to use for ADWS Connection -p Password to use for ADWS Connection
Supported methods: Cache Dump all objectSids to cache file for Acl methods Acl Enumerate and analyze DACLs for specified objects, specifically Users, Computers, Groups, Domains, DomainControllers and GPOs DCSync Enumerate all DCSync-capable accounts and can set DCSync backdoors DontReqPreAuth Enumerates all accounts that do not require kerberos preauthentication, and can enable this option for accounts Kerberoastable Enumerates all Kerberoastable accounts, and can write SPNs for accounts AddComputer Add a machine account within the scope of ms-DS-MachineAccountQuota for RBCD attack RBCD Read, write and remove msDS-AllowedToActOnBehalfOfOtherIdentity attributes for Resource-Based Constrained Delegation attack Certify Enumerate all ADCS data like Certify.exe, and can write template attributes Whisker List, add and remove msDS-KeyCredentialLink attribute like Whisker.exe for ShadowCredentials attack FindDelegation Enumerate all delegation relationships for the target domain
Acl options: -dn RFC 2253 DN to base search from -scope Set your Scope, support Base (Default), Onelevel, Subtree -trustee The sAMAccountName of a security principal to check for its effective permissions -right Filter DACL for a specific AD rights -rid Specify a rid value and filter out DACL that security principal's rid is greater than it -user Enumerate DACL for all user objects -computer Enumerate DACL for all computer objects -group Enumerate DACL for all group objects -domain Enumerate DACL for all domain objects -domaincontroller Enumerate DACL for all domain controller objects -gpo Enumerate DACL for all gpo objects
DCSync options: -action [{list, write}] Action to operate on DCSync method list List all accounts with DCSync permissions write Escalate accounts with DCSync permissions -target Specify the sAMAccountName of the account
DontReqPreAuth options: -action [{list, write}] Action to operate on DontReqPreAuth method list List all accounts that do not require kerberos preauthentication write Enable do not require kerberos preauthentication for an account -target Specify the sAMAccountName of the account
Kerberoastable options: -action [{list, write}] Action to operate on Kerberoastable method list List all kerberoastable accounts write Write SPNs for an account to kerberoast -target Specify the sAMAccountName of the account
AddComputer options: -computer-name Name of computer to add, without '$' suffix -computer-pass Password to set for the computer
RBCD options: -action [{read,write,remove}] Action to operate on RBCD method read Read the msDS-AllowedToActOnBehalfOfOtherIdentity attribute of the account write Write the msDS-AllowedToActOnBehalfOfOtherIdentity attribute of the account remove Remove the msDS-AllowedToActOnBehalfOfOtherIdentity attribute value of the account added by the write action