Page cover

NetExec

NetExec (nxc) is a network service exploitation tool that helps automate assessing the security of large networks. Check out its amazing and ever-evolving wiki page! You can view its usage in almost any of the AD-related boxes.

SMB

Enumeration

Enumerate domain/local users:

# List domain users
nxc smb <TARGET-IP> -u '<USER>' -p '<PASS>' --users
# List local users
nxc smb <TARGET-IP> -u '<USER>' -p '<PASS>' --users --local-auth

# Create a users list from nxc's output
$ nxc smb <target> -u <user> -p <pass> --users | awk '$1 == "SMB" && $5 != "[+]" && $5 != "-Username-" && $5 != "[*]" && $5 != "Guest" && $5 != "krbtgt" {print $5}' > domain_users

Domain users can be also be enumerated via a RID-bruteforcing attack:

# Brute-force RIDs (default up to 4000)
nxc smb <TARGET-IP> -u '<USER>' -p '<PASS>' --rid-brute <max-rid>
# Create a users list from nxc's output
nxc smb <TARGET-IP> -u '<USER>' -p '<PASS>' --rid-brute <max-rid> > nxc_users
cat nxc_users | awk '{print $6}' | awk -F'\' '{print $2}' > domain_users

Enumerate domain/local hosts:

# List domain hosts
nxc smb <TARGET-IP> -u '<USER>' -p '<PASS>' --computers
# List local hosts
nxc smb <TARGET-IP> -u '<USER>' -p '<PASS>' --computers --local-auth

Password Spray

If the results include the domain , e.g. (seruca.yzx) → a domain account.

If it has (Pw3d!) at the end → Local Administrator account.

RCE

NetExec uses impacket-psexec to perform the Pass-the-Hash attack:

Spidering

Upload/Download

If large files are failing/erroring, add --smb-timeout with a value than 2.

Modules

For stealing hashes via writeable shares via SMB using slinky, drop-sc, or scuffy check here.

The hash format that starts with $DCC2$ (derived from --lsa) is stronger than NTLM and cannot be used for a PtH attack. For attempting to crack them, the domain and username needs to be removed; only the value starting with $DCC2$ is required.

Vulnerabilities

The most critical vulnerabilities: from no creds/low privileges straight to DA !

Check for all at once:

ZeroLogon (CVE-2020-1472) is a vulnerability in Microsoft’s Netlogon protocol that lets an attacker with network access spoof a DC, reset its password to blank, and gain full domain admin rights—without any credentials.

There is a PoC available:

Checks for coerce vulnerabilities. By default the LISTENER ip will be set to localhost, so no traffic will appear on the network.

The coerce_plus module includes:

  • PetitPotam: Coerces a DC to authenticate to an attacker via MS-EFSRPC, enabling NTLM relay attacks for domain takeover.

  • DFSCoerce: Tricks a DC into authenticating to the attacker via the Distributed File System service, enabling relay attacks.

  • PrinterBug: Exploits Windows Print Spooler to coerce authentication and enable NTLM relay attacks.

  • MSEven: Uses the Microsoft Exchange’s Web Services to force authentication, facilitating NTLM relay and privilege escalation.

  • ShadowCoerce: Coerces a domain host to authenticate by abusing the Shadow Copy service, enabling relay attacks.

If one or more are found, set the listener:

LDAP

Enumerate the description field of domain users (get-desc-users):

Execute the whoami command for any domain user:

Obtain the domain's SID:

SSH

MSSQL

Two methods can be used to authenticate to MSSQL: Windows (default) & local auth:

Ports can be also be specified:

FTP

Resources

  • A nice short demnostration of nxc's usage (video)

  • The amazing CME-based academy module from Hack The Box (module)

Last updated

Was this helpful?