LogoLogo
NetExec Github
  • Welcome
  • News
    • 🕷️v1.0.0 Release!
    • 🔧v1.1.0 - nxc4u
    • 📡v1.2.0 - ItsAlwaysDNS
    • 🏎️v1.3.0 - NeedForSpeed
    • 🧈v1.4.0 - SmoothOperator
  • Logo & Banner
  • Getting Started
    • Installation
      • 🐧Installation for Unix
      • 🪟Installation for Windows
      • 🍎Installation for Mac
      • 🛠️Manually building the binary
      • ➡️Post Installation Setup
    • Selecting & Using a Protocol
    • Target Formats
    • Using Credentials
    • Using Kerberos
    • Using Certificates
    • Using Modules
    • 🆕DNS options
    • Database General Usage
    • BloodHound Integration
    • Audit Mode
    • Ignore OpSec Warnings
    • Logging
  • SMB protocol
    • Generate hosts file
    • Generate krb5.conf file
    • Generate TGT
    • Scan for Vulnerabilities
    • Enumeration
      • Enumerate Hosts
      • Enumerate Null Sessions
      • Enumerate Guest Logon
      • Enumerate Hosts with SMB Signing Not Required
      • Enumerate Active SMB Sessions
      • Enumerate Shares and Access
      • 🆕Enumerate Network Interfaces
      • Enumerate Disks
      • Enumerate Bitlocker
      • Enumerate Logged on Users
      • Enumerate Domain Users
      • Enumerate Users by Bruteforcing RID
      • Enumerate Domain Groups
      • Enumerate Local Groups
      • Enumerate Domain Password Policy
      • 🆕Enumerate Anti-Virus & EDR
    • Password Spraying
    • Authentication
      • Checking Credentials (Domain)
      • Checking Credentials (Local)
      • 🆕Delegation
    • Command Execution
      • Executing Remote Commands
        • Process Injection (pi module)
      • Getting Shells 101
    • Spidering Shares
    • Get and Put Files
    • Obtaining Credentials
      • Dump SAM
      • Dump LSA
      • Dump NTDS.dit
      • Dump LSASS
      • Dump DPAPI
      • 🆕Dump with BackupOperator Priv
      • 🆕Dump SCCM
      • 🆕Dump Token Broker Cache
      • Dump WIFI password
      • Dump KeePass
      • Dump Veeam
      • Dump WinSCP
      • 🆕Dump PuTTY
      • 🆕Dump VNC
      • 🆕Dump mRemoteNG
      • 🆕Dump Notepad
      • 🆕Dump Notepad++
      • 🆕Dump Remote Desktop Credential Manager
    • Defeating LAPS
    • Checking for Spooler & WebDav
    • Steal Microsoft Teams Cookies
    • 🆕Impersonate logged-on Users
    • 🆕Change User Password
    • 🆕Dump User Local Security Questions
  • LDAP protocol
    • Authentication
    • Enumerate Domain Users
    • Enumerate Domain Groups
    • 🆕Query LDAP
    • ASREPRoast
    • Find Domain SID
    • Kerberoasting
    • 🆕Find Misconfigured Delegation
    • Unconstrained Delegation
    • Admin Count
    • Machine Account Quota
    • Get User Descriptions
    • Dump gMSA
    • Exploit ESC8 (ADCS)
    • Extract Subnet
    • 🛠️Check LDAP Signing
    • Read DACL Rights
    • Extract gMSA Secrets
    • Bloodhound Ingestor
    • List DC IP
    • Enumerate Domain Trusts
    • 🆕Enumerate SCCM
  • WINRM protocol
    • Password Spraying
    • Authentication
    • Command Execution
    • 🆕Defeating LAPS
  • MSSQL protocol
    • Password Spraying
    • Authentication
    • MSSQL PrivEsc
    • MSSQL Command Execution
    • MSSQL Upload & Download
    • Execute via xp_cmdshell
    • 🆕Enumerate Users by Bruteforcing RID
  • SSH protocol
    • Password Spraying
    • Authentication
    • Command Execution
    • Get and Put Files
  • FTP protocol
    • Password Spraying
    • 🆕File Listing, etc
    • 🆕File Upload & Download
  • RDP Protocol
    • Password Spraying
    • Screenshot (connected)
    • Screenshot Without NLA (not connected)
  • WMI Protocol
    • Password Spraying
    • Authentication
    • Command Execution
  • NFS Protocol
    • 🆕Enumeration
    • Download and Upload Files
    • 🆕Escape to root file system
Powered by GitBook
On this page
  • Command Execution
  • Execution Methods
  • Executing Commands
  • Bypass AMSI

Was this helpful?

Edit on GitHub
  1. SMB protocol
  2. Command Execution

Executing Remote Commands

Command Execution

Executing commands on a windows system requires Administrator credentials.

nxc automatically tells you if the credential set you're using has admin access to a host by appending "(Pwn3d!)" (or whatever value you've set in the config) to the output when authentication is successful.

Execution Methods

nxc has three different command execution methods:

  • wmiexec executes commands via WMI

  • atexec executes commands by scheduling a task with windows task scheduler

  • smbexec executes commands by creating and running a service

By default nxc will fail over to a different execution method if one fails. It attempts to execute commands in the following order:

  1. wmiexec

  2. atexec

  3. smbexec

If you want to force nxc to use only one execution method you can specify which one using the --exec-method flag.

Executing Commands

In the following example, we try to execute whoami on the target using the -x flag:

nxc smb 192.168.10.11 -u Administrator -p 'P@ssw0rd' -x whoami
06-05-2016 14:34:35 nxc          192.168.10.11:445 WIN7BOX         [*] Windows 6.1 Build 7601 (name:WIN7BOX) (domain:LAB)
06-05-2016 14:34:35 nxc          192.168.10.11:445 WIN7BOX         [+] LAB\Administrator:P@ssw0rd (Pwn3d!)
06-05-2016 14:34:39 nxc          192.168.10.11:445 WIN7BOX         [+] Executed command 
06-05-2016 14:34:39 nxc          192.168.10.11:445 WIN7BOX         lab\administrator
06-05-2016 14:34:39 [*] KTHXBYE!

You can also directly execute PowerShell commands using the -X flag:

nxc smb 192.168.10.11 -u Administrator -p 'P@ssw0rd' -X '$PSVersionTable'
06-05-2016 14:36:06 nxc          192.168.10.11:445 WIN7BOX         [*] Windows 6.1 Build 7601 (name:WIN7BOX) (domain:LAB)
06-05-2016 14:36:06 nxc          192.168.10.11:445 WIN7BOX         [+] LAB\Administrator:P@ssw0rd (Pwn3d!)
06-05-2016 14:36:10 nxc          192.168.10.11:445 WIN7BOX         [+] Executed command 
06-05-2016 14:36:10 nxc          192.168.10.11:445 WIN7BOX         Name                           Value
06-05-2016 14:36:10 nxc          192.168.10.11:445 WIN7BOX         ----                           -----
06-05-2016 14:36:10 nxc          192.168.10.11:445 WIN7BOX         CLRVersion                     2.0.50727.5420
06-05-2016 14:36:10 nxc          192.168.10.11:445 WIN7BOX         BuildVersion                   6.1.7601.17514
06-05-2016 14:36:10 nxc          192.168.10.11:445 WIN7BOX         PSVersion                      2.0
06-05-2016 14:36:10 nxc          192.168.10.11:445 WIN7BOX         WSManStackVersion              2.0
06-05-2016 14:36:10 nxc          192.168.10.11:445 WIN7BOX         PSCompatibleVersions           {1.0, 2.0}
06-05-2016 14:36:10 nxc          192.168.10.11:445 WIN7BOX         SerializationVersion           1.1.0.1
06-05-2016 14:36:10 nxc          192.168.10.11:445 WIN7BOX         PSRemotingProtocolVersion      2.1
06-05-2016 14:36:10 [*] KTHXBYE!

Bypass AMSI

nxc smb 192.168.10.11 -u Administrator -p 'P@ssw0rd' -X '$PSVersionTable'  --amsi-bypass /path/payload
PreviousCommand ExecutionNextProcess Injection (pi module)

Last updated 2 months ago

Was this helpful?