$> 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.
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 RPC và Windows 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.
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.
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#.
$> smbmap -u forend -p Klmcargo2 -d INLANEFREIGHT.LOCAL -H 172.16.5.5
[+] IP: 172.16.5.5:445 Name: inlanefreight.local
Disk Permissions Comment
---- ----------- -------
ADMIN$ NO ACCESS Remote Admin
C$ NO ACCESS Default share
Department Shares READ ONLY
IPC$ READ ONLY Remote IPC
NETLOGON READ ONLY Logon server share
SYSVOL READ ONLY Logon server share
User Shares READ ONLY
ZZZ_archive READ ONLY
$> windapsearch.py -h
usage: windapsearch.py [-h] [-d DOMAIN] [--dc-ip DC_IP] [-u USER]
[-p PASSWORD] [--functionality] [-G] [-U] [-C]
[-m GROUP_NAME] [--da] [--admin-objects] [--user-spns]
[--unconstrained-users] [--unconstrained-computers]
[--gpos] [-s SEARCH_TERM] [-l DN]
[--custom CUSTOM_FILTER] [-r] [--attrs ATTRS] [--full]
[-o output_dir]
Script to perform Windows domain enumeration through LDAP queries to a Domain
Controller
optional arguments:
-h, --help show this help message and exit
Domain Options:
-d DOMAIN, --domain DOMAIN
The FQDN of the domain (e.g. 'lab.example.com'). Only
needed if DC-IP not provided
--dc-ip DC_IP The IP address of a domain controller
Bind Options:
Specify bind account. If not specified, anonymous bind will be attempted
-u USER, --user USER The full username with domain to bind with (e.g.
'[email protected]' or 'LAB\ropnop'
-p PASSWORD, --password PASSWORD
Password to use. If not specified, will be prompted
for
Enumeration Options:
Data to enumerate from LDAP
--functionality Enumerate Domain Functionality level. Possible through
anonymous bind
-G, --groups Enumerate all AD Groups
-U, --users Enumerate all AD Users
-PU, --privileged-users
Enumerate All privileged AD Users. Performs recursive
lookups for nested members.
-C, --computers Enumerate all AD Computers
<SNIP>
$> python3 windapsearch.py --dc-ip 172.16.5.5 -u [email protected] -p Klmcargo2 -PU
[+] Using Domain Controller at: 172.16.5.5
[+] Getting defaultNamingContext from Root DSE
[+] Found: DC=INLANEFREIGHT,DC=LOCAL
[+] Attempting bind
[+] ...success! Binded as:
[+] u:INLANEFREIGHT\forend
[+] Attempting to enumerate all AD privileged users
[+] Using DN: CN=Domain Admins,CN=Users,DC=INLANEFREIGHT,DC=LOCAL
[+] Found 28 nested users for group Domain Admins:
cn: Administrator
userPrincipalName: [email protected]cn: lab_adm
cn: Angela Dunn
userPrincipalName: [email protected]cn: Matthew Morgan
userPrincipalName: [email protected]cn: Dorothy Click
userPrincipalName: [email protected]<SNIP>
[+] Using DN: CN=Enterprise Admins,CN=Users,DC=INLANEFREIGHT,DC=LOCAL
[+] Found 3 nested users for group Enterprise Admins:
cn: Administrator
userPrincipalName: [email protected]cn: lab_adm
cn: Sharepoint Admin
userPrincipalName: [email protected]<SNIP>
$> bloodhound-python -h
usage: bloodhound-python [-h] [-c COLLECTIONMETHOD] [-u USERNAME]
[-p PASSWORD] [-k] [--hashes HASHES] [-ns NAMESERVER]
[--dns-tcp] [--dns-timeout DNS_TIMEOUT] [-d DOMAIN]
[-dc HOST] [-gc HOST] [-w WORKERS] [-v]
[--disable-pooling] [--disable-autogc] [--zip]
Python based ingestor for BloodHound
For help or reporting issues, visit https://github.com/Fox-IT/BloodHound.py
optional arguments:
-h, --help show this help message and exit
-c COLLECTIONMETHOD, --collectionmethod COLLECTIONMETHOD
Which information to collect. Supported: Group,
LocalAdmin, Session, Trusts, Default (all previous),
DCOnly (no computer connections), DCOM, RDP,PSRemote,
LoggedOn, ObjectProps, ACL, All (all except LoggedOn).
You can specify more than one by separating them with
a comma. (default: Default)
-u USERNAME, --username USERNAME
Username. Format: username[@domain]; If the domain is
unspecified, the current domain is used.
-p PASSWORD, --password PASSWORD
Password
<SNIP>
$> sudo bloodhound-python -u 'forend' -p 'Klmcargo2' -ns 172.16.5.5 -d inlanefreight.local -c all
INFO: Found AD domain: inlanefreight.local
INFO: Connecting to LDAP server: ACADEMY-EA-DC01.INLANEFREIGHT.LOCAL
INFO: Found 1 domains
INFO: Found 2 domains in the forest
INFO: Found 564 computers
INFO: Connecting to LDAP server: ACADEMY-EA-DC01.INLANEFREIGHT.LOCAL
INFO: Found 2951 users
INFO: Connecting to GC LDAP server: ACADEMY-EA-DC01.INLANEFREIGHT.LOCAL
INFO: Found 183 groups
INFO: Found 2 trusts
INFO: Starting computer enumeration with 10 workers
<SNIP>
$> ls
20220307163102_computers.json 20220307163102_domains.json 20220307163102_groups.json 20220307163102_users.json
sudo neo4j start
bloodhound
.\SharpHound.exe -c All
PS C:\htb> .\SharpHound.exe -c All --zipfilename ILFREIGHT
2022-04-18T13:58:22.1163680-07:00|INFORMATION|Resolved Collection Methods: Group, LocalAdmin, GPOLocalGroup, Session, LoggedOn, Trusts, ACL, Container, RDP, ObjectProps, DCOM, SPNTargets, PSRemote
2022-04-18T13:58:22.1163680-07:00|INFORMATION|Initializing SharpHound at 1:58 PM on 4/18/2022
2022-04-18T13:58:22.6788709-07:00|INFORMATION|Flags: Group, LocalAdmin, GPOLocalGroup, Session, LoggedOn, Trusts, ACL, Container, RDP, ObjectProps, DCOM, SPNTargets, PSRemote
2022-04-18T13:58:23.0851206-07:00|INFORMATION|Beginning LDAP search for INLANEFREIGHT.LOCAL
2022-04-18T13:58:53.9132950-07:00|INFORMATION|Status: 0 objects finished (+0 0)/s -- Using 67 MB RAM
2022-04-18T13:59:15.7882419-07:00|INFORMATION|Producer has finished, closing LDAP channel
2022-04-18T13:59:16.1788930-07:00|INFORMATION|LDAP channel closed, waiting for consumers
2022-04-18T13:59:23.9288698-07:00|INFORMATION|Status: 3793 objects finished (+3793 63.21667)/s -- Using 112 MB RAM
2022-04-18T13:59:45.4132561-07:00|INFORMATION|Consumers finished, closing output channel
Closing writers
2022-04-18T13:59:45.4601086-07:00|INFORMATION|Output channel closed, waiting for output task to complete
2022-04-18T13:59:45.8663528-07:00|INFORMATION|Status: 3809 objects finished (+16 46.45122)/s -- Using 110 MB RAM
2022-04-18T13:59:45.8663528-07:00|INFORMATION|Enumeration finished in 00:01:22.7919186
2022-04-18T13:59:46.3663660-07:00|INFORMATION|SharpHound Enumeration Completed at 1:59 PM on 4/18/2022! Happy Graphing