Credentialed Enumeration

CrackMapExec

CrackMapExec là công cụ để assess môi trường AD, được viết dựa trên Impacket và PowerSploit.

Xem wiki: https://www.netexec.wiki

CME Help Menu

crackmapexec -h
$> crackmapexec -h

usage: crackmapexec [-h] [-t THREADS] [--timeout TIMEOUT] [--jitter INTERVAL] [--darrell]
                    [--verbose]
                    {mssql,smb,ssh,winrm} ...

      ______ .______           ___        ______  __  ___ .___  ___.      ___      .______    _______ ___   ___  _______   ______
     /      ||   _  \         /   \      /      ||  |/  / |   \/   |     /   \     |   _  \  |   ____|\  \ /  / |   ____| /      |
    |  ,----'|  |_)  |       /  ^  \    |  ,----'|  '  /  |  \  /  |    /  ^  \    |  |_)  | |  |__    \  V  /  |  |__   |  ,----'
    |  |     |      /       /  /_\  \   |  |     |    <   |  |\/|  |   /  /_\  \   |   ___/  |   __|    >   <   |   __|  |  |
    |  `----.|  |\  \----. /  _____  \  |  `----.|  .  \  |  |  |  |  /  _____  \  |  |      |  |____  /  .  \  |  |____ |  `----.
     \______|| _| `._____|/__/     \__\  \______||__|\__\ |__|  |__| /__/     \__\ | _|      |_______|/__/ \__\ |_______| \______|

                                         A swiss army knife for pentesting networks
                                    Forged by @byt3bl33d3r using the powah of dank memes

                                                      Version: 5.0.2dev
                                                     Codename: P3l1as
optional arguments:
  -h, --help            show this help message and exit
  -t THREADS            set how many concurrent threads to use (default: 100)
  --timeout TIMEOUT     max timeout in seconds of each thread (default: None)
  --jitter INTERVAL     sets a random delay between each connection (default: None)
  --darrell             give Darrell a hand
  --verbose             enable verbose output

protocols:
  available protocols

  {mssql,smb,ssh,winrm}
    mssql               own stuff using MSSQL
    smb                 own stuff using SMB
    ssh                 own stuff using SSH
    winrm               own stuff using WINRM

Ya feelin' a bit buggy all of a sudden?

CME Options (SMB)

CME - Domain User Enumeration

Khi đã có một credential trong domain, ta có thể truy xuất được toàn bộ user trong domain (bao gồm cả badPwdCount).

CME - Domain Group Enumeration

membercount chỉ số lượng user của mỗi group. Output cũng trả ra các built-in group trong DC.

CME - Logged On Users

(Pwn3d!) có tức là credential này đã authenticate thành công computer này.

CME Share Searching

Permissions để kiểm tra user đang có quyền gì trên phạm vi share.

Spider_plus

Module spider_plus sẽ scan từng share đọc được trên host và list ra output.

Khi hoàn thành, CME sẽ write output vào file JSON nằm ở /tmp/cme_spider_plus/<ip of host>.

SMBMap

SMBMap để emumerate các shares từ các máy Linux của attacker, ngoài ra còn thu thập permissions, content nếu có thể truy cập, download/upload files, remote exec commands,...

Giống CME, nếu có SMBMap và một credential hợp lệ ta có thể kiểm tra được tài nguyên shares trên remote computer.

List of All Directories

rpcclient

rpcclient sử dụng Samba protocol để làm việc với MS-RPC, nó có thể enumerate, thêm, sửa, xóa objects trong AD.

Field rid: bên cạnh user là Relative Identifier (RID) được sử dụng để xác định unique đối tượng bởi Windows (biểu diễn dưới dạng hexadecimal).

Ví dụ: RID:[0x457] === 1111

Khi một đối tượng được tạo trong domain, thì SID sẽ kết hợp vs RID tạo ra unique object.

Full SID: S-1-5-21-3842939050-3880317879-2865463114-1111

Trong đó RID là 1111 biểu diễn ở dạng decimal.

Tuy nhiên, có những accounts sẽ có cùng RID, ví dụ như các account built-in Administrator trong domain sẽ có dạng RID:[0x1f4] chuyển sang decimal là 500.

RPCClient User Enumeration By RID

Enumdomusers

Impacket Toolkit

Một trong những module mạnh của Impacket, được clone từ psexec của Sysinternals. Tool này sẽ tạo ra các file executable với tên file random lên share của ADMIN$ trên host mục tiêu. Sau đó register service thông qua RPCWindows Service Control Manager.

Khi execute psexec module, ta sẽ ở thư mục C:\Windows\system32.

Wmiexec là một semi-interactive shell được executed qua Windows Management Instrumentation. Khác với psexec thì wmiexec không đẩy bất kì file lên lên máy mục tiêu và tạo ra ít logs hơn.

Mỗi lệnh sẽ thực thi theo một process cmd.exe . Nhược điểm là tạo ra event ID 4688: A new process has been created.

Windapsearch

Windapsearch là một công cụ viết bằng Python có thể enumerate users, groups, computers từ một computer Windows trong domain sử dụng LDAP queries.

Find Domain Admins

Find Privileged Users

Bloodhound.py

BloodHound.py sẽ chuyển dữ liệu lớn thành dạng biểu đồ để tìm các attack paths mà khó phát hiện thủ công. Công cụ này bao gồm 2 phần:

  • SharpHound collector trên Windows, viết bằng C#

  • BloodHound.py (ingestor) và BloodHound GUI để upload các file JSON thu thập được lên và parsing nó.

BloudHound GUI sử dụng graph theory để visualize relationships và unclover attack path thậm chí không thể phát hiện bởi các công cụ scan tự động khác. Ngôn ngữ query là Cypher language.

SharpHound sẽ collect data từ AD như users, groups, computers, group membership, GPOs, ACLs, domain trusts, local admin access, user sessions, user properties, RDP access, WinRM access,...

BloudHound đã có phiên bản được port sang Python (BloodHound.py require Imacpket, ldap3, dnspython).

Sau đó, ta cần start neo4j để start neo4j service, load vào database và truy vấn qua Cypher queries. Cuối cùng là start bloodhound GUI.

Chọn Analysis tab để run query, tham khảo cheetsheet tại: https://queries.specterops.io

BloodHound

ActiveDirectory PowerShell module là một nhóm các PowerShell cmdlets để quản lý môi trường AD. Nó bao gồm 147 cmdlets.

Group Enumeration

Detailed Group Info

Group Membership

PowerView

PowerView được viết bằng PowerShell sử dụng cung cấp một các xác định nơi user loggon, enumerate domain info, computers, groups, ACLs, trusts, kerberoasting và thực hiện hunt các file shares chứa password hoặc thông tin quan trọng. Nó đòi hỏi phải thực hiện thủ công khá nhiều để xác định cấu hình sai và các relationships trong domain.

Command

Description

Export-PowerViewCSV

Append results to a CSV file

ConvertTo-SID

Convert a User or group name to its SID value

Get-DomainSPNTicket

Requests the Kerberos ticket for a specified Service Principal Name (SPN) account

Domain/LDAP Functions:

Get-Domain

Will return the AD object for the current (or specified) domain

Get-DomainController

Return a list of the Domain Controllers for the specified domain

Get-DomainUser

Will return all users or specific user objects in AD

Get-DomainComputer

Will return all computers or specific computer objects in AD

Get-DomainGroup

Will return all groups or specific group objects in AD

Get-DomainOU

Search for all or specific OU objects in AD

Find-InterestingDomainAcl

Finds object ACLs in the domain with modification rights set to non-built in objects

Get-DomainGroupMember

Will return the members of a specific domain group

Get-DomainFileServer

Returns a list of servers likely functioning as file servers

Get-DomainDFSShare

Returns a list of all distributed file systems for the current (or specified) domain

GPO Functions:

Get-DomainGPO

Will return all GPOs or specific GPO objects in AD

Get-DomainPolicy

Returns the default domain policy or the domain controller policy for the current domain

Computer Enumeration Functions:

Get-NetLocalGroup

Enumerates local groups on the local or a remote machine

Get-NetLocalGroupMember

Enumerates members of a specific local group

Get-NetShare

Returns open shares on the local (or a remote) machine

Get-NetSession

Will return session information for the local (or a remote) machine

Test-AdminAccess

Tests if the current user has administrative access to the local (or a remote) machine

Threaded 'Meta'-Functions:

Find-DomainUserLocation

Finds machines where specific users are logged in

Find-DomainShare

Finds reachable shares on domain machines

Find-InterestingDomainShareFile

Searches for files matching specific criteria on readable shares in the domain

Find-LocalAdminAccess

Find machines on the local domain where the current user has local administrator access

Domain Trust Functions:

Get-DomainTrust

Returns domain trusts for the current domain or a specified domain

Get-ForestTrust

Returns all forest trusts for the current forest or a specified forest

Get-DomainForeignUser

Enumerates users who are in groups outside of the user's domain

Get-DomainForeignGroupMember

Enumerates groups with users outside of the group's domain and returns each foreign member

Get-DomainTrustMapping

Will enumerate all trusts for the current domain and any others seen.

Domain User Information

Recursive Group Membership

Trust Enumeration

Testing for Local Admin Access

Finding Users With SPN Set

SharpView

PowerView hiện tại đã deprecated và ko còn được maintain nữa. Các update đến từ phía BC-SECURITY. Phiên bản này của PowerView có thêm một số chức năng mới như Get-NetGmsa được sử dụng để tìm kiếm Group Managed Service Accounts.

SharpView được port từ PowerView sang phiên bản C#.

Snaffler

Last updated