Forest

Multitask nmap scan

sleep 300 ; nmap -p- -v forest.htb -oN forest-nmap-al-port

common ports : 135 / 445 = smb 389 = LDAP

run internal network dns checking

nslookup
server forest.htb
127.0.0.1
forest.htb

LDAP

Locating base LDAP directory of a IP

using nmap:

locate -r nse$ | grep ldap
nmap -p 389 --script ldap-rootdse -Pn forest.htb
nmap -p 389 --script ldap-search -Pn forest.htb

nse$ = anything that ends with nse

ldapsearch

ldapsearch -H ldap://forest.htb 
ldapsearch -x -H ldap://forest.htb
ldapsearch -x -H ldap://forest.htb -s base namingcontexts
	ldapsearch -x -H ldap://forest.htb -b "DC=htb,DC=local" > htb/forest/ldap-anonymous.txt
ldapsearch -x -H ldap://forest.htb -b "DC=htb,DC=local"  'objectClass=person'
cat ldapsearch-person.txt | grep 'dn: CN='
ldapsearch -x -H ldap://forest.htb -b "DC=htb,DC=local"  'objectClass=person'  sAMAccountName | grep sAMAccountName | awk '{print $2}'

-h = host Note : Default have MD5 authentication -x = simple authentication / anonymous bind -b = get from -s base namingcontexts 'objectClass=' = filter by attributes eg: person,user

ldapdomaindump

Password Crafting

Appending year to end of all password

Adding symbols to passwordlist

Improving passwordlist with hashcat

--force = no need gpu --stdout = print everything out -r = rule file best64.rule = random common permutation toggles1.rule = upper case lower case awk 'length($0) >8' = get password length > 8

impacket

Alternative

GetNPUsers.py = ASREPRoast = Kerberoasting

hashcat

Alternative way to login

winrm port open ?

command execution methods:

  • wmiexec executes commands via WMI

  • atexec executes commands by scheduling a task with windows task scheduler

  • smbexec executes commands by creating and running a service

bloodhound

To extract data for bloodhound :

bloodhound-python

sharphound

in Bloodhound if see : Account Operators :

  • Special group in windows that create account and put in different groups

Service Accounts

  • Created by Account Operators

Account Operators

  • Grant limited account creation to a user

  • Execpt Administrator , Server Operators , Account Operators , Backup Operators or Print Operators groups

![[Pasted image 20230622011245.png]]

Create a new user using "Account Operators" because we are

Check if member exist in the group "Exchange Windows Permissions"

Adding user into the group

Download powerview into remote machine

Print all hashes only

Print all users : hashes

--user to ask hashcat adjust and remove usernames accordingly

Show result

Crafting Golden Ticket with user NotExist

kerbrute

Rerefence : https://artkond.com/2016/12/18/pivoting-kerberos/

https://0xdf.gitlab.io/2020/03/21/htb-forest.html#shell-as-svc-alfresco

https://infra.newerasec.com/infrastructure-testing/privilege-esclation/windows/running-services

Last updated