OSCP Cheatsheet
  • Reference List
  • Basic
  • Methodology
    • Basic Scans
    • Service Enumeration
      • TCP: HTTP(S) - 80 / 443
      • TCP: SMB - 139 / 445
      • TCP: FTP - 21
      • TCP/UDP: DNS - 53
      • TCP: SSH - 22
      • TCP/UDP: LDAP - 389 / 636 / 3268
      • TCP/UDP: Kerberos - 88
      • UDP: SNMP - 161
      • TCP: SMTP - 25
      • TCP: RDP - 3389
      • TCP: RPC - 135 / 593
      • TCP: Evil-WinRM - 5985 / 5986
      • TCP: MYSQL - 3306
      • TCP: MSSQL - 1433
      • TCP: Confluence - 8090
    • Extras
  • File Transfer
  • KeePass Database
  • Shells
  • Enumeration
    • Linux
    • Windows
    • Git
  • Privilege Escalation
    • Linux
      • Abusing Cron Jobs
      • Abusing Password Authentication
      • Abusing Setuid Binaries and Capabilities
      • Abusing Sudo
      • Exploits
    • Windows
      • Service Binary Hijacking
      • DLL Hijacking
      • Unquoted Service Paths
      • Scheduled Tasks
      • Exploits
  • Port Forwarding
    • Linux
    • Windows
  • Attacks
    • Public Exploits
    • User Creation
    • Password Cracking
      • Custom Rules
      • Custom Password List
    • Phishing
    • SQLi
  • Active Directory
    • Enumeration
    • Attack
    • Lateral Movement
    • Persistence
Powered by GitBook
On this page
  • Scanning
  • Basic
  • LDAPSearch
  • Enumeration
  • Bruteforce
  1. Methodology
  2. Service Enumeration

TCP/UDP: LDAP - 389 / 636 / 3268

Scanning

Basic

Domain Name

nmap -n -sV --script "ldap* and not brute" <Target IP Address>

Banner Grabbing

nmap -p 389 --script ldap-search -Pn <Target IP Address>

LDAPSearch

Check if LDAP is accessible and accepting anonymous

ldapsearch -H ldap://<Target IP Address> -x

Search the base/root DSE

ldapsearch -x -H ldap://<Target IP Address> -s base namingcontexts

EXAMPLE:

namingContexts: DC=corp, DC=local

Search entire subtree

ldapsearch -x -H ldap://<Target IP Address> -s sub -b "<Naming Contexts>"

Enumerate all users

ldapsearch -H ldap://<Target IP Address> -x -b "<Naming Contexts>" '(objectClass=Person)'

Enumerate all objects

ldapsearch -H ldap://<Target IP Address> -x -b "<Naming Contexts>" '(objectClass=*)'

Enumerate all username

ldapsearch -H ldap://<IP> -x -b "<Naming Contexts>" '(objectClass=user)' | grep sAMAccountName: | awk '{print $2}' > usernames.txt

Enumeration

Dump users, groups, OUs, computers, acls

LDAP Login: ldapdomaindump <Target IP Address> [-r <Target IP Address>] -u '<Domain Nam>\<Usernam>' -p '<Password>' [--authtype SIMPLE] --no-json --no-grep [-o /path/dir]

Bruteforce

hydra -l <Username> -P <Password List> <Target IP Address> ldap2 -V -f
PreviousTCP: SSH - 22NextTCP/UDP: Kerberos - 88

Last updated 21 days ago